savara SVN: r225 - trunk/validators/jbossesb.
by do-not-reply@jboss.org
Author: objectiser
Date: 2010-05-19 13:48:41 -0400 (Wed, 19 May 2010)
New Revision: 225
Modified:
trunk/validators/jbossesb/
Log:
Ignore target folder.
Property changes on: trunk/validators/jbossesb
___________________________________________________________________
Name: svn:ignore
+ target
13 years, 11 months
savara SVN: r224 - in trunk: validators and 13 other directories.
by do-not-reply@jboss.org
Author: objectiser
Date: 2010-05-19 13:47:49 -0400 (Wed, 19 May 2010)
New Revision: 224
Added:
trunk/validators/
trunk/validators/jbossesb/
trunk/validators/jbossesb/pom.xml
trunk/validators/jbossesb/src/
trunk/validators/jbossesb/src/main/
trunk/validators/jbossesb/src/main/configs/
trunk/validators/jbossesb/src/main/configs/META-INF/
trunk/validators/jbossesb/src/main/configs/META-INF/deployment.xml
trunk/validators/jbossesb/src/main/configs/META-INF/jbm-queue-service.xml
trunk/validators/jbossesb/src/main/configs/META-INF/jboss-esb.xml
trunk/validators/jbossesb/src/main/configs/META-INF/jboss-scanning.xml
trunk/validators/jbossesb/src/main/configs/META-INF/jboss-structure.xml
trunk/validators/jbossesb/src/main/configs/esb-assembly.xml
trunk/validators/jbossesb/src/main/configs/models/
trunk/validators/jbossesb/src/main/configs/models/TrailBlazer.cdm
trunk/validators/jbossesb/src/main/configs/pi4soa.xml
trunk/validators/jbossesb/src/main/configs/validator-config.xml
trunk/validators/jbossesb/src/main/java/
trunk/validators/jbossesb/src/main/java/org/
trunk/validators/jbossesb/src/main/java/org/jboss/
trunk/validators/jbossesb/src/main/java/org/jboss/savara/
trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/
trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/
trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/AbstractServiceValidator.java
trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/DefaultValidatorConfig.java
trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ESBUtil.java
trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/Endpoint.java
trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ServiceValidator.java
trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ServiceValidatorFactory.java
trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ServiceValidatorManager.java
trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorConfig.java
trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorConfigFactory.java
trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorConfigLoader.java
trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorFilter.java
trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorName.java
trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/pi4soa/
trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/pi4soa/Pi4SOAServiceRecorder.java
trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/pi4soa/Pi4SOAServiceValidator.java
trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/pi4soa/Pi4SOAValidatorConfigLoader.java
trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/pi4soa/ValidatorConfigGenerator.java
trunk/validators/jbossesb/src/main/resources/
trunk/validators/pom.xml
Modified:
trunk/pom.xml
Log:
Added the validator functionality to the refactored trunk.
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-05-18 21:31:32 UTC (rev 223)
+++ trunk/pom.xml 2010-05-19 17:47:49 UTC (rev 224)
@@ -37,9 +37,12 @@
</developer>
</developers>
<modules>
+ <module>validators</module>
+ <!--
<module>tools</module>
<module>docs</module>
<module>distribution</module>
+ -->
</modules>
<build>
Added: trunk/validators/jbossesb/pom.xml
===================================================================
--- trunk/validators/jbossesb/pom.xml (rev 0)
+++ trunk/validators/jbossesb/pom.xml 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,131 @@
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.savara.validators</groupId>
+ <artifactId>savara-validator-jbossesb</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Savara::Validators::JBossESB</name>
+
+ <parent>
+ <groupId>org.jboss.savara</groupId>
+ <artifactId>validators</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.overlord.dependencies.org.jboss.esb</groupId>
+ <artifactId>jbossesb-rosetta</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.savara.dependencies.pi4soa</groupId>
+ <artifactId>pi4soa-common</artifactId>
+ <version>2.0</version>
+ <!-- >scope>provided</scope -->
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.savara.dependencies.pi4soa</groupId>
+ <artifactId>pi4soa-cdl</artifactId>
+ <version>2.0</version>
+ <!-- >scope>provided</scope -->
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.savara.dependencies.pi4soa</groupId>
+ <artifactId>pi4soa-service</artifactId>
+ <version>2.0</version>
+ <!-- >scope>provided</scope -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.savara.dependencies.eclipse</groupId>
+ <artifactId>emf-common</artifactId>
+ <version>2.3.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.savara.dependencies.eclipse</groupId>
+ <artifactId>emf-ecore</artifactId>
+ <version>2.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.savara.dependencies.eclipse</groupId>
+ <artifactId>emf-ecore-xmi</artifactId>
+ <version>2.3.1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>dist</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <finalName>savara-validator-jbossesb.esb</finalName>
+ <appendAssemblyId>true</appendAssemblyId>
+ <descriptors>
+ <descriptor>src/main/configs/esb-assembly.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-javadoc</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <doclet>org.jboss.apiviz.APIviz</doclet>
+ <docletArtifact>
+ <groupId>org.jboss.apiviz</groupId>
+ <artifactId>apiviz</artifactId>
+ <version>1.2.4.GA</version>
+ </docletArtifact>
+ <aggregate>true</aggregate>
+ <attach>false</attach>
+ <additionalparam>
+ -d ${project.build.directory}/javadoc
+ -charset UTF-8
+ -docencoding UTF-8
+ -version
+ -author
+ -breakiterator
+ -windowtitle "${project.name} ${project.version} API Reference"
+ -doctitle "${project.name} ${project.version} API Reference"
+ -bottom "Copyright © ${project.inceptionYear}-Present ${project.organization.name}. All Rights Reserved."
+ -link http://java.sun.com/javase/6/docs/api/
+ -sourceclasspath ${project.build.outputDirectory}
+ </additionalparam>
+ <encoding>UTF-8</encoding>
+ <locale>en_US</locale>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
+
Added: trunk/validators/jbossesb/src/main/configs/META-INF/deployment.xml
===================================================================
--- trunk/validators/jbossesb/src/main/configs/META-INF/deployment.xml (rev 0)
+++ trunk/validators/jbossesb/src/main/configs/META-INF/deployment.xml 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbossesb-deployment>
+ <depends>jboss.esb:deployment=jbossesb.esb</depends>
+ <depends>jboss.messaging.destination:service=Topic,name=tracker</depends>
+</jbossesb-deployment>
Added: trunk/validators/jbossesb/src/main/configs/META-INF/jbm-queue-service.xml
===================================================================
--- trunk/validators/jbossesb/src/main/configs/META-INF/jbm-queue-service.xml (rev 0)
+++ trunk/validators/jbossesb/src/main/configs/META-INF/jbm-queue-service.xml 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+
+ <mbean code="org.jboss.jms.server.destination.TopicService"
+ name="jboss.messaging.destination:service=Topic,name=tracker"
+ xmbean-dd="xmdesc/Topic-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+
+</server>
Added: trunk/validators/jbossesb/src/main/configs/META-INF/jboss-esb.xml
===================================================================
--- trunk/validators/jbossesb/src/main/configs/META-INF/jboss-esb.xml (rev 0)
+++ trunk/validators/jbossesb/src/main/configs/META-INF/jboss-esb.xml 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,6 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml..." parameterReloadSecs="5">
+ <!--
+ jbossesb internal services
+ -->
+</jbossesb>
Added: trunk/validators/jbossesb/src/main/configs/META-INF/jboss-scanning.xml
===================================================================
--- trunk/validators/jbossesb/src/main/configs/META-INF/jboss-scanning.xml (rev 0)
+++ trunk/validators/jbossesb/src/main/configs/META-INF/jboss-scanning.xml 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,3 @@
+<scanning xmlns="urn:jboss:scanning:1.0">
+ <!-- prevent scanning for annotations -->
+</scanning>
Added: trunk/validators/jbossesb/src/main/configs/META-INF/jboss-structure.xml
===================================================================
--- trunk/validators/jbossesb/src/main/configs/META-INF/jboss-structure.xml (rev 0)
+++ trunk/validators/jbossesb/src/main/configs/META-INF/jboss-structure.xml 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<structure>
+ <context>
+ <path name=""/>
+ <metaDataPath>
+ <path name="META-INF"/>
+ </metaDataPath>
+ <classpath>
+ <path name=""/>
+ <path name="" suffixes=".jar" />
+ <path name="lib" suffixes=".jar" />
+ </classpath>
+ </context>
+</structure>
Added: trunk/validators/jbossesb/src/main/configs/esb-assembly.xml
===================================================================
--- trunk/validators/jbossesb/src/main/configs/esb-assembly.xml (rev 0)
+++ trunk/validators/jbossesb/src/main/configs/esb-assembly.xml 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,33 @@
+<assembly 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/assembly-1.1.0-SNAPSHOT.xsd">
+ <id>dist</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <includeBaseDirectory>true</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>src/main/configs</directory>
+ <outputDirectory>/</outputDirectory>
+ <excludes>
+ <exclude>esb-assembly.xml</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>/lib</outputDirectory>
+ <includes>
+ <include>org.jboss.savara.validator:savara-validator-jbossesb</include>
+ <include>org.jboss.savara.dependencies.pi4soa:pi4soa-common</include>
+ <include>org.jboss.savara.dependencies.pi4soa:pi4soa-cdl</include>
+ <include>org.jboss.savara.dependencies.pi4soa:pi4soa-service</include>
+ <include>org.jboss.savara.dependencies.eclipse:emf-common</include>
+ <include>org.jboss.savara.dependencies.eclipse:emf-ecore</include>
+ <include>org.jboss.savara.dependencies.eclipse:emf-ecore-xmi</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
+
+</assembly>
Added: trunk/validators/jbossesb/src/main/configs/models/TrailBlazer.cdm
===================================================================
--- trunk/validators/jbossesb/src/main/configs/models/TrailBlazer.cdm (rev 0)
+++ trunk/validators/jbossesb/src/main/configs/models/TrailBlazer.cdm 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<org.pi4soa.cdl:Package xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:org.pi4soa.cdl="http:///org/pi4soa/cdl.ecore" description="The choreography description for TrailBlazer" name="TrailBlazer" author="gary" version="0.1" targetNamespace="http://www.pi4soa.org/TrailBlazer">
+ <typeDefinitions>
+ <nameSpaces description="Target Namespace for TrailBlazer" prefix="tns" uRI="http://www.pi4soa.org/TrailBlazer"/>
+ <nameSpaces description="XML Schema Namespace" prefix="xsd" uRI="http://www.w3.org/2001/XMLSchema"/>
+ <informationTypes description="This is the information type CreditCheckReq" name="CreditCheckReq" elementName="creditCheck"/>
+ <informationTypes description="This is the information type CreditCheckResp" name="CreditCheckResp" elementName="creditCheckResult"/>
+ <informationTypes description="This is the information type InsufficientCredit" name="InsufficientCredit" elementName="insufficientCredit"/>
+ <informationTypes description="This is the information type Quote" name="Quote" elementName="quote"/>
+ <informationTypes description="This is the information type QuoteRefType" name="QuoteRefType" typeName="xsd:string"/>
+ <informationTypes description="This is the information type QuoteReq" name="QuoteReq" elementName="quoteRequest"/>
+ <informationTypes description="This is the information type SSNType" name="SSNType" typeName="xsd:string"/>
+ <informationTypes description="This is the information type URIType" name="URIType" typeName="xsd:anyURI"/>
+ <tokens description="This is the token QuoteRef" name="QuoteRef" informationType="//@typeDefinitions/(a)informationTypes.4"/>
+ <tokens description="This is the token SSN" name="SSN" informationType="//@typeDefinitions/(a)informationTypes.6"/>
+ <tokens description="This is the token URI" name="URI" informationType="//@typeDefinitions/(a)informationTypes.7"/>
+ <tokenLocators description="This is the token locator QuoteRef4InsufficientCredit" token="//@typeDefinitions/(a)tokens.0" informationType="//@typeDefinitions/(a)informationTypes.2" query="//ref/text()" name="QuoteRef4InsufficientCredit"/>
+ <tokenLocators description="This is the token locator QuoteRef4Quote" token="//@typeDefinitions/(a)tokens.0" informationType="//@typeDefinitions/(a)informationTypes.3" query="//ref/text()" name="QuoteRef4Quote"/>
+ <tokenLocators description="This is the token locator QuoteRef4QuoteReq" token="//@typeDefinitions/(a)tokens.0" informationType="//@typeDefinitions/(a)informationTypes.5" query="//@ref" name="QuoteRef4QuoteReq"/>
+ <tokenLocators description="This is the token locator SSN4CreditCheckReq" token="//@typeDefinitions/(a)tokens.1" informationType="//@typeDefinitions/(a)informationTypes.0" query="//@ssn" name="SSN4CreditCheckReq"/>
+ <tokenLocators description="This is the token locator SSN4CreditCheckResp" token="//@typeDefinitions/(a)tokens.1" informationType="//@typeDefinitions/(a)informationTypes.1" query="//@ssn" name="SSN4CreditCheckResp"/>
+ <tokenLocators description="This is the token locator SSN4InsufficientCredit" token="//@typeDefinitions/(a)tokens.1" informationType="//@typeDefinitions/(a)informationTypes.2" query="//customerUID/text()" name="SSN4InsufficientCredit"/>
+ <tokenLocators description="This is the token locator SSN4Quote" token="//@typeDefinitions/(a)tokens.1" informationType="//@typeDefinitions/(a)informationTypes.3" query="//customerUID/text()" name="SSN4Quote"/>
+ <tokenLocators description="This is the token locator SSN4QuoteReq" token="//@typeDefinitions/(a)tokens.1" informationType="//@typeDefinitions/(a)informationTypes.5" query="//@ssn" name="SSN4QuoteReq"/>
+ <roleTypes description="This is the role type Bank" name="Bank">
+ <behaviors description="This is the behavior BankBehavior" name="BankBehavior" interface="bank"/>
+ </roleTypes>
+ <roleTypes description="This is the role type CreditAgency" name="CreditAgency">
+ <behaviors description="This is the behavior CreditAgencyBehavior" name="CreditAgencyBehavior" interface="creditAgency"/>
+ </roleTypes>
+ <roleTypes description="This is the role type LoanBroker" name="LoanBroker">
+ <behaviors description="This is the behavior LoanBrokerBehavior" name="LoanBrokerBehavior" interface="loanBroker"/>
+ </roleTypes>
+ <roleTypes description="This is the role type Notifier" name="Notifier">
+ <behaviors description="This is the behavior NotifierBehavior" name="NotifierBehavior" interface="notifier"/>
+ </roleTypes>
+ <relationshipTypes description="Relationship between LoanBroker and Bank" name="LoanBrokerToBankRel" firstRoleType="//@typeDefinitions/(a)roleTypes.2" secondRoleType="//@typeDefinitions/(a)roleTypes.0"/>
+ <relationshipTypes description="Relationship between LoanBroker and CreditAgency" name="LoanBrokerToCreditAgencyRel" firstRoleType="//@typeDefinitions/(a)roleTypes.2" secondRoleType="//@typeDefinitions/(a)roleTypes.1"/>
+ <relationshipTypes description="Relationship between LoanBroker and Notifier" name="LoanBrokerToNotifierRel" firstRoleType="//@typeDefinitions/(a)roleTypes.2" secondRoleType="//@typeDefinitions/(a)roleTypes.3"/>
+ <participantTypes description="This is the participant type BankParticipant" name="BankParticipant" roleTypes="//@typeDefinitions/(a)roleTypes.0"/>
+ <participantTypes description="This is the participant type CreditAgencyParticipant" name="CreditAgencyParticipant" roleTypes="//@typeDefinitions/(a)roleTypes.1"/>
+ <participantTypes description="This is the participant type LoanBrokerParticipant" name="LoanBrokerParticipant" roleTypes="//@typeDefinitions/(a)roleTypes.2"/>
+ <participantTypes description="This is the participant type NotifierParticipant" name="NotifierParticipant" roleTypes="//@typeDefinitions/(a)roleTypes.3"/>
+ <channelTypes description="This is the channel type BankChannelType" name="BankChannelType" referenceToken="//@typeDefinitions/(a)tokens.2" roleType="//@typeDefinitions/(a)roleTypes.0">
+ <identities description="SSN Id and Quote Ref" tokens="//@typeDefinitions/(a)tokens.1 //@typeDefinitions/(a)tokens.0"/>
+ <identities description="SSN Id" type="Association" tokens="//@typeDefinitions/(a)tokens.1"/>
+ </channelTypes>
+ <channelTypes description="This is the channel type CreditAgencyChannelType" name="CreditAgencyChannelType" referenceToken="//@typeDefinitions/(a)tokens.2" roleType="//@typeDefinitions/(a)roleTypes.1">
+ <identities description="SSN Id" tokens="//@typeDefinitions/(a)tokens.1"/>
+ </channelTypes>
+ <channelTypes description="This is the channel type NotifierChannelType" name="NotifierChannelType" referenceToken="//@typeDefinitions/(a)tokens.2" roleType="//@typeDefinitions/(a)roleTypes.3">
+ <identities description="SSN Id" type="Association" tokens="//@typeDefinitions/(a)tokens.1"/>
+ <identities description="SSN Id and Quote Ref" tokens="//@typeDefinitions/(a)tokens.1 //@typeDefinitions/(a)tokens.0"/>
+ </channelTypes>
+ </typeDefinitions>
+ <choreographies description="Choreography flow for the TrailBlazer process" name="TrailBlazerProcess" root="true">
+ <enclosedChoreographies name="RequestQuote">
+ <variableDefinitions description="Channel to facilitate interaction to Bank" name="BankChannel" type="//@typeDefinitions/(a)channelTypes.0" roleTypes="//@typeDefinitions/(a)roleTypes.0 //@typeDefinitions/(a)roleTypes.2"/>
+ <variableDefinitions description="Channel to facilitate interaction to Notifier" name="NotifierChannel" type="//@typeDefinitions/(a)channelTypes.2" roleTypes="//@typeDefinitions/(a)roleTypes.2 //@typeDefinitions/(a)roleTypes.3"/>
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="QuoteRequest" operation="requestQuote" channelVariable="//@choreographies.0/@enclosedChoreographies.0/(a)variableDefinitions.0" relationship="//@typeDefinitions/(a)relationshipTypes.0">
+ <exchangeDetails description="This is the exchange details for the request exchange associated with interaction QuoteRequest" name="QuoteRequestRequestExchange" type="//@typeDefinitions/(a)informationTypes.5">
+ <semanticAnnotations annotation="<jbossesb>
	<destination name="{{Destination;The URI for the ESB destination;string;;jms:queue/esb-tb-jmsBankRequestQueue}}"
		dynamicReplyTo="{{Dynamic ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}" />
</jbossesb>
" name="jbossesb"/>
+ <semanticAnnotations annotation="<jbossesb>
	<destination name="{{Destination;The URI for the ESB destination;string;;jms:queue/esb-tb-fileBankRequestQueue}}"
		dynamicReplyTo="{{Dynamic ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}" />
</jbossesb>
" name="jbossesb"/>
+ </exchangeDetails>
+ <exchangeDetails description="This is the exchange details for the respond exchange associated with interaction QuoteRequest" name="QuoteRequestRespondExchange" type="//@typeDefinitions/(a)informationTypes.3" action="Respond">
+ <semanticAnnotations annotation="<jbossesb>
	<destination name="{{Destination;The URI for the ESB destination;string;;jms:queue/esb-tb-jmsBankResponseQueue}}"
		dynamicReplyTo="{{Dynamic ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}" />
</jbossesb>
" name="jbossesb"/>
+ <semanticAnnotations annotation="<jbossesb>
	<destination name="{{Destination;The URI for the ESB destination;string;;jms:queue/esb-tb-fileBankResponseQueue}}"
		dynamicReplyTo="{{Dynamic ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}" />
</jbossesb>
" name="jbossesb"/>
+ </exchangeDetails>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="NotifyCustomer" operation="notify" channelVariable="//@choreographies.0/@enclosedChoreographies.0/(a)variableDefinitions.1" relationship="//@typeDefinitions/(a)relationshipTypes.2">
+ <exchangeDetails description="This is the exchange details for the request exchange associated with interaction NotifyCustomer" name="NotifyCustomerRequestExchange" type="//@typeDefinitions/(a)informationTypes.3">
+ <semanticAnnotations annotation="<jbossesb>
	<destination name="{{Destination;The URI for the ESB destination;string;;jms:queue/esb-tb-customerNotifier}}"
		dynamicReplyTo="{{Dynamic ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}" />
</jbossesb>
" name="jbossesb"/>
+ </exchangeDetails>
+ </activities>
+ </enclosedChoreographies>
+ <variableDefinitions description="Channel to facilitate interaction to CreditAgency" name="CreditAgencyChannel" type="//@typeDefinitions/(a)channelTypes.1" roleTypes="//@typeDefinitions/(a)roleTypes.1 //@typeDefinitions/(a)roleTypes.2"/>
+ <variableDefinitions description="This is the variable NotifierChannel" name="NotifierChannel" type="//@typeDefinitions/(a)channelTypes.2" roleTypes="//@typeDefinitions/(a)roleTypes.2 //@typeDefinitions/(a)roleTypes.3"/>
+ <variableDefinitions description="This is the variable creditCheckResult" name="creditCheckResult" type="//@typeDefinitions/(a)informationTypes.1" roleTypes="//@typeDefinitions/(a)roleTypes.2"/>
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="CreditCheck" operation="checkCredit" channelVariable="//@choreographies.0/(a)variableDefinitions.0" relationship="//@typeDefinitions/(a)relationshipTypes.1">
+ <exchangeDetails description="This is the exchange details for the request exchange associated with interaction CreditCheck" name="CreditCheckRequestExchange" type="//@typeDefinitions/(a)informationTypes.0">
+ <semanticAnnotations annotation="<jbossesb>
	<destination name="{{Destination;The URI for the ESB destination;string;;jms:queue/esb-tb-creditAgencyQueue}}"
		dynamicReplyTo="{{Dynamic ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}" />
</jbossesb>
" name="jbossesb"/>
+ </exchangeDetails>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="CreditCheck" operation="checkCredit" channelVariable="//@choreographies.0/(a)variableDefinitions.0" relationship="//@typeDefinitions/(a)relationshipTypes.1">
+ <exchangeDetails description="This is the exchange details for the respond exchange associated with interaction CreditCheck" name="CreditCheckRespondExchange" type="//@typeDefinitions/(a)informationTypes.1" action="Respond" receiveVariable="//@choreographies.0/(a)variableDefinitions.2">
+ <semanticAnnotations annotation="<jbossesb>
	<destination name="{{Destination;The URI for the ESB destination;string;;jms:queue/esb-tb-creditAgencyQueue_reply}}"
		dynamicReplyTo="{{Dynamic ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}" />
</jbossesb>
" name="jbossesb"/>
+ </exchangeDetails>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Choice">
+ <activities xsi:type="org.pi4soa.cdl:Conditional" description="Sufficient credit to request quotes" name="ValidCredit" expression="cdl:getVariable('creditCheckResult','','//@score') >= 4">
+ <activities xsi:type="org.pi4soa.cdl:Parallel">
+ <activities xsi:type="org.pi4soa.cdl:Sequence" description="First quote">
+ <activities xsi:type="org.pi4soa.cdl:Perform" choreography="//@choreographies.0/(a)enclosedChoreographies.0"/>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Sequence" description="Second quote">
+ <activities xsi:type="org.pi4soa.cdl:Perform" choreography="//@choreographies.0/(a)enclosedChoreographies.0"/>
+ </activities>
+ </activities>
+ </activities>
+ <activities xsi:type="org.pi4soa.cdl:Sequence" description="Insufficient credit">
+ <activities xsi:type="org.pi4soa.cdl:Interaction" name="NotifyCustomer" operation="notify" channelVariable="//@choreographies.0/(a)variableDefinitions.1" relationship="//@typeDefinitions/(a)relationshipTypes.2">
+ <exchangeDetails description="This is the exchange details for the request exchange associated with interaction NotifyCustomer" name="NotifyCustomerRequestExchange" type="//@typeDefinitions/(a)informationTypes.2">
+ <semanticAnnotations annotation="<jbossesb>
	<destination name="{{Destination;The URI for the ESB destination;string;;jms:queue/esb-tb-customerNotifier}}"
		dynamicReplyTo="{{Dynamic ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}" />
</jbossesb>
" name="jbossesb"/>
+ </exchangeDetails>
+ </activities>
+ </activities>
+ </activities>
+ </choreographies>
+</org.pi4soa.cdl:Package>
Added: trunk/validators/jbossesb/src/main/configs/pi4soa.xml
===================================================================
--- trunk/validators/jbossesb/src/main/configs/pi4soa.xml (rev 0)
+++ trunk/validators/jbossesb/src/main/configs/pi4soa.xml 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,38 @@
+<!--
+/*
+# * Copyright 2005-8 Pi4 Technologies Ltd
+# *
+# * 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.
+# *
+# *
+# * Change History:
+# * 16, June 2008: Initial version created by gary
+# */
+-->
+
+<pi4soa>
+ <container>
+ <serviceTracker class="org.pi4soa.service.tracker.jms.JMSServiceTracker" >
+ <jmsConnectionFactory>ConnectionFactory</jmsConnectionFactory>
+ <jmsDestination>topic/tracker</jmsDestination>
+ <recordMessagePayload>true</recordMessagePayload>
+ </serviceTracker>
+ </container>
+ <monitor>
+ <serviceTracker class="org.pi4soa.service.tracker.jms.JMSServiceTracker" >
+ <jmsConnectionFactory>ConnectionFactory</jmsConnectionFactory>
+ <jmsDestination>topic/tracker</jmsDestination>
+ <recordMessagePayload>true</recordMessagePayload>
+ </serviceTracker>
+ </monitor>
+</pi4soa>
\ No newline at end of file
Added: trunk/validators/jbossesb/src/main/configs/validator-config.xml
===================================================================
--- trunk/validators/jbossesb/src/main/configs/validator-config.xml (rev 0)
+++ trunk/validators/jbossesb/src/main/configs/validator-config.xml 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,2 @@
+<validator mode="monitor" replyToTimeout="10000" >
+</validator>
Added: trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/AbstractServiceValidator.java
===================================================================
--- trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/AbstractServiceValidator.java (rev 0)
+++ trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/AbstractServiceValidator.java 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.validator.jbossesb;
+
+/**
+ * Abstract base class representing the ServiceValidator.
+ */
+public abstract class AbstractServiceValidator implements ServiceValidator {
+
+ private static final String MODELS_PATH = "models/";
+
+ /**
+ * This is the constructor for the abstract
+ * service validator, initialised with the validator
+ * name.
+ *
+ * @param name The validator name
+ */
+ public AbstractServiceValidator(ValidatorName name) {
+ m_name = name;
+ }
+
+ /**
+ * This method returns the validator name.
+ *
+ * @return The validator name
+ */
+ public ValidatorName getValidatorName() {
+ return(m_name);
+ }
+
+ /**
+ * This method returns the input stream associated
+ * with the model. Once the input stream has been
+ * used, it is the caller's responsibility to close
+ * the stream.
+ *
+ * @return The model's input stream, or null if
+ * not found
+ */
+ protected java.io.InputStream getModel() {
+ String filePath=MODELS_PATH+getValidatorName().getModelName();
+
+ java.io.InputStream ret = AbstractServiceValidator.class.
+ getClassLoader().getResourceAsStream(filePath);
+
+ return(ret);
+ }
+
+ public String toString() {
+ return("ServiceValidator["+getValidatorName()+"]");
+ }
+
+ private ValidatorName m_name=null;
+}
Added: trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/DefaultValidatorConfig.java
===================================================================
--- trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/DefaultValidatorConfig.java (rev 0)
+++ trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/DefaultValidatorConfig.java 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.validator.jbossesb;
+
+import org.jboss.soa.esb.helpers.*;
+
+/**
+ * This class represents a default configuration that will be used for
+ * validation against a stream of ESB based messages.
+ */
+public class DefaultValidatorConfig implements ValidatorConfig {
+
+ /**
+ * This is the constructor for the default validator model.
+ *
+ * @param modeType The model type
+ * @param config The configuration
+ */
+ public DefaultValidatorConfig(String modelType, ConfigTree config) {
+ m_modelType = modelType;
+ m_configuration = config;
+ }
+
+ /**
+ * This method returns the type of the model associated
+ * with this validator configuration. This will
+ * general be based on the file extension of the model
+ * file.
+ *
+ * @return The model type
+ */
+ public String getModelType() {
+ return(m_modelType);
+ }
+
+ /**
+ * This method returns the validator configuration
+ * associated with the model.
+ *
+ * @return The validator model
+ */
+ public ConfigTree getConfiguration() {
+ return(m_configuration);
+ }
+
+ private String m_modelType=null;
+ private ConfigTree m_configuration=null;
+}
Added: trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ESBUtil.java
===================================================================
--- trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ESBUtil.java (rev 0)
+++ trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ESBUtil.java 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.validator.jbossesb;
+
+import org.apache.log4j.Logger;
+
+/**
+ * This class provides utility functions for processing
+ * ESB messages.
+ */
+public class ESBUtil {
+
+ /**
+ * This method returns the message content associated
+ * with the supplied JBoss ESB message.
+ *
+ * @param message The esb message
+ * @return The message content
+ */
+ public static java.io.Serializable getMessage(
+ org.jboss.soa.esb.message.Message message) {
+ java.io.Serializable ret=null;
+
+ ret = (java.io.Serializable)message.getBody().get();
+
+ // Check if should return a multipart message
+ if (ret == null) {
+
+ // Check if single or multipart message
+ if (message.getBody().getNames() != null &&
+ message.getBody().getNames().length == 1) {
+
+ Object mesg=message.getBody().get(message.getBody().getNames()[0]);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("MESSAGE("+
+ message.getBody().getNames()[0]+")="+mesg);
+ }
+
+ if (mesg instanceof java.io.Serializable) {
+ ret = (java.io.Serializable)mesg;
+ }
+
+ } else if (message.getBody().getNames() != null &&
+ message.getBody().getNames().length > 1) {
+
+ java.util.Hashtable<String,Object> multipart=
+ new java.util.Hashtable<String,Object>();
+
+ for (int i=0; i < message.getBody().getNames().length; i++) {
+ multipart.put(message.getBody().getNames()[i],
+ message.getBody().get(message.getBody().getNames()[i]));
+ }
+
+ ret = multipart;
+ }
+ }
+
+ if (ret instanceof byte[]) {
+ ret = new String((byte[])ret);
+ }
+
+ return(ret);
+ }
+
+ private static Logger logger = Logger.getLogger(ESBUtil.class);
+}
Added: trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/Endpoint.java
===================================================================
--- trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/Endpoint.java (rev 0)
+++ trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/Endpoint.java 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.validator.jbossesb;
+
+/**
+ * This class represents an endpoint being monitored by one
+ * or more service validator.
+ */
+public class Endpoint {
+
+ /**
+ * This is the constructor for the endpoint, supplying
+ * the destination associated with the endpoint.
+ *
+ * @param destination The destination
+ */
+ public Endpoint(String destination) {
+ m_destination = destination;
+ }
+
+ /**
+ * This method returns the destination for the endpoint.
+ *
+ * @return The destination
+ */
+ public String getDestination() {
+ return(m_destination);
+ }
+
+ /**
+ * This method returns the list of service validators
+ * associated with this endpoint.
+ *
+ * @return The list of service validators for this endpoint
+ */
+ public java.util.List<ServiceValidator> getServiceValidators() {
+ return(m_validators);
+ }
+
+ public boolean equals(Object obj) {
+ boolean ret=false;
+
+ if (obj instanceof Endpoint) {
+ Endpoint ep=(Endpoint)obj;
+
+ if (ep.getDestination() != null &&
+ ep.getDestination().equals(m_destination)) {
+ ret = true;
+ }
+ }
+
+ return(ret);
+ }
+
+ public int hashCode() {
+ int ret=0;
+
+ if (m_destination != null) {
+ ret = m_destination.hashCode();
+ }
+
+ return(ret);
+ }
+
+ public String toString() {
+ return("Endpoint["+m_destination+"]");
+ }
+
+ private String m_destination=null;
+ private java.util.List<ServiceValidator> m_validators=
+ new java.util.Vector<ServiceValidator>();
+}
Added: trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ServiceValidator.java
===================================================================
--- trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ServiceValidator.java (rev 0)
+++ trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ServiceValidator.java 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.validator.jbossesb;
+
+import org.jboss.soa.esb.message.Message;
+
+/**
+ * This interface represents a service validator responsible for
+ * validing a stream of ESB messages against a model.
+ */
+public interface ServiceValidator {
+
+ /**
+ * This method returns the validator name.
+ *
+ * @return The validator name
+ */
+ public ValidatorName getValidatorName();
+
+ /**
+ * This method processes a sent message against a service
+ * behavioural description.
+ *
+ * @param msg The message
+ * @throws Exception Failed to process sent message
+ */
+ public void messageSent(Message msg) throws Exception;
+
+ /**
+ * This method processes a received message against a service
+ * behavioural description.
+ *
+ * @param msg The message
+ * @throws Exception Failed to process received message
+ */
+ public void messageReceived(Message msg) throws Exception;
+
+ /**
+ * This method is called to update the model associated
+ * with the service validator.
+ *
+ * @throws Exception Failed to update the service validator
+ */
+ public void update() throws Exception;
+
+ /**
+ * This method closes the service validator.
+ *
+ * @throws Exception Failed to close the service validator
+ */
+ public void close() throws Exception;
+
+}
Added: trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ServiceValidatorFactory.java
===================================================================
--- trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ServiceValidatorFactory.java (rev 0)
+++ trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ServiceValidatorFactory.java 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.validator.jbossesb;
+
+import java.lang.reflect.Constructor;
+import org.apache.log4j.Logger;
+
+/**
+ * This class provides a factory for Service Validators.
+ */
+public class ServiceValidatorFactory {
+
+ /**
+ * This method returns the Service Validator appropriate
+ * for the supplied validator name.
+ *
+ * @param name The validator name
+ * @return The service validator
+ * @exception IOException Failed to create the service validator
+ */
+ public static ServiceValidator getServiceValidator(ValidatorName name)
+ throws Exception {
+ ServiceValidator ret=null;
+
+ String modelType=name.getModelType();
+
+ if (modelType != null &&
+ m_validatorClasses.containsKey(modelType)) {
+ Class<?> cls=m_validatorClasses.get(modelType);
+
+ Constructor<?> con=cls.getConstructor(
+ new Class[]{ValidatorName.class});
+
+ ret = (ServiceValidator)con.newInstance(new Object[]{name});
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Returning service validator for "+
+ name+": "+ret);
+ }
+
+ return(ret);
+ }
+
+ private static final Logger logger = Logger.getLogger(ServiceValidatorFactory.class);
+
+ private static java.util.Map<String,Class<?>> m_validatorClasses=
+ new java.util.HashMap<String,Class<?>>();
+
+ static {
+ m_validatorClasses.put(org.jboss.savara.validator.jbossesb.pi4soa.Pi4SOAServiceRecorder.getModelType(),
+ org.jboss.savara.validator.jbossesb.pi4soa.Pi4SOAServiceRecorder.class);
+ m_validatorClasses.put(org.jboss.savara.validator.jbossesb.pi4soa.Pi4SOAServiceValidator.getModelType(),
+ org.jboss.savara.validator.jbossesb.pi4soa.Pi4SOAServiceValidator.class);
+ }
+}
Added: trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ServiceValidatorManager.java
===================================================================
--- trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ServiceValidatorManager.java (rev 0)
+++ trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ServiceValidatorManager.java 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,966 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.validator.jbossesb;
+
+import org.apache.log4j.Logger;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
+
+/**
+ * This class is responsible for managing the active
+ * service validators, the mapping of endpoints to the service
+ * validators and updating the configuration when changes
+ * are detected.
+ */
+public class ServiceValidatorManager {
+
+ /**
+ * Default constructor for the service validator manager.
+ */
+ private ServiceValidatorManager() {
+ initialize();
+ }
+
+ /**
+ * This method returns the singleton ValidatorConfigurationManager.
+ *
+ * @return The singleton
+ */
+ public synchronized static ServiceValidatorManager instance() {
+ if (m_instance == null) {
+ m_instance = new ServiceValidatorManager();
+ }
+
+ return(m_instance);
+ }
+
+ /**
+ * This method initializes the service validator manager on
+ * startup.
+ */
+ protected void initialize() {
+
+ java.net.URL url=
+ ValidatorFilter.class.getClassLoader().getResource(CONFIG_FILE);
+
+ if (url != null) {
+ m_validatorConfigFile = new java.io.File(url.getFile());
+
+ java.io.File[] files=m_validatorConfigFile.getParentFile().listFiles();
+
+ for (int i=0; m_modelsDir == null && i < files.length; i++) {
+ if (files[i].getName().equals("models") &&
+ files[i].isDirectory()) {
+ m_modelsDir = files[i];
+ }
+ }
+
+ if (m_modelsDir != null) {
+ ValidatorConfigChangeMonitor mon=
+ new ValidatorConfigChangeMonitor();
+
+ new Thread(mon).start();
+ }
+ }
+ }
+
+ /**
+ * This method returns the list of service validators associated
+ * with the supplied input endpoint.
+ *
+ * @param endpoint The input endpoint
+ * @return The list of service validators, or null if the endpoint
+ * is unknown
+ */
+ public java.util.List<ServiceValidator> getInputServiceValidators(Endpoint endpoint) {
+ java.util.List<ServiceValidator> ret=
+ m_inputValidators.get(endpoint);
+
+ if (ret == null) {
+ ret = m_replyToManager.getInputServiceValidators(endpoint);
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Return input validators '"+endpoint+"': "+ret);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method determines whether the supplied endpoint will be
+ * associated with a dynamic reply-to endpoint.
+ *
+ * @param endpoint The endpoint
+ * @return Whether the endpoint has a dynamic reply-to
+ */
+ public boolean isInputDynamicReplyTo(Endpoint endpoint) {
+ boolean ret=m_inputDynaReplyTos.contains(endpoint);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Is input endpoint '"+endpoint+
+ "' a dynamic reply-to: "+ret);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the list of service validators associated
+ * with the supplied output endpoint.
+ *
+ * @param endpoint The output endpoint
+ * @return The list of service validators, or null if the endpoint
+ * is unknown
+ */
+ public java.util.List<ServiceValidator> getOutputServiceValidators(Endpoint endpoint) {
+ java.util.List<ServiceValidator> ret=
+ m_outputValidators.get(endpoint);
+
+ if (ret == null) {
+ ret = m_replyToManager.getOutputServiceValidators(endpoint);
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Return output validators '"+endpoint+"': "+ret);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method determines whether the supplied endpoint will be
+ * associated with a dynamic reply-to endpoint.
+ *
+ * @param endpoint The endpoint
+ * @return Whether the endpoint has a dynamic reply-to
+ */
+ public boolean isOutputDynamicReplyTo(Endpoint endpoint) {
+ boolean ret=m_outputDynaReplyTos.contains(endpoint);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Is output endpoint '"+endpoint+
+ "' a dynamic reply-to: "+ret);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method registers a list of service validators against
+ * a dynamic 'reply-to' endpoint.
+ *
+ * @param endpoint The endpoint
+ * @param validators The list of service validators
+ */
+ public void registerInputReplyToValidators(Endpoint endpoint,
+ java.util.List<ServiceValidator> validators) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Register input reply-to '"+endpoint+"': "+validators);
+ }
+
+ m_replyToManager.registerInputDynamicReplyTo(endpoint, validators);
+ }
+
+ /**
+ * This method registers a list of service validators against
+ * a dynamic 'reply-to' endpoint.
+ *
+ * @param endpoint The endpoint
+ * @param validators The list of service validators
+ */
+ public void registerOutputReplyToValidators(Endpoint endpoint,
+ java.util.List<ServiceValidator> validators) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Register output reply-to '"+endpoint+"': "+validators);
+ }
+
+ m_replyToManager.registerOutputDynamicReplyTo(endpoint, validators);
+ }
+
+ /**
+ * This method returns a ServiceValidator associated with the
+ * supplied validator name.
+ *
+ * @param name The validator name
+ * @return The service validator
+ * @throws Exception Failed to create service validator
+ */
+ public ServiceValidator createServiceValidator(ValidatorName name)
+ throws Exception {
+ ServiceValidator ret=null;
+
+ synchronized(m_serviceValidators) {
+ ret = m_serviceValidators.get(name);
+
+ // If does not exist, then create, else update
+ // the existing service validator
+ if (ret == null) {
+ ret = ServiceValidatorFactory.getServiceValidator(name);
+
+ m_serviceValidators.put(name, ret);
+ } else {
+
+ // Update the description
+ ret.update();
+ }
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Created Service Validator '"+name+"': "+ret);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method removes the service validator associated with
+ * the supplied validator name.
+ *
+ * @param name The validator name
+ * @throws Exception Failed to remove the service validator
+ */
+ protected void removeServiceValidator(ValidatorName name)
+ throws Exception {
+ synchronized(m_serviceValidators) {
+ ServiceValidator validator=(ServiceValidator)
+ m_serviceValidators.remove(name);
+
+ // Check if validator should be removed from
+ // input/output endpoint mappings
+ java.util.Iterator<Endpoint> iter=m_inputValidators.keySet().iterator();
+
+ while (iter.hasNext()) {
+ Endpoint ep=iter.next();
+ java.util.List<ServiceValidator> list=
+ m_inputValidators.get(ep);
+
+ if (list.contains(validator)) {
+ list.remove(validator);
+
+ if (list.size() == 0) {
+ logger.error("Input validator list, associated with endpoint '"+
+ ep+"' contains no entries after removal of validator '"+
+ name+"' - this Endpoint should have previously been removed");
+ }
+ }
+ }
+
+ iter=m_outputValidators.keySet().iterator();
+
+ while (iter.hasNext()) {
+ Endpoint ep=iter.next();
+ java.util.List<ServiceValidator> list=
+ m_outputValidators.get(ep);
+
+ if (list.contains(validator)) {
+ list.remove(validator);
+
+ if (list.size() == 0) {
+ logger.error("Output validator list, associated with endpoint '"+
+ ep+"' contains no entries after removal of validator '"+
+ name+"' - this Endpoint should have previously been removed");
+ }
+ }
+ }
+
+ if (validator != null) {
+ validator.close();
+ }
+ }
+ }
+
+ /**
+ * This method returns the set of currently configured
+ * service validator names.
+ *
+ * @return The set of validator names
+ */
+ protected java.util.Set<ValidatorName> getServiceValidatorNames() {
+ java.util.Set<ValidatorName> ret=new java.util.HashSet<ValidatorName>();
+
+ ret.addAll(m_serviceValidators.keySet());
+
+ return(ret);
+ }
+
+ /**
+ * This method updates the configuration of the service
+ * validators and endpoint mappings.
+ */
+ protected void updateConfigurations() {
+ java.util.Set<ValidatorName> existingValidatorNames=
+ getServiceValidatorNames();
+
+ java.util.Set<Endpoint> existingInputEndpoints=
+ new java.util.HashSet<Endpoint>(m_inputValidators.keySet());
+
+ java.util.Set<Endpoint> existingOutputEndpoints=
+ new java.util.HashSet<Endpoint>(m_outputValidators.keySet());
+
+ java.util.Set<Endpoint> existingInputDynaReplyTos=
+ new java.util.HashSet<Endpoint>(m_inputDynaReplyTos);
+
+ java.util.Set<Endpoint> existingOutputDynaReplyTos=
+ new java.util.HashSet<Endpoint>(m_outputDynaReplyTos);
+
+ java.io.InputStream is=ValidatorFilter.class.getClassLoader().
+ getResourceAsStream(CONFIG_FILE);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("ValidationFilter: config="+CONFIG_FILE+" is="+is);
+ }
+
+ try {
+ ConfigTree config=ConfigTree.fromInputStream(is);
+
+ if (config.getName().equals(VALIDATOR_NODE)) {
+ // Old 'active' attribute is now 'mode'
+ String active=config.getAttribute(ACTIVE_ATTR);
+
+ if (active != null && active.equalsIgnoreCase("true")) {
+ m_managedMode = true;
+ }
+
+ String mode=config.getAttribute(MODE_ATTR);
+
+ if (mode != null) {
+ if (mode.equals("manage")) {
+ m_managedMode = true;
+ } else if (mode.equals("monitor")) {
+ m_managedMode = false; // will override active=true
+ } else {
+ logger.error("Unknown mode '"+mode+"' - setting to 'monitor'");
+ m_managedMode = false;
+ }
+ }
+
+ if (m_managedMode) {
+ logger.debug("Setting validators in 'manage' mode");
+ } else {
+ logger.debug("Setting validators in 'monitor' mode");
+ }
+
+ // Check for dynamic replyTo endpoint timeout
+ String timeoutValue=config.getAttribute(REPLY_TO_TIMEOUT_ATTR);
+
+ if (timeoutValue != null) {
+ try {
+ long tv=Long.parseLong(timeoutValue);
+
+ m_replyToManager.setReplyToTimeout(tv);
+ } catch(Exception e) {
+ logger.error("Unable to set 'reply to' timeout", e);
+ }
+ }
+ }
+
+ updateConfiguration(config, existingValidatorNames,
+ existingInputEndpoints, existingOutputEndpoints,
+ existingInputDynaReplyTos, existingOutputDynaReplyTos);
+
+ // Work through choreography files in the models directory
+ java.io.File[] files=m_modelsDir.listFiles();
+
+ for (int i=0; i < files.length; i++) {
+
+ // Check if a ValidatorModel exists for the
+ // file
+ try {
+ ValidatorConfig vm=
+ ValidatorConfigFactory.getValidatorConfig(files[i]);
+
+ if (vm != null) {
+ ConfigTree vConfig=vm.getConfiguration();
+
+ if (vConfig != null) {
+ updateConfiguration(vConfig,
+ existingValidatorNames,
+ existingInputEndpoints,
+ existingOutputEndpoints,
+ existingInputDynaReplyTos,
+ existingOutputDynaReplyTos);
+ } else {
+ logger.error("Failed to obtain configuration for model '"+
+ files[i].getName()+"'");
+ }
+ }
+ } catch(Exception e) {
+ logger.error("Failed to update configuration for model '"+
+ files[i].getName()+"'", e);
+ }
+ }
+
+ // Any remaining input keys need to be removed
+ java.util.Iterator<Endpoint> iter=
+ existingInputEndpoints.iterator();
+
+ while (iter.hasNext()) {
+ Endpoint key=iter.next();
+ m_inputValidators.remove(key);
+ }
+
+ iter = existingInputDynaReplyTos.iterator();
+
+ while (iter.hasNext()) {
+ Endpoint key=iter.next();
+ m_inputDynaReplyTos.remove(key);
+ }
+
+ // Any remaining output keys need to be removed
+ iter = existingOutputEndpoints.iterator();
+
+ while (iter.hasNext()) {
+ Endpoint key=iter.next();
+ m_outputValidators.remove(key);
+ }
+
+ iter = existingOutputDynaReplyTos.iterator();
+
+ while (iter.hasNext()) {
+ Endpoint key=iter.next();
+ m_outputDynaReplyTos.remove(key);
+ }
+
+ // Any remaining service description names need to
+ // have their associated monitors removed
+ java.util.Iterator<ValidatorName> sviter=
+ existingValidatorNames.iterator();
+
+ while (sviter.hasNext()) {
+ ValidatorName svkey=sviter.next();
+
+ try {
+ logger.debug("Removing service validator: "+svkey);
+ removeServiceValidator(svkey);
+ } catch(Exception e) {
+ logger.error(
+ "Failed to remove service validator: "+svkey, e);
+ }
+ }
+ } catch(Exception e) {
+ logger.error("Failed to update configuration from input stream", e);
+ }
+ }
+
+ /**
+ * This method performs the update of the configuration of
+ * service monitors, based on the information in the validator
+ * configuration XML file, and the choreographies defined in the
+ * models folder.
+ *
+ * @param config The configuration
+ * @param existingValidatorNames The list of validator names
+ * @param existingInputEndpoints The list of input endpoints
+ * @param existingOutputEndpoints The list of output endpoints
+ * @param existingInputDynaReplyTos The set of input dynamic replyTo endpoints
+ * @param existingOutputDynaReplyTos The set of output dynamic replyTo endpoints
+ */
+ protected void updateConfiguration(ConfigTree config,
+ java.util.Set<ValidatorName> existingValidatorNames,
+ java.util.Set<Endpoint> existingInputEndpoints,
+ java.util.Set<Endpoint> existingOutputEndpoints,
+ java.util.Set<Endpoint> existingInputDynaReplyTos,
+ java.util.Set<Endpoint> existingOutputDynaReplyTos) {
+ logger.debug("Update Service Validator Configuration");
+
+ if (config != null) {
+ try {
+ if (config.getName().equals(VALIDATOR_NODE)) {
+ String active=config.getAttribute(ACTIVE_ATTR);
+
+ if (active != null && active.equalsIgnoreCase("true")) {
+
+ logger.debug("Setting validator into active mode");
+ m_managedMode = true;
+ }
+ }
+
+ ConfigTree[] services=config.getChildren(SERVICE_NODE);
+
+ if (logger.isDebugEnabled()) {
+ if (services != null) {
+ logger.debug("ValidationFilter: services="+services.length);
+ } else {
+ logger.debug("ValidationFilter: services null");
+ }
+ }
+
+ for (int i=0; i < services.length; i++) {
+ ServiceValidator sm=null;
+
+ // Create service monitor for service
+ String modelName=
+ services[i].getAttribute(MODEL_ATTR);
+ String role=
+ services[i].getAttribute(ROLE_ATTR);
+ boolean validate=
+ services[i].getBooleanAttribute(VALIDATE_ATTR, true);
+
+ // Check for old attribute names, for
+ // backward compatibility - only support
+ // for a limited time
+ if (role == null) {
+ role = services[i].getAttribute("participantType");
+ }
+
+ if (modelName == null) {
+ modelName = services[i].getAttribute("cdmFilePath");
+
+ if (modelName != null) {
+ // Remove path
+ int pos=modelName.lastIndexOf('/');
+ if (pos != -1) {
+ modelName = modelName.substring(pos+1);
+ }
+ }
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Initialize service validator for: model="+
+ modelName+" role="+role+" validate="+validate);
+ }
+
+ if (role != null) {
+
+ if (modelName != null ||
+ validate == false) {
+ ValidatorName name=null;
+
+ if (validate) {
+ name = new ValidatorName(modelName, role);
+ } else {
+ name = new ValidatorName(role);
+
+ }
+
+ try {
+ // Obtain the service container
+ sm = createServiceValidator(name);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Service validator for '"+modelName+
+ "' and role '"+role+"' = "+sm);
+ }
+
+ // Remove validator name from list
+ existingValidatorNames.remove(sm.getValidatorName());
+ } catch(Exception e) {
+ logger.error(
+ "Failed to create service validator '"+
+ name+"'", e);
+ }
+ } else {
+ logger.error("Model name must be specified in validation mode");
+ }
+ } else {
+ logger.error("Role must be specified");
+ }
+
+ if (sm != null) {
+ // Map inputs to service
+ ConfigTree[] inputs=services[i].getChildren(INPUT_NODE);
+
+ for (int j=0; j < inputs.length; j++) {
+ String epr=inputs[j].getAttribute(EPR_ATTR);
+
+ if (epr != null) {
+ Endpoint endpoint=new Endpoint(epr);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Storing input endpoint '"+
+ endpoint+"' against validator: "+sm);
+ }
+
+ // Check if existing list
+ java.util.List<ServiceValidator> svs=
+ m_inputValidators.get(endpoint);
+
+ if (svs == null) {
+ svs = new java.util.Vector<ServiceValidator>();
+ m_inputValidators.put(endpoint, svs);
+ }
+
+ if (svs.contains(sm) == false) {
+ svs.add(sm);
+ }
+
+ existingInputEndpoints.remove(endpoint);
+
+ // Check if dynamic replyTo
+ if (inputs[j].getAttribute(DYNAMIC_REPLY_TO_ATTR,
+ "false").equalsIgnoreCase("true")) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Input endpoint '"+
+ endpoint+"' has dynamic replyTo destination");
+ }
+
+ m_inputDynaReplyTos.add(endpoint);
+
+ existingInputDynaReplyTos.remove(endpoint);
+ }
+ }
+ }
+
+ // Map outputs to service
+ ConfigTree[] outputs=services[i].getChildren(OUTPUT_NODE);
+
+ for (int j=0; j < outputs.length; j++) {
+ String epr=outputs[j].getAttribute(EPR_ATTR);
+
+ if (epr != null) {
+ Endpoint endpoint=new Endpoint(epr);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Storing output endpoint '"+
+ endpoint+"' against validator: "+sm);
+ }
+
+ // Check if existing list
+ java.util.List<ServiceValidator> svs=
+ m_outputValidators.get(endpoint);
+
+ if (svs == null) {
+ svs = new java.util.Vector<ServiceValidator>();
+ m_outputValidators.put(endpoint, svs);
+ }
+
+ if (svs.contains(sm) == false) {
+ svs.add(sm);
+ }
+
+ existingOutputEndpoints.remove(endpoint);
+
+ // Check if dynamic replyTo
+ if (outputs[j].getAttribute(DYNAMIC_REPLY_TO_ATTR,
+ "false").equalsIgnoreCase("true")) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Output endpoint '"+
+ endpoint+"' has dynamic replyTo destination");
+ }
+
+ m_outputDynaReplyTos.add(endpoint);
+
+ existingOutputDynaReplyTos.remove(endpoint);
+ }
+ }
+ }
+ }
+ }
+ } catch(Exception e) {
+ logger.error("Failed to load validator config", e);
+ }
+ }
+ }
+
+ /**
+ * This method returns whether the service validator configuration
+ * is in 'manage' mode. If yes, then invalid messages will
+ * be blocked from being delivered to their destination.
+ *
+ * @return Whether the service validator is in 'manage' mode
+ */
+ public boolean isManagedMode() {
+ return(m_managedMode);
+ }
+
+ private static final Logger logger = Logger.getLogger(ServiceValidatorManager.class);
+
+ private static final String EPR_ATTR = "epr";
+ private static final String DYNAMIC_REPLY_TO_ATTR = "dynamicReplyTo";
+
+ private static final String OUTPUT_NODE = "output";
+ private static final String INPUT_NODE = "input";
+ private static final String SERVICE_NODE = "service";
+ private static final String ACTIVE_ATTR = "active";
+ private static final String MODE_ATTR = "mode";
+ private static final String REPLY_TO_TIMEOUT_ATTR = "replyToTimeout";
+ private static final String VALIDATOR_NODE = "validator";
+
+ private static final String CONFIG_FILE = "validator-config.xml";
+ private static final String MODEL_ATTR="model";
+ private static final String ROLE_ATTR="role";
+ private static final String VALIDATE_ATTR="validate";
+
+ private static ServiceValidatorManager m_instance=null;
+ private java.io.File m_validatorConfigFile=null;
+ private java.io.File m_modelsDir=null;
+ private java.util.Map<ValidatorName,ServiceValidator> m_serviceValidators=
+ new java.util.HashMap<ValidatorName,ServiceValidator>();
+ private java.util.Map<Endpoint,java.util.List<ServiceValidator>> m_inputValidators=new java.util.Hashtable<Endpoint,java.util.List<ServiceValidator>>();
+ private java.util.Map<Endpoint,java.util.List<ServiceValidator>> m_outputValidators=new java.util.Hashtable<Endpoint,java.util.List<ServiceValidator>>();
+ private java.util.Set<Endpoint> m_inputDynaReplyTos=new java.util.HashSet<Endpoint>();
+ private java.util.Set<Endpoint> m_outputDynaReplyTos=new java.util.HashSet<Endpoint>();
+ private boolean m_managedMode=false;
+ private DynamicReplyToEndpointManager m_replyToManager=new DynamicReplyToEndpointManager();
+
+ /**
+ * This class is responsible for monitoring the models folder,
+ * within the overlord validator ESB bundle, to determine when
+ * the configuration has changed.
+ */
+ public class ValidatorConfigChangeMonitor implements java.lang.Runnable {
+
+ public ValidatorConfigChangeMonitor() {
+ // Do initial check for updates, so monitors
+ // initialized before returning from construct,
+ // as remainder of checks will be in a separate
+ // thread - so we need to ensure that the monitors
+ // are configured before the first message is
+ // passed through the filter.
+ checkForUpdates();
+ }
+
+ public void run() {
+
+ while (true) {
+ checkForUpdates();
+
+ try {
+ synchronized(ValidatorConfigChangeMonitor.this) {
+ wait(30000);
+ }
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ protected void checkForUpdates() {
+ logger.debug("Checking for config updates");
+
+ // Get last update time
+ long lastUpdate=getLastUpdate();
+
+ if (lastUpdate > m_lastUpdate) {
+
+ updateConfigurations();
+
+ m_lastUpdate = lastUpdate;
+ }
+ }
+
+ protected long getLastUpdate() {
+ long ret=0;
+
+ if (m_validatorConfigFile != null) {
+ ret = m_validatorConfigFile.lastModified();
+ }
+
+ if (m_modelsDir != null) {
+ java.io.File[] files=m_modelsDir.listFiles();
+
+ for (int i=0; i < files.length; i++) {
+ if (files[i].getName().endsWith(".cdm") &&
+ ret < files[i].lastModified()) {
+ ret = files[i].lastModified();
+ }
+ }
+
+ if (ret < m_modelsDir.lastModified()) {
+ ret = m_modelsDir.lastModified();
+ }
+ }
+
+ return(ret);
+ }
+
+ private long m_lastUpdate=0;
+ }
+
+ public class DynamicReplyToEndpointManager extends Thread {
+
+ /**
+ * The default constructor
+ */
+ public DynamicReplyToEndpointManager() {
+ setDaemon(true);
+
+ start();
+ }
+
+ /**
+ * The run method is responsible for ensuring the dynamic
+ * 'reply-to' endpoints are cleaned up periodically.
+ */
+ public void run() {
+
+ while(true) {
+
+ try {
+ synchronized(this) {
+ wait(m_replyToTimeout);
+ }
+ } catch(Exception e) {
+ logger.error("Failed to wait");
+ }
+
+ // Shift main entries to an emptied 'pending delete'
+ // map
+ synchronized(m_inputs) {
+ if (logger.isDebugEnabled()) {
+ java.util.Iterator<Endpoint> iter=
+ m_inputsPendingDelete.keySet().iterator();
+ while (iter.hasNext()) {
+ Endpoint endpoint=iter.next();
+ java.util.List<ServiceValidator> validators=
+ m_inputsPendingDelete.get(endpoint);
+ logger.debug("Deleting input (reply-to) validators '"+
+ endpoint+"': "+validators);
+ }
+ }
+
+ m_inputsPendingDelete.clear();
+ m_inputsPendingDelete.putAll(m_inputs);
+ m_inputs.clear();
+ }
+
+ synchronized(m_outputs) {
+ if (logger.isDebugEnabled()) {
+ java.util.Iterator<Endpoint> iter=
+ m_outputsPendingDelete.keySet().iterator();
+ while (iter.hasNext()) {
+ Endpoint endpoint=iter.next();
+ java.util.List<ServiceValidator> validators=
+ m_outputsPendingDelete.get(endpoint);
+ logger.debug("Deleting output (reply-to) validators '"+
+ endpoint+"': "+validators);
+ }
+ }
+
+ m_outputsPendingDelete.clear();
+ m_outputsPendingDelete.putAll(m_outputs);
+ m_outputs.clear();
+ }
+ }
+ }
+
+ /**
+ * This method returns the list of service validators
+ * associated with the dynamic reply-to endpoint.
+ *
+ * @param endpoint The input endpoint
+ * @return The list of service validators, or null if
+ * not found
+ */
+ public java.util.List<ServiceValidator> getInputServiceValidators(Endpoint endpoint) {
+ java.util.List<ServiceValidator> ret=null;
+
+ synchronized(m_inputs) {
+ ret = m_inputs.get(endpoint);
+
+ if (ret == null) {
+ ret = m_inputsPendingDelete.get(endpoint);
+ }
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Return input (reply-to) validators '"+endpoint+"': "+ret);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the list of service validators
+ * associated with the dynamic reply-to endpoint.
+ *
+ * @param endpoint The output endpoint
+ * @return The list of service validators, or null if
+ * not found
+ */
+ public java.util.List<ServiceValidator> getOutputServiceValidators(Endpoint endpoint) {
+ java.util.List<ServiceValidator> ret=null;
+
+ synchronized(m_outputs) {
+ ret = m_outputs.get(endpoint);
+
+ if (ret == null) {
+ ret = m_outputsPendingDelete.get(endpoint);
+ }
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Return output (reply-to) validators '"+endpoint+"': "+ret);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method registers a list of service validators against
+ * a dynamic 'reply-to' endpoint.
+ *
+ * @param endpoint The endpoint
+ * @param validators The list of service validators
+ */
+ public void registerInputDynamicReplyTo(Endpoint endpoint,
+ java.util.List<ServiceValidator> validators) {
+
+ synchronized(m_inputs) {
+ m_inputs.put(endpoint, validators);
+
+ // May not be necessary, as entry would not be
+ // used - but could save memory?
+ m_inputsPendingDelete.remove(endpoint);
+ }
+ }
+
+ /**
+ * This method registers a list of service validators against
+ * a dynamic 'reply-to' endpoint.
+ *
+ * @param endpoint The endpoint
+ * @param validators The list of service validators
+ */
+ public void registerOutputDynamicReplyTo(Endpoint endpoint,
+ java.util.List<ServiceValidator> validators) {
+
+ synchronized(m_outputs) {
+ m_outputs.put(endpoint, validators);
+
+ // May not be necessary, as entry would not be
+ // used - but could save memory?
+ m_outputsPendingDelete.remove(endpoint);
+ }
+ }
+
+ /**
+ * This method sets the timeout period for purging the
+ * cache of reply-to endpoints.
+ *
+ * @param timeoutValue The timeout value
+ */
+ public void setReplyToTimeout(long timeoutValue) {
+ m_replyToTimeout = timeoutValue;
+ }
+
+ private java.util.Map<Endpoint,java.util.List<ServiceValidator>> m_inputs=
+ new java.util.HashMap<Endpoint,java.util.List<ServiceValidator>>();
+ private java.util.Map<Endpoint,java.util.List<ServiceValidator>> m_outputs=
+ new java.util.HashMap<Endpoint,java.util.List<ServiceValidator>>();
+ private java.util.Map<Endpoint,java.util.List<ServiceValidator>> m_inputsPendingDelete=
+ new java.util.HashMap<Endpoint,java.util.List<ServiceValidator>>();
+ private java.util.Map<Endpoint,java.util.List<ServiceValidator>> m_outputsPendingDelete=
+ new java.util.HashMap<Endpoint,java.util.List<ServiceValidator>>();
+ private long m_replyToTimeout=10000;
+ }
+}
Added: trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorConfig.java
===================================================================
--- trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorConfig.java (rev 0)
+++ trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorConfig.java 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.validator.jbossesb;
+
+import org.jboss.soa.esb.helpers.*;
+
+/**
+ * This interface represents a configuration that will be used for
+ * validation against a stream of ESB based messages.
+ */
+public interface ValidatorConfig {
+
+ /**
+ * This method returns the type of the model associated
+ * with this validator configuration. This will
+ * general be based on the file extension of the model
+ * file.
+ *
+ * @return The model type
+ */
+ public String getModelType();
+
+ /**
+ * This method returns the validator configuration
+ * associated with the model.
+ *
+ * @return The validator model
+ */
+ public ConfigTree getConfiguration();
+
+}
Added: trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorConfigFactory.java
===================================================================
--- trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorConfigFactory.java (rev 0)
+++ trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorConfigFactory.java 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.validator.jbossesb;
+
+import org.apache.log4j.Logger;
+
+/**
+ * This class provides a factory for ValidatorConfig objects
+ * based on supplied model file details.
+ */
+public class ValidatorConfigFactory {
+
+ /**
+ * This method retrieves a validator config associated with
+ * the supplied file. If the model associated with the
+ * file is not supported, then a null will be returned.
+ *
+ * @param file The file containing the model
+ * @return The validator config, or null if an unsupported type
+ * @exception IOException Failed to load supported model type
+ */
+ public static ValidatorConfig getValidatorConfig(java.io.File file)
+ throws java.io.IOException {
+ ValidatorConfig ret=null;
+
+ String modelType=null;
+
+ if (file != null && (modelType=getModelType(file.getName())) != null) {
+ ValidatorConfigLoader loader=null;
+
+ for (int i=0; loader == null &&
+ i < m_loaders.size(); i++) {
+
+ if (m_loaders.get(i).isSupported(modelType)) {
+ loader = m_loaders.get(i);
+ }
+ }
+
+ if (loader != null) {
+ java.io.FileInputStream fis=new java.io.FileInputStream(file);
+
+ ret = loader.loadValidatorConfig(fis, file.getName());
+
+ fis.close();
+ }
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Returning validator config for "+
+ file.getName()+": "+ret);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method determines the model type associated with the
+ * supplied model filename.
+ *
+ * @param name The model filename
+ * @return The model type, or null if not known
+ */
+ protected static String getModelType(String name) {
+ String ret=null;
+ int pos=name.lastIndexOf('.');
+
+ if (pos != -1) {
+ ret = name.substring(pos+1);
+ }
+
+ return(ret);
+ }
+
+ private static final Logger logger = Logger.getLogger(ValidatorConfigFactory.class);
+
+ private static java.util.List<ValidatorConfigLoader> m_loaders=
+ new java.util.Vector<ValidatorConfigLoader>();
+
+ static {
+ m_loaders.add(new org.jboss.savara.validator.jbossesb.pi4soa.Pi4SOAValidatorConfigLoader());
+ }
+}
Added: trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorConfigLoader.java
===================================================================
--- trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorConfigLoader.java (rev 0)
+++ trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorConfigLoader.java 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.validator.jbossesb;
+
+/**
+ * This interface is implemented by model specific loaders, to
+ * load a ValidatorConfig for the particular model type.
+ */
+public interface ValidatorConfigLoader {
+
+ /**
+ * This method determines if the validator config loader
+ * implementation supports the supplied model type.
+ *
+ * @param modelType The model type
+ * @return Whether the loader supports the model type
+ */
+ public boolean isSupported(String modelType);
+
+ /**
+ * This method loads the validator config, contained within
+ * the supplied input stream representing a model of the
+ * supported type.
+ *
+ * @param is The input stream
+ * @param modelPath The path to the model file
+ * @return The validator config
+ * @throws java.io.IOException Failed to load validator config
+ */
+ public ValidatorConfig loadValidatorConfig(java.io.InputStream is,
+ String modelPath) throws java.io.IOException;
+
+}
Added: trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorFilter.java
===================================================================
--- trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorFilter.java (rev 0)
+++ trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorFilter.java 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,250 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.validator.jbossesb;
+
+import org.apache.log4j.Logger;
+
+import org.jboss.soa.esb.message.*;
+import org.jboss.soa.esb.couriers.*;
+
+/**
+ * This class represents the filter used to intercept ESB
+ * messages an apply them to relevant Service Validators.
+ */
+public class ValidatorFilter extends org.jboss.soa.esb.filter.InputOutputFilter {
+
+ private static final String TOPIC_PREFIX = "topic/";
+ private static final String QUEUE_PREFIX = "queue/";
+ private static final String JMS_PROTOCOL_PREFIX = "jms:";
+
+ /**
+ * The default constructor.
+ */
+ public ValidatorFilter() {
+ }
+
+ /**
+ * This method is invoked when a message is sent by an
+ * ESB service.
+ *
+ * @param msg The ESB message
+ * @param params The parameters
+ * @throws CourierException Failed to validate message
+ */
+ public Message onOutput(Message msg, java.util.Map params)
+ throws CourierException {
+
+ Endpoint endpoint=getEndpoint(msg);
+
+ if (endpoint != null) {
+ java.util.List<ServiceValidator> validators=
+ ServiceValidatorManager.instance().getOutputServiceValidators(endpoint);
+
+ if (validators != null && validators.size() > 0) {
+ boolean validated=false;
+ Exception ex=null;
+
+ for (int i=0; validators != null &&
+ i < validators.size(); i++) {
+ try {
+ validators.get(i).messageSent(msg);
+ validated = true;
+ } catch(Exception t) {
+ // Ignore
+ ex = t;
+ }
+ }
+
+ // Only raise exception if none of the service
+ // validators were able to validate the message
+ if (validated == false) {
+ String vnames="";
+
+ for (int i=0; validators != null &&
+ i < validators.size(); i++) {
+ if (vnames.length() > 0) {
+ vnames += ", ";
+ }
+ vnames += validators.get(i).getValidatorName();
+ }
+
+ logger.error("Failed to handle sent message on endpoint '"+
+ endpoint+"' validated against: "+vnames);
+
+ if (ServiceValidatorManager.instance().isManagedMode()) {
+ throw new CourierException("Failed to handle sent message on endpoint '"+
+ endpoint+"' validated against: "+vnames, ex);
+ }
+ } else {
+
+ // Check whether a dynamic reply is expected
+ if (ServiceValidatorManager.instance().isOutputDynamicReplyTo(endpoint)) {
+
+ // Register interest in the 'reply-to' endpoint
+ Endpoint replyTo=getReplyToEndpoint(msg);
+
+ if (replyTo != null) {
+ ServiceValidatorManager.instance().registerInputReplyToValidators(replyTo,
+ validators);
+ } else {
+ logger.error("Unable to get 'reply-to' endpoint for message: "+msg);
+ }
+ }
+ }
+ }
+ }
+
+ return(msg);
+ }
+
+ /**
+ * This method is invoked when a message is received by an
+ * ESB service.
+ *
+ * @param msg The ESB message
+ * @param params The parameters
+ * @throws CourierException Failed to validate message
+ */
+ public Message onInput(Message msg, java.util.Map params)
+ throws CourierException {
+
+ Endpoint endpoint=getEndpoint(msg);
+
+ if (endpoint != null) {
+ java.util.List<ServiceValidator> validators=
+ ServiceValidatorManager.instance().getInputServiceValidators(endpoint);
+
+ if (validators != null && validators.size() > 0) {
+ boolean validated=false;
+ Exception ex=null;
+
+ for (int i=0; validators != null &&
+ i < validators.size(); i++) {
+ try {
+ validators.get(i).messageReceived(msg);
+ validated = true;
+ } catch(Exception t) {
+ // Ignore
+ ex = t;
+ }
+ }
+
+ // Only raise exception if none of the service
+ // validators were able to validate the message
+ if (validated == false) {
+ String vnames="";
+
+ for (int i=0; validators != null &&
+ i < validators.size(); i++) {
+ if (vnames.length() > 0) {
+ vnames += ", ";
+ }
+ vnames += validators.get(i).getValidatorName();
+ }
+
+ logger.error("Failed to handle received message on endpoint '"+
+ endpoint+"' validated against: "+vnames);
+
+ if (ServiceValidatorManager.instance().isManagedMode()) {
+ throw new CourierException("Failed to handle received message on endpoint '"+
+ endpoint+"' validated against: "+vnames, ex);
+ }
+ } else {
+
+ // Check whether a dynamic reply is expected
+ if (ServiceValidatorManager.instance().isInputDynamicReplyTo(endpoint)) {
+
+ // Register interest in the 'reply-to' endpoint
+ Endpoint replyTo=getReplyToEndpoint(msg);
+
+ if (replyTo != null) {
+ ServiceValidatorManager.instance().registerOutputReplyToValidators(replyTo,
+ validators);
+ } else {
+ logger.error("Unable to get 'reply-to' endpoint for message: "+msg);
+ }
+ }
+ }
+ }
+ }
+
+ return(msg);
+ }
+
+ /**
+ * This method returns an endpoint associated with the 'to'
+ * destination of the supplied message.
+ *
+ * @param msg The message
+ * @return The endpoint, or null if not relevant
+ */
+ protected Endpoint getEndpoint(Message msg) {
+ Endpoint ret=null;
+
+ if (msg != null && msg.getHeader() != null &&
+ msg.getHeader().getCall() != null &&
+ msg.getHeader().getCall().getTo() != null &&
+ msg.getHeader().getCall().getTo().getAddr() != null) {
+
+ String key=msg.getHeader().getCall().getTo().getAddr().getAddress();
+ int ind=-1;
+
+ if (key.startsWith(JMS_PROTOCOL_PREFIX) &&
+ ((ind=key.indexOf(QUEUE_PREFIX)) != -1 ||
+ (ind=key.indexOf(TOPIC_PREFIX)) != -1)) {
+ ret = new Endpoint(JMS_PROTOCOL_PREFIX+key.substring(ind));
+ }
+ }
+
+ logger.debug("Destination for message '"+msg+"' is: "+ret);
+
+ return(ret);
+ }
+
+ /**
+ * This method returns an endpoint associated with the 'to'
+ * destination of the supplied message.
+ *
+ * @param msg The message
+ * @return The endpoint, or null if not relevant
+ */
+ protected Endpoint getReplyToEndpoint(Message msg) {
+ Endpoint ret=null;
+
+ if (msg != null && msg.getHeader() != null &&
+ msg.getHeader().getCall() != null &&
+ msg.getHeader().getCall().getReplyTo() != null &&
+ msg.getHeader().getCall().getReplyTo().getAddr() != null) {
+
+ String key=msg.getHeader().getCall().getReplyTo().getAddr().getAddress();
+ int ind=-1;
+
+ if (key.startsWith(JMS_PROTOCOL_PREFIX) &&
+ ((ind=key.indexOf(QUEUE_PREFIX)) != -1 ||
+ (ind=key.indexOf(TOPIC_PREFIX)) != -1)) {
+ ret = new Endpoint(JMS_PROTOCOL_PREFIX+key.substring(ind));
+ }
+ }
+
+ logger.debug("Reply-To Destination for message '"+msg+"' is: "+ret);
+
+ return(ret);
+ }
+
+ private static final Logger logger = Logger.getLogger(ValidatorFilter.class);
+}
Added: trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorName.java
===================================================================
--- trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorName.java (rev 0)
+++ trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/ValidatorName.java 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.validator.jbossesb;
+
+/**
+ * This class represents a key for looking up a service validator.
+ */
+public class ValidatorName {
+
+ /**
+ * This constructor is initialized with the details used to
+ * identify the validator.
+ *
+ * @param role The role
+ */
+ public ValidatorName(String role) {
+ m_role = role;
+ m_validate = false;
+ }
+
+ /**
+ * This constructor is initialized with the details used to
+ * identify the validator.
+ *
+ * @param modelName The model name
+ * @param role The role
+ * @param validate Whether to validate, or simply record
+ */
+ public ValidatorName(String modelName, String role) {
+ m_modelName = modelName;
+ m_role = role;
+ m_validate = true;
+ }
+
+ /**
+ * This method returns the model name associated with the
+ * service validator.
+ *
+ * @return The model name
+ */
+ public String getModelName() {
+ return(m_modelName);
+ }
+
+ /**
+ * This method returns the type associated with the model.
+ * If no model has been defined for the validator name,
+ * as in the case of a validator in record mode, then
+ * this method will return ValidatorName.NO_MODEL_TYPE.
+ *
+ * @return The model type
+ */
+ public String getModelType() {
+ String ret=null;
+ int pos=0;
+
+ if (m_modelName != null &&
+ (pos=m_modelName.lastIndexOf('.')) != -1) {
+ ret = m_modelName.substring(pos+1);
+ } else {
+ ret = NO_MODEL_TYPE;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the role associated with the Service
+ * Validator.
+ *
+ * @return The role
+ */
+ public String getRole() {
+ return(m_role);
+ }
+
+ /**
+ * This method determines whether the associated service
+ * validator is in validation or record mode.
+ *
+ * @return Whether in validation or record mode
+ */
+ public boolean isValidate() {
+ return(m_validate);
+ }
+
+ public boolean equals(Object obj) {
+ boolean ret=false;
+
+ if (obj instanceof ValidatorName) {
+ ret = (obj.toString().equals(toString()) &&
+ ((ValidatorName)obj).m_validate == m_validate);
+ }
+
+ return(ret);
+ }
+
+ public int hashCode() {
+ return(toString().hashCode());
+ }
+
+ public String toString() {
+ String ret=null;
+
+ if (isValidate()) {
+ ret = m_modelName+":"+m_role;
+ } else {
+ ret = m_role;
+ }
+
+ return(ret);
+ }
+
+ public static final String NO_MODEL_TYPE="NoModelType";
+
+ private String m_modelName=null;
+ private String m_role=null;
+ private boolean m_validate=false;
+}
\ No newline at end of file
Added: trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/pi4soa/Pi4SOAServiceRecorder.java
===================================================================
--- trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/pi4soa/Pi4SOAServiceRecorder.java (rev 0)
+++ trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/pi4soa/Pi4SOAServiceRecorder.java 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,155 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.validator.jbossesb.pi4soa;
+
+import org.apache.log4j.Logger;
+
+import org.jboss.savara.validator.jbossesb.*;
+import org.jboss.soa.esb.message.Message;
+import org.pi4soa.common.util.MessageUtil;
+import org.pi4soa.service.ServiceException;
+import org.pi4soa.service.behavior.*;
+import org.pi4soa.service.monitor.*;
+
+/**
+ * This class implements the pi4soa service validator responsible for
+ * recording a stream of ESB messages.
+ */
+public class Pi4SOAServiceRecorder extends AbstractServiceValidator {
+
+ /**
+ * This is the constructor for the pi4soa service
+ * recorder implementation.
+ *
+ * @param name The validator name
+ */
+ public Pi4SOAServiceRecorder(ValidatorName name) {
+ super(name);
+
+ initialize();
+ }
+
+ /**
+ * This method initializes the service recorder.
+ */
+ protected void initialize() {
+ try {
+ // Use XML configuration, to enable alternative
+ // runtime configuration to be specified by
+ // including a pi4soa.xml file in the environment
+ DefaultMonitorConfiguration conf=
+ new XMLMonitorConfiguration();
+
+ conf.setValidateBehaviour(getValidatorName().isValidate());
+
+ m_monitor = ServiceMonitorFactory.getServiceMonitor(conf);
+
+ ServiceDescription sdesc=BehaviorFactory.eINSTANCE.createServiceDescription();
+ sdesc.setName(getValidatorName().getRole());
+
+ // Register service description
+ m_monitor.getConfiguration().getServiceRepository().
+ addServiceDescription(sdesc);
+
+ logger.debug("Created monitor for service description "+sdesc.getFullyQualifiedName());
+
+ } catch(Exception e) {
+ logger.error("Failed to initialize service monitor: "+e);
+ }
+ }
+
+ /**
+ * This method returns the model type associated with this
+ * service recorder.
+ *
+ * @return The model type
+ */
+ public static String getModelType() {
+ return(ValidatorName.NO_MODEL_TYPE);
+ }
+
+ /**
+ * This method is called to update the model associated
+ * with the service validator.
+ */
+ public void update() {
+ }
+
+ /**
+ * This method processes a sent message against a service
+ * behavioural description.
+ *
+ * @param msg The message
+ * @throws Exception Failed to process sent message
+ */
+ public void messageSent(Message msg) throws Exception {
+ java.io.Serializable value=ESBUtil.getMessage(msg);
+
+ if (value == null) {
+ throw new ServiceException("Failed to obtain value from message: "+msg);
+ }
+
+ String mesgType=MessageUtil.getMessageType(value);
+
+ org.pi4soa.service.Message mesg=
+ m_monitor.createMessage(mesgType,
+ null, null, value, null, null);
+
+ synchronized(m_monitor) {
+ m_monitor.messageSent(mesg);
+ }
+ }
+
+ /**
+ * This method processes a received message against a service
+ * behavioural description.
+ *
+ * @param msg The message
+ * @throws Exception Failed to process received message
+ */
+ public void messageReceived(Message msg) throws Exception {
+ java.io.Serializable value=ESBUtil.getMessage(msg);
+
+ if (value == null) {
+ throw new ServiceException("Failed to obtain value from message: "+msg);
+ }
+
+ String mesgType=MessageUtil.getMessageType(value);
+
+ org.pi4soa.service.Message mesg=
+ m_monitor.createMessage(mesgType,
+ null, null, value, null, null);
+
+ synchronized(m_monitor) {
+ m_monitor.messageReceived(mesg);
+ }
+ }
+
+ /**
+ * This method closes the service validator.
+ *
+ * @throws Exception Failed to close the service validator
+ */
+ public void close() throws Exception {
+ m_monitor.close();
+ }
+
+ private static final Logger logger = Logger.getLogger(Pi4SOAServiceRecorder.class);
+
+ private org.pi4soa.service.monitor.ServiceMonitor m_monitor=null;
+}
Added: trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/pi4soa/Pi4SOAServiceValidator.java
===================================================================
--- trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/pi4soa/Pi4SOAServiceValidator.java (rev 0)
+++ trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/pi4soa/Pi4SOAServiceValidator.java 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,216 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.validator.jbossesb.pi4soa;
+
+import org.apache.log4j.Logger;
+
+import org.jboss.savara.validator.jbossesb.*;
+import org.jboss.soa.esb.message.Message;
+import org.pi4soa.common.util.MessageUtil;
+import org.pi4soa.service.ServiceException;
+import org.pi4soa.service.behavior.*;
+import org.pi4soa.service.monitor.*;
+
+/**
+ * This class implements the pi4soa service validator responsible for
+ * validating a stream of ESB messages against a choreography model.
+ */
+public class Pi4SOAServiceValidator extends AbstractServiceValidator {
+
+ private static final String CDM_MODEL_TYPE = "cdm";
+
+ /**
+ * This is the constructor for the pi4soa service
+ * validator implementation.
+ *
+ * @param name The validator name
+ * @throws Exception Failed to initialize service validator
+ */
+ public Pi4SOAServiceValidator(ValidatorName name)
+ throws Exception {
+ super(name);
+
+ update();
+ }
+
+ /**
+ * This method returns the model type associated with this
+ * service validator.
+ *
+ * @return The model type
+ */
+ public static String getModelType() {
+ return CDM_MODEL_TYPE;
+ }
+
+ /**
+ * This method is called to update the model associated
+ * with the service validator.
+ *
+ * @throws Exception Failed to update the service validator
+ */
+ public void update() throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Update: "+getValidatorName());
+ }
+
+ java.io.InputStream is=getModel();
+
+ if (is != null) {
+ org.pi4soa.service.behavior.ServiceDescription sdesc=
+ org.pi4soa.service.util.DescriptionRetrievalUtil.instance().getServiceDescription(is,
+ getValidatorName().getRole());
+
+ try {
+ is.close();
+ } catch(Exception e) {
+ logger.error("Failed to close model '"+
+ getValidatorName()+"' input stream", e);
+ }
+
+ if (sdesc != null) {
+
+ if (m_monitor == null) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Service monitor for '"+
+ sdesc.getFullyQualifiedName()+
+ "' being created");
+ }
+
+ try {
+ // Use XML configuration, to enable alternative
+ // runtime configuration to be specified by
+ // including a pi4soa.xml file in the environment
+ DefaultMonitorConfiguration conf=
+ new XMLMonitorConfiguration();
+
+ conf.setValidateBehaviour(getValidatorName().isValidate());
+
+ m_monitor = ServiceMonitorFactory.getServiceMonitor(conf);
+
+ // Register service description
+ m_monitor.getConfiguration().getServiceRepository().
+ addServiceDescription(sdesc);
+
+ logger.debug("Created monitor for service description "+sdesc.getFullyQualifiedName());
+
+ } catch(Exception e) {
+ logger.error("Failed to initialize service monitor: "+e);
+ }
+ } else {
+
+ synchronized(m_monitor) {
+ // Service monitor already in use for the service
+ // description, so update description
+ try {
+ // Clear previous version of the service description
+ ServiceDescription[] sdescs=
+ m_monitor.getConfiguration().getServiceRepository().getServiceDescriptions();
+
+ for (int i=0; sdescs != null && i < sdescs.length; i++) {
+ m_monitor.getConfiguration().getServiceRepository().
+ removeServiceDescription(sdescs[i]);
+ }
+
+ logger.debug("Updating service description for "+sdesc.getFullyQualifiedName());
+
+ m_monitor.getConfiguration().getServiceRepository().addServiceDescription(sdesc);
+ } catch(Exception e) {
+ logger.error("Failed to update service description '"+
+ sdesc.getFullyQualifiedName()+"'", e);
+ }
+ }
+ }
+ } else {
+ logger.error("Unable to obtain service description for validator '"+
+ getValidatorName()+"'");
+ }
+ } else {
+ logger.error("Unable to obtain model for validator '"+
+ getValidatorName()+"'");
+
+ throw new java.io.IOException("Failed to locate model '"+
+ getValidatorName().getModelName()+"'");
+ }
+ }
+
+ /**
+ * This method processes a sent message against a service
+ * behavioural description.
+ *
+ * @param msg The message
+ * @throws Exception Failed to process sent message
+ */
+ public void messageSent(Message msg) throws Exception {
+ java.io.Serializable value=ESBUtil.getMessage(msg);
+
+ if (value == null) {
+ throw new ServiceException("Failed to obtain value from message: "+msg);
+ }
+
+ String mesgType=MessageUtil.getMessageType(value);
+
+ org.pi4soa.service.Message mesg=
+ m_monitor.createMessage(mesgType,
+ null, null, value, null, null);
+
+ synchronized(m_monitor) {
+ m_monitor.messageSent(mesg);
+ }
+ }
+
+ /**
+ * This method processes a received message against a service
+ * behavioural description.
+ *
+ * @param msg The message
+ * @throws Exception Failed to process received message
+ */
+ public void messageReceived(Message msg) throws Exception {
+ java.io.Serializable value=ESBUtil.getMessage(msg);
+
+ if (value == null) {
+ throw new ServiceException("Failed to obtain value from message: "+msg);
+ }
+
+ String mesgType=MessageUtil.getMessageType(value);
+
+ org.pi4soa.service.Message mesg=
+ m_monitor.createMessage(mesgType,
+ null, null, value, null, null);
+
+ synchronized(m_monitor) {
+ m_monitor.messageReceived(mesg);
+ }
+ }
+
+ /**
+ * This method closes the service validator.
+ *
+ * @throws Exception Failed to close the service validator
+ */
+ public void close() throws Exception {
+ m_monitor.close();
+ }
+
+ private static final Logger logger = Logger.getLogger(Pi4SOAServiceValidator.class);
+
+ private org.pi4soa.service.monitor.ServiceMonitor m_monitor=null;
+}
Added: trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/pi4soa/Pi4SOAValidatorConfigLoader.java
===================================================================
--- trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/pi4soa/Pi4SOAValidatorConfigLoader.java (rev 0)
+++ trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/pi4soa/Pi4SOAValidatorConfigLoader.java 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.validator.jbossesb.pi4soa;
+
+import org.jboss.savara.validator.jbossesb.*;
+import org.jboss.soa.esb.helpers.ConfigTree;
+
+/**
+ * This class provides the pi4soa implementation of the
+ * validator config loader.
+ */
+public class Pi4SOAValidatorConfigLoader implements ValidatorConfigLoader {
+
+ public static final String PI4SOA_MODEL_TYPE="cdm";
+
+ /**
+ * This method determines if the validator config loader
+ * implementation supports the supplied model type.
+ *
+ * @param modelType The model type
+ * @return Whether the loader supports the model type
+ */
+ public boolean isSupported(String modelType) {
+ return(PI4SOA_MODEL_TYPE.equals(modelType));
+ }
+
+ /**
+ * This method loads the validator config, contained within
+ * the supplied input stream representing a model of the
+ * supported type.
+ *
+ * @param is The input stream
+ * @param modelPath The path to the model file
+ * @return The validator config
+ * @throws java.io.IOException Failed to load validator config
+ */
+ public ValidatorConfig loadValidatorConfig(java.io.InputStream is,
+ String modelPath) throws java.io.IOException {
+ ValidatorConfig ret=null;
+
+ org.pi4soa.cdl.Package cdlpack=
+ org.pi4soa.service.util.DescriptionRetrievalUtil.instance().getCDLPackage(is);
+
+ ValidatorConfigGenerator generator=new ValidatorConfigGenerator();
+
+ org.w3c.dom.Element validator=
+ generator.generate(cdlpack, modelPath);
+
+ ret = new DefaultValidatorConfig(PI4SOA_MODEL_TYPE,
+ ConfigTree.fromElement(validator));
+
+ return(ret);
+ }
+}
Added: trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/pi4soa/ValidatorConfigGenerator.java
===================================================================
--- trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/pi4soa/ValidatorConfigGenerator.java (rev 0)
+++ trunk/validators/jbossesb/src/main/java/org/jboss/savara/validator/jbossesb/pi4soa/ValidatorConfigGenerator.java 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,285 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.savara.validator.jbossesb.pi4soa;
+
+import java.util.Collections;
+import org.apache.log4j.Logger;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.pi4soa.cdl.*;
+import org.pi4soa.common.annotations.*;
+
+/**
+ * This class provides a generator for the JBossESB Validator
+ * configuration.
+ */
+public class ValidatorConfigGenerator {
+
+ private static final String ROLE_ATTR = "role";
+ private static final String MODEL_ATTR = "model";
+ private static final String SERVICE_ELEMENT = "service";
+ private static final String VALIDATOR_ELEMENT = "validator";
+
+ /**
+ * The default constructor.
+ */
+ public ValidatorConfigGenerator() {
+ }
+
+ /**
+ * This method generates the validator configuration associated
+ * with the supplied choreography.
+ *
+ * @param cdlpack The CDL package
+ * @param model The model (choreography file name)
+ * @return The validator config
+ */
+ public org.w3c.dom.Element generate(org.pi4soa.cdl.Package cdlpack,
+ String model) {
+ org.w3c.dom.Element ret=null;
+
+ try {
+ ret = createValidatorConfig();
+
+ // Create the new entries for the supplied choreography
+ if (cdlpack != null) {
+ createEntries(ret, model, cdlpack);
+ } else {
+ logger.error("Choreography not supplied for '"+model+"'");
+ }
+
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method creates the initial template for the
+ * validator config.
+ *
+ * @return The initial validator config
+ * @throws Exception Failed to generate validator config
+ */
+ protected org.w3c.dom.Element createValidatorConfig()
+ throws Exception {
+ org.w3c.dom.Element ret=null;
+
+ org.w3c.dom.Document doc=
+ javax.xml.parsers.DocumentBuilderFactory.
+ newInstance().newDocumentBuilder().newDocument();
+
+ ret = doc.createElement(VALIDATOR_ELEMENT);
+
+ doc.appendChild(ret);
+
+ return(ret);
+ }
+
+ /**
+ * This method creates the entries in the validator config.
+ *
+ * @param validator The validator config
+ * @param model The model
+ * @param cdlpack The choreography description
+ */
+ protected void createEntries(org.w3c.dom.Element validator,
+ String model, org.pi4soa.cdl.Package cdlpack) {
+
+ for (int i=0; i < cdlpack.getTypeDefinitions().getParticipantTypes().size(); i++) {
+ org.pi4soa.cdl.ParticipantType ptype=
+ cdlpack.getTypeDefinitions().getParticipantTypes().get(i);
+
+ org.w3c.dom.Element service=
+ validator.getOwnerDocument().createElement(SERVICE_ELEMENT);
+
+ service.setAttribute(MODEL_ATTR, model);
+ service.setAttribute(ROLE_ATTR, ptype.getName());
+
+ cdlpack.visit(new InputOutputAnalyser(ptype, service));
+
+ if (service.getFirstChild() != null) {
+ validator.appendChild(service);
+ }
+ }
+ }
+
+ private static Logger logger = Logger.getLogger(ValidatorConfigGenerator.class);
+
+ public class InputOutputAnalyser extends DefaultCDLVisitor {
+
+ private static final String DYNAMIC_REPLY_TO_ATTR = "dynamicReplyTo";
+ private static final String JBOSSESB_ANNOTATION = "jbossesb";
+ private static final String JBOSSESB_ELEMENT = "jbossesb";
+ private static final String DESTINATION_ELEMENT = "destination";
+ private static final String NAME_ATTR = "name";
+ private static final String EPR_ATTR = "epr";
+ private static final String INPUT_ELEMENT = "input";
+ private static final String OUTPUT_ELEMENT = "output";
+
+ public InputOutputAnalyser(org.pi4soa.cdl.ParticipantType ptype,
+ org.w3c.dom.Element service) {
+ m_participantType = ptype;
+ m_service = service;
+
+ m_templateProcessor =
+ org.pi4soa.common.annotations.AnnotationsManagerFactory.getAnnotationsManager().getTemplateProcessor(JBOSSESB_ANNOTATION);
+ }
+
+ /**
+ * This method inspects the supplied interaction.
+ *
+ */
+ public void interaction(Interaction interaction) {
+ if (m_participantType.getRoleTypes().contains(interaction.getFromRoleType()) ||
+ (interaction.getFromParticipant() != null &&
+ Collections.disjoint(m_participantType.getRoleTypes(),
+ interaction.getFromParticipant().getRoleTypes()) == false)) {
+
+ for (int i=0; i < interaction.getExchangeDetails().size(); i++) {
+ processExchangeDetails(interaction.getExchangeDetails().get(i), true);
+ }
+ } else if (m_participantType.getRoleTypes().contains(interaction.getToRoleType()) ||
+ (interaction.getToParticipant() != null &&
+ Collections.disjoint(m_participantType.getRoleTypes(),
+ interaction.getToParticipant().getRoleTypes()) == false)) {
+ for (int i=0; i < interaction.getExchangeDetails().size(); i++) {
+ processExchangeDetails(interaction.getExchangeDetails().get(i), false);
+ }
+ }
+ }
+
+ /**
+ * This method checks the supplied exchange details to determine
+ * if there is a 'jbossesb' annotation containing information
+ * about a destination to be validated.
+ *
+ * @param details The exchange details
+ * @param from Whether the 'from' details should be checked,
+ * otherwise the 'to' details will be checked
+ */
+ protected void processExchangeDetails(ExchangeDetails details, boolean from) {
+
+ for (int i=0; i < details.getSemanticAnnotations().size(); i++) {
+ SemanticAnnotation sa=details.getSemanticAnnotations().get(i);
+ org.w3c.dom.Element dest=null;
+
+ if (sa.getAnnotation() != null && sa.getName() != null &&
+ sa.getName().equals(JBOSSESB_ANNOTATION)) {
+ try {
+ // Transform the text representation to DOM
+ DocumentBuilderFactory fact=DocumentBuilderFactory.newInstance();
+ fact.setNamespaceAware(true);
+
+ DocumentBuilder builder=fact.newDocumentBuilder();
+ org.w3c.dom.Document doc=
+ builder.parse(new java.io.ByteArrayInputStream(
+ sa.getAnnotation().getBytes()));
+
+ if (doc.getDocumentElement() != null &&
+ doc.getDocumentElement().getNodeName().equals(
+ JBOSSESB_ELEMENT)) {
+ org.w3c.dom.NodeList nl=
+ doc.getDocumentElement().getElementsByTagName(DESTINATION_ELEMENT);
+
+ if (nl.getLength() == 1) {
+ dest = (org.w3c.dom.Element)nl.item(0);
+ } else if (nl.getLength() > 1) {
+ logger.error("Too many destination elements ("+
+ nl.getLength()+") found");
+ } else {
+ logger.error("No destinations found");
+ }
+ }
+
+ } catch(Exception e) {
+ logger.error("Failed to load jbossesb annotation", e);
+ }
+ }
+
+ if (dest != null) {
+ processDestination(details, dest, from);
+ }
+ }
+ }
+
+ /**
+ * This method processes the destination information
+ * associated with the exchange details.
+ *
+ * @param details The exchange details
+ * @param dest The destination DOM element
+ * @param from Whether the 'from' or 'to' role should
+ * be considered
+ */
+ protected void processDestination(ExchangeDetails details,
+ org.w3c.dom.Element dest, boolean from) {
+ String elemName=null;
+
+ if (dest != null) {
+ if (from) {
+ if (details.getAction() == ExchangeActionType.REQUEST) {
+ elemName = OUTPUT_ELEMENT;
+ } else {
+ elemName = INPUT_ELEMENT;
+ }
+ } else {
+ if (details.getAction() == ExchangeActionType.REQUEST) {
+ elemName = INPUT_ELEMENT;
+ } else {
+ elemName = OUTPUT_ELEMENT;
+ }
+ }
+
+ org.w3c.dom.Element elem=m_service.getOwnerDocument().createElement(elemName);
+
+ // Parameter has been stored in a structured manner
+ // to support use of templates and presentations,
+ // so need to extract the value
+ java.util.List<TemplateParameter> params=
+ m_templateProcessor.getTemplateParameters(dest.getAttribute(NAME_ATTR));
+
+ if (params != null && params.size() > 0) {
+ elem.setAttribute(EPR_ATTR, params.get(0).getValue());
+ }
+
+ if (dest.hasAttribute(DYNAMIC_REPLY_TO_ATTR)) {
+ params=m_templateProcessor.getTemplateParameters(dest.getAttribute(DYNAMIC_REPLY_TO_ATTR));
+
+ if (params != null && params.size() > 0) {
+
+ if (params.get(0).getValue().equalsIgnoreCase("true")) {
+ elem.setAttribute(DYNAMIC_REPLY_TO_ATTR, "true");
+ }
+ }
+ }
+
+ if (elem.hasAttribute(EPR_ATTR)) {
+ m_service.appendChild(elem);
+ }
+ }
+ }
+
+ private ParticipantType m_participantType=null;
+ private org.w3c.dom.Element m_service=null;
+ private org.pi4soa.common.annotations.TemplateProcessor m_templateProcessor=null;
+ }
+}
Added: trunk/validators/pom.xml
===================================================================
--- trunk/validators/pom.xml (rev 0)
+++ trunk/validators/pom.xml 2010-05-19 17:47:49 UTC (rev 224)
@@ -0,0 +1,23 @@
+<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>
+
+ <groupId>org.jboss.savara</groupId>
+ <artifactId>validators</artifactId>
+ <packaging>pom</packaging>
+ <name>Savara::Validators</name>
+ <version>1.0-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>savara</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <modules>
+ <module>jbossesb</module>
+ </modules>
+
+</project>
13 years, 11 months
savara SVN: r223 - in trunk: distribution and 15 other directories.
by do-not-reply@jboss.org
Author: objectiser
Date: 2010-05-18 17:31:32 -0400 (Tue, 18 May 2010)
New Revision: 223
Added:
trunk/docs/samplesguide/
trunk/docs/samplesguide/pom.xml
trunk/docs/samplesguide/src/
trunk/docs/samplesguide/src/main/
trunk/docs/samplesguide/src/main/images/
trunk/docs/samplesguide/src/main/images/ChoreoMonReady.jpg
trunk/docs/samplesguide/src/main/images/MonitorMenu.jpg
trunk/docs/samplesguide/src/main/images/TrailblazerWebPage.jpg
trunk/docs/samplesguide/src/main/master.xml
trunk/docs/samplesguide/src/main/module/
trunk/docs/samplesguide/src/main/module/author_group.xml
trunk/docs/samplesguide/src/main/module/overview.xml
trunk/docs/samplesguide/src/main/module/servicevalidator.xml
trunk/docs/samplesguide/src/main/xslt/
trunk/docs/samplesguide/src/main/xslt/pdf.xsl
trunk/docs/trailblazer/
trunk/docs/trailblazer/TBGuide.odt
trunk/docs/trailblazer/TBGuide.pdf
trunk/docs/user/
trunk/docs/user/TBGuide.odt
trunk/docs/user/TBGuide.pdf
trunk/tools/
trunk/tools/eclipse/
trunk/tools/pom.xml
Removed:
trunk/plugins/
Modified:
trunk/distribution/pom.xml
trunk/distribution/src/main/assembly/bin.xml
trunk/docs/gettingstartedguide/pom.xml
trunk/docs/pom.xml
trunk/docs/userguide/pom.xml
trunk/pom.xml
trunk/tools/eclipse/eclipse-build/pom.xml
trunk/tools/eclipse/pom.xml
Log:
Refactored trunk to prepare for combining tools and validator distributions. Currently just moved the plugins and added the docs from validator.
Modified: trunk/distribution/pom.xml
===================================================================
--- trunk/distribution/pom.xml 2010-05-18 17:30:48 UTC (rev 222)
+++ trunk/distribution/pom.xml 2010-05-18 21:31:32 UTC (rev 223)
@@ -19,16 +19,16 @@
-->
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.savara.tools.eclipse</groupId>
+ <groupId>org.jboss.savara</groupId>
<artifactId>distribution</artifactId>
<packaging>pom</packaging>
- <name>Savara::Tools::Eclipse::Distribution</name>
+ <name>Savara::Distribution</name>
<version>1.0-SNAPSHOT</version>
<url>http://www.jboss.org/savara</url>
<parent>
- <groupId>org.jboss.savara.tools</groupId>
- <artifactId>eclipse</artifactId>
+ <groupId>org.jboss</groupId>
+ <artifactId>savara</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -61,7 +61,7 @@
<goal>single</goal>
</goals>
<configuration>
- <finalName>savara-tools-eclipse-${project.version}</finalName>
+ <finalName>savara-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/bin.xml</descriptor>
@@ -75,7 +75,7 @@
<goal>single</goal>
</goals>
<configuration>
- <finalName>savara-tools-eclipse-${project.version}-src</finalName>
+ <finalName>savara-${project.version}-src</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/src.xml</descriptor>
Modified: trunk/distribution/src/main/assembly/bin.xml
===================================================================
--- trunk/distribution/src/main/assembly/bin.xml 2010-05-18 17:30:48 UTC (rev 222)
+++ trunk/distribution/src/main/assembly/bin.xml 2010-05-18 21:31:32 UTC (rev 223)
@@ -40,7 +40,7 @@
<!-- copy Eclipse features and plugins -->
<fileSet>
- <directory>../plugins/eclipse-build/target/dist</directory>
+ <directory>../tools/eclipse/eclipse-build/target/dist</directory>
<outputDirectory>eclipse</outputDirectory>
<!-- includes>
<include>*.zip</include>
@@ -64,6 +64,11 @@
<outputDirectory>docs/gettingstartedguide</outputDirectory>
</fileSet>
+ <fileSet>
+ <directory>../docs/samplesguide/target/docbook/publish/en-US</directory>
+ <outputDirectory>docs/samplesguide</outputDirectory>
+ </fileSet>
+
<!-- End of copying documents -->
</fileSets>
Modified: trunk/docs/gettingstartedguide/pom.xml
===================================================================
--- trunk/docs/gettingstartedguide/pom.xml 2010-05-18 17:30:48 UTC (rev 222)
+++ trunk/docs/gettingstartedguide/pom.xml 2010-05-18 21:31:32 UTC (rev 223)
@@ -4,14 +4,14 @@
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.savara.tools.eclipse.docs</groupId>
+ <groupId>org.jboss.savara.docs</groupId>
<artifactId>gettingstartedguide</artifactId>
<packaging>jdocbook</packaging>
- <name>Savara::Tools::Eclipse::Docs::GettingStartedGuide</name>
+ <name>Savara::Docs::GettingStartedGuide</name>
<version>1.0-SNAPSHOT</version>
<parent>
- <groupId>org.jboss.savara.tools.eclipse</groupId>
+ <groupId>org.jboss.savara</groupId>
<artifactId>docs</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
@@ -60,7 +60,7 @@
<format>
<formatName>pdf</formatName>
<stylesheetResource>file:///${basedir}/src/main/xslt/pdf.xsl</stylesheetResource>
- <finalName>SAVARA-Eclipse-Tools-GettingStartedGuide.pdf</finalName>
+ <finalName>SAVARA-GettingStartedGuide.pdf</finalName>
</format>
<format>
<formatName>html</formatName>
Modified: trunk/docs/pom.xml
===================================================================
--- trunk/docs/pom.xml 2010-05-18 17:30:48 UTC (rev 222)
+++ trunk/docs/pom.xml 2010-05-18 21:31:32 UTC (rev 223)
@@ -4,21 +4,22 @@
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.savara.tools.eclipse</groupId>
+ <groupId>org.jboss.savara</groupId>
<artifactId>docs</artifactId>
<packaging>pom</packaging>
- <name>Savara::Tools::Eclipse::Docs</name>
+ <name>Savara::Docs</name>
<version>1.0-SNAPSHOT</version>
<parent>
- <groupId>org.jboss.savara.tools</groupId>
- <artifactId>eclipse</artifactId>
+ <groupId>org.jboss</groupId>
+ <artifactId>savara</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modules>
<module>userguide</module>
<module>gettingstartedguide</module>
+ <module>samplesguide</module>
</modules>
</project>
Added: trunk/docs/samplesguide/pom.xml
===================================================================
--- trunk/docs/samplesguide/pom.xml (rev 0)
+++ trunk/docs/samplesguide/pom.xml 2010-05-18 21:31:32 UTC (rev 223)
@@ -0,0 +1,86 @@
+<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>
+
+ <groupId>org.jboss.savara.docs</groupId>
+ <artifactId>samplesguide</artifactId>
+ <packaging>jdocbook</packaging>
+ <name>Savara::Docs::SamplesGuide</name>
+ <version>1.0-M1</version>
+
+ <parent>
+ <groupId>org.jboss.savara</groupId>
+ <artifactId>docs</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.1.2</version>
+ <extensions>true</extensions>
+ <executions>
+ <execution>
+ <id>generate-docbook</id>
+ <phase>package</phase>
+ <goals>
+ <goal>resources</goal>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-docbook-xslt</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.1.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>master.xml</sourceDocumentName>
+ <sourceDirectory>${basedir}/src/main</sourceDirectory>
+ <imageResource>
+ <directory>${basedir}/src/main</directory>
+ <includes>
+ <include>images/**/*</include>
+ </includes>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>file:///${basedir}/src/main/xslt/pdf.xsl</stylesheetResource>
+ <finalName>SAVARA-SamplesGuide.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <docbookVersion>1.72.0</docbookVersion>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: trunk/docs/samplesguide/src/main/images/ChoreoMonReady.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/docs/samplesguide/src/main/images/ChoreoMonReady.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docs/samplesguide/src/main/images/MonitorMenu.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/docs/samplesguide/src/main/images/MonitorMenu.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docs/samplesguide/src/main/images/TrailblazerWebPage.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/docs/samplesguide/src/main/images/TrailblazerWebPage.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docs/samplesguide/src/main/master.xml
===================================================================
--- trunk/docs/samplesguide/src/main/master.xml (rev 0)
+++ trunk/docs/samplesguide/src/main/master.xml 2010-05-18 21:31:32 UTC (rev 223)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % RH-ENTITIES SYSTEM "Common_Config/rh-entities.ent">
+]>
+
+<book lang="en">
+ <bookinfo>
+ <title>SAVARA Validator 1.0-M1</title>
+ <subtitle>Samples Guide</subtitle>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="module/author_group.xml"/>
+ </bookinfo>
+
+ <toc/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="module/overview.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="module/servicevalidator.xml"/>
+
+</book>
Added: trunk/docs/samplesguide/src/main/module/author_group.xml
===================================================================
--- trunk/docs/samplesguide/src/main/module/author_group.xml (rev 0)
+++ trunk/docs/samplesguide/src/main/module/author_group.xml 2010-05-18 21:31:32 UTC (rev 223)
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE authorgroup PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+]>
+<authorgroup>
+ <corpauthor>Gary Brown</corpauthor>
+ <corpauthor>Jeff Yu</corpauthor>
+</authorgroup>
Added: trunk/docs/samplesguide/src/main/module/overview.xml
===================================================================
--- trunk/docs/samplesguide/src/main/module/overview.xml (rev 0)
+++ trunk/docs/samplesguide/src/main/module/overview.xml 2010-05-18 21:31:32 UTC (rev 223)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+]>
+<chapter id="overview">
+ <title>Overview</title>
+ <para>The SAVARA Validator component provides the ability to validate executing services
+ against a choreography description, demonstrating a form runtime governance.
+ </para>
+
+ <para>
+ Further information about configuring the runtime validation of services against a choreography
+ can be found in the <emphasis role="bold">SAVARA Validator User Guide</emphasis> and the
+ <emphasis role="bold">SAVARA Eclipse Tools User Guide</emphasis>.
+ </para>
+
+ <note>
+ <para>
+ Before attempting to deploy and run these examples, you must follow the instructions
+ in the <filename>${SAVARA-Validator}/install</filename> folder. To be able to
+ examine and modify the examples, it is advisable to install the SAVARA Eclipse Tools,
+ and import the samples into the Eclipse environment.
+ </para>
+ </note>
+
+</chapter>
Added: trunk/docs/samplesguide/src/main/module/servicevalidator.xml
===================================================================
--- trunk/docs/samplesguide/src/main/module/servicevalidator.xml (rev 0)
+++ trunk/docs/samplesguide/src/main/module/servicevalidator.xml 2010-05-18 21:31:32 UTC (rev 223)
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+]>
+<chapter id="servicevalidator">
+ <title>Service Validator</title>
+
+ <section>
+ <title>Trailblazer Example</title>
+
+ <para>
+This example can be found in the <filename>trailblazer</filename> folder. See the TrailBlazer Guide
+(<filename>${SAVARA-Validator}/docs/samples/trailblazer/TBGuide.pdf</filename>) for more information about the example.
+ </para>
+
+<note>
+ <para>
+The choreography description for the Trailblazer example can be found in the
+<emphasis>trailblazer-models</emphasis> project in the Eclipse environment. If the project has
+not yet been imported, then please refer to the instructions in the
+<emphasis>SAVARA Eclipse Tools Getting Started Guide</emphasis>.
+ </para>
+ <para>
+You can open the choreography for the trailblazer (trailblazer.cdm) and also a scenario representing
+a valid transaction associated with the choreography (LoanRequest.scn). In the choreography description
+editor, view the "Choreography Flows" tab to see the structure of the process.
+ </para>
+ <para>
+To simulate the scenario against the choreography, to ensure that the choreography correctly caters
+for the valid business scenario, the user should press the green 'play' button in the toolbar, associated
+with the Scenario Editor.
+ </para>
+</note>
+
+
+ <orderedlist>
+ <listitem>
+Update the <filename>${JBossAS}/server/default/deployers/esb.deployer/jbossesb-properties.xml</filename>
+file, in the section entitled "transports" and specify all of the SMTP mail server settings for your
+environment.
+ </listitem>
+ <listitem>
+Update the <filename>${SAVARA-Validator}/samples/trailblazer/trailblazer.properties</filename>
+ <para>
+Update the <property>file.bank.monitored.directory</property> and
+<property>file.output.directory</property> properties. These are folders used by the File Based Bank,
+and are set to <filename>/tmp/input</filename> and <filename>/tmp/output</filename> by default.
+If the selected folders do not exist, then please ensure they are created prior to running the example.
+ </para>
+ </listitem>
+ <listitem>
+Update the <filename>trailblazer/esb/conf/jboss-esb.xml</filename>
+ <para>
+There is a <emphasis>fs-provider</emphasis> block, update the <property>directory</property>
+attribute value to be the same as the <property>file.output.directory</property> value in
+<filename>trailblazer.properties</filename> file.
+ </para>
+ </listitem>
+ <listitem>
+Start the JBossAS server
+ </listitem>
+ <listitem>
+From the <filename>trailblazer</filename> folder, execute the command to start the ESB:
+<emphasis role="bold">ant deploy</emphasis>
+ <para>
+this should deploy the ESB and WAR files to your JBoss AS <filename>server/default</filename>.
+ </para>
+ </listitem>
+ <listitem>
+From the <filename>trailblazer/banks</filename> folder, execute the command to start the JMS
+Bank service: <emphasis role="bold">ant runJMSBank</emphasis>.
+ </listitem>
+ <listitem>
+From the <filename>trailblazer/banks</filename> folder, execute the command to start the File based
+Bank service: <emphasis role="bold">ant runFileBank</emphasis>.
+ </listitem>
+ <listitem>
+ <para>
+In the Eclipse environment, select the popup menu associated with the <filename>trailblazer.cdm</filename>
+file, and choose the <emphasis>Choreography->Monitor</emphasis> menu item.
+ </para>
+
+ <imageobject>
+ <imagedata fileref="images/MonitorMenu.jpg" align="center" width="2in" />
+ </imageobject>
+
+ <para>
+Wait for the monitor window to start, and indicate that the choreography is being monitored, shown in the
+status line at the bottom of the window.
+ </para>
+
+ <imageobject>
+ <imagedata fileref="images/ChoreoMonReady.jpg" align="center" width="4in" />
+ </imageobject>
+
+ </listitem>
+ <listitem>
+ <para>
+Start a browser and enter the URL:
+<ulink url="http://localhost:8080/trailblazer">localhost:8080/trailblazer</ulink>.
+ </para>
+
+ <imageobject>
+ <imagedata fileref="images/TrailblazerWebPage.jpg" align="center" width="4in" />
+ </imageobject>
+
+ </listitem>
+ <listitem>
+Now you can submit quotes, You will see either a loan request rejected (single email) because the
+score is less than 4, or two emails (one from JMS bank and one from FileBased bank) with valid quotes.
+When entering subsequent quotes, make sure that the quote reference is updated, so that each session
+has a unique id.
+ </listitem>
+ </orderedlist>
+ <para>
+To demonstrate what occurs when the implementation deviates from the expected behaviour as defined
+in the choreography description, try the following steps:
+ </para>
+ <orderedlist>
+ <listitem>
+ Run the ant task <emphasis role="bold">ant deploy-error-client</emphasis> to redeploy the
+ trailblaizer example.
+ </listitem>
+ <listitem>
+ Run the commands from step 6 above.
+ </listitem>
+ </orderedlist>
+ <para>
+ The above steps show how changing the service implementation without updating a choreography
+ can result in behavioural validation errors being detected.
+ </para>
+ <tip>
+ <title>What is changed when we run ant deploy-error-client</title>
+ <para>
+ Compared to command of <emphasis role="bold">ant deploy</emphasis>, basically, we have
+ just updated the following code in
+ <emphasis role="bold">${SAVARA-Validator}/samples/trailblazer/client/src/org/jboss/soa/esb/samples/trailblazer/loanbroker/LoanBroker.java</emphasis> file.
+ </para>
+ <para>
+ In the following code within the <emphasis role="bold">processLoanRequest</emphasis>
+ method, we've changed the "4" to "7"
+
+<programlisting>
+ //step 2 - check if score is acceptable
+ if (score >= 4) {
+</programlisting>
+ </para>
+ </tip>
+
+ <para>
+ TO BE UPDATED WITH JOPR APPROACH:
+ Issue further loan requests, remembering to change the quote reference each time, until a Credit
+ Check result of between 4 and 6 inclusive occurs, which will result in an out of sequence message
+ being reported (in red) to the Choreography Monitor
+
+ <note>
+ <para>
+ It is currently a requirement that the choreography used within the Choreography Monitor is
+ the same as the description used to locally monitor the services
+ (i.e. within the savara-validator-jbossesb.esb/models directory).
+ </para>
+ </note>
+ </para>
+
+ </section>
+
+</chapter>
Added: trunk/docs/samplesguide/src/main/xslt/pdf.xsl
===================================================================
--- trunk/docs/samplesguide/src/main/xslt/pdf.xsl (rev 0)
+++ trunk/docs/samplesguide/src/main/xslt/pdf.xsl 2010-05-18 21:31:32 UTC (rev 223)
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ version="1.0">
+
+ <xsl:import href="http://docbook.sourceforge.net/release/xsl/1.72.0/fo/docbook.xsl" />
+ <xsl:import href="classpath:/xslt/org/jboss/pdf.xsl" />
+
+ <!-- Override the default font settings -->
+ <xsl:param name="body.font.family" select="'Times New Roman, serif'" />
+ <xsl:param name="monospace.font.family" select="'DejaVu Sans Mono, monospace'" />
+ <xsl:param name="sans.font.family" select="'Arial, sans-serif'" />
+ <xsl:param name="title.font.family" select="$body.font.family" />
+ <xsl:param name="programlisting.font" select="$monospace.font.family" />
+ <xsl:param name="programlisting.font.size" select="'75%'" />
+
+ <!-- Remove the blank pages between the chapters -->
+ <xsl:param name="double.sided" select="0" />
+
+ <!-- Use SVG for callout images instead of PNG -->
+ <xsl:param name="callout.graphics" select="1" />
+ <xsl:param name="callout.graphics.extension" select="'.svg'" />
+
+ <!-- Hide URL -->
+ <xsl:param name="ulink.show" select="0"/>
+
+ <!-- Don't use italic font for links -->
+ <xsl:attribute-set name="xref.properties">
+ <xsl:attribute name="font-style">normal</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Decrease the link font size in the program listing -->
+ <xsl:attribute-set name="monospace.properties">
+ <xsl:attribute name="font-size">1em</xsl:attribute>
+ <xsl:attribute name="font-family">
+ <xsl:value-of select="$monospace.font.family"/>
+ </xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Add some spacing between callout listing items -->
+ <xsl:template match="callout">
+ <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
+ <fo:list-item id="{$id}" space-before="1em">
+ <fo:list-item-label end-indent="label-end()">
+ <fo:block>
+ <xsl:call-template name="callout.arearefs">
+ <xsl:with-param name="arearefs" select="@arearefs"/>
+ </xsl:call-template>
+ </fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body start-indent="body-start()">
+ <fo:block padding-top="0.2em">
+ <xsl:apply-templates/>
+ </fo:block>
+ </fo:list-item-body>
+ </fo:list-item>
+ </xsl:template>
+
+ <!-- Slight baseline-shift for callouts in the program listing -->
+ <xsl:template name="callout-bug">
+ <xsl:param name="conum" select='1'/>
+ <xsl:choose>
+ <xsl:when test="$conum <= $callout.graphics.number.limit">
+ <xsl:variable name="filename"
+ select="concat($callout.graphics.path, $conum,
+ $callout.graphics.extension)"/>
+
+ <fo:external-graphic content-width="{$callout.icon.size}"
+ width="{$callout.icon.size}"
+ padding="0.0em" margin="0.0em"
+ baseline-shift="-0.375em">
+ <xsl:attribute name="src">
+ <xsl:choose>
+ <xsl:when test="$passivetex.extensions != 0
+ or $fop.extensions != 0
+ or $arbortext.extensions != 0">
+ <xsl:value-of select="$filename"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>url(</xsl:text>
+ <xsl:value-of select="$filename"/>
+ <xsl:text>)</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </fo:external-graphic>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet>
+
Added: trunk/docs/trailblazer/TBGuide.odt
===================================================================
(Binary files differ)
Property changes on: trunk/docs/trailblazer/TBGuide.odt
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docs/trailblazer/TBGuide.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/docs/trailblazer/TBGuide.pdf
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docs/user/TBGuide.odt
===================================================================
(Binary files differ)
Property changes on: trunk/docs/user/TBGuide.odt
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docs/user/TBGuide.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/docs/user/TBGuide.pdf
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/docs/userguide/pom.xml
===================================================================
--- trunk/docs/userguide/pom.xml 2010-05-18 17:30:48 UTC (rev 222)
+++ trunk/docs/userguide/pom.xml 2010-05-18 21:31:32 UTC (rev 223)
@@ -4,14 +4,14 @@
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.savara.tools.eclipse.docs</groupId>
+ <groupId>org.jboss.savara.docs</groupId>
<artifactId>userguide</artifactId>
<packaging>jdocbook</packaging>
- <name>Savara::Tools::Eclipse::Docs::UserGuide</name>
+ <name>Savara::Docs::UserGuide</name>
<version>1.0-SNAPSHOT</version>
<parent>
- <groupId>org.jboss.savara.tools.eclipse</groupId>
+ <groupId>org.jboss.savara</groupId>
<artifactId>docs</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
@@ -60,7 +60,7 @@
<format>
<formatName>pdf</formatName>
<stylesheetResource>file:///${basedir}/src/main/xslt/pdf.xsl</stylesheetResource>
- <finalName>SAVARA-Eclipse-Tools-UserGuide.pdf</finalName>
+ <finalName>SAVARA-UserGuide.pdf</finalName>
</format>
<format>
<formatName>html</formatName>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-05-18 17:30:48 UTC (rev 222)
+++ trunk/pom.xml 2010-05-18 21:31:32 UTC (rev 223)
@@ -2,17 +2,17 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.savara.tools</groupId>
- <artifactId>eclipse</artifactId>
+ <groupId>org.jboss</groupId>
+ <artifactId>savara</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
- <name>Savara::Tools::Eclipse</name>
+ <name>Savara</name>
<url>http://www.jboss.org/savara</url>
<description>
- The JBoss SAVARA Eclipse Tools.
+ The JBoss SAVARA project
</description>
<scm>
- <connection>scm:svn:https://svn.jboss.org/repos/savara/tools/eclipse</connection>
+ <connection>scm:svn:https://svn.jboss.org/repos/savara</connection>
</scm>
<developers>
<developer>
@@ -37,7 +37,7 @@
</developer>
</developers>
<modules>
- <module>plugins</module>
+ <module>tools</module>
<module>docs</module>
<module>distribution</module>
</modules>
Copied: trunk/tools/eclipse (from rev 222, trunk/plugins)
Modified: trunk/tools/eclipse/eclipse-build/pom.xml
===================================================================
--- trunk/plugins/eclipse-build/pom.xml 2010-05-18 17:30:48 UTC (rev 222)
+++ trunk/tools/eclipse/eclipse-build/pom.xml 2010-05-18 21:31:32 UTC (rev 223)
@@ -3,15 +3,15 @@
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.savara.tools.eclipse.plugins</groupId>
+ <groupId>org.jboss.savara.tools.eclipse</groupId>
<artifactId>build</artifactId>
<packaging>pom</packaging>
- <name>Savara::Tools::Eclipse::Plugins::Build</name>
+ <name>Savara::Tools::Eclipse::Build</name>
<version>1.0-SNAPSHOT</version>
<parent>
- <groupId>org.jboss.savara.tools.eclipse</groupId>
- <artifactId>plugins</artifactId>
+ <groupId>org.jboss.savara.tools</groupId>
+ <artifactId>eclipse</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
@@ -28,7 +28,7 @@
<tasks>
<property name="eclipse.home" value="target/eclipse" />
- <property name="localEclipseDrop" value="${basedir}/../../../local-eclipse-drop-mirror" />
+ <property name="localEclipseDrop" value="${basedir}/../../../../local-eclipse-drop-mirror" />
<delete failonerror="false" dir="target/eclipse.build"/>
Modified: trunk/tools/eclipse/pom.xml
===================================================================
--- trunk/plugins/pom.xml 2010-05-18 17:30:48 UTC (rev 222)
+++ trunk/tools/eclipse/pom.xml 2010-05-18 21:31:32 UTC (rev 223)
@@ -3,15 +3,15 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.savara.tools.eclipse</groupId>
- <artifactId>plugins</artifactId>
+ <groupId>org.jboss.savara.tools</groupId>
+ <artifactId>eclipse</artifactId>
<packaging>pom</packaging>
- <name>Savara::Tools::Eclipse::Plugins</name>
+ <name>Savara::Tools::Eclipse</name>
<version>1.0-SNAPSHOT</version>
<parent>
- <groupId>org.jboss.savara.tools</groupId>
- <artifactId>eclipse</artifactId>
+ <groupId>org.jboss.savara</groupId>
+ <artifactId>tools</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
Added: trunk/tools/pom.xml
===================================================================
--- trunk/tools/pom.xml (rev 0)
+++ trunk/tools/pom.xml 2010-05-18 21:31:32 UTC (rev 223)
@@ -0,0 +1,23 @@
+<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>
+
+ <groupId>org.jboss.savara</groupId>
+ <artifactId>tools</artifactId>
+ <packaging>pom</packaging>
+ <name>Savara::Tools</name>
+ <version>1.0-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>savara</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <modules>
+ <module>eclipse</module>
+ </modules>
+
+</project>
13 years, 11 months
savara SVN: r222 - /.
by do-not-reply@jboss.org
Author: objectiser
Date: 2010-05-18 13:30:48 -0400 (Tue, 18 May 2010)
New Revision: 222
Removed:
tools/
Log:
13 years, 11 months
savara SVN: r220 - validator/tags and 1 other directory.
by do-not-reply@jboss.org
Author: objectiser
Date: 2010-05-18 13:26:05 -0400 (Tue, 18 May 2010)
New Revision: 220
Added:
tags/validator-1.0-M1/
Removed:
validator/tags/1.0-M1/
Log:
Copied: tags/validator-1.0-M1 (from rev 219, validator/tags/1.0-M1)
13 years, 11 months
savara SVN: r219 - tags.
by do-not-reply@jboss.org
Author: objectiser
Date: 2010-05-18 13:24:53 -0400 (Tue, 18 May 2010)
New Revision: 219
Added:
tags/tools-eclipse-1.0-M1/
Removed:
tags/1.0-M1/
Log:
Copied: tags/tools-eclipse-1.0-M1 (from rev 218, tags/1.0-M1)
13 years, 11 months
savara SVN: r217 - /.
by do-not-reply@jboss.org
Author: objectiser
Date: 2010-05-18 13:20:16 -0400 (Tue, 18 May 2010)
New Revision: 217
Removed:
trunk/
Log:
To be replaced by tools/eclipse/trunk.
13 years, 11 months