Overlord SVN: r494 - cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2009-02-13 10:04:18 -0500 (Fri, 13 Feb 2009)
New Revision: 494
Modified:
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java
Log:
Added configuration for dynamic endpoint monitoring timeout value.
Modified: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java 2009-02-12 16:52:07 UTC (rev 493)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java 2009-02-13 15:04:18 UTC (rev 494)
@@ -342,6 +342,21 @@
logger.info("Setting validators into passive mode");
m_active = false;
}
+
+ // Check if dynamic reply-to endpoint timeout specified
+ String timeout=config.getAttribute(DYNAMIC_ENDPOINT_TIMEOUT_ATTR);
+ long replyToTimeout=DynamicReplyToEndpointManager.DYNAMIC_ENDPOINT_TIMEOUT;
+
+ if (timeout != null && timeout.trim().length() > 0) {
+ try {
+ replyToTimeout = Long.parseLong(timeout);
+ } catch(Exception te) {
+ logger.severe("Dynamic endpoint timeout value '"+
+ timeout+"' not a valid Long type: "+te);
+ }
+ }
+
+ m_replyToManager.setTimeout(replyToTimeout);
}
updateConfiguration(config, existingValidatorNames,
@@ -482,11 +497,11 @@
// Create service monitor for service
String modelName=
- services[i].getAttribute(MODEL_NAME);
+ services[i].getAttribute(MODEL_ATTR);
String role=
- services[i].getAttribute(ROLE_NAME);
+ services[i].getAttribute(ROLE_ATTR);
boolean validate=
- services[i].getBooleanAttribute(VALIDATE, true);
+ services[i].getBooleanAttribute(VALIDATE_ATTR, true);
// Check for old attribute names, for
// backward compatibility - only support
@@ -661,6 +676,7 @@
private static final String EPR_ATTR = "epr";
private static final String DYNAMIC_REPLY_TO_ATTR = "dynamicReplyTo";
+ private static final String DYNAMIC_ENDPOINT_TIMEOUT_ATTR = "dynamicEndpointTimeout";
private static final String OUTPUT_NODE = "output";
private static final String INPUT_NODE = "input";
@@ -669,9 +685,9 @@
private static final String VALIDATOR_NODE = "validator";
private static final String CONFIG_FILE = "validator-config.xml";
- public static final String MODEL_NAME="model";
- public static final String ROLE_NAME="role";
- public static final String VALIDATE="validate";
+ 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;
@@ -761,6 +777,8 @@
public class DynamicReplyToEndpointManager extends Thread {
+ public static final int DYNAMIC_ENDPOINT_TIMEOUT = 10000;
+
/**
* The default constructor
*/
@@ -780,7 +798,7 @@
try {
synchronized(this) {
- wait(10000);
+ wait(m_timeout);
}
} catch(Exception e) {
logger.severe("Failed to wait");
@@ -827,6 +845,20 @@
}
/**
+ * This method sets the timeout used to determine when to
+ * discard the dynamic endpoints being monitored.
+ *
+ * @param timeout The timeout value
+ */
+ public void setTimeout(long timeout) {
+ m_timeout = timeout;
+
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Dynamic endpoint monitoring timeout="+timeout);
+ }
+ }
+
+ /**
* This method returns the list of service validators
* associated with the dynamic reply-to endpoint.
*
@@ -924,5 +956,6 @@
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_timeout=DYNAMIC_ENDPOINT_TIMEOUT;
}
}
15 years, 2 months
Overlord SVN: r493 - in cdl/trunk: distribution and 16 other directories.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2009-02-12 11:52:07 -0500 (Thu, 12 Feb 2009)
New Revision: 493
Added:
cdl/trunk/validator/jbossesb-assembly/
cdl/trunk/validator/jbossesb-assembly/pom.xml
cdl/trunk/validator/jbossesb-assembly/src/
cdl/trunk/validator/jbossesb-assembly/src/main/
cdl/trunk/validator/jbossesb-assembly/src/main/java/
cdl/trunk/validator/jbossesb-assembly/src/main/resources/
cdl/trunk/validator/jbossesb-assembly/src/main/resources/META-INF/
cdl/trunk/validator/jbossesb-assembly/src/main/resources/META-INF/deployment.xml
cdl/trunk/validator/jbossesb-assembly/src/main/resources/META-INF/jboss-esb.xml
cdl/trunk/validator/jbossesb-assembly/src/main/resources/models/
cdl/trunk/validator/jbossesb-assembly/src/main/resources/models/TrailBlazer.cdm
cdl/trunk/validator/jbossesb-assembly/src/main/resources/validator-config.xml
cdl/trunk/validator/jbossesb-assembly/src/test/
cdl/trunk/validator/jbossesb-assembly/src/test/java/
cdl/trunk/validator/jbossesb-assembly/src/test/resources/
cdl/trunk/validator/jbossesb/pom.xml
cdl/trunk/validator/jbossesb/src/main/resources/
cdl/trunk/validator/pom.xml
Removed:
cdl/trunk/distribution/validator/jbossesb/overlord-cdl-validator.esb/
Modified:
cdl/trunk/distribution/pom.xml
cdl/trunk/distribution/src/main/assembly/bin.xml
cdl/trunk/distribution/src/main/release/version.properties
cdl/trunk/distribution/validator/jbossesb/conf/jbossesb-properties-validator.xml
cdl/trunk/pom.xml
cdl/trunk/runtime/jbossesb-assembly/pom.xml
cdl/trunk/runtime/jbossesb/pom.xml
Log:
Updated maven build structure to include new validator library.
Modified: cdl/trunk/distribution/pom.xml
===================================================================
--- cdl/trunk/distribution/pom.xml 2009-02-12 12:09:45 UTC (rev 492)
+++ cdl/trunk/distribution/pom.xml 2009-02-12 16:52:07 UTC (rev 493)
@@ -1,81 +1,92 @@
-<!--
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., 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.
- *
- * (C) 2008
--->
-<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.soa.overlord.cdl</groupId>
- <artifactId>distribution</artifactId>
- <packaging>pom</packaging>
- <name>Overlord::CDL::Distribution</name>
- <version>1.0-SNAPSHOT</version>
- <url>http://www.jboss.org/soag</url>
-
- <properties>
- <maven.test.skip>true</maven.test.skip>
- <cdl.version>${project.version}</cdl.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.soa.overlord.cdl.runtime</groupId>
- <artifactId>cdl-jbossesb</artifactId>
- <version>${pom.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.soa.overlord.cdl.runtime</groupId>
- <artifactId>cdl-jbossesb-assembly</artifactId>
- <version>${pom.version}</version>
- <type>esb</type>
- </dependency>
- </dependencies>
-
- <build>
- <finalName>overlord-cdl-${project.version}</finalName>
- <resources>
- <resource>
- <directory>src/main/java</directory>
- <includes>
- <include>**/*</include>
- </includes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>distribution-package</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>src/main/assembly/bin.xml</descriptor>
- </descriptors>
- <tarLongFileMode>gnu</tarLongFileMode>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., 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.
+ *
+ * (C) 2008
+-->
+<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.soa.overlord.cdl</groupId>
+ <artifactId>distribution</artifactId>
+ <packaging>pom</packaging>
+ <name>Overlord::CDL::Distribution</name>
+ <version>1.0-SNAPSHOT</version>
+ <url>http://www.jboss.org/soag</url>
+
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ <cdl.version>${project.version}</cdl.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.soa.overlord.cdl.runtime</groupId>
+ <artifactId>cdl-jbossesb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.soa.overlord.cdl.runtime</groupId>
+ <artifactId>cdl-jbossesb-assembly</artifactId>
+ <version>${pom.version}</version>
+ <type>esb</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.soa.overlord.cdl.validator</groupId>
+ <artifactId>cdl-jbossesb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.soa.overlord.cdl.validator</groupId>
+ <artifactId>cdl-jbossesb-assembly</artifactId>
+ <version>${pom.version}</version>
+ <type>esb</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>overlord-cdl-${project.version}</finalName>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/bin.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Modified: cdl/trunk/distribution/src/main/assembly/bin.xml
===================================================================
--- cdl/trunk/distribution/src/main/assembly/bin.xml 2009-02-12 12:09:45 UTC (rev 492)
+++ cdl/trunk/distribution/src/main/assembly/bin.xml 2009-02-12 16:52:07 UTC (rev 493)
@@ -43,6 +43,11 @@
<outputDirectory>modules/runtime-jbossesb-${cdl.version}</outputDirectory>
</fileSet>
+ <fileSet>
+ <directory>../validator/jbossesb-assembly/target/overlord-cdl-validator-jbossesb</directory>
+ <outputDirectory>modules/validator-jbossesb-${cdl.version}/overlord-cdl-validator.esb</outputDirectory>
+ </fileSet>
+
<!--Copy files like License and samples etc -->
<fileSet>
<directory>src/main/release</directory>
Modified: cdl/trunk/distribution/src/main/release/version.properties
===================================================================
--- cdl/trunk/distribution/src/main/release/version.properties 2009-02-12 12:09:45 UTC (rev 492)
+++ cdl/trunk/distribution/src/main/release/version.properties 2009-02-12 16:52:07 UTC (rev 493)
@@ -1 +1 @@
-cdl.version=1.0-M1
+cdl.version=1.0-SNAPSHOT
Modified: cdl/trunk/distribution/validator/jbossesb/conf/jbossesb-properties-validator.xml
===================================================================
--- cdl/trunk/distribution/validator/jbossesb/conf/jbossesb-properties-validator.xml 2009-02-12 12:09:45 UTC (rev 492)
+++ cdl/trunk/distribution/validator/jbossesb/conf/jbossesb-properties-validator.xml 2009-02-12 16:52:07 UTC (rev 493)
@@ -90,6 +90,6 @@
<properties name="filters">
<property name="org.jboss.soa.esb.filter.1" value="org.jboss.internal.soa.esb.message.filter.MetaDataFilter"/>
<property name="org.jboss.soa.esb.filter.2" value="org.jboss.internal.soa.esb.message.filter.GatewayFilter"/>
- <property name="org.jboss.soa.esb.filter.10" value="org.pi4soa.jbossesb.validator.ValidatorFilter" />
+ <property name="org.jboss.soa.esb.filter.10" value="org.jboss.soa.overlord.validator.jbossesb.ValidatorFilter" />
</properties>
</esb>
Modified: cdl/trunk/pom.xml
===================================================================
--- cdl/trunk/pom.xml 2009-02-12 12:09:45 UTC (rev 492)
+++ cdl/trunk/pom.xml 2009-02-12 16:52:07 UTC (rev 493)
@@ -1,196 +1,206 @@
-<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.soa.overlord</groupId>
- <artifactId>cdl</artifactId>
- <version>1.0-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>Overlord::CDL</name>
- <url>http://www.jboss.org/overlord</url>
- <description>
- JBoss Overlord CDL.
- </description>
- <scm>
- <connection>scm:svn:https://svn.jboss.org/repos/soag/cdl/trunk</connection>
- </scm>
- <developers>
- <developer>
- <name>Jeff Yu</name>
- <id>jeff.yuchang</id>
- <email>cyu(a)redhat.com</email>
- <organization>Red Hat</organization>
- <roles>
- <role>Developer</role>
- </roles>
- <timezone>+8</timezone>
- </developer>
- <developer>
- <name>Gary Brown</name>
- <id>objectiser</id>
- <email>gary.brown(a)hattricksoftware.com</email>
- <organization>Hattrick Software</organization>
- <roles>
- <role>Developer</role>
- </roles>
- <timezone>+1</timezone>
- </developer>
- </developers>
- <modules>
- <module>runtime</module>
- <module>docs/docbook</module>
- <module>distribution</module>
- </modules>
-
- <properties>
- <overlord-version>1.0-SNAPSHOT</overlord-version>
- </properties>
-
- <profiles>
- <profile>
- <id>release</id>
- <modules>
- <module>docs</module>
- <module>docs/examples/gettingstarted</module>
- </modules>
- </profile>
- <profile>
- <!--
- This profile is activated when the "generate.docs" property is set,
- as in "mvn ... -Dgenerate.docs=true ..."
- -->
- <id>docs</id>
- <activation>
- <property>
- <name>generate.docs</name>
- </property>
- </activation>
- <modules>
- <module>docs</module>
- </modules>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <aggregate>true</aggregate>
- <show>public</show>
- <title>JBoss Overlord ${project.version}</title>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
- </profile>
- </profiles>
-
- <build>
- <!-- This section defines the default plugin settings inherited by child projects. -->
- <pluginManagement>
- <plugins>
- <!-- Fixes how test resources of a project can be used in projects dependent on it -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.2</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.2</version>
- <configuration>
- <aggregate>true</aggregate>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <!-- Specify the compiler options and settings -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.0.2</version>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- <showDeprecation>false</showDeprecation>
- <showWarnings>false</showWarnings>
- </configuration>
- </plugin>
- <!-- Produce source jars during the 'verify' phase -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-sources</id>
- <phase>verify</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <includes>
- <include>**/*TestCase.java</include>
- <include>**/*Test.java</include>
- </includes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-report-plugin</artifactId>
- </plugin>
- </plugins>
- </reporting>
-
- <repositories>
- <repository>
- <id>jboss</id>
- <url>http://repository.jboss.com/maven2/</url>
- </repository>
-
- <repository>
- <id>jboss-snapshot</id>
- <url>http://snapshots.jboss.org/maven2</url>
- </repository>
-
- <repository>
- <id>maven.repo</id>
- <name>maven repository</name>
- <url>http://repo1.maven.org/maven2</url>
- </repository>
-
- <repository>
- <id>ibiblio</id>
- <name>ibiblio repository</name>
- <url>http://mirrors.ibiblio.org/pub/mirrors/maven2</url>
- </repository>
-
- <repository>
- <id>codehaus</id>
- <name>codehaus repository</name>
- <url>http://repo1.maven.org/maven2</url>
- </repository>
-
- </repositories>
-
- <distributionManagement>
- <repository>
- <!-- Copy the distribution jar file to a local checkout of the maven repository
- - This variable can be set in $MAVEN_HOME/conf/settings.xml -->
- <id>repository.jboss.org</id>
- <url>file://${jboss.repository.root}</url>
- </repository>
- </distributionManagement>
-
-</project>
-
+<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.soa.overlord</groupId>
+ <artifactId>cdl</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Overlord::CDL</name>
+ <url>http://www.jboss.org/overlord</url>
+ <description>
+ JBoss Overlord CDL.
+ </description>
+ <scm>
+ <connection>scm:svn:https://svn.jboss.org/repos/soag/cdl/trunk</connection>
+ </scm>
+ <developers>
+ <developer>
+ <name>Jeff Yu</name>
+ <id>jeff.yuchang</id>
+ <email>cyu(a)redhat.com</email>
+ <organization>Red Hat</organization>
+ <roles>
+ <role>Developer</role>
+ </roles>
+ <timezone>+8</timezone>
+ </developer>
+ <developer>
+ <name>Gary Brown</name>
+ <id>objectiser</id>
+ <email>gary.brown(a)hattricksoftware.com</email>
+ <organization>Hattrick Software</organization>
+ <roles>
+ <role>Developer</role>
+ </roles>
+ <timezone>+1</timezone>
+ </developer>
+ </developers>
+ <modules>
+ <module>runtime</module>
+ <module>validator</module>
+ <module>docs/docbook</module>
+ <module>distribution</module>
+ </modules>
+
+ <properties>
+ <overlord-version>1.0-SNAPSHOT</overlord-version>
+ </properties>
+
+ <profiles>
+ <profile>
+ <id>release</id>
+ <modules>
+ <module>docs</module>
+ <module>docs/examples/gettingstarted</module>
+ </modules>
+ </profile>
+ <profile>
+ <!--
+ This profile is activated when the "generate.docs" property is set,
+ as in "mvn ... -Dgenerate.docs=true ..."
+ -->
+ <id>docs</id>
+ <activation>
+ <property>
+ <name>generate.docs</name>
+ </property>
+ </activation>
+ <modules>
+ <module>docs</module>
+ </modules>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <aggregate>true</aggregate>
+ <show>public</show>
+ <title>JBoss Overlord ${project.version}</title>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+ </profile>
+ </profiles>
+
+ <build>
+ <!-- This section defines the default plugin settings inherited by child projects. -->
+ <pluginManagement>
+ <plugins>
+ <!-- Fixes how test resources of a project can be used in projects dependent on it -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <aggregate>true</aggregate>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <!-- Specify the compiler options and settings -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ <showDeprecation>false</showDeprecation>
+ <showWarnings>false</showWarnings>
+ </configuration>
+ </plugin>
+ <!-- Produce source jars during the 'verify' phase -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*TestCase.java</include>
+ <include>**/*Test.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <repositories>
+ <repository>
+ <id>jboss</id>
+ <url>http://repository.jboss.com/maven2/</url>
+ </repository>
+
+ <repository>
+ <id>jboss-snapshot</id>
+ <url>http://snapshots.jboss.org/maven2</url>
+ </repository>
+
+ <repository>
+ <id>maven.repo</id>
+ <name>maven repository</name>
+ <url>http://repo1.maven.org/maven2</url>
+ </repository>
+
+ <repository>
+ <id>ibiblio</id>
+ <name>ibiblio repository</name>
+ <url>http://mirrors.ibiblio.org/pub/mirrors/maven2</url>
+ </repository>
+
+ <repository>
+ <id>codehaus</id>
+ <name>codehaus repository</name>
+ <url>http://repo1.maven.org/maven2</url>
+ </repository>
+
+ <!-- Not all dependencies are resolved when using this repository.
+ Complains about not finding appropriate version of
+ org.eclipse.equinox.app plugin. -->
+ <!-- repository>
+ <id>eclipse</id>
+ <name>eclipse repository</name>
+ <url>http://repo1.maven.org/eclipse</url>
+ </repository-->
+
+ </repositories>
+
+ <distributionManagement>
+ <repository>
+ <!-- Copy the distribution jar file to a local checkout of the maven repository
+ - This variable can be set in $MAVEN_HOME/conf/settings.xml -->
+ <id>repository.jboss.org</id>
+ <url>file://${jboss.repository.root}</url>
+ </repository>
+ </distributionManagement>
+
+</project>
+
Modified: cdl/trunk/runtime/jbossesb/pom.xml
===================================================================
--- cdl/trunk/runtime/jbossesb/pom.xml 2009-02-12 12:09:45 UTC (rev 492)
+++ cdl/trunk/runtime/jbossesb/pom.xml 2009-02-12 16:52:07 UTC (rev 493)
@@ -1,115 +1,115 @@
-<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.soa.overlord.cdl.runtime</groupId>
- <artifactId>cdl-jbossesb</artifactId>
- <version>1.0-SNAPSHOT</version>
- <packaging>jar</packaging>
- <name>Overlord::CDL::Runtime::JBossESB</name>
-
- <parent>
- <groupId>org.jboss.soa.overlord.cdl</groupId>
- <artifactId>runtime</artifactId>
- <version>1.0-SNAPSHOT</version>
- </parent>
-
- <properties>
- <hibernate-version>3.2.4.sp1</hibernate-version>
- <hibernate-annotations-version>3.2.1.ga</hibernate-annotations-version>
- <ejb3-persistence-version>1.0.1.GA</ejb3-persistence-version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.jbossesb</groupId>
- <artifactId>rosetta</artifactId>
- <version>4.3</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.jbossesb</groupId>
- <artifactId>config-model</artifactId>
- <version>1.0.1</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate</artifactId>
- <version>${hibernate-version}</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-annotations</artifactId>
- <version>${hibernate-annotations-version}</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>ejb3-persistence</artifactId>
- <version>${ejb3-persistence-version}</version>
- </dependency>
- <dependency>
- <groupId>c3p0</groupId>
- <artifactId>c3p0</artifactId>
- <version>0.9.1</version>
- </dependency>
- <dependency>
- <groupId>org.mvel</groupId>
- <artifactId>mvel</artifactId>
- <version>1.3.4-java1.5</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.4</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <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>
-
+<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.soa.overlord.cdl.runtime</groupId>
+ <artifactId>cdl-runtime-jbossesb</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Overlord::CDL::Runtime::JBossESB</name>
+
+ <parent>
+ <groupId>org.jboss.soa.overlord.cdl</groupId>
+ <artifactId>runtime</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <properties>
+ <hibernate-version>3.2.4.sp1</hibernate-version>
+ <hibernate-annotations-version>3.2.1.ga</hibernate-annotations-version>
+ <ejb3-persistence-version>1.0.1.GA</ejb3-persistence-version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossesb</groupId>
+ <artifactId>rosetta</artifactId>
+ <version>4.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossesb</groupId>
+ <artifactId>config-model</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate</artifactId>
+ <version>${hibernate-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>${hibernate-annotations-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>ejb3-persistence</artifactId>
+ <version>${ejb3-persistence-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>c3p0</groupId>
+ <artifactId>c3p0</artifactId>
+ <version>0.9.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mvel</groupId>
+ <artifactId>mvel</artifactId>
+ <version>1.3.4-java1.5</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <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>
+
Modified: cdl/trunk/runtime/jbossesb-assembly/pom.xml
===================================================================
--- cdl/trunk/runtime/jbossesb-assembly/pom.xml 2009-02-12 12:09:45 UTC (rev 492)
+++ cdl/trunk/runtime/jbossesb-assembly/pom.xml 2009-02-12 16:52:07 UTC (rev 493)
@@ -1,118 +1,118 @@
-<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.soa.overlord.cdl.runtime</groupId>
- <artifactId>cdl-jbossesb-assembly</artifactId>
- <version>1.0-SNAPSHOT</version>
- <packaging>jboss-esb</packaging>
- <name>Overlord::CDL::Runtime::JBossESB-Assembly</name>
-
- <parent>
- <groupId>org.jboss.soa.overlord.cdl</groupId>
- <artifactId>runtime</artifactId>
- <version>1.0-SNAPSHOT</version>
- </parent>
-
- <properties>
- <hibernate-commons-annotations>3.0.0.ga</hibernate-commons-annotations>
- <hibernate-tools-version>3.2.0.ga</hibernate-tools-version>
- <hsqldb-version>1.8.0.7</hsqldb-version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.soa.overlord.cdl.runtime</groupId>
- <artifactId>cdl-jbossesb</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-commons-annotations</artifactId>
- <version>${hibernate-commons-annotations}</version>
- </dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-tools</artifactId>
- <version>${hibernate-tools-version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>${hsqldb-version}</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.4</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <finalName>overlord-cdl-runtime-jbossesb</finalName>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <!--export schemas to database -->
- <!--execution>
- <id>schemaexport</id>
- <phase>compile</phase>
- <configuration>
- <tasks>
- <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"
- classpathref="maven.compile.classpath"/>
- <hibernatetool destdir=".">
- <classpath>
- <pathelement path="maven.compile.classpath" />
- </classpath>
- <annotationconfiguration configurationfile="target/classes/overlord-cdl-jbossesb.cfg.xml" />
- <hbm2ddl
- create="true"
- drop="false"
- export="true"
- outputfilename="cdl.hsqldb.sql"
- delimiter=";"
- format="true"/>
- </hibernatetool>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution-->
-
- </executions>
-
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jboss-packaging-maven-plugin</artifactId>
- <version>2.0-20080130.110241-9</version>
- <extensions>true</extensions>
- </plugin>
- </plugins>
- </build>
-
- <pluginRepositories>
- <pluginRepository>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots/>
- <id>jboss-plugin-snapshots</id>
- <name>JBoss Snapshot Plugin Repository</name>
- <url>http://snapshots.repository.codehaus.org</url>
- </pluginRepository>
- </pluginRepositories>
-
-</project>
-
+<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.soa.overlord.cdl.runtime</groupId>
+ <artifactId>cdl-jbossesb-assembly</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jboss-esb</packaging>
+ <name>Overlord::CDL::Runtime::JBossESB-Assembly</name>
+
+ <parent>
+ <groupId>org.jboss.soa.overlord.cdl</groupId>
+ <artifactId>runtime</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <properties>
+ <hibernate-commons-annotations>3.0.0.ga</hibernate-commons-annotations>
+ <hibernate-tools-version>3.2.0.ga</hibernate-tools-version>
+ <hsqldb-version>1.8.0.7</hsqldb-version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.soa.overlord.cdl.runtime</groupId>
+ <artifactId>cdl-runtime-jbossesb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-commons-annotations</artifactId>
+ <version>${hibernate-commons-annotations}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-tools</artifactId>
+ <version>${hibernate-tools-version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>${hsqldb-version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>overlord-cdl-runtime-jbossesb</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <!--export schemas to database -->
+ <!--execution>
+ <id>schemaexport</id>
+ <phase>compile</phase>
+ <configuration>
+ <tasks>
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"
+ classpathref="maven.compile.classpath"/>
+ <hibernatetool destdir=".">
+ <classpath>
+ <pathelement path="maven.compile.classpath" />
+ </classpath>
+ <annotationconfiguration configurationfile="target/classes/overlord-cdl-jbossesb.cfg.xml" />
+ <hbm2ddl
+ create="true"
+ drop="false"
+ export="true"
+ outputfilename="cdl.hsqldb.sql"
+ delimiter=";"
+ format="true"/>
+ </hibernatetool>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution-->
+
+ </executions>
+
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-packaging-maven-plugin</artifactId>
+ <version>2.0-20080130.110241-9</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots/>
+ <id>jboss-plugin-snapshots</id>
+ <name>JBoss Snapshot Plugin Repository</name>
+ <url>http://snapshots.repository.codehaus.org</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+</project>
+
Added: cdl/trunk/validator/jbossesb/pom.xml
===================================================================
--- cdl/trunk/validator/jbossesb/pom.xml (rev 0)
+++ cdl/trunk/validator/jbossesb/pom.xml 2009-02-12 16:52:07 UTC (rev 493)
@@ -0,0 +1,128 @@
+<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.soa.overlord.cdl.validator</groupId>
+ <artifactId>cdl-validator-jbossesb</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Overlord::CDL::Validator::JBossESB</name>
+
+ <parent>
+ <groupId>org.jboss.soa.overlord.cdl</groupId>
+ <artifactId>validator</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossesb</groupId>
+ <artifactId>rosetta</artifactId>
+ <version>4.3</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossesb</groupId>
+ <artifactId>config-model</artifactId>
+ <version>1.0.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <!--dependency>
+ <groupId>c3p0</groupId>
+ <artifactId>c3p0</artifactId>
+ <version>0.9.1</version>
+ </dependency-->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.pi4soa</groupId>
+ <artifactId>common</artifactId>
+ <version>2.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.pi4soa</groupId>
+ <artifactId>cdl</artifactId>
+ <version>2.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.pi4soa</groupId>
+ <artifactId>service</artifactId>
+ <version>2.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>common</artifactId>
+ <version>2.3.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>ecore</artifactId>
+ <version>2.3.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.emf.ecore</groupId>
+ <artifactId>xmi</artifactId>
+ <version>2.3.1</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <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: cdl/trunk/validator/jbossesb-assembly/pom.xml
===================================================================
--- cdl/trunk/validator/jbossesb-assembly/pom.xml (rev 0)
+++ cdl/trunk/validator/jbossesb-assembly/pom.xml 2009-02-12 16:52:07 UTC (rev 493)
@@ -0,0 +1,65 @@
+<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.soa.overlord.cdl.validator</groupId>
+ <artifactId>cdl-jbossesb-assembly</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jboss-esb</packaging>
+ <name>Overlord::CDL::Validator::JBossESB-Assembly</name>
+
+ <parent>
+ <groupId>org.jboss.soa.overlord.cdl</groupId>
+ <artifactId>validator</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.soa.overlord.cdl.validator</groupId>
+ <artifactId>cdl-validator-jbossesb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>overlord-cdl-validator-jbossesb</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ </executions>
+
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-packaging-maven-plugin</artifactId>
+ <version>2.0-20080130.110241-9</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots/>
+ <id>jboss-plugin-snapshots</id>
+ <name>JBoss Snapshot Plugin Repository</name>
+ <url>http://snapshots.repository.codehaus.org</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+</project>
+
Added: cdl/trunk/validator/jbossesb-assembly/src/main/resources/META-INF/deployment.xml
===================================================================
--- cdl/trunk/validator/jbossesb-assembly/src/main/resources/META-INF/deployment.xml (rev 0)
+++ cdl/trunk/validator/jbossesb-assembly/src/main/resources/META-INF/deployment.xml 2009-02-12 16:52:07 UTC (rev 493)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbossesb-deployment>
+ <depends>jboss.esb:deployment=jbossesb.esb</depends>
+ <depends>pi4soa:service=pi4soa</depends>
+</jbossesb-deployment>
Added: cdl/trunk/validator/jbossesb-assembly/src/main/resources/META-INF/jboss-esb.xml
===================================================================
--- cdl/trunk/validator/jbossesb-assembly/src/main/resources/META-INF/jboss-esb.xml (rev 0)
+++ cdl/trunk/validator/jbossesb-assembly/src/main/resources/META-INF/jboss-esb.xml 2009-02-12 16:52:07 UTC (rev 493)
@@ -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: cdl/trunk/validator/jbossesb-assembly/src/main/resources/models/TrailBlazer.cdm
===================================================================
--- cdl/trunk/validator/jbossesb-assembly/src/main/resources/models/TrailBlazer.cdm (rev 0)
+++ cdl/trunk/validator/jbossesb-assembly/src/main/resources/models/TrailBlazer.cdm 2009-02-12 16:52:07 UTC (rev 493)
@@ -0,0 +1,95 @@
+<?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"/>
+ <exchangeDetails description="This is the exchange details for the respond exchange associated with interaction QuoteRequest" name="QuoteRequestRespondExchange" type="//@typeDefinitions/(a)informationTypes.3" action="Respond"/>
+ </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"/>
+ </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"/>
+ </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"/>
+ </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"/>
+ </activities>
+ </activities>
+ </activities>
+ </choreographies>
+</org.pi4soa.cdl:Package>
Added: cdl/trunk/validator/jbossesb-assembly/src/main/resources/validator-config.xml
===================================================================
--- cdl/trunk/validator/jbossesb-assembly/src/main/resources/validator-config.xml (rev 0)
+++ cdl/trunk/validator/jbossesb-assembly/src/main/resources/validator-config.xml 2009-02-12 16:52:07 UTC (rev 493)
@@ -0,0 +1,24 @@
+<validator>
+ <service model="TrailBlazer.cdm" role="LoanBrokerParticipant" >
+ <output epr="jms:queue/esb-tb-creditAgencyQueue" />
+ <input epr="jms:queue/esb-tb-creditAgencyQueue_reply" />
+ <output epr="jms:queue/esb-tb-jmsBankRequestQueue" />
+ <output epr="jms:queue/esb-tb-fileBankRequestQueue" />
+ <input epr="jms:queue/esb-tb-jmsBankResponseQueue" />
+ <output epr="jms:queue/esb-tb-customerNotifier" />
+ <input epr="jms:queue/esb-tb-fileBankResponseQueue" />
+ </service>
+ <service model="TrailBlazer.cdm" role="CreditAgencyParticipant" >
+ <input epr="jms:queue/esb-tb-creditAgencyQueue" />
+ <output epr="jms:queue/esb-tb-creditAgencyQueue_reply" />
+ </service>
+ <service model="TrailBlazer.cdm" role="BankParticipant" >
+ <input epr="jms:queue/esb-tb-jmsBankRequestQueue" />
+ <input epr="jms:queue/esb-tb-fileBankRequestQueue" />
+ <output epr="jms:queue/esb-tb-jmsBankResponseQueue" />
+ <output epr="jms:queue/esb-tb-fileBankResponseQueue" />
+ </service>
+ <service model="TrailBlazer.cdm" role="NotifierParticipant" >
+ <input epr="jms:queue/esb-tb-customerNotifier" />
+ </service>
+</validator>
Added: cdl/trunk/validator/pom.xml
===================================================================
--- cdl/trunk/validator/pom.xml (rev 0)
+++ cdl/trunk/validator/pom.xml 2009-02-12 16:52:07 UTC (rev 493)
@@ -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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.soa.overlord.cdl</groupId>
+ <artifactId>validator</artifactId>
+ <packaging>pom</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>Overlord::CDL::Validator</name>
+
+ <parent>
+ <groupId>org.jboss.soa.overlord</groupId>
+ <artifactId>cdl</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <modules>
+ <module>jbossesb</module>
+ <module>jbossesb-assembly</module>
+ </modules>
+
+</project>
+
15 years, 2 months
Overlord SVN: r491 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb: src/java/org/jboss/tools/overlord/cdl/validator/jbossesb and 2 other directories.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2009-02-11 15:48:24 -0500 (Wed, 11 Feb 2009)
New Revision: 491
Removed:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/actions/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/dialogs/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/generator/
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/plugin.xml
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/JBossESBValidatorAnnotations.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/annotations/cdl/jbossesb.presentation
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/annotations/cdl/jbossesb.template
Log:
Remove generate service validator configuration action, dialog and tool - this will now be done directly from the choreography in the overlord-cdl-validator.esb/models folder. Updated the annotation structure to refer to 'dynamic reply-to' rather than 'temporary', as it may not be a temporary reply-to destination - just selected at runtime.
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/plugin.xml
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/plugin.xml 2009-02-11 20:22:47 UTC (rev 490)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/plugin.xml 2009-02-11 20:48:24 UTC (rev 491)
@@ -8,30 +8,4 @@
</annotationsManager>
</extension>
- <extension point="org.eclipse.ui.popupMenus">
- <objectContribution
- id="org.jboss.tools.overlord.cdl.validator.jbossesb.object.contribution"
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*.cdm">
- <menu
- id="org.jboss.tools.overlord.menu"
- label="Overlord"
- path="additions">
- <separator name="group1"/>
- </menu>
- <menu
- id="generate.menu"
- label="Generate"
- path="org.jboss.tools.overlord.menu/additions">
- <separator name="group2"/>
- </menu>
- <action
- label="JBossESB Service Validators"
- class="org.jboss.tools.overlord.cdl.validator.jbossesb.actions.GenerateValidatorAction"
- menubarPath="org.jboss.tools.overlord.menu/generate.menu/group2"
- enablesFor="1"
- id="org.jboss.tools.overlord.cdl.validator.jbossesb.actions.GenerateAction">
- </action>
- </objectContribution>
- </extension>
</plugin>
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/JBossESBValidatorAnnotations.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/JBossESBValidatorAnnotations.java 2009-02-11 20:22:47 UTC (rev 490)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/JBossESBValidatorAnnotations.java 2009-02-11 20:48:24 UTC (rev 491)
@@ -20,6 +20,7 @@
package org.jboss.tools.overlord.cdl.validator.jbossesb.eclipse;
import java.net.URL;
+import java.util.logging.Level;
import java.util.logging.Logger;
import org.pi4soa.common.annotations.eclipse.EclipseAnnotationsManager;
@@ -56,7 +57,10 @@
logger.severe("Failed to get input stream for URL '"+
url+"': "+e);
}
- logger.info("Ret="+ret);
+
+ if (logger.isLoggable(Level.FINEST)) {
+ logger.finest("Ret="+ret);
+ }
return(ret);
}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/annotations/cdl/jbossesb.presentation
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/annotations/cdl/jbossesb.presentation 2009-02-11 20:22:47 UTC (rev 490)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/annotations/cdl/jbossesb.presentation 2009-02-11 20:48:24 UTC (rev 491)
@@ -1,3 +1,3 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
-The JBossESB Service destination is <xsl:if test="jbossesb/destination/@name != ''" >'<xsl:value-of select="jbossesb/destination/@name" />' </xsl:if><xsl:if test="jbossesb/destination/@name = ''" >'undefined' </xsl:if> [temporary=<xsl:value-of select="jbossesb/destination/@temporary"/>]</xsl:template></xsl:stylesheet>
\ No newline at end of file
+The JBossESB Service destination is <xsl:if test="jbossesb/destination/@name != ''" >'<xsl:value-of select="jbossesb/destination/@name" />' </xsl:if><xsl:if test="jbossesb/destination/@name = ''" >'undefined' </xsl:if> [Dynamic Reply-To Destination=<xsl:value-of select="jbossesb/destination/@dynamicReplyTo"/>]</xsl:template></xsl:stylesheet>
\ No newline at end of file
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/annotations/cdl/jbossesb.template
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/annotations/cdl/jbossesb.template 2009-02-11 20:22:47 UTC (rev 490)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.validator.jbossesb/src/java/org/jboss/tools/overlord/cdl/validator/jbossesb/eclipse/annotations/cdl/jbossesb.template 2009-02-11 20:48:24 UTC (rev 491)
@@ -1,4 +1,4 @@
<jbossesb>
<destination name="{{Destination;The URI for the ESB destination;string;;}}"
- temporary="{{Temporary;Whether the destination is temporary;boolean;;false}}" />
+ dynamicReplyTo="{{Dynamic ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}" />
</jbossesb>
15 years, 2 months
Overlord SVN: r490 - in cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb: pi4soa and 1 other directory.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2009-02-11 15:22:47 -0500 (Wed, 11 Feb 2009)
New Revision: 490
Modified:
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorFilter.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/ValidatorConfigGenerator.java
Log:
Added support for dynamically defined reply-to destinations - rather than having to put the ValidationAction in the jboss-esb.xml configuration.
Modified: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java 2009-02-10 22:37:26 UTC (rev 489)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java 2009-02-11 20:22:47 UTC (rev 490)
@@ -89,10 +89,39 @@
* is unknown
*/
public java.util.List<ServiceValidator> getInputServiceValidators(Endpoint endpoint) {
- return(m_inputValidators.get(endpoint));
+ java.util.List<ServiceValidator> ret=
+ m_inputValidators.get(endpoint);
+
+ if (ret == null) {
+ ret = m_replyToManager.getInputServiceValidators(endpoint);
+ }
+
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("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.isLoggable(Level.FINE)) {
+ logger.fine("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.
*
@@ -101,10 +130,72 @@
* is unknown
*/
public java.util.List<ServiceValidator> getOutputServiceValidators(Endpoint endpoint) {
- return(m_outputValidators.get(endpoint));
+ java.util.List<ServiceValidator> ret=
+ m_outputValidators.get(endpoint);
+
+ if (ret == null) {
+ ret = m_replyToManager.getOutputServiceValidators(endpoint);
+ }
+
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("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.isLoggable(Level.FINE)) {
+ logger.fine("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.isLoggable(Level.FINE)) {
+ logger.fine("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.isLoggable(Level.FINE)) {
+ logger.fine("Register output reply-to '"+endpoint+"': "+validators);
+ }
+
+ m_replyToManager.registerOutputDynamicReplyTo(endpoint, validators);
+ }
+
+ /**
* This method returns a ServiceValidator associated with the
* supplied validator name.
*
@@ -224,6 +315,12 @@
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);
@@ -232,9 +329,25 @@
}
try {
- updateConfiguration(ConfigTree.fromInputStream(is), existingValidatorNames,
- existingInputEndpoints, existingOutputEndpoints);
+ ConfigTree config=ConfigTree.fromInputStream(is);
+ if (config.getName().equals(VALIDATOR_NODE)) {
+ String active=config.getAttribute(ACTIVE_ATTR);
+
+ if (active != null && active.equalsIgnoreCase("true")) {
+
+ logger.info("Setting validators into active mode");
+ m_active = true;
+ } else {
+ logger.info("Setting validators into passive mode");
+ m_active = false;
+ }
+ }
+
+ updateConfiguration(config, existingValidatorNames,
+ existingInputEndpoints, existingOutputEndpoints,
+ existingInputDynaReplyTos, existingOutputDynaReplyTos);
+
// Work through choreography files in the models directory
java.io.File[] files=m_modelsDir.listFiles();
@@ -247,13 +360,15 @@
ValidatorConfigFactory.getValidatorConfig(files[i]);
if (vm != null) {
- ConfigTree config=vm.getConfiguration();
+ ConfigTree vConfig=vm.getConfiguration();
- if (config != null) {
- updateConfiguration(config,
+ if (vConfig != null) {
+ updateConfiguration(vConfig,
existingValidatorNames,
existingInputEndpoints,
- existingOutputEndpoints);
+ existingOutputEndpoints,
+ existingInputDynaReplyTos,
+ existingOutputDynaReplyTos);
} else {
logger.severe("Failed to obtain configuration for model '"+
files[i].getName()+"'");
@@ -275,6 +390,13 @@
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();
@@ -283,6 +405,13 @@
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=
@@ -315,11 +444,15 @@
* @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> existingOutputEndpoints,
+ java.util.Set<Endpoint> existingInputDynaReplyTos,
+ java.util.Set<Endpoint> existingOutputDynaReplyTos) {
logger.info("Update Service Validator Configuration");
if (config != null) {
@@ -443,6 +576,20 @@
}
existingInputEndpoints.remove(endpoint);
+
+ // Check if dynamic replyTo
+ if (inputs[j].getAttribute(DYNAMIC_REPLY_TO_ATTR,
+ "false").equalsIgnoreCase("true")) {
+
+ if (logger.isLoggable(Level.FINEST)) {
+ logger.finest("Input endpoint '"+
+ endpoint+"' has dynamic replyTo destination");
+ }
+
+ m_inputDynaReplyTos.add(endpoint);
+
+ existingInputDynaReplyTos.remove(endpoint);
+ }
}
}
@@ -474,6 +621,20 @@
}
existingOutputEndpoints.remove(endpoint);
+
+ // Check if dynamic replyTo
+ if (outputs[j].getAttribute(DYNAMIC_REPLY_TO_ATTR,
+ "false").equalsIgnoreCase("true")) {
+
+ if (logger.isLoggable(Level.FINEST)) {
+ logger.finest("Output endpoint '"+
+ endpoint+"' has dynamic replyTo destination");
+ }
+
+ m_outputDynaReplyTos.add(endpoint);
+
+ existingOutputDynaReplyTos.remove(endpoint);
+ }
}
}
}
@@ -499,6 +660,8 @@
private static final Logger logger = Logger.getLogger("org.jboss.soa.overlord.validator.jbossesb");
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";
@@ -517,7 +680,10 @@
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_active=false;
+ private DynamicReplyToEndpointManager m_replyToManager=new DynamicReplyToEndpointManager();
/**
* This class is responsible for monitoring the models folder,
@@ -592,4 +758,171 @@
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(10000);
+ }
+ } catch(Exception e) {
+ logger.severe("Failed to wait");
+ }
+
+ // Shift main entries to an emptied 'pending delete'
+ // map
+ synchronized(m_inputs) {
+ if (logger.isLoggable(Level.FINEST)) {
+ 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.finest("Deleting input (reply-to) validators '"+
+ endpoint+"': "+validators);
+ }
+ }
+
+ m_inputsPendingDelete.clear();
+ m_inputsPendingDelete.putAll(m_inputs);
+ m_inputs.clear();
+ }
+
+ synchronized(m_outputs) {
+ if (logger.isLoggable(Level.FINEST)) {
+ 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.finest("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.isLoggable(Level.FINEST)) {
+ logger.finest("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.isLoggable(Level.FINEST)) {
+ logger.finest("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);
+ }
+ }
+
+ 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>>();
+ }
}
Modified: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorFilter.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorFilter.java 2009-02-10 22:37:26 UTC (rev 489)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorFilter.java 2009-02-11 20:22:47 UTC (rev 490)
@@ -56,20 +56,46 @@
java.util.List<ServiceValidator> validators=
ServiceValidatorManager.instance().getOutputServiceValidators(endpoint);
- for (int i=0; validators != null &&
+ 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;
+ }
+ }
- try {
- validators.get(i).messageSent(msg);
-
- } catch(Throwable t) {
+ // Only raise exception if none of the service
+ // validators were able to validate the message
+ if (validated == false) {
logger.log(java.util.logging.Level.SEVERE,
- "Failed to handle sent message", t);
+ "Failed to handle sent message", ex);
if (ServiceValidatorManager.instance().isActive()) {
- throw new CourierException("Failed to handle sent message", t);
+ throw new CourierException("Failed to handle sent message", 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.severe("Unable to get 'reply-to' endpoint for message: "+msg);
+ }
+ }
+ }
}
}
@@ -91,22 +117,48 @@
if (endpoint != null) {
java.util.List<ServiceValidator> validators=
- ServiceValidatorManager.instance().getInputServiceValidators(endpoint);
+ ServiceValidatorManager.instance().getInputServiceValidators(endpoint);
- for (int i=0; validators != null &&
+ 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;
+ }
+ }
- try {
- validators.get(i).messageReceived(msg);
-
- } catch(Throwable t) {
+ // Only raise exception if none of the service
+ // validators were able to validate the message
+ if (validated == false) {
logger.log(java.util.logging.Level.SEVERE,
- "Failed to handle received message", t);
+ "Failed to handle received message", ex);
if (ServiceValidatorManager.instance().isActive()) {
- throw new CourierException("Failed to handle received message", t);
+ throw new CourierException("Failed to handle received message", 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.severe("Unable to get 'reply-to' endpoint for message: "+msg);
+ }
+ }
+ }
}
}
@@ -145,5 +197,37 @@
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));
+ }
+ }
+
+ if (logger.isLoggable(Level.FINEST)) {
+ logger.finest("Reply-To Destination for message '"+msg+"' is: "+ret);
+ }
+
+ return(ret);
+ }
+
private static final Logger logger = Logger.getLogger("org.jboss.soa.overlord.validator.jbossesb");
}
Modified: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/ValidatorConfigGenerator.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/ValidatorConfigGenerator.java 2009-02-10 22:37:26 UTC (rev 489)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/ValidatorConfigGenerator.java 2009-02-11 20:22:47 UTC (rev 490)
@@ -123,6 +123,7 @@
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";
@@ -231,8 +232,7 @@
org.w3c.dom.Element dest, boolean from) {
String elemName=null;
- if (dest != null &&
- dest.getAttribute("temporary").equalsIgnoreCase("true") == false) {
+ if (dest != null) {
if (from) {
if (details.getAction() == ExchangeActionType.REQUEST) {
elemName = OUTPUT_ELEMENT;
@@ -247,6 +247,8 @@
}
}
+ 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
@@ -254,9 +256,21 @@
m_templateProcessor.getTemplateParameters(dest.getAttribute(NAME_ATTR));
if (params != null && params.size() > 0) {
- org.w3c.dom.Element elem=m_service.getOwnerDocument().createElement(elemName);
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);
}
}
15 years, 2 months
Overlord SVN: r489 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model: change/stateless and 1 other directory.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2009-02-10 17:37:26 -0500 (Tue, 10 Feb 2009)
New Revision: 489
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/stateless/SendMessageAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/stateless/SwitchAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/stateless/IfModelChangeRule.java
Log:
Use response category/name to derive additional stateless paths. Remove commented out regions.
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/stateless/SendMessageAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/stateless/SendMessageAction.java 2009-02-10 21:05:51 UTC (rev 488)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/stateless/SendMessageAction.java 2009-02-10 22:37:26 UTC (rev 489)
@@ -17,6 +17,8 @@
*/
package org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.stateless;
+import java.util.logging.Logger;
+
import org.jboss.tools.overlord.cdl.runtime.jbossesb.model.*;
import org.scribble.conversation.model.*;
import org.scribble.model.*;
@@ -171,6 +173,80 @@
if (context.getRole() != null) {
send.setFromRole(new Role(context.getRole()));
}
+
+ // Check if reply destination has been defined
+ if (hasProperty(RESPONSE_SERVICE_CATEGORY) &&
+ hasProperty(RESPONSE_SERVICE_NAME)) {
+ String responseName=getPropertyValue(RESPONSE_SERVICE_NAME);
+ String responseCategory=getPropertyValue(RESPONSE_SERVICE_CATEGORY);
+
+ ESBService serv=getService().getModel().
+ getService(responseCategory, responseName);
+
+ Definition defn=send.getEnclosingDefinition().
+ getTopLevelDefinition();
+
+ if (serv == null) {
+ logger.severe("Failed to find response ESB service '"+
+ responseCategory+"/"+responseName+"'");
+
+ } else if (context.isOnStack(serv)) {
+
+ // Ignore service as don't want to recursively
+ // process it
+
+ } else if (defn != null && defn.isStateless()) {
+ If ifelem=null;
+
+ context.push(serv);
+
+ for (int i=0; ifelem == null &&
+ i < defn.getBlock().getContents().size(); i++) {
+ if (defn.getBlock().getContents().get(i) instanceof If) {
+ ifelem = (If)defn.getBlock().getContents().get(i);
+ }
+ }
+
+ if (ifelem != null) {
+
+ if (serv.getActions().size() == 1 &&
+ serv.getActions().get(0) instanceof SwitchAction) {
+ // Work through case entries and add each
+ // to top level conversation stateless 'if'
+ SwitchAction sw=(SwitchAction)serv.getActions().get(0);
+
+ for (int i=0; i < sw.getNumberOfCases(); i++) {
+ String name=sw.getCaseServiceName(i);
+ String category=sw.getCaseServiceCategory(i);
+
+ ESBService subServ=getService().getModel().
+ getService(category, name);
+
+ if (subServ == null) {
+ logger.severe("Failed to find response sub ESB service '"+
+ category+"/"+name+"'");
+ } else {
+ ConditionalBlock cb=new ConditionalBlock();
+
+ ifelem.getConditionalBlocks().add(cb);
+
+ subServ.convert(cb.getContents(), context);
+ }
+ }
+ } else {
+ ConditionalBlock cb=new ConditionalBlock();
+
+ ifelem.getConditionalBlocks().add(cb);
+
+ serv.convert(cb.getContents(), context);
+ }
+ } else {
+ logger.severe("Unable to find top level 'stateless' IF activity");
+ }
+
+ context.pop(serv);
+ }
+ }
}
/**
@@ -214,4 +290,6 @@
prop.setAttribute(VALUE_ATTR, name);
}
}
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.model.actions.stateless");
}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/stateless/SwitchAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/stateless/SwitchAction.java 2009-02-10 21:05:51 UTC (rev 488)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/stateless/SwitchAction.java 2009-02-10 22:37:26 UTC (rev 489)
@@ -383,8 +383,44 @@
return(ret);
}
+
+ /**
+ * This method returns the service category of the case
+ * associated with the supplied index.
+ *
+ * @param index The index
+ * @return The service category
+ */
+ public String getCaseServiceCategory(int index) {
+ String ret=null;
+ org.w3c.dom.Element caseElem=getCaseElement(index);
+
+ if (caseElem != null) {
+ ret = caseElem.getAttribute(SERVICE_CATEGORY);
+ }
+ return(ret);
+ }
+
/**
+ * This method returns the service name of the case
+ * associated with the supplied index.
+ *
+ * @param index The index
+ * @return The service name
+ */
+ public String getCaseServiceName(int index) {
+ String ret=null;
+ org.w3c.dom.Element caseElem=getCaseElement(index);
+
+ if (caseElem != null) {
+ ret = caseElem.getAttribute(SERVICE_NAME);
+ }
+
+ return(ret);
+ }
+
+ /**
* This method returns the DOM element associated with the
* specified service category and name.
*
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/stateless/IfModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/stateless/IfModelChangeRule.java 2009-02-10 21:05:51 UTC (rev 488)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/stateless/IfModelChangeRule.java 2009-02-10 22:37:26 UTC (rev 489)
@@ -97,15 +97,6 @@
int pos=getPosition(service, ref);
- /*
- ESBService joinService=
- esbModel.createService(service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(joinService);
- */
-
// Check if should be an 'if' or a 'switch' action
if (ifElem.getRoles().contains(context.getRole())) {
@@ -114,22 +105,6 @@
} else {
insertSwitch(context, model, service, ifElem, pos);
}
-
-
- //context.setParent(joinService);
-
- // If reference provided, then move subsequent activities
- // to the 'join service'
- /*
- if (pos != -1) {
- for (int i=pos+1; i < service.getActions().size();) {
- ESBAction act=service.getActions().get(i);
- service.getActions().remove(i);
-
- joinService.addAction(act, -1);
- }
- }
- */
return(true);
}
@@ -165,21 +140,6 @@
ifAction.addPath((i==0 ? IfAction.IF : IfAction.ELSEIF),
subService.getCategory(), subService.getName(),
immediate, null, i);
-
- /* REQUIRED?
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- schedule.setDestination(joinService.getCategory(),
- joinService.getName(), true);
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- ifElem.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)ifElem.getEnclosingDefinition())));
- }
- */
}
if (ifElem.getElseBlock() != null) {
@@ -203,30 +163,7 @@
ifAction.addPath(IfAction.ELSE,
subService.getCategory(), subService.getName(),
immediate, null, -1);
-
- /* REQUIRED?
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- schedule.setDestination(joinService.getCategory(),
- joinService.getName(), true);
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- ifElem.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)ifElem.getEnclosingDefinition())));
- }
- */
}
-
- /*
- if (service.getFirstSessionBasedAction() == ifAction &&
- ifElem.getEnclosingDefinition() instanceof Conversation) {
- ifAction.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)ifElem.getEnclosingDefinition())));
- }
- */
}
protected void insertSwitch(ModelChangeContext context,
@@ -238,40 +175,6 @@
java.util.Map<ESBService,java.util.Set<Interaction>> replyServiceMTypes=
new java.util.Hashtable<ESBService,java.util.Set<Interaction>>();
- // Check if 'when' needs to be placed in new service
- // descriptor - i.e. if insert at end, but current service
- // already has service based actions, or reference object
- // provided, but is not first position
-
- /* IS THIS REQUIRED???
- if (shouldScheduleNewService(service, (pos == -1 ?
- service.getActions().size() : pos))) {
-
- // Already has activities, so need to separate
- // into another service descriptor
- ESBService switchService=esbModel.createService(
- service.getCategory(),
- esbModel.getUniqueServiceName(service.getCategory(),
- service.getName()));
-
- esbModel.addService(switchService);
-
- // Add schedule action
- ScheduleStateAction schedule=
- new ScheduleStateAction(service);
-
- schedule.setDestination(switchService.getCategory(),
- switchService.getName(), false);
-
- service.addAction(schedule, pos);
-
- context.setParent(switchService);
-
- service = switchService;
- pos = -1;
- }
- */
-
// Switch action, as role is a decision observer
SwitchAction switchAction=new SwitchAction(service);
@@ -283,8 +186,6 @@
String namespace=((Model)conv.getModel()).
getNamespace().getName();
- String category=ConversationUtil.getServiceCategory(conv);
-
String name=ConversationUtil.getServiceName(conv);
String sdname="";
@@ -325,6 +226,8 @@
}
}
+ service.addAction(switchAction, pos);
+
// Get lookahead analyser
LookaheadAnalyser la=(LookaheadAnalyser)
RegistryFactory.getRegistry().getExtension(
@@ -334,11 +237,6 @@
logger.severe("Failed to find lookahead analyser");
}
- service.addAction(switchAction, pos);
-
- //java.util.Set<MessageSignature> messageTypes=
- // new java.util.HashSet<MessageSignature>();
-
for (int i=0; i < ifElem.getConditionalBlocks().size(); i++) {
ConditionalBlock cb=ifElem.getConditionalBlocks().get(i);
@@ -379,40 +277,7 @@
} else {
switchAction.addCase(subService.getCategory(),
subService.getName(), interactions, i);
- }
-
- /* REQUIRED?
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- schedule.setDestination(joinService.getCategory(),
- joinService.getName(), true);
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- ifElem.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)ifElem.getEnclosingDefinition())));
- }
-
- if (interactions != null) {
- java.util.Iterator<Interaction> iter=interactions.iterator();
-
- while (iter.hasNext()) {
- Interaction interaction=iter.next();
-
- //TODO: Only deals with single type for now
- // If a receive and not a response, then
- // add to the gateway
- if (InteractionUtil.isSend(interaction) == false &&
- interaction.getReplyToLabel() == null &&
- interaction.getMessageSignature().getTypes().size()==1) {
-
- messageTypes.add(interaction.getMessageSignature());
- }
- }
- }
- */
+ }
}
if (ifElem.getElseBlock() != null) {
@@ -456,39 +321,6 @@
switchAction.addCase(subService.getCategory(),
subService.getName(), interactions, -1);
}
-
- /*
- ScheduleStateAction schedule=
- new ScheduleStateAction((ESBService)context.getParent());
-
- schedule.setDestination(joinService.getCategory(),
- joinService.getName(), true);
- ((ESBService)context.getParent()).addAction(schedule, -1);
-
- if (((ESBService)context.getParent()).getFirstSessionBasedAction() == schedule &&
- ifElem.getEnclosingDefinition() instanceof Conversation) {
- schedule.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)ifElem.getEnclosingDefinition())));
- }
-
- if (interactions != null) {
- java.util.Iterator<Interaction> iter=interactions.iterator();
-
- while (iter.hasNext()) {
- Interaction interaction=iter.next();
-
- //TODO: Only deals with single type for now
- // If a receive and not a response, then
- // add to the gateway
- if (InteractionUtil.isSend(interaction) == false &&
- interaction.getReplyToLabel() == null &&
- interaction.getMessageSignature().getTypes().size()==1) {
-
- messageTypes.add(interaction.getMessageSignature());
- }
- }
- }
- */
}
java.util.Iterator<String> replyLabels=replyServices.keySet().iterator();
@@ -523,38 +355,6 @@
}
}
}
-
- // Only record message router 'routes' if the switch
- // receives request interactions, and it is the first
- // session based action in the service
- /*
- if (messageTypes.size() > 0 &&
- service.getFirstSessionBasedAction() == switchAction) {
- ESBService gwService=
- esbModel.getGatewayService();
-
- if (gwService != null) {
- ESBAction gwAction=gwService.getGatewayAction();
-
- if (gwAction instanceof SwitchAction) {
- SwitchAction mra=(SwitchAction)
- gwAction;
-
- mra.addCase(service.getCategory(),
- service.getName(),
- messageTypes, 0);
- }
- }
- }
- */
-
- /*
- if (service.getFirstSessionBasedAction() == switchAction &&
- ifElem.getEnclosingDefinition() instanceof Conversation) {
- switchAction.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
- ((Conversation)ifElem.getEnclosingDefinition())));
- }
- */
}
protected String getReplyLabel(java.util.Set<Interaction> interactions) {
15 years, 2 months
Overlord SVN: r488 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model: actions/stateless and 1 other directories.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2009-02-10 16:05:51 -0500 (Tue, 10 Feb 2009)
New Revision: 488
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBService.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBService.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/stateless/SwitchAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/stateless/ConversationInteractionModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/stateless/IfModelChangeRule.java
Log:
Changed to deal with responses in separate service descriptors, not through the top level SwitchAction.
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBService.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBService.java 2009-02-10 18:06:51 UTC (rev 487)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/DefaultESBService.java 2009-02-10 21:05:51 UTC (rev 488)
@@ -235,6 +235,16 @@
}
/**
+ * This method sets the name associated with the service
+ * descriptor.
+ *
+ * @param name The service name
+ */
+ public void setName(String name) {
+ m_service.setAttribute(NAME_ATTR, name);
+ }
+
+ /**
* This method returns the XML configuration representation of the service.
*
* @return The XML configuration for the service
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBService.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBService.java 2009-02-10 18:06:51 UTC (rev 487)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/ESBService.java 2009-02-10 21:05:51 UTC (rev 488)
@@ -58,6 +58,14 @@
public String getName();
/**
+ * This method sets the name associated with the service
+ * descriptor.
+ *
+ * @param name The service name
+ */
+ public void setName(String name);
+
+ /**
* This method returns the ESB model.
*
* @return The ESB model
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/stateless/SwitchAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/stateless/SwitchAction.java 2009-02-10 18:06:51 UTC (rev 487)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/actions/stateless/SwitchAction.java 2009-02-10 21:05:51 UTC (rev 488)
@@ -255,6 +255,7 @@
* @param name The service name
* @param messageTypes The set of interactions
* @param position The position
+ * @return Whether the path is added
*/
public void addCase(String category, String name,
java.util.Set<Interaction> messageTypes, int position) {
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/stateless/ConversationInteractionModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/stateless/ConversationInteractionModelChangeRule.java 2009-02-10 18:06:51 UTC (rev 487)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/stateless/ConversationInteractionModelChangeRule.java 2009-02-10 21:05:51 UTC (rev 488)
@@ -160,7 +160,7 @@
ESBService gw=esbModel.getGatewayService();
action.setResponseDestination(gw.getCategory(),
- gw.getName());
+ interaction.getRequestLabel());
}
/* IS REQUIRED??
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/stateless/IfModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/stateless/IfModelChangeRule.java 2009-02-10 18:06:51 UTC (rev 487)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.runtime.jbossesb/src/java/org/jboss/tools/overlord/cdl/runtime/jbossesb/model/change/stateless/IfModelChangeRule.java 2009-02-10 21:05:51 UTC (rev 488)
@@ -233,6 +233,10 @@
Model model, ESBService service,
If ifElem, int pos) {
ESBLanguageModel esbModel=(ESBLanguageModel)model;
+ java.util.Map<String,java.util.List<ESBService>> replyServices=
+ new java.util.Hashtable<String,java.util.List<ESBService>>();
+ java.util.Map<ESBService,java.util.Set<Interaction>> replyServiceMTypes=
+ new java.util.Hashtable<ESBService,java.util.Set<Interaction>>();
// Check if 'when' needs to be placed in new service
// descriptor - i.e. if insert at end, but current service
@@ -339,9 +343,12 @@
ConditionalBlock cb=ifElem.getConditionalBlocks().get(i);
java.util.Set<Interaction> interactions=null;
+ String replyLabel=null;
if (la != null) {
interactions = la.getInteractions(cb);
+
+ replyLabel = getReplyLabel(interactions);
}
ESBService subService=
@@ -357,8 +364,22 @@
context.insert(model, cb.getContents().get(j), null);
}
- switchAction.addCase(subService.getCategory(),
- subService.getName(), interactions, i);
+ if (replyLabel != null) {
+ java.util.List<ESBService> services=
+ replyServices.get(replyLabel);
+
+ if (services == null) {
+ services = new java.util.Vector<ESBService>();
+ replyServices.put(replyLabel, services);
+ }
+
+ services.add(subService);
+
+ replyServiceMTypes.put(subService, interactions);
+ } else {
+ switchAction.addCase(subService.getCategory(),
+ subService.getName(), interactions, i);
+ }
/* REQUIRED?
ScheduleStateAction schedule=
@@ -411,13 +432,30 @@
}
java.util.Set<Interaction> interactions=null;
+ String replyLabel=null;
if (la != null) {
interactions = la.getInteractions(ifElem.getElseBlock());
+
+ replyLabel = getReplyLabel(interactions);
}
- switchAction.addCase(subService.getCategory(),
- subService.getName(), interactions, -1);
+ if (replyLabel != null) {
+ java.util.List<ESBService> services=
+ replyServices.get(replyLabel);
+
+ if (services == null) {
+ services = new java.util.Vector<ESBService>();
+ replyServices.put(replyLabel, services);
+ }
+
+ services.add(subService);
+
+ replyServiceMTypes.put(subService, interactions);
+ } else {
+ switchAction.addCase(subService.getCategory(),
+ subService.getName(), interactions, -1);
+ }
/*
ScheduleStateAction schedule=
@@ -453,6 +491,39 @@
*/
}
+ java.util.Iterator<String> replyLabels=replyServices.keySet().iterator();
+
+ while (replyLabels.hasNext()) {
+ String replyLabel=replyLabels.next();
+
+ java.util.List<ESBService> services=replyServices.get(replyLabel);
+
+ if (services.size() == 1) {
+ ESBService serv=services.get(0);
+
+ serv.setName(replyLabel);
+ } else {
+ ESBService subService=
+ esbModel.createService(service.getCategory(),
+ replyLabel);
+
+ esbModel.addService(subService);
+
+ SwitchAction subSwitchAction=
+ new SwitchAction(subService);
+
+ subService.addAction(subSwitchAction, -1);
+
+ for (int i=0; i < services.size(); i++) {
+ ESBService serv=services.get(i);
+
+ subSwitchAction.addCase(serv.getCategory(),
+ serv.getName(),
+ replyServiceMTypes.get(serv), -1);
+ }
+ }
+ }
+
// Only record message router 'routes' if the switch
// receives request interactions, and it is the first
// session based action in the service
@@ -485,6 +556,25 @@
}
*/
}
+
+ protected String getReplyLabel(java.util.Set<Interaction> interactions) {
+ String ret=null;
+
+ if (interactions != null) {
+ java.util.Iterator<Interaction> iter=
+ interactions.iterator();
+
+ while (ret == null && iter.hasNext()) {
+ Interaction interaction=iter.next();
+ if (InteractionUtil.isSend(interaction) == false) {
+ ret = interaction.getReplyToLabel();
+ }
+ }
+ }
+
+ return(ret);
+ }
+
private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.runtime.jbossesb.model.change.stateless");
}
15 years, 2 months
Overlord SVN: r487 - in cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb: pi4soa and 1 other directory.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2009-02-10 13:06:51 -0500 (Tue, 10 Feb 2009)
New Revision: 487
Modified:
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/AbstractServiceValidator.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/Endpoint.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidator.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorName.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/Pi4SOAServiceValidator.java
Log:
Updates following testing.
Modified: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/AbstractServiceValidator.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/AbstractServiceValidator.java 2009-02-10 17:59:36 UTC (rev 486)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/AbstractServiceValidator.java 2009-02-10 18:06:51 UTC (rev 487)
@@ -46,7 +46,9 @@
/**
* This method returns the input stream associated
- * with the model.
+ * 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
@@ -60,5 +62,9 @@
return(ret);
}
+ public String toString() {
+ return("ServiceValidator["+getValidatorName()+"]");
+ }
+
private ValidatorName m_name=null;
}
Modified: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/Endpoint.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/Endpoint.java 2009-02-10 17:59:36 UTC (rev 486)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/Endpoint.java 2009-02-10 18:06:51 UTC (rev 487)
@@ -77,6 +77,10 @@
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>();
Modified: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidator.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidator.java 2009-02-10 17:59:36 UTC (rev 486)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidator.java 2009-02-10 18:06:51 UTC (rev 487)
@@ -53,8 +53,10 @@
/**
* This method is called to update the model associated
* with the service validator.
+ *
+ * @throws Exception Failed to update the service validator
*/
- public void update();
+ public void update() throws Exception;
/**
* This method closes the service validator.
Modified: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java 2009-02-10 17:59:36 UTC (rev 486)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java 2009-02-10 18:06:51 UTC (rev 487)
@@ -391,16 +391,22 @@
name = new ValidatorName(role);
}
- // Obtain the service container
- sm = createServiceValidator(name);
-
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Service validator for '"+modelName+
- "' and role '"+role+"' = "+sm);
- }
-
- // Remove validator name from list
- existingValidatorNames.remove(sm.getValidatorName());
+
+ try {
+ // Obtain the service container
+ sm = createServiceValidator(name);
+
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Service validator for '"+modelName+
+ "' and role '"+role+"' = "+sm);
+ }
+
+ // Remove validator name from list
+ existingValidatorNames.remove(sm.getValidatorName());
+ } catch(Exception e) {
+ logger.log(Level.SEVERE, "Failed to create service validator '"+
+ name+"'", e);
+ }
} else {
logger.severe("Model name must be specified in validation mode");
}
@@ -432,7 +438,9 @@
m_inputValidators.put(endpoint, svs);
}
- svs.add(sm);
+ if (svs.contains(sm) == false) {
+ svs.add(sm);
+ }
existingInputEndpoints.remove(endpoint);
}
@@ -461,7 +469,9 @@
m_outputValidators.put(endpoint, svs);
}
- svs.add(sm);
+ if (svs.contains(sm) == false) {
+ svs.add(sm);
+ }
existingOutputEndpoints.remove(endpoint);
}
@@ -571,6 +581,10 @@
ret = files[i].lastModified();
}
}
+
+ if (ret < m_modelsDir.lastModified()) {
+ ret = m_modelsDir.lastModified();
+ }
}
return(ret);
Modified: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorName.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorName.java 2009-02-10 17:59:36 UTC (rev 486)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorName.java 2009-02-10 18:06:51 UTC (rev 487)
@@ -103,7 +103,8 @@
boolean ret=false;
if (obj instanceof ValidatorName) {
- ret = obj.toString().equals(toString());
+ ret = (obj.toString().equals(toString()) &&
+ ((ValidatorName)obj).m_validate == m_validate);
}
return(ret);
Modified: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/Pi4SOAServiceValidator.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/Pi4SOAServiceValidator.java 2009-02-10 17:59:36 UTC (rev 486)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/Pi4SOAServiceValidator.java 2009-02-10 18:06:51 UTC (rev 487)
@@ -39,8 +39,10 @@
* validator implementation.
*
* @param name The validator name
+ * @throws Exception Failed to initialize service validator
*/
- public Pi4SOAServiceValidator(ValidatorName name) {
+ public Pi4SOAServiceValidator(ValidatorName name)
+ throws Exception {
super(name);
update();
@@ -59,8 +61,10 @@
/**
* This method is called to update the model associated
* with the service validator.
+ *
+ * @throws Exception Failed to update the service validator
*/
- public void update() {
+ public void update() throws Exception {
if (logger.isLoggable(Level.FINE)) {
logger.fine("Update: "+getValidatorName());
@@ -72,6 +76,13 @@
org.pi4soa.service.behavior.ServiceDescription sdesc=
org.pi4soa.service.util.DescriptionRetrievalUtil.instance().getServiceDescription(is,
getValidatorName().getRole());
+
+ try {
+ is.close();
+ } catch(Exception e) {
+ logger.log(Level.SEVERE, "Failed to close model '"+
+ getValidatorName()+"' input stream", e);
+ }
if (sdesc != null) {
@@ -134,6 +145,9 @@
} else {
logger.severe("Unable to obtain model for validator '"+
getValidatorName()+"'");
+
+ throw new java.io.IOException("Failed to locate model '"+
+ getValidatorName().getModelName()+"'");
}
}
15 years, 2 months
Overlord SVN: r486 - cdl/trunk/distribution/validator/jbossesb/pi4soa.sar.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2009-02-10 12:59:36 -0500 (Tue, 10 Feb 2009)
New Revision: 486
Added:
cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.cdl_2.0.0.200902101645.jar
cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.common_2.0.0.200902101645.jar
cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.j2ee_2.0.0.200902101645.jar
cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.jboss_2.0.0.200902101645.jar
cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.jbossesb_2.0.0.200902101645.jar
cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.service_2.0.0.200902101645.jar
Removed:
cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.cdl_2.0.0.200810241341.jar
cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.common_2.0.0.200810241341.jar
cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.j2ee_2.0.0.200810241341.jar
cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.jboss_2.0.0.200810241341.jar
cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.jbossesb_2.0.0.200810241341.jar
cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.service_2.0.0.200810241341.jar
Log:
Updated pi4soa jars.
Deleted: cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.cdl_2.0.0.200810241341.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.cdl_2.0.0.200902101645.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.cdl_2.0.0.200902101645.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.common_2.0.0.200810241341.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.common_2.0.0.200902101645.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.common_2.0.0.200902101645.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.j2ee_2.0.0.200810241341.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.j2ee_2.0.0.200902101645.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.j2ee_2.0.0.200902101645.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.jboss_2.0.0.200810241341.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.jboss_2.0.0.200902101645.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.jboss_2.0.0.200902101645.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.jbossesb_2.0.0.200810241341.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.jbossesb_2.0.0.200902101645.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.jbossesb_2.0.0.200902101645.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.service_2.0.0.200810241341.jar
===================================================================
(Binary files differ)
Added: cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.service_2.0.0.200902101645.jar
===================================================================
(Binary files differ)
Property changes on: cdl/trunk/distribution/validator/jbossesb/pi4soa.sar/org.pi4soa.service_2.0.0.200902101645.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 2 months
Overlord SVN: r485 - in cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb: action and 1 other directories.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2009-02-10 06:12:34 -0500 (Tue, 10 Feb 2009)
New Revision: 485
Added:
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/AbstractServiceValidator.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/DefaultValidatorConfig.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/Endpoint.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidator.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorFactory.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorConfig.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorConfigFactory.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorConfigLoader.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorName.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/action/
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/action/ValidationAction.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/Pi4SOAServiceRecorder.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/Pi4SOAServiceValidator.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/Pi4SOAValidatorConfigLoader.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/ValidatorConfigGenerator.java
Removed:
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidationAction.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorGenerator.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorManager.java
Modified:
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ESBUtil.java
cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorFilter.java
Log:
Updated service validator to incorporate an update mechanism. Currently the ValidationAction is not functional.
Added: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/AbstractServiceValidator.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/AbstractServiceValidator.java (rev 0)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/AbstractServiceValidator.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -0,0 +1,64 @@
+/*
+ * 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.soa.overlord.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.
+ *
+ * @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);
+ }
+
+ private ValidatorName m_name=null;
+}
Added: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/DefaultValidatorConfig.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/DefaultValidatorConfig.java (rev 0)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/DefaultValidatorConfig.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -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.soa.overlord.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;
+}
Modified: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ESBUtil.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ESBUtil.java 2009-02-09 20:27:42 UTC (rev 484)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ESBUtil.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -19,17 +19,18 @@
import java.util.logging.Logger;
-import org.pi4soa.common.util.NamesUtil;
-import org.pi4soa.common.xml.NameSpaceUtil;
-
+/**
+ * This class provides utility functions for processing
+ * ESB messages.
+ */
public class ESBUtil {
/**
- * This method returns the pi4soa message associated
+ * This method returns the message content associated
* with the supplied JBoss ESB message.
*
* @param message The esb message
- * @return The pi4soa message
+ * @return The message content
*/
public static java.io.Serializable getMessage(
org.jboss.soa.esb.message.Message message) {
@@ -58,7 +59,8 @@
} else if (message.getBody().getNames() != null &&
message.getBody().getNames().length > 1) {
- java.util.Hashtable multipart=new java.util.Hashtable();
+ 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],
@@ -76,74 +78,5 @@
return(ret);
}
- /**
- * This method returns the JBoss ESB message associated
- * with the supplied pi4soa message.
- *
- * @param message The pi4soa message
- * @return The esb message
- */
- public static org.jboss.soa.esb.message.Message getMessage(
- org.pi4soa.service.Message message) {
- org.jboss.soa.esb.message.Message ret=
- org.jboss.soa.esb.message.format.MessageFactory.getInstance().getMessage();
-
- // Check if multi-part message
- if (message.isMultiPart()) {
- if (message.getValue() instanceof java.util.Map) {
- java.util.Map parts=(java.util.Map)message.getValue();
-
- java.util.Iterator iter=parts.keySet().iterator();
- while (iter.hasNext()) {
- String key=(String)iter.next();
-
- ret.getBody().add(key, parts.get(key));
- }
- } else {
- logger.severe("JBossESB message " +
- "is not a valid multi-part message");
- }
- } else {
- ret.getBody().add(message.getValue());
- }
-
- // Determine if the message represents a fault
- if (NamesUtil.isSet(message.getFaultName())) {
- String namespace=NameSpaceUtil.getNamespace(message.getFaultName());
- String localpart=NameSpaceUtil.getLocalPart(message.getFaultName());
-
- try {
- ret.getFault().setCode(new java.net.URI(
- namespace+"/"+localpart));
- } catch(Exception e) {
- logger.severe("JBossESB message " +
- "failed to set fault code: "+e);
- }
- }
-
- return(ret);
- }
-
- public static String encodeServiceParameter(String param) {
- return(param.replaceAll(":", "/colon/"));
- }
-
- public static String decodeServiceParameter(String param) {
- return(param.replaceAll("/colon/", ":"));
- }
-
- public static String getCategory(String category) {
- String ret=category;
-
- if (ret.startsWith("http://")) {
- ret = ret.substring(7);
- }
-
- // Convert '/' into another separator
- ret = ret.replace('/', '_');
-
- return(ret);
- }
-
- private static Logger logger = Logger.getLogger("org.pi4soa.jbossesb.util");
+ private static Logger logger = Logger.getLogger("org.jboss.soa.overlord.validator.jbossesb");
}
Added: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/Endpoint.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/Endpoint.java (rev 0)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/Endpoint.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -0,0 +1,83 @@
+/*
+ * 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.soa.overlord.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);
+ }
+
+ private String m_destination=null;
+ private java.util.List<ServiceValidator> m_validators=
+ new java.util.Vector<ServiceValidator>();
+}
Added: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidator.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidator.java (rev 0)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidator.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -0,0 +1,66 @@
+/*
+ * 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.soa.overlord.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.
+ */
+ public void update();
+
+ /**
+ * This method closes the service validator.
+ *
+ * @throws Exception Failed to close the service validator
+ */
+ public void close() throws Exception;
+
+}
Added: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorFactory.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorFactory.java (rev 0)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorFactory.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -0,0 +1,72 @@
+/*
+ * 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.soa.overlord.validator.jbossesb;
+
+import java.lang.reflect.Constructor;
+import java.util.logging.Level;
+import java.util.logging.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.isLoggable(Level.FINE)) {
+ logger.fine("Returning service validator for "+
+ name+": "+ret);
+ }
+
+ return(ret);
+ }
+
+ private static final Logger logger = Logger.getLogger("org.jboss.soa.overlord.validator.jbossesb");
+
+ private static java.util.Map<String,Class<?>> m_validatorClasses=
+ new java.util.HashMap<String,Class<?>>();
+
+ static {
+ m_validatorClasses.put(org.jboss.soa.overlord.validator.jbossesb.pi4soa.Pi4SOAServiceRecorder.getModelType(),
+ org.jboss.soa.overlord.validator.jbossesb.pi4soa.Pi4SOAServiceRecorder.class);
+ m_validatorClasses.put(org.jboss.soa.overlord.validator.jbossesb.pi4soa.Pi4SOAServiceValidator.getModelType(),
+ org.jboss.soa.overlord.validator.jbossesb.pi4soa.Pi4SOAServiceValidator.class);
+ }
+}
Copied: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java (from rev 479, cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorManager.java)
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java (rev 0)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -0,0 +1,581 @@
+/*
+ * 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.soa.overlord.validator.jbossesb;
+
+import java.util.logging.Level;
+import java.util.logging.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) {
+ return(m_inputValidators.get(endpoint));
+ }
+
+ /**
+ * 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) {
+ return(m_outputValidators.get(endpoint));
+ }
+
+ /**
+ * 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.isLoggable(Level.FINE)) {
+ logger.fine("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.severe("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.severe("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.io.InputStream is=ValidatorFilter.class.getClassLoader().
+ getResourceAsStream(CONFIG_FILE);
+
+ if (logger.isLoggable(Level.FINEST)) {
+ logger.finest("ValidationFilter: config="+CONFIG_FILE+" is="+is);
+ }
+
+ try {
+ updateConfiguration(ConfigTree.fromInputStream(is), existingValidatorNames,
+ existingInputEndpoints, existingOutputEndpoints);
+
+ // 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 config=vm.getConfiguration();
+
+ if (config != null) {
+ updateConfiguration(config,
+ existingValidatorNames,
+ existingInputEndpoints,
+ existingOutputEndpoints);
+ } else {
+ logger.severe("Failed to obtain configuration for model '"+
+ files[i].getName()+"'");
+ }
+ }
+ } catch(Exception e) {
+ logger.log(Level.SEVERE,
+ "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);
+ }
+
+ // Any remaining output keys need to be removed
+ iter = existingOutputEndpoints.iterator();
+
+ while (iter.hasNext()) {
+ Endpoint key=iter.next();
+ m_outputValidators.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.info("Removing service validator: "+svkey);
+ removeServiceValidator(svkey);
+ } catch(Exception e) {
+ logger.log(Level.SEVERE,
+ "Failed to remove service validator: "+svkey, e);
+ }
+ }
+ } catch(Exception e) {
+ logger.log(Level.SEVERE,
+ "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
+ */
+ protected void updateConfiguration(ConfigTree config,
+ java.util.Set<ValidatorName> existingValidatorNames,
+ java.util.Set<Endpoint> existingInputEndpoints,
+ java.util.Set<Endpoint> existingOutputEndpoints) {
+ logger.info("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.info("Setting validator into active mode");
+ m_active = true;
+ }
+ }
+
+ ConfigTree[] services=config.getChildren(SERVICE_NODE);
+
+ if (logger.isLoggable(Level.FINEST)) {
+ if (services != null) {
+ logger.finest("ValidationFilter: services="+services.length);
+ } else {
+ logger.finest("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_NAME);
+ String role=
+ services[i].getAttribute(ROLE_NAME);
+ boolean validate=
+ services[i].getBooleanAttribute(VALIDATE, 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.isLoggable(Level.FINE)) {
+ logger.fine("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);
+
+ }
+ // Obtain the service container
+ sm = createServiceValidator(name);
+
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("Service validator for '"+modelName+
+ "' and role '"+role+"' = "+sm);
+ }
+
+ // Remove validator name from list
+ existingValidatorNames.remove(sm.getValidatorName());
+ } else {
+ logger.severe("Model name must be specified in validation mode");
+ }
+ } else {
+ logger.severe("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.isLoggable(Level.FINEST)) {
+ logger.finest("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);
+ }
+
+ svs.add(sm);
+
+ existingInputEndpoints.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.isLoggable(Level.FINEST)) {
+ logger.finest("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);
+ }
+
+ svs.add(sm);
+
+ existingOutputEndpoints.remove(endpoint);
+ }
+ }
+ }
+ }
+ } catch(Exception e) {
+ logger.log(java.util.logging.Level.SEVERE,
+ "Failed to load validator config", e);
+ }
+ }
+ }
+
+ /**
+ * This method returns whether the service validator configuration
+ * is in 'active' mode. If yes, then invalid messages will
+ * be blocked from being delivered to their destination.
+ *
+ * @return Whether the service validator is in 'active' mode
+ */
+ public boolean isActive() {
+ return(m_active);
+ }
+
+ private static final Logger logger = Logger.getLogger("org.jboss.soa.overlord.validator.jbossesb");
+
+ private static final String EPR_ATTR = "epr";
+ 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 VALIDATOR_NODE = "validator";
+
+ private static final String CONFIG_FILE = "validator-config.xml";
+ public static final String MODEL_NAME="model";
+ public static final String ROLE_NAME="role";
+ public static final String VALIDATE="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 boolean m_active=false;
+
+ /**
+ * 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.info("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();
+ }
+ }
+ }
+
+ return(ret);
+ }
+
+ private long m_lastUpdate=0;
+ }
+}
Property changes on: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ServiceValidatorManager.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidationAction.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidationAction.java 2009-02-09 20:27:42 UTC (rev 484)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidationAction.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -1,247 +0,0 @@
-/*
- * 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.soa.overlord.validator.jbossesb;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.jboss.soa.esb.actions.*;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-
-import org.pi4soa.common.util.MessageUtil;
-import org.pi4soa.service.*;
-import org.pi4soa.service.behavior.*;
-import org.pi4soa.service.monitor.*;
-import org.pi4soa.common.util.NamesUtil;
-
-/**
- * This class provides the action implementation for validation
- * against the pi4soa state machine.
- */
-public class ValidationAction extends AbstractActionLifecycle {
-
- private static final String ACTIVE_ATTR = "active";
- private static final String INBOUND_ATTR = "inbound";
- public static final String CDM_FILE_PATH="cdmFilePath";
- public static final String PARTICIPANT_TYPE="participantType";
-
- /**
- * This constructor initializes the actions with the
- * service configuration details.
- *
- * @param config The service configuration
- */
- public ValidationAction(ConfigTree config) {
- m_config = config;
- }
-
- /**
- * This method initializes the service action.
- */
- public void initialise() throws ActionLifecycleException {
-
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("ValidationAction initialise: "+this);
- }
-
- super.initialise();
-
- String direction=
- m_config.getAttribute(INBOUND_ATTR);
-
- if (direction != null && direction.equalsIgnoreCase("false")) {
- m_inbound = false;
- }
-
- String active=
- m_config.getAttribute(ACTIVE_ATTR);
-
- if (active != null && active.equalsIgnoreCase("false")) {
- m_active = false;
- }
-
- getServiceMonitor();
- }
-
- /**
- * This method returns the service monitor associated with
- * the ESB service.
- *
- * @return The service monitor
- */
- protected synchronized ServiceMonitor getServiceMonitor() {
-
- if (m_serviceMonitor == null) {
-
- try {
- ServiceDescription sdesc=null;
- String cdmFilePath=
- m_config.getAttribute(CDM_FILE_PATH);
- String participantType=
- m_config.getAttribute(PARTICIPANT_TYPE);
-
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("ValidationAction config: cdm="+
- cdmFilePath+" participant="+participantType);
- }
-
- if (NamesUtil.isSet(cdmFilePath) &&
- NamesUtil.isSet(participantType)) {
-
- java.io.InputStream is=ValidationAction.class.
- getClassLoader().getResourceAsStream(cdmFilePath);
-
- if (is == null) {
-
- is = ClassLoader.getSystemResourceAsStream(cdmFilePath);
-
- if (is == null) {
- throw new ServiceException("Failed to locate path '"+
- cdmFilePath+"'");
- }
- }
-
- if (is != null) {
- sdesc = org.pi4soa.service.util.DescriptionRetrievalUtil.instance().getServiceDescription(is, participantType);
- }
- } else {
- logger.severe("Choreography file and Participant Type not specified: "+this);
- }
-
- if (sdesc != null) {
- m_serviceDescriptionName = sdesc.getFullyQualifiedName();
-
- // Obtain the service container
- m_serviceMonitor = ValidatorManager.createServiceContainer(
- sdesc);
- } else {
- logger.severe("Service description could not be loaded: "+
- cdmFilePath+" participant="+participantType);
- }
-
- } catch(Exception e) {
- logger.log(Level.SEVERE,
- "Failed to initialize ValidationAction", e);
- }
- }
-
- return(m_serviceMonitor);
- }
-
- /**
- * This method processes a message for the service associated
- * with this ESB action.
- *
- * @param message The message
- * @return The message
- */
- public Message processMessage(Message message) throws ActionProcessingException {
-
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("ValidationAction: "+this+" message="+message);
- }
-
- try {
- java.io.Serializable value=ESBUtil.getMessage(message);
-
- if (value == null) {
- throw new ServiceException("Failed to obtain value from message: "+message);
- }
-
- String mesgType=MessageUtil.getMessageType(value);
-
- org.pi4soa.service.Message mesg=
- getServiceMonitor().createMessage(mesgType, null,
- null, value, null, null);
-
- try {
- if (m_inbound) {
- getServiceMonitor().messageReceived(mesg);
- } else {
- getServiceMonitor().messageSent(mesg);
- }
- } catch(OutOfSequenceMessageException osme) {
-
- if (m_active) {
- throw osme;
- } else {
- logger.severe("Out of sequence message detected");
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest(message.toString());
- }
- }
- } catch(UnexpectedMessageException ume) {
-
- if (m_active) {
- throw ume;
- } else {
- logger.severe("Unexpected message detected");
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest(message.toString());
- }
- }
- }
-
- } catch(Throwable t) {
- logger.log(java.util.logging.Level.SEVERE,
- "Failed to handle message", t);
-
- throw new ActionProcessingException("Failed to handle message", t);
- }
-
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("ValidationAction: "+this+
- "serviceDescriptionName="+
- m_serviceDescriptionName+
- " finished processing message="+message);
- }
-
- return(message);
- }
-
- /**
- * This method is called to tidy up after the action is
- * no longer required.
- */
- public void destroy() throws ActionLifecycleException {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("ValidationAction destroy: "+this);
- }
-
- super.destroy();
-
- if (m_serviceMonitor != null &&
- m_serviceDescriptionName != null) {
- try {
- ValidatorManager.releaseServiceMonitor(m_serviceDescriptionName);
- } catch(org.pi4soa.service.ServiceException se) {
- throw new ActionLifecycleException("Failed to destroy service monitor",
- se);
- }
- }
- }
-
- private static final Logger logger = Logger.getLogger("org.pi4soa.jbossesb.validator");
-
- private ConfigTree m_config=null;
- private String m_serviceDescriptionName=null;
- private ServiceMonitor m_serviceMonitor=null;
- private boolean m_inbound=true;
- private boolean m_active=true;
-}
\ No newline at end of file
Added: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorConfig.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorConfig.java (rev 0)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorConfig.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -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.soa.overlord.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: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorConfigFactory.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorConfigFactory.java (rev 0)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorConfigFactory.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -0,0 +1,98 @@
+/*
+ * 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.soa.overlord.validator.jbossesb;
+
+import java.util.logging.Level;
+import java.util.logging.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.isLoggable(Level.FINE)) {
+ logger.fine("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("org.jboss.soa.overlord.validator.jbossesb");
+
+ private static java.util.List<ValidatorConfigLoader> m_loaders=
+ new java.util.Vector<ValidatorConfigLoader>();
+
+ static {
+ m_loaders.add(new org.jboss.soa.overlord.validator.jbossesb.pi4soa.Pi4SOAValidatorConfigLoader());
+ }
+}
Added: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorConfigLoader.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorConfigLoader.java (rev 0)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorConfigLoader.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -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.soa.overlord.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;
+
+}
Modified: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorFilter.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorFilter.java 2009-02-09 20:27:42 UTC (rev 484)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorFilter.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -22,84 +22,53 @@
import org.jboss.soa.esb.message.*;
import org.jboss.soa.esb.couriers.*;
-import org.jboss.soa.esb.helpers.*;
-import org.pi4soa.common.util.MessageUtil;
-import org.pi4soa.common.util.NamesUtil;
-import org.pi4soa.common.xml.XMLUtils;
-import org.pi4soa.service.OutOfSequenceMessageException;
-import org.pi4soa.service.ServiceException;
-import org.pi4soa.service.UnexpectedMessageException;
-import org.pi4soa.service.monitor.*;
-import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
-
+/**
+ * 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 CONFIG_FILE = "validator-config.xml";
- public static final String CDM_FILE_PATH="cdmFilePath";
- public static final String PARTICIPANT_TYPE="participantType";
- public static final String VALIDATE="validate";
+ 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() {
- initialize();
}
+ /**
+ * 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 {
- String key=getKey(msg);
-
- if (key != null) {
- ServiceMonitor sm=(ServiceMonitor)m_outputServices.get(key);
+ Endpoint endpoint=getEndpoint(msg);
+
+ if (endpoint != null) {
+ java.util.List<ServiceValidator> validators=
+ ServiceValidatorManager.instance().getOutputServiceValidators(endpoint);
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("ValidationFilter: "+this+" message="+
- msg+" monitor="+sm);
- }
-
- if (sm != null) {
+ for (int i=0; validators != null &&
+ i < validators.size(); i++) {
+
try {
- java.io.Serializable value=ESBUtil.getMessage(msg);
+ validators.get(i).messageSent(msg);
- if (value == null) {
- throw new ServiceException("Failed to obtain value from message: "+msg);
- }
-
- String mesgType=MessageUtil.getMessageType(value);
-
- org.pi4soa.service.Message mesg=
- sm.createMessage(mesgType,
- null, null, value, null, null);
-
- try {
- sm.messageSent(mesg);
- } catch(OutOfSequenceMessageException osme) {
-
- if (m_active) {
- throw osme;
- } else {
- logger.severe("Out of sequence message detected");
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest(msg.toString());
- }
- }
- } catch(UnexpectedMessageException ume) {
-
- if (m_active) {
- throw ume;
- } else {
- logger.severe("Unexpected message detected");
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest(msg.toString());
- }
- }
- }
-
} catch(Throwable t) {
logger.log(java.util.logging.Level.SEVERE,
- "Failed to handle message", t);
+ "Failed to handle sent message", t);
- throw new CourierException("Failed to handle message", t);
+ if (ServiceValidatorManager.instance().isActive()) {
+ throw new CourierException("Failed to handle sent message", t);
+ }
}
}
}
@@ -107,61 +76,36 @@
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 {
- String key=getKey(msg);
-
- if (key != null) {
- ServiceMonitor sm=(ServiceMonitor)m_inputServices.get(key);
+ Endpoint endpoint=getEndpoint(msg);
+
+ if (endpoint != null) {
+ java.util.List<ServiceValidator> validators=
+ ServiceValidatorManager.instance().getInputServiceValidators(endpoint);
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("ValidationFilter: "+this+" message="+msg+" monitor="+sm);
- }
-
- if (sm != null) {
+ for (int i=0; validators != null &&
+ i < validators.size(); i++) {
+
try {
- java.io.Serializable value=ESBUtil.getMessage(msg);
+ validators.get(i).messageReceived(msg);
- if (value == null) {
- throw new ServiceException("Failed to obtain value from message: "+msg);
- }
-
- String mesgType=MessageUtil.getMessageType(value);
-
- org.pi4soa.service.Message mesg=
- sm.createMessage(mesgType,
- null, null, value, null, null);
-
- try {
- sm.messageReceived(mesg);
- } catch(OutOfSequenceMessageException osme) {
-
- if (m_active) {
- throw osme;
- } else {
- logger.severe("Out of sequence message detected");
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest(msg.toString());
- }
- }
- } catch(UnexpectedMessageException ume) {
-
- if (m_active) {
- throw ume;
- } else {
- logger.severe("Unexpected message detected");
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest(msg.toString());
- }
- }
- }
-
} catch(Throwable t) {
logger.log(java.util.logging.Level.SEVERE,
- "Failed to handle message", t);
+ "Failed to handle received message", t);
- throw new CourierException("Failed to handle message", t);
+ if (ServiceValidatorManager.instance().isActive()) {
+ throw new CourierException("Failed to handle received message", t);
+ }
}
}
}
@@ -169,251 +113,15 @@
return(msg);
}
- protected void initialize() {
-
- java.net.URL url=
- ValidatorFilter.class.getClassLoader().getResource(CONFIG_FILE);
-
- System.out.println("CONFIG FILE URL="+url);
- System.out.println("CONFIG FILE URL TYPE="+url.getClass());
-
- if (url != null) {
- java.io.File file=new java.io.File(url.getFile());
-
- java.io.File[] files=file.getParentFile().listFiles();
- java.io.File models=null;
-
- for (int i=0; models == null && i < files.length; i++) {
- if (files[i].getName().equals("models") &&
- files[i].isDirectory()) {
- models = files[i];
- }
- }
-
- if (models != null) {
- ValidatorConfigChangeMonitor mon=new ValidatorConfigChangeMonitor(file, models);
-
- new Thread(mon).start();
- }
- }
- }
-
/**
- * 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.
- */
- protected void updateConfiguration(java.io.InputStream is,
- java.util.Set<String> existingServiceDescriptions,
- java.util.Set<String> existingInputKeys,
- java.util.Set<String> existingOutputKeys) {
-
- try {
- updateConfiguration(ConfigTree.fromInputStream(is),
- existingServiceDescriptions, existingInputKeys,
- existingOutputKeys);
- } catch(Exception e) {
-
- logger.log(Level.SEVERE,
- "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.
- */
- protected void updateConfiguration(org.w3c.dom.Element elem,
- java.util.Set<String> existingServiceDescriptions,
- java.util.Set<String> existingInputKeys,
- java.util.Set<String> existingOutputKeys) {
-
- try {
- updateConfiguration(ConfigTree.fromElement(elem),
- existingServiceDescriptions, existingInputKeys,
- existingOutputKeys);
- } catch(Exception e) {
-
- logger.log(Level.SEVERE,
- "Failed to update configuration from DOM element", 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.
- */
- protected void updateConfiguration(ConfigTree config,
- java.util.Set<String> existingServiceDescriptions,
- java.util.Set<String> existingInputKeys,
- java.util.Set<String> existingOutputKeys) {
- logger.info("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.info("Setting validator into active mode");
- m_active = true;
- }
- }
-
- ConfigTree[] services=config.getChildren(SERVICE_NODE);
-
- if (logger.isLoggable(Level.FINEST)) {
- if (services != null) {
- logger.finest("ValidationFilter: services="+services.length);
- } else {
- logger.finest("ValidationFilter: services null");
- }
- }
-
- for (int i=0; i < services.length; i++) {
- org.pi4soa.service.monitor.ServiceMonitor sm=null;
-
- // Create service monitor for service
- String cdmFilePath=
- services[i].getAttribute(CDM_FILE_PATH);
- String participantType=
- services[i].getAttribute(PARTICIPANT_TYPE);
- boolean validate=
- services[i].getBooleanAttribute(VALIDATE, true);
-
- if (NamesUtil.isSet(participantType)) {
-
- if (NamesUtil.isSet(cdmFilePath)) {
- java.io.InputStream is = ValidatorFilter.class.
- getClassLoader().getResourceAsStream(
- cdmFilePath);
-
- if (is != null) {
- org.pi4soa.service.behavior.ServiceDescription sdesc=
- org.pi4soa.service.util.DescriptionRetrievalUtil.instance().getServiceDescription(is, participantType);
-
- if (sdesc != null) {
-
- // Obtain the service container
- sm = ValidatorManager.createServiceContainer(sdesc, validate);
-
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Service monitor for '"+cdmFilePath+
- "' and participantType '"+participantType+"' = "+sm);
- }
-
- // Remove service description from list
- existingServiceDescriptions.remove(sdesc.getFullyQualifiedName());
-
- } else {
- logger.severe("Service description could not be loaded");
- }
-
- } else {
- logger.severe("Choreography file path not found: "+this);
- }
- } else if (validate == false) {
-
- logger.fine("Create non-validating service monitor for: "+
- participantType);
-
- // Just record information for participant
- // using the service tracker
- org.pi4soa.service.behavior.ServiceDescription sdesc=
- org.pi4soa.service.behavior.BehaviorFactory.eINSTANCE.createServiceDescription();
- sdesc.setName(participantType);
-
- sm = ValidatorManager.createServiceContainer(sdesc, validate);
-
- // Remove service description from list
- existingServiceDescriptions.remove(sdesc.getFullyQualifiedName());
-
- } else {
- logger.severe("Choreography file path not specified: "+this);
- }
- } else {
- logger.severe("Participant type not specified: "+this);
- }
-
- 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) {
-
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Storing input epr '"+
- epr+"' against monitor: "+sm);
- }
-
- // Check if EPR associated with different
- // input service
- ServiceMonitor tmp=m_inputServices.get(epr);
-
- if (tmp != null && tmp != sm) {
- logger.severe("Input EPR '"+epr+
- "' already associated with another Service Monitor");
- }
-
- m_inputServices.put(epr, sm);
-
- existingInputKeys.remove(epr);
- }
- }
-
- // 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) {
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Storing output epr '"+
- epr+"' against monitor: "+sm);
- }
-
- // Check if EPR associated with different
- // output service
- ServiceMonitor tmp=m_outputServices.get(epr);
-
- if (tmp != null && tmp != sm) {
- logger.severe("Output EPR '"+epr+
- "' already associated with another Service Monitor");
- }
-
- m_outputServices.put(epr, sm);
-
- existingOutputKeys.remove(epr);
- }
- }
- }
- }
- } catch(Exception e) {
- logger.log(java.util.logging.Level.SEVERE,
- "Failed to load validator config", e);
- }
- }
- }
-
- /**
- * This method returns a key associated with the 'to'
+ * This method returns an endpoint associated with the 'to'
* destination of the supplied message.
*
* @param msg The message
- * @return The key, or null if not relevant
+ * @return The endpoint, or null if not relevant
*/
- protected String getKey(Message msg) {
- String ret=null;
+ protected Endpoint getEndpoint(Message msg) {
+ Endpoint ret=null;
if (msg != null && msg.getHeader() != null &&
msg.getHeader().getCall() != null &&
@@ -426,191 +134,16 @@
if (key.startsWith(JMS_PROTOCOL_PREFIX) &&
((ind=key.indexOf(QUEUE_PREFIX)) != -1 ||
(ind=key.indexOf(TOPIC_PREFIX)) != -1)) {
- ret = JMS_PROTOCOL_PREFIX+key.substring(ind);
+ ret = new Endpoint(JMS_PROTOCOL_PREFIX+key.substring(ind));
}
}
if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Key for message '"+msg+"' is: "+ret);
+ logger.finest("Destination for message '"+msg+"' is: "+ret);
}
return(ret);
}
- private static final Logger logger = Logger.getLogger("org.pi4soa.jbossesb.validator");
-
- private static final String TOPIC_PREFIX = "topic/";
- private static final String QUEUE_PREFIX = "queue/";
- private static final String JMS_PROTOCOL_PREFIX = "jms:";
- private static final String EPR_ATTR = "epr";
- 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 VALIDATOR_NODE = "validator";
-
- private java.util.Map<String,ServiceMonitor> m_inputServices=new java.util.Hashtable<String,ServiceMonitor>();
- private java.util.Map<String,ServiceMonitor> m_outputServices=new java.util.Hashtable<String,ServiceMonitor>();
- private boolean m_active=false;
-
- public class ValidatorConfigChangeMonitor implements java.lang.Runnable {
-
- public ValidatorConfigChangeMonitor(java.io.File validatorConfigFile,
- java.io.File modelsDir) {
- m_validatorConfigFile = validatorConfigFile;
- m_modelsDir = modelsDir;
-
- // 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.info("Checking for config updates");
-
- // Get last update time
- long lastUpdate=getLastUpdate();
-
- if (lastUpdate > m_lastUpdate) {
-
- updateConfigurations();
-
- m_lastUpdate = lastUpdate;
- }
- }
-
- protected void updateConfigurations() {
- java.util.Set<String> existingServiceDescriptions=
- ValidatorManager.getServiceDescriptionNames();
-
- java.util.Set<String> existingInputKeys=
- new java.util.HashSet<String>(m_inputServices.keySet());
-
- java.util.Set<String> existingOutputKeys=
- new java.util.HashSet<String>(m_outputServices.keySet());
-
- java.io.InputStream is=ValidatorFilter.class.getClassLoader().
- getResourceAsStream(CONFIG_FILE);
-
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("ValidationFilter: config="+CONFIG_FILE+" is="+is);
- }
-
- updateConfiguration(is, existingServiceDescriptions,
- existingInputKeys, existingOutputKeys);
-
- // Work through choreography files in the models directory
- java.io.File[] files=m_modelsDir.listFiles();
-
- for (int i=0; i < files.length; i++) {
- if (files[i].getName().endsWith(".cdm")) {
-
- try {
- java.io.FileInputStream fis=new java.io.FileInputStream(files[i]);
-
- org.pi4soa.cdl.Package cdlpack=
- org.pi4soa.service.util.DescriptionRetrievalUtil.instance().getCDLPackage(fis);
-
- ValidatorGenerator generator=new ValidatorGenerator();
-
- org.w3c.dom.Element validator=
- generator.generate(cdlpack, files[i].getName());
-
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("ValidationFilter: model="+files[i].getName()+
- " cdlpack="+cdlpack+" config=\r\n"+
- XMLUtils.getText(validator, true));
- }
-
- updateConfiguration(validator,
- existingServiceDescriptions,
- existingInputKeys, existingOutputKeys);
-
- fis.close();
- } catch(Exception e) {
- logger.log(Level.SEVERE,
- "Failed to update configuration for model '"+
- files[i].getName()+"'", e);
- }
- }
- }
-
- // Any remaining service description names need to
- // have their associated monitors removed
- java.util.Iterator<String> iter=
- existingServiceDescriptions.iterator();
-
- while (iter.hasNext()) {
- String sdescName=iter.next();
-
- try {
- logger.info("Removing service monitor for '"+sdescName+"'");
- ValidatorManager.removeServiceMonitor(sdescName);
- } catch(Exception e) {
- logger.log(Level.SEVERE,
- "Failed to remove service monitor '"+sdescName+"'", e);
- }
- }
-
- // Any remaining input keys need to be removed
- iter = existingInputKeys.iterator();
-
- while (iter.hasNext()) {
- String key=iter.next();
- m_inputServices.remove(key);
- }
-
- // Any remaining output keys need to be removed
- iter = existingOutputKeys.iterator();
-
- while (iter.hasNext()) {
- String key=iter.next();
- m_outputServices.remove(key);
- }
- }
-
- 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();
- }
- }
- }
-
- return(ret);
- }
-
- private java.io.File m_validatorConfigFile=null;
- private java.io.File m_modelsDir=null;
- private long m_lastUpdate=0;
- }
+ private static final Logger logger = Logger.getLogger("org.jboss.soa.overlord.validator.jbossesb");
}
Deleted: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorGenerator.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorGenerator.java 2009-02-09 20:27:42 UTC (rev 484)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorGenerator.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -1,229 +0,0 @@
-/*
- * 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.soa.overlord.validator.jbossesb;
-
-import java.util.Collections;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.pi4soa.cdl.*;
-import org.pi4soa.common.annotations.*;
-import org.pi4soa.common.xml.XMLUtils;
-
-/**
- * This class provides a generator for the JBossESB Validator
- * configuration.
- */
-public class ValidatorGenerator {
-
- private static final String CDM_FILE_PATH_ATTR = "cdmFilePath";
- private static final String FILE_PATH_PREFIX = "models/";
- private static final String SERVICE_ELEMENT = "service";
- private static final String VALIDATOR_ELEMENT = "validator";
-
- public ValidatorGenerator() {
- }
-
- public org.w3c.dom.Element generate(org.pi4soa.cdl.Package cdlpack,
- String cdmFileName) {
- org.w3c.dom.Element ret=null;
-
- try {
- ret = createValidatorConfig();
-
- String cdmFilePath=getFilePath(cdmFileName);
-
- // Create the new entries for the supplied choreography
- createEntries(ret, cdmFilePath, cdlpack);
-
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- return(ret);
- }
-
- 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);
- }
-
- protected void createEntries(org.w3c.dom.Element validator,
- String cdmFilePath, 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(CDM_FILE_PATH_ATTR, cdmFilePath);
- service.setAttribute("participantType", ptype.getName());
-
- cdlpack.visit(new InputOutputAnalyser(ptype, service));
-
- if (service.getFirstChild() != null) {
- validator.appendChild(service);
- }
- }
- }
-
- protected String getFilePath(String cdmFileName) {
- return(FILE_PATH_PREFIX+cdmFileName);
- }
-
- private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.cdl.validator.jbossesb.actions");
-
- public class InputOutputAnalyser extends DefaultCDLVisitor {
-
- 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);
- }
-
- 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);
- }
- }
- }
-
- 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.severe("Too many destination elements ("+
- nl.getLength()+") found");
- } else {
- logger.severe("No destinations found");
- }
- }
-
- } catch(Exception e) {
- logger.log(Level.SEVERE,
- "Failed to load jbossesb annotation", e);
- }
- }
-
- if (dest != null) {
- processDestination(details, dest, from);
- }
- }
- }
-
- protected void processDestination(ExchangeDetails details,
- org.w3c.dom.Element dest, boolean from) {
- String elemName=null;
-
- if (dest != null &&
- dest.getAttribute("temporary").equalsIgnoreCase("true") == false) {
- 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;
- }
- }
-
- // 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) {
- org.w3c.dom.Element elem=m_service.getOwnerDocument().createElement(elemName);
- elem.setAttribute(EPR_ATTR, params.get(0).getValue());
-
- 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;
- }
-}
Deleted: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorManager.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorManager.java 2009-02-09 20:27:42 UTC (rev 484)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorManager.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -1,234 +0,0 @@
-/*
- * 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.soa.overlord.validator.jbossesb;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.pi4soa.service.ServiceException;
-import org.pi4soa.service.behavior.ServiceDescription;
-import org.pi4soa.service.monitor.*;
-
-public class ValidatorManager {
-
- /**
- * This method returns a reference to the service monitor
- * associated with the supplied service description name,
- * or null if one does not exist.
- *
- * @param sdesc The service description name
- * @return The service monitor, or null if does not exist
- */
- public static ServiceMonitor getServiceMonitor(String sdesc) {
- ServiceMonitor ret=null;
-
- synchronized(m_serviceMonitors) {
- ret = (ServiceMonitor)m_serviceMonitors.get(sdesc);
- }
-
- return(ret);
- }
-
- /**
- * This method returns a reference counted Service Monitor
- * associated with the supplied service description.
- *
- * @param sdesc The service description
- * @return The service monitor
- */
- public static ServiceMonitor createServiceContainer(ServiceDescription sdesc) {
- return(createServiceContainer(sdesc, true));
- }
-
- /**
- * This method returns a reference counted Service Monitor
- * associated with the supplied service description.
- *
- * @param sdesc The service description
- * @param validate Whether the behavior should be validated
- * @return The service monitor
- */
- public static ServiceMonitor createServiceContainer(ServiceDescription sdesc,
- boolean validate) {
- ServiceMonitor ret=null;
-
- synchronized(m_serviceMonitors) {
-
- if ((ret = (ServiceMonitor)m_serviceMonitors.get(
- sdesc.getFullyQualifiedName())) == null) {
-
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("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(validate);
-
- ret = ServiceMonitorFactory.getServiceMonitor(conf);
-
- // Register service description
- ret.getConfiguration().getServiceRepository().
- addServiceDescription(sdesc);
-
- logger.info("Created monitor for service description "+sdesc.getFullyQualifiedName());
-
- m_serviceMonitors.put(sdesc.getFullyQualifiedName(), ret);
-
- //m_serviceMonitorCounters.put(sdesc.getFullyQualifiedName(), new Integer(1));
-
- } catch(Exception e) {
- logger.severe("Failed to initialize service monitor: "+e);
- }
- } else {
-
- // Service monitor already in use for the service
- // description, so update description
- try {
- // Clear previous version of the service description
- ServiceDescription[] sdescs=
- ret.getConfiguration().getServiceRepository().getServiceDescriptions();
-
- for (int i=0; sdescs != null && i < sdescs.length; i++) {
- ret.getConfiguration().getServiceRepository().
- removeServiceDescription(sdescs[i]);
- }
-
- logger.info("Updating service description for "+sdesc.getFullyQualifiedName());
-
- ret.getConfiguration().getServiceRepository().addServiceDescription(sdesc);
- } catch(Exception e) {
- logger.log(Level.SEVERE, "Failed to update service description '"+
- sdesc.getFullyQualifiedName()+"'", e);
- }
-
- /* MAY REMOVE
- *
- // Increment the counter
- Integer counter=(Integer)m_serviceMonitorCounters.get(sdesc.getFullyQualifiedName());
- if (counter != null) {
- counter = new Integer(counter.intValue()+1);
- m_serviceMonitorCounters.put(sdesc.getFullyQualifiedName(), counter);
-
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Service monitor for '"+
- sdesc.getFullyQualifiedName()+"' reference count now: "+counter);
- }
- } else {
- logger.severe("Failed to find counter for "+sdesc.getFullyQualifiedName());
- }
- */
- }
- }
-
- return(ret);
- }
-
- /**
- * This method removes the service monitor associated with
- * the supplied service description name.
- *
- * @param sdesc The service description name
- * @throws ServiceException Failed to remove the service monitor
- */
- public static void removeServiceMonitor(String sdesc)
- throws ServiceException {
- synchronized(m_serviceMonitors) {
- ServiceMonitor monitor=(ServiceMonitor)
- m_serviceMonitors.remove(sdesc);
-
- if (monitor != null) {
- monitor.close();
- }
- }
- }
-
- /**
- * This method decrements the service monitor reference count
- * associated with the service description, and if reaches zero,
- * then it will close the service monitor.
- *
- * @param sdesc The service description name
- * @throws ServiceException Failed to release the service monitor
- */
- public static void releaseServiceMonitor(String sdesc)
- throws ServiceException {
-
- /* MAY REMOVE
- *
- synchronized(m_serviceMonitors) {
-
- Integer counter=(Integer)m_serviceMonitorCounters.get(sdesc);
- if (counter != null) {
-
- if (counter.intValue() > 1) {
- counter = new Integer(counter.intValue()-1);
- m_serviceMonitorCounters.put(sdesc, counter);
-
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Service monitor for '"+
- sdesc+"' reference count now: "+counter);
- }
- } else {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Service monitor for '"+
- sdesc+"' being closed");
- }
-
- m_serviceMonitorCounters.remove(sdesc);
-
- ServiceMonitor monitor=(ServiceMonitor)
- m_serviceMonitors.remove(sdesc);
-
- monitor.close();
- }
- } else {
- logger.severe("Failed to find counter for "+sdesc);
- }
- }
- */
- }
-
- /**
- * This method returns the set of service description names
- * that are associated with service monitors.
- *
- * @return The set of service monitors
- */
- public static java.util.Set<String> getServiceDescriptionNames() {
- java.util.Set<String> ret=new java.util.HashSet<String>();
-
- // Return copy to ensure changes in the map, do not
- // affect the returned set of names
- ret.addAll(m_serviceMonitors.keySet());
-
- return(ret);
- }
-
- private static Logger logger = Logger.getLogger("org.pi4soa.jbossesb.validator");
-
- private static java.util.Map<String,ServiceMonitor> m_serviceMonitors=new java.util.Hashtable<String,ServiceMonitor>();
- //private static java.util.Map<String,Integer> m_serviceMonitorCounters=new java.util.Hashtable<String,Integer>();
-}
Added: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorName.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorName.java (rev 0)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorName.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -0,0 +1,133 @@
+/*
+ * 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.soa.overlord.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());
+ }
+
+ 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
Copied: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/action/ValidationAction.java (from rev 479, cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidationAction.java)
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/action/ValidationAction.java (rev 0)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/action/ValidationAction.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -0,0 +1,249 @@
+/*
+ * 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.soa.overlord.validator.jbossesb.action;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.jboss.soa.esb.actions.*;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.overlord.validator.jbossesb.ESBUtil;
+
+import org.pi4soa.common.util.MessageUtil;
+import org.pi4soa.service.*;
+import org.pi4soa.service.behavior.*;
+import org.pi4soa.service.monitor.*;
+import org.pi4soa.common.util.NamesUtil;
+
+/**
+ * This class provides the action implementation for validation
+ * against the pi4soa state machine.
+ */
+public class ValidationAction extends AbstractActionLifecycle {
+
+ private static final String ACTIVE_ATTR = "active";
+ private static final String INBOUND_ATTR = "inbound";
+ public static final String CDM_FILE_PATH="cdmFilePath";
+ public static final String PARTICIPANT_TYPE="participantType";
+
+ /**
+ * This constructor initializes the actions with the
+ * service configuration details.
+ *
+ * @param config The service configuration
+ */
+ public ValidationAction(ConfigTree config) {
+ m_config = config;
+ }
+
+ /**
+ * This method initializes the service action.
+ */
+ public void initialise() throws ActionLifecycleException {
+
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("ValidationAction initialise: "+this);
+ }
+
+ super.initialise();
+
+ String direction=
+ m_config.getAttribute(INBOUND_ATTR);
+
+ if (direction != null && direction.equalsIgnoreCase("false")) {
+ m_inbound = false;
+ }
+
+ String active=
+ m_config.getAttribute(ACTIVE_ATTR);
+
+ if (active != null && active.equalsIgnoreCase("false")) {
+ m_active = false;
+ }
+
+ getServiceMonitor();
+ }
+
+ /**
+ * This method returns the service monitor associated with
+ * the ESB service.
+ *
+ * @return The service monitor
+ */
+ protected synchronized ServiceMonitor getServiceMonitor() {
+
+ if (m_serviceMonitor == null) {
+
+ try {
+ ServiceDescription sdesc=null;
+ String cdmFilePath=
+ m_config.getAttribute(CDM_FILE_PATH);
+ String participantType=
+ m_config.getAttribute(PARTICIPANT_TYPE);
+
+ if (logger.isLoggable(Level.FINEST)) {
+ logger.finest("ValidationAction config: cdm="+
+ cdmFilePath+" participant="+participantType);
+ }
+
+ if (NamesUtil.isSet(cdmFilePath) &&
+ NamesUtil.isSet(participantType)) {
+
+ java.io.InputStream is=ValidationAction.class.
+ getClassLoader().getResourceAsStream(cdmFilePath);
+
+ if (is == null) {
+
+ is = ClassLoader.getSystemResourceAsStream(cdmFilePath);
+
+ if (is == null) {
+ throw new ServiceException("Failed to locate path '"+
+ cdmFilePath+"'");
+ }
+ }
+
+ if (is != null) {
+ sdesc = org.pi4soa.service.util.DescriptionRetrievalUtil.instance().getServiceDescription(is, participantType);
+ }
+ } else {
+ logger.severe("Choreography file and Participant Type not specified: "+this);
+ }
+
+ if (sdesc != null) {
+ m_serviceDescriptionName = sdesc.getFullyQualifiedName();
+
+ // Obtain the service container
+ //m_serviceMonitor = createServiceContainer(sdesc);
+ } else {
+ logger.severe("Service description could not be loaded: "+
+ cdmFilePath+" participant="+participantType);
+ }
+
+ } catch(Exception e) {
+ logger.log(Level.SEVERE,
+ "Failed to initialize ValidationAction", e);
+ }
+ }
+
+ return(m_serviceMonitor);
+ }
+
+ /**
+ * This method processes a message for the service associated
+ * with this ESB action.
+ *
+ * @param message The message
+ * @return The message
+ */
+ public Message processMessage(Message message) throws ActionProcessingException {
+
+ if (logger.isLoggable(Level.FINEST)) {
+ logger.finest("ValidationAction: "+this+" message="+message);
+ }
+
+ try {
+ java.io.Serializable value=ESBUtil.getMessage(message);
+
+ if (value == null) {
+ throw new ServiceException("Failed to obtain value from message: "+message);
+ }
+
+ String mesgType=MessageUtil.getMessageType(value);
+
+ org.pi4soa.service.Message mesg=
+ getServiceMonitor().createMessage(mesgType, null,
+ null, value, null, null);
+
+ try {
+ if (m_inbound) {
+ getServiceMonitor().messageReceived(mesg);
+ } else {
+ getServiceMonitor().messageSent(mesg);
+ }
+ } catch(OutOfSequenceMessageException osme) {
+
+ if (m_active) {
+ throw osme;
+ } else {
+ logger.severe("Out of sequence message detected");
+ if (logger.isLoggable(Level.FINEST)) {
+ logger.finest(message.toString());
+ }
+ }
+ } catch(UnexpectedMessageException ume) {
+
+ if (m_active) {
+ throw ume;
+ } else {
+ logger.severe("Unexpected message detected");
+ if (logger.isLoggable(Level.FINEST)) {
+ logger.finest(message.toString());
+ }
+ }
+ }
+
+ } catch(Throwable t) {
+ logger.log(java.util.logging.Level.SEVERE,
+ "Failed to handle message", t);
+
+ throw new ActionProcessingException("Failed to handle message", t);
+ }
+
+ if (logger.isLoggable(Level.FINEST)) {
+ logger.finest("ValidationAction: "+this+
+ "serviceDescriptionName="+
+ m_serviceDescriptionName+
+ " finished processing message="+message);
+ }
+
+ return(message);
+ }
+
+ /**
+ * This method is called to tidy up after the action is
+ * no longer required.
+ */
+ public void destroy() throws ActionLifecycleException {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("ValidationAction destroy: "+this);
+ }
+
+ super.destroy();
+
+ if (m_serviceMonitor != null &&
+ m_serviceDescriptionName != null) {
+ /*
+ try {
+ ServiceValidatorManager.releaseServiceMonitor(m_serviceDescriptionName);
+ } catch(org.pi4soa.service.ServiceException se) {
+ throw new ActionLifecycleException("Failed to destroy service monitor",
+ se);
+ }
+ */
+ }
+ }
+
+ private static final Logger logger = Logger.getLogger("org.jboss.soa.overlord.validator.jbossesb.action");
+
+ private ConfigTree m_config=null;
+ private String m_serviceDescriptionName=null;
+ private ServiceMonitor m_serviceMonitor=null;
+ private boolean m_inbound=true;
+ private boolean m_active=true;
+}
\ No newline at end of file
Property changes on: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/action/ValidationAction.java
___________________________________________________________________
Name: svn:mergeinfo
+
Added: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/Pi4SOAServiceRecorder.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/Pi4SOAServiceRecorder.java (rev 0)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/Pi4SOAServiceRecorder.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -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.soa.overlord.validator.jbossesb.pi4soa;
+
+import java.util.logging.*;
+
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.overlord.validator.jbossesb.*;
+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.info("Created monitor for service description "+sdesc.getFullyQualifiedName());
+
+ } catch(Exception e) {
+ logger.severe("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("org.jboss.soa.overlord.validator.jbossesb.pi4soa");
+
+ private org.pi4soa.service.monitor.ServiceMonitor m_monitor=null;
+}
Added: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/Pi4SOAServiceValidator.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/Pi4SOAServiceValidator.java (rev 0)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/Pi4SOAServiceValidator.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -0,0 +1,202 @@
+/*
+ * 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.soa.overlord.validator.jbossesb.pi4soa;
+
+import java.util.logging.*;
+
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.overlord.validator.jbossesb.*;
+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
+ */
+ public Pi4SOAServiceValidator(ValidatorName name) {
+ 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.
+ */
+ public void update() {
+
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("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());
+
+ if (sdesc != null) {
+
+ if (m_monitor == null) {
+
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine("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.info("Created monitor for service description "+sdesc.getFullyQualifiedName());
+
+ } catch(Exception e) {
+ logger.severe("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.info("Updating service description for "+sdesc.getFullyQualifiedName());
+
+ m_monitor.getConfiguration().getServiceRepository().addServiceDescription(sdesc);
+ } catch(Exception e) {
+ logger.log(Level.SEVERE, "Failed to update service description '"+
+ sdesc.getFullyQualifiedName()+"'", e);
+ }
+ }
+ }
+ } else {
+ logger.severe("Unable to obtain service description for validator '"+
+ getValidatorName()+"'");
+ }
+ } else {
+ logger.severe("Unable to obtain model for validator '"+
+ 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 {
+ 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("org.jboss.soa.overlord.validator.jbossesb.pi4soa");
+
+ private org.pi4soa.service.monitor.ServiceMonitor m_monitor=null;
+}
Added: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/Pi4SOAValidatorConfigLoader.java
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/Pi4SOAValidatorConfigLoader.java (rev 0)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/Pi4SOAValidatorConfigLoader.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -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.soa.overlord.validator.jbossesb.pi4soa;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.overlord.validator.jbossesb.*;
+
+/**
+ * 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);
+ }
+}
Copied: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/ValidatorConfigGenerator.java (from rev 479, cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/ValidatorGenerator.java)
===================================================================
--- cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/ValidatorConfigGenerator.java (rev 0)
+++ cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/ValidatorConfigGenerator.java 2009-02-10 11:12:34 UTC (rev 485)
@@ -0,0 +1,269 @@
+/*
+ * 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.soa.overlord.validator.jbossesb.pi4soa;
+
+import java.util.Collections;
+import java.util.logging.Level;
+import java.util.logging.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
+ createEntries(ret, model, cdlpack);
+
+ } 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("org.jboss.soa.overlord.validator.jbossesb.pi4soa");
+
+ public class InputOutputAnalyser extends DefaultCDLVisitor {
+
+ 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.severe("Too many destination elements ("+
+ nl.getLength()+") found");
+ } else {
+ logger.severe("No destinations found");
+ }
+ }
+
+ } catch(Exception e) {
+ logger.log(Level.SEVERE,
+ "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 &&
+ dest.getAttribute("temporary").equalsIgnoreCase("true") == false) {
+ 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;
+ }
+ }
+
+ // 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) {
+ org.w3c.dom.Element elem=m_service.getOwnerDocument().createElement(elemName);
+ elem.setAttribute(EPR_ATTR, params.get(0).getValue());
+
+ 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;
+ }
+}
Property changes on: cdl/trunk/validator/jbossesb/src/main/java/org/jboss/soa/overlord/validator/jbossesb/pi4soa/ValidatorConfigGenerator.java
___________________________________________________________________
Name: svn:mergeinfo
+
15 years, 2 months