[savara-commits] savara SVN: r689 - in branches/experimental/2.0.x: bundles/org.savara.activity.notifier.jms and 21 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Feb 18 15:09:46 EST 2011
Author: objectiser
Date: 2011-02-18 15:09:45 -0500 (Fri, 18 Feb 2011)
New Revision: 689
Added:
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/Copyright.txt
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/META-INF/
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/META-INF/MANIFEST.MF
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/pom.xml
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/AbstractServiceValidator.java
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/CDMActivityValidator.java
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/DefaultValidatorConfig.java
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/Endpoint.java
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ServiceValidator.java
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ServiceValidatorFactory.java
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ServiceValidatorManager.java
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ValidatorConfig.java
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ValidatorConfigFactory.java
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ValidatorConfigLoader.java
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ValidatorName.java
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/osgi/
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/osgi/Activator.java
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/pi4soa/
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/pi4soa/JMSServiceTracker.java
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/pi4soa/Pi4SOAServiceValidator.java
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/pi4soa/Pi4SOAValidatorConfigLoader.java
branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/pi4soa/ValidatorConfigGenerator.java
Removed:
branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/AbstractServiceValidator.java
branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/DefaultValidatorConfig.java
branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/Endpoint.java
branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ServiceValidator.java
branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ServiceValidatorFactory.java
branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ServiceValidatorManager.java
branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ValidatorConfig.java
branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ValidatorConfigFactory.java
branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ValidatorConfigLoader.java
branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ValidatorName.java
branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/JMSServiceTracker.java
branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/Pi4SOAServiceValidator.java
branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/Pi4SOAValidatorConfigLoader.java
branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/ValidatorConfigGenerator.java
Modified:
branches/experimental/2.0.x/bundles/org.savara.activity.notifier.jms/pom.xml
branches/experimental/2.0.x/bundles/pom.xml
branches/experimental/2.0.x/integration/jboss/common/.classpath
branches/experimental/2.0.x/integration/jboss/common/pom.xml
branches/experimental/2.0.x/integration/jboss/common/src/main/configs/META-INF/jboss-beans.xml
branches/experimental/2.0.x/integration/jboss/common/src/main/configs/common-assembly.xml
branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/service/ServiceValidatorService.java
branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/service/ServiceValidatorServiceMBean.java
branches/experimental/2.0.x/integration/jboss/esb/.classpath
branches/experimental/2.0.x/integration/jboss/esb/src/main/java/org/savara/validator/jbossesb/JBossESBInterceptor.java
branches/experimental/2.0.x/integration/jboss/wsnative/.classpath
Log:
Moved old pi4soa based service validation mechanism to a bundle, to simplify the server integration.
Modified: branches/experimental/2.0.x/bundles/org.savara.activity.notifier.jms/pom.xml
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.notifier.jms/pom.xml 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.notifier.jms/pom.xml 2011-02-18 20:09:45 UTC (rev 689)
@@ -5,7 +5,7 @@
<artifactId>org.savara.activity.notifier.jms</artifactId>
<version>2.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
- <name>Savara::Bundles::ActivityJMS</name>
+ <name>Savara::Bundles::ActivityNotifierJMS</name>
<parent>
<groupId>org.savara</groupId>
Added: branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/Copyright.txt
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/Copyright.txt (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/Copyright.txt 2011-02-18 20:09:45 UTC (rev 689)
@@ -0,0 +1,17 @@
+/*
+ * 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.
+ */
Added: branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/META-INF/MANIFEST.MF
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/META-INF/MANIFEST.MF (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/META-INF/MANIFEST.MF 2011-02-18 20:09:45 UTC (rev 689)
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: SAVARA Activity Validator CDM
+Bundle-SymbolicName: org.savara.activity.validator.cdm
+Bundle-Version: 2.0.0.SNAPSHOT
+Bundle-Activator: org.savara.activity.validator.cdm.osgi.Activator
+Bundle-Vendor: www.savara.org
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.osgi.framework;version="1.3.0"
Added: branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/pom.xml
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/pom.xml (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/pom.xml 2011-02-18 20:09:45 UTC (rev 689)
@@ -0,0 +1,81 @@
+<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.savara.bundles</groupId>
+ <artifactId>org.savara.activity.validator.cdm</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Savara::Bundles::ActivityValidatorCDM</name>
+
+ <parent>
+ <groupId>org.savara</groupId>
+ <artifactId>bundles</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.savara.bundles</groupId>
+ <artifactId>org.savara.common</artifactId>
+ <version>${savara.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.savara.bundles</groupId>
+ <artifactId>org.savara.activity</artifactId>
+ <version>${savara.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.pi4soa</groupId>
+ <artifactId>org.pi4soa.common</artifactId>
+ <version>${pi4soa.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.pi4soa</groupId>
+ <artifactId>org.pi4soa.cdl</artifactId>
+ <version>${pi4soa.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.pi4soa</groupId>
+ <artifactId>org.pi4soa.service</artifactId>
+ <version>${pi4soa.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.savara.dependencies.eclipse</groupId>
+ <artifactId>emf-common</artifactId>
+ <version>2.3.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.savara.dependencies.eclipse</groupId>
+ <artifactId>emf-ecore</artifactId>
+ <version>2.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.savara.dependencies.eclipse</groupId>
+ <artifactId>emf-ecore-xmi</artifactId>
+ <version>2.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.jms</groupId>
+ <artifactId>jms</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>${osgi.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Added: branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/AbstractServiceValidator.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/AbstractServiceValidator.java (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/AbstractServiceValidator.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.savara.activity.validator.cdm;
+
+/**
+ * Abstract base class representing the ServiceValidator.
+ */
+public abstract class AbstractServiceValidator implements ServiceValidator {
+
+ private static final String MODELS_PATH = "models/";
+
+ /**
+ * This is the constructor for the abstract
+ * service validator, initialised with the validator
+ * name.
+ *
+ * @param name The validator name
+ */
+ public AbstractServiceValidator(ValidatorName name) {
+ m_name = name;
+ }
+
+ /**
+ * This method returns the validator name.
+ *
+ * @return The validator name
+ */
+ public ValidatorName getValidatorName() {
+ return(m_name);
+ }
+
+ /**
+ * This method returns the input stream associated
+ * with the model. Once the input stream has been
+ * used, it is the caller's responsibility to close
+ * the stream.
+ *
+ * @return The model's input stream, or null if
+ * not found
+ */
+ protected java.io.InputStream getModel() {
+ String filePath=MODELS_PATH+getValidatorName().getModelName();
+
+ java.io.InputStream ret = AbstractServiceValidator.class.
+ getClassLoader().getResourceAsStream(filePath);
+
+ return(ret);
+ }
+
+ public String toString() {
+ return("ServiceValidator["+getValidatorName()+"]");
+ }
+
+ private ValidatorName m_name=null;
+}
Added: branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/CDMActivityValidator.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/CDMActivityValidator.java (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/CDMActivityValidator.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008-11, 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.savara.activity.validator.cdm;
+
+import org.savara.activity.ActivityValidator;
+import org.savara.activity.model.Activity;
+import org.savara.activity.model.ExchangeType;
+import org.savara.activity.model.InteractionActivity;
+import org.savara.activity.model.ProtocolAnalysis;
+import org.savara.common.util.XMLUtils;
+
+public class CDMActivityValidator implements ActivityValidator {
+
+ private ServiceValidatorManager m_serviceValidatorManager=new ServiceValidatorManager();
+
+ public void setServiceValidatorManager(ServiceValidatorManager svm) {
+ m_serviceValidatorManager = svm;
+ }
+
+ public void validate(Activity activity) {
+
+ if (activity instanceof InteractionActivity) {
+ InteractionActivity ia=(InteractionActivity)activity;
+ java.util.List<ServiceValidator> validators=null;
+ Endpoint endpoint=new Endpoint(ia.getDestinationType() != null ?
+ ia.getDestinationType() : ia.getDestinationAddress());
+
+ if (isOutputValidator(ia)) {
+ validators = m_serviceValidatorManager.getOutputServiceValidators(endpoint);
+ } else {
+ validators = m_serviceValidatorManager.getInputServiceValidators(endpoint);
+ }
+
+ process(validators, ia);
+
+ // Check whether a dynamic reply is expected
+ if (isOutputValidator(ia)) {
+ if (m_serviceValidatorManager.isOutputDynamicReplyTo(endpoint) &&
+ ia.getReplyToAddress() != null) {
+
+ // Register interest in the 'reply-to' endpoint
+ Endpoint replyTo=new Endpoint(ia.getReplyToAddress());
+
+ m_serviceValidatorManager.registerInputReplyToValidators(replyTo,
+ validators);
+ }
+ } else if (m_serviceValidatorManager.isInputDynamicReplyTo(endpoint) &&
+ ia.getReplyToAddress() != null) {
+
+ // Register interest in the 'reply-to' endpoint
+ Endpoint replyTo=new Endpoint(ia.getReplyToAddress());
+
+ m_serviceValidatorManager.registerOutputReplyToValidators(replyTo,
+ validators);
+ }
+ }
+ }
+
+ protected boolean isOutputValidator(InteractionActivity ia) {
+ return((ia.getExchangeType() == ExchangeType.UNDEFINED && ia.isOutbound()) ||
+ (ia.getExchangeType() != ExchangeType.UNDEFINED &&
+ (ia.getExchangeType() == ExchangeType.REQUEST) == ia.isOutbound()));
+ }
+
+ public void process(java.util.List<ServiceValidator> validators, InteractionActivity ia) {
+
+ if (validators != null && validators.size() > 0 && ia.getParameter().size() == 1) {
+
+ for (int i=0; validators != null &&
+ i < validators.size(); i++) {
+ boolean validated=false;
+ java.util.List<org.savara.activity.model.Context> contexts=null;
+
+ try {
+ if (ia.isOutbound()) {
+ contexts = validators.get(i).messageSent(ia.getParameter().get(0).getType(),
+ ia.getParameter().get(0).getValue());
+ } else {
+ contexts = validators.get(i).messageReceived(ia.getParameter().get(0).getType(),
+ ia.getParameter().get(0).getValue());
+ }
+ validated = true;
+ } catch(Exception t) {
+ // Ignore
+ }
+
+ ProtocolAnalysis pa=new ProtocolAnalysis();
+ pa.setProtocol(validators.get(i).getProtocolName());
+ pa.setRole(XMLUtils.getLocalname(validators.get(i).getValidatorName().getRole()));
+ pa.setExpected(validated);
+
+ ia.getAnalysis().add(pa);
+
+ if (contexts != null) {
+ ia.getContext().addAll(contexts);
+ }
+ }
+ }
+ }
+}
Added: branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/DefaultValidatorConfig.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/DefaultValidatorConfig.java (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/DefaultValidatorConfig.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -0,0 +1,61 @@
+/*
+ * 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.savara.activity.validator.cdm;
+
+/**
+ * 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, org.w3c.dom.Element 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 org.w3c.dom.Element getConfiguration() {
+ return(m_configuration);
+ }
+
+ private String m_modelType=null;
+ private org.w3c.dom.Element m_configuration=null;
+}
Added: branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/Endpoint.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/Endpoint.java (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/Endpoint.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.savara.activity.validator.cdm;
+
+/**
+ * This class represents an endpoint being monitored by one
+ * or more service validator.
+ */
+public class Endpoint {
+
+ /**
+ * This is the constructor for the endpoint, supplying
+ * the destination associated with the endpoint.
+ *
+ * @param destination The destination
+ */
+ public Endpoint(String destination) {
+ m_destination = destination;
+ }
+
+ /**
+ * This method returns the destination for the endpoint.
+ *
+ * @return The destination
+ */
+ public String getDestination() {
+ return(m_destination);
+ }
+
+ /**
+ * This method returns the list of service validators
+ * associated with this endpoint.
+ *
+ * @return The list of service validators for this endpoint
+ */
+ public java.util.List<ServiceValidator> getServiceValidators() {
+ return(m_validators);
+ }
+
+ public boolean equals(Object obj) {
+ boolean ret=false;
+
+ if (obj instanceof Endpoint) {
+ Endpoint ep=(Endpoint)obj;
+
+ if (ep.getDestination() != null &&
+ ep.getDestination().equals(m_destination)) {
+ ret = true;
+ }
+ }
+
+ return(ret);
+ }
+
+ public int hashCode() {
+ int ret=0;
+
+ if (m_destination != null) {
+ ret = m_destination.hashCode();
+ }
+
+ return(ret);
+ }
+
+ public String toString() {
+ return("Endpoint["+m_destination+"]");
+ }
+
+ private String m_destination=null;
+ private java.util.List<ServiceValidator> m_validators=
+ new java.util.Vector<ServiceValidator>();
+}
Added: branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ServiceValidator.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ServiceValidator.java (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ServiceValidator.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -0,0 +1,77 @@
+/*
+ * 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.savara.activity.validator.cdm;
+
+import org.savara.activity.model.Context;
+
+/**
+ * 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();
+
+ /**
+ * The protocol name.
+ *
+ * @return The protocol name
+ */
+ public String getProtocolName();
+
+ /**
+ * This method processes a sent message against a service
+ * behavioural description.
+ *
+ * @param mesgType The optional message type
+ * @param msg The message
+ * @throws Exception Failed to process sent message
+ */
+ public java.util.List<Context> messageSent(String mesgType, java.io.Serializable msg) throws Exception;
+
+ /**
+ * This method processes a received message against a service
+ * behavioural description.
+ *
+ * @param mesgType The optional message type
+ * @param msg The message
+ * @throws Exception Failed to process received message
+ */
+ public java.util.List<Context> messageReceived(String mesgType, java.io.Serializable msg) throws Exception;
+
+ /**
+ * This method is called to update the model associated
+ * with the service validator.
+ *
+ * @throws Exception Failed to update the service validator
+ */
+ public void update() throws Exception;
+
+ /**
+ * This method closes the service validator.
+ *
+ * @throws Exception Failed to close the service validator
+ */
+ public void close() throws Exception;
+
+}
Added: branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ServiceValidatorFactory.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ServiceValidatorFactory.java (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ServiceValidatorFactory.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -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.savara.activity.validator.cdm;
+
+import java.lang.reflect.Constructor;
+import org.apache.log4j.Logger;
+
+/**
+ * This class provides a factory for Service Validators.
+ */
+public class ServiceValidatorFactory {
+
+ /**
+ * This method returns the Service Validator appropriate
+ * for the supplied validator name.
+ *
+ * @param name The validator name
+ * @return The service validator
+ * @exception IOException Failed to create the service validator
+ */
+ public static ServiceValidator getServiceValidator(ValidatorName name)
+ throws Exception {
+ ServiceValidator ret=null;
+
+ String modelType=name.getModelType();
+
+ if (modelType != null &&
+ m_validatorClasses.containsKey(modelType)) {
+ Class<?> cls=m_validatorClasses.get(modelType);
+
+ Constructor<?> con=cls.getConstructor(
+ new Class[]{ValidatorName.class});
+
+ ret = (ServiceValidator)con.newInstance(new Object[]{name});
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Returning service validator for "+
+ name+": "+ret);
+ }
+
+ return(ret);
+ }
+
+ private static final Logger logger = Logger.getLogger(ServiceValidatorFactory.class);
+
+ private static java.util.Map<String,Class<?>> m_validatorClasses=
+ new java.util.HashMap<String,Class<?>>();
+
+ static {
+ m_validatorClasses.put(org.savara.activity.validator.cdm.pi4soa.Pi4SOAServiceValidator.getModelType(),
+ org.savara.activity.validator.cdm.pi4soa.Pi4SOAServiceValidator.class);
+ }
+}
Added: branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ServiceValidatorManager.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ServiceValidatorManager.java (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ServiceValidatorManager.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -0,0 +1,972 @@
+/*
+ * 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.savara.activity.validator.cdm;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.log4j.Logger;
+
+/**
+ * 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.
+ */
+ public ServiceValidatorManager() {
+ initialize();
+ }
+
+ /**
+ * This method initializes the service validator manager on
+ * startup.
+ */
+ protected void initialize() {
+
+ java.net.URL url=
+ ServiceValidatorManager.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 closes the service validation manager.
+ */
+ public void close() {
+ }
+
+ /**
+ * This method returns the list of service validators associated
+ * with the supplied input endpoint.
+ *
+ * @param endpoint The input endpoint
+ * @return The list of service validators, or null if the endpoint
+ * is unknown
+ */
+ public java.util.List<ServiceValidator> getInputServiceValidators(Endpoint endpoint) {
+ java.util.List<ServiceValidator> ret=
+ m_inputValidators.get(endpoint);
+
+ if (ret == null) {
+ ret = m_replyToManager.getInputServiceValidators(endpoint);
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Return input validators '"+endpoint+"': "+ret);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method determines whether the supplied endpoint will be
+ * associated with a dynamic reply-to endpoint.
+ *
+ * @param endpoint The endpoint
+ * @return Whether the endpoint has a dynamic reply-to
+ */
+ public boolean isInputDynamicReplyTo(Endpoint endpoint) {
+ boolean ret=m_inputDynaReplyTos.contains(endpoint);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Is input endpoint '"+endpoint+
+ "' a dynamic reply-to: "+ret);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the list of service validators associated
+ * with the supplied output endpoint.
+ *
+ * @param endpoint The output endpoint
+ * @return The list of service validators, or null if the endpoint
+ * is unknown
+ */
+ public java.util.List<ServiceValidator> getOutputServiceValidators(Endpoint endpoint) {
+ java.util.List<ServiceValidator> ret=
+ m_outputValidators.get(endpoint);
+
+ if (ret == null) {
+ ret = m_replyToManager.getOutputServiceValidators(endpoint);
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Return output validators '"+endpoint+"': "+ret);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method determines whether the supplied endpoint will be
+ * associated with a dynamic reply-to endpoint.
+ *
+ * @param endpoint The endpoint
+ * @return Whether the endpoint has a dynamic reply-to
+ */
+ public boolean isOutputDynamicReplyTo(Endpoint endpoint) {
+ boolean ret=m_outputDynaReplyTos.contains(endpoint);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Is output endpoint '"+endpoint+
+ "' a dynamic reply-to: "+ret);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method registers a list of service validators against
+ * a dynamic 'reply-to' endpoint.
+ *
+ * @param endpoint The endpoint
+ * @param validators The list of service validators
+ */
+ public void registerInputReplyToValidators(Endpoint endpoint,
+ java.util.List<ServiceValidator> validators) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Register input reply-to '"+endpoint+"': "+validators);
+ }
+
+ m_replyToManager.registerInputDynamicReplyTo(endpoint, validators);
+ }
+
+ /**
+ * This method registers a list of service validators against
+ * a dynamic 'reply-to' endpoint.
+ *
+ * @param endpoint The endpoint
+ * @param validators The list of service validators
+ */
+ public void registerOutputReplyToValidators(Endpoint endpoint,
+ java.util.List<ServiceValidator> validators) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Register output reply-to '"+endpoint+"': "+validators);
+ }
+
+ m_replyToManager.registerOutputDynamicReplyTo(endpoint, validators);
+ }
+
+ /**
+ * This method returns a ServiceValidator associated with the
+ * supplied validator name.
+ *
+ * @param name The validator name
+ * @return The service validator
+ * @throws Exception Failed to create service validator
+ */
+ public ServiceValidator createServiceValidator(ValidatorName name)
+ throws Exception {
+ ServiceValidator ret=null;
+
+ synchronized(m_serviceValidators) {
+ ret = m_serviceValidators.get(name);
+
+ // If does not exist, then create, else update
+ // the existing service validator
+ if (ret == null) {
+ ret = ServiceValidatorFactory.getServiceValidator(name);
+
+ m_serviceValidators.put(name, ret);
+ } else {
+
+ // Update the description
+ ret.update();
+ }
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Created Service Validator '"+name+"': "+ret);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method removes the service validator associated with
+ * the supplied validator name.
+ *
+ * @param name The validator name
+ * @throws Exception Failed to remove the service validator
+ */
+ protected void removeServiceValidator(ValidatorName name)
+ throws Exception {
+ synchronized(m_serviceValidators) {
+ ServiceValidator validator=(ServiceValidator)
+ m_serviceValidators.remove(name);
+
+ // Check if validator should be removed from
+ // input/output endpoint mappings
+ java.util.Iterator<Endpoint> iter=m_inputValidators.keySet().iterator();
+
+ while (iter.hasNext()) {
+ Endpoint ep=iter.next();
+ java.util.List<ServiceValidator> list=
+ m_inputValidators.get(ep);
+
+ if (list.contains(validator)) {
+ list.remove(validator);
+
+ if (list.size() == 0) {
+ logger.error("Input validator list, associated with endpoint '"+
+ ep+"' contains no entries after removal of validator '"+
+ name+"' - this Endpoint should have previously been removed");
+ }
+ }
+ }
+
+ iter=m_outputValidators.keySet().iterator();
+
+ while (iter.hasNext()) {
+ Endpoint ep=iter.next();
+ java.util.List<ServiceValidator> list=
+ m_outputValidators.get(ep);
+
+ if (list.contains(validator)) {
+ list.remove(validator);
+
+ if (list.size() == 0) {
+ logger.error("Output validator list, associated with endpoint '"+
+ ep+"' contains no entries after removal of validator '"+
+ name+"' - this Endpoint should have previously been removed");
+ }
+ }
+ }
+
+ if (validator != null) {
+ validator.close();
+ }
+ }
+ }
+
+ /**
+ * This method returns the set of currently configured
+ * service validator names.
+ *
+ * @return The set of validator names
+ */
+ protected java.util.Set<ValidatorName> getServiceValidatorNames() {
+ java.util.Set<ValidatorName> ret=new java.util.HashSet<ValidatorName>();
+
+ ret.addAll(m_serviceValidators.keySet());
+
+ return(ret);
+ }
+
+ /**
+ * This method updates the configuration of the service
+ * validators and endpoint mappings.
+ */
+ protected void updateConfigurations() {
+ java.util.Set<ValidatorName> existingValidatorNames=
+ getServiceValidatorNames();
+
+ java.util.Set<Endpoint> existingInputEndpoints=
+ new java.util.HashSet<Endpoint>(m_inputValidators.keySet());
+
+ java.util.Set<Endpoint> existingOutputEndpoints=
+ new java.util.HashSet<Endpoint>(m_outputValidators.keySet());
+
+ java.util.Set<Endpoint> existingInputDynaReplyTos=
+ new java.util.HashSet<Endpoint>(m_inputDynaReplyTos);
+
+ java.util.Set<Endpoint> existingOutputDynaReplyTos=
+ new java.util.HashSet<Endpoint>(m_outputDynaReplyTos);
+
+ java.io.InputStream is=ServiceValidatorManager.class.getClassLoader().
+ getResourceAsStream(CONFIG_FILE);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("ValidationFilter: config="+CONFIG_FILE+" is="+is);
+ }
+
+ try {
+ DocumentBuilderFactory fact=DocumentBuilderFactory.newInstance();
+ fact.setNamespaceAware(true);
+
+ DocumentBuilder builder=fact.newDocumentBuilder();
+ org.w3c.dom.Document doc=builder.parse(is);
+
+ org.w3c.dom.Element config=doc.getDocumentElement();
+
+ if (config.getNodeName().equals(VALIDATOR_NODE)) {
+
+ // Old 'active' attribute is now 'mode'
+ String active=config.getAttribute(ACTIVE_ATTR);
+
+ if (active != null && active.equalsIgnoreCase("true")) {
+ m_managedMode = true;
+ }
+
+ String mode=config.getAttribute(MODE_ATTR);
+
+ if (mode != null) {
+ if (mode.equals("manage")) {
+ m_managedMode = true;
+ } else if (mode.equals("monitor")) {
+ m_managedMode = false; // will override active=true
+ } else {
+ logger.error("Unknown mode '"+mode+"' - setting to 'monitor'");
+ m_managedMode = false;
+ }
+ }
+
+ if (m_managedMode) {
+ logger.debug("Setting validators in 'manage' mode");
+ } else {
+ logger.debug("Setting validators in 'monitor' mode");
+ }
+
+ // Check for dynamic replyTo endpoint timeout
+ String timeoutValue=config.getAttribute(REPLY_TO_TIMEOUT_ATTR);
+
+ if (timeoutValue != null) {
+ try {
+ long tv=Long.parseLong(timeoutValue);
+
+ m_replyToManager.setReplyToTimeout(tv);
+ } catch(Exception e) {
+ logger.error("Unable to set 'reply to' timeout", e);
+ }
+ }
+ }
+
+ updateConfiguration(config, existingValidatorNames,
+ existingInputEndpoints, existingOutputEndpoints,
+ existingInputDynaReplyTos, existingOutputDynaReplyTos);
+
+ // Work through choreography files in the models directory
+ java.io.File[] files=m_modelsDir.listFiles();
+
+ for (int i=0; i < files.length; i++) {
+
+ // Check if a ValidatorModel exists for the
+ // file
+ try {
+ ValidatorConfig vm=
+ ValidatorConfigFactory.getValidatorConfig(files[i]);
+
+ if (vm != null) {
+ org.w3c.dom.Element vConfig=vm.getConfiguration();
+
+ if (vConfig != null) {
+ updateConfiguration(vConfig,
+ existingValidatorNames,
+ existingInputEndpoints,
+ existingOutputEndpoints,
+ existingInputDynaReplyTos,
+ existingOutputDynaReplyTos);
+ } else {
+ logger.error("Failed to obtain configuration for model '"+
+ files[i].getName()+"'");
+ }
+ }
+ } catch(Exception e) {
+ logger.error("Failed to update configuration for model '"+
+ files[i].getName()+"'", e);
+ }
+ }
+
+ // Any remaining input keys need to be removed
+ java.util.Iterator<Endpoint> iter=
+ existingInputEndpoints.iterator();
+
+ while (iter.hasNext()) {
+ Endpoint key=iter.next();
+ m_inputValidators.remove(key);
+ }
+
+ iter = existingInputDynaReplyTos.iterator();
+
+ while (iter.hasNext()) {
+ Endpoint key=iter.next();
+ m_inputDynaReplyTos.remove(key);
+ }
+
+ // Any remaining output keys need to be removed
+ iter = existingOutputEndpoints.iterator();
+
+ while (iter.hasNext()) {
+ Endpoint key=iter.next();
+ m_outputValidators.remove(key);
+ }
+
+ iter = existingOutputDynaReplyTos.iterator();
+
+ while (iter.hasNext()) {
+ Endpoint key=iter.next();
+ m_outputDynaReplyTos.remove(key);
+ }
+
+ // Any remaining service description names need to
+ // have their associated monitors removed
+ java.util.Iterator<ValidatorName> sviter=
+ existingValidatorNames.iterator();
+
+ while (sviter.hasNext()) {
+ ValidatorName svkey=sviter.next();
+
+ try {
+ logger.debug("Removing service validator: "+svkey);
+ removeServiceValidator(svkey);
+ } catch(Exception e) {
+ logger.error(
+ "Failed to remove service validator: "+svkey, e);
+ }
+ }
+ } catch(Exception e) {
+ logger.error("Failed to update configuration from input stream", e);
+ }
+ }
+
+ /**
+ * This method performs the update of the configuration of
+ * service monitors, based on the information in the validator
+ * configuration XML file, and the choreographies defined in the
+ * models folder.
+ *
+ * @param config The configuration
+ * @param existingValidatorNames The list of validator names
+ * @param existingInputEndpoints The list of input endpoints
+ * @param existingOutputEndpoints The list of output endpoints
+ * @param existingInputDynaReplyTos The set of input dynamic replyTo endpoints
+ * @param existingOutputDynaReplyTos The set of output dynamic replyTo endpoints
+ */
+ protected void updateConfiguration(org.w3c.dom.Element config,
+ java.util.Set<ValidatorName> existingValidatorNames,
+ java.util.Set<Endpoint> existingInputEndpoints,
+ java.util.Set<Endpoint> existingOutputEndpoints,
+ java.util.Set<Endpoint> existingInputDynaReplyTos,
+ java.util.Set<Endpoint> existingOutputDynaReplyTos) {
+ logger.debug("Update Service Validator Configuration");
+
+ if (config != null) {
+ try {
+ if (config.getNodeName().equals(VALIDATOR_NODE)) {
+ String active=config.getAttribute(ACTIVE_ATTR);
+
+ if (active != null && active.equalsIgnoreCase("true")) {
+
+ logger.debug("Setting validator into active mode");
+ m_managedMode = true;
+ }
+ }
+
+ org.w3c.dom.NodeList services=config.getElementsByTagName(SERVICE_NODE);
+
+ if (logger.isDebugEnabled()) {
+ if (services != null) {
+ logger.debug("ServiceValidationManager: services="+services.getLength());
+ } else {
+ logger.debug("ServiceValidationManager: services null");
+ }
+ }
+
+ for (int i=0; i < services.getLength(); i++) {
+ ServiceValidator sm=null;
+
+ // Create service monitor for service
+ String modelName=
+ ((org.w3c.dom.Element)services.item(i)).getAttribute(MODEL_ATTR);
+ String role=
+ ((org.w3c.dom.Element)services.item(i)).getAttribute(ROLE_ATTR);
+ String validate=
+ ((org.w3c.dom.Element)services.item(i)).getAttribute(VALIDATE_ATTR);
+
+ // Check for old attribute names, for
+ // backward compatibility - only support
+ // for a limited time
+ if (role == null) {
+ role = ((org.w3c.dom.Element)services.item(i)).getAttribute("participantType");
+ }
+
+ if (modelName == null) {
+ modelName = ((org.w3c.dom.Element)services.item(i)).getAttribute("cdmFilePath");
+
+ if (modelName != null) {
+ // Remove path
+ int pos=modelName.lastIndexOf('/');
+ if (pos != -1) {
+ modelName = modelName.substring(pos+1);
+ }
+ }
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Initialize service validator for: model="+
+ modelName+" role="+role+" validate="+validate);
+ }
+
+ if (role != null) {
+ boolean f_validate=(validate != null && validate.equalsIgnoreCase("true"));
+
+ if (modelName != null ||
+ f_validate == false) {
+ ValidatorName name=null;
+
+ if (f_validate) {
+ name = new ValidatorName(modelName, role);
+ } else {
+ name = new ValidatorName(role);
+
+ }
+
+ try {
+ // Obtain the service container
+ sm = createServiceValidator(name);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Service validator for '"+modelName+
+ "' and role '"+role+"' = "+sm);
+ }
+
+ // Remove validator name from list
+ existingValidatorNames.remove(sm.getValidatorName());
+ } catch(Exception e) {
+ logger.error(
+ "Failed to create service validator '"+
+ name+"'", e);
+ }
+ } else {
+ logger.error("Model name must be specified in validation mode");
+ }
+ } else {
+ logger.error("Role must be specified");
+ }
+
+ if (sm != null) {
+ // Map inputs to service
+ org.w3c.dom.NodeList inputs=((org.w3c.dom.Element)services.item(i)).getElementsByTagName(INPUT_NODE);
+
+ for (int j=0; j < inputs.getLength(); j++) {
+ String epr=((org.w3c.dom.Element)inputs.item(j)).getAttribute(EPR_ATTR);
+
+ if (epr != null) {
+ Endpoint endpoint=new Endpoint(epr);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Storing input endpoint '"+
+ endpoint+"' against validator: "+sm);
+ }
+
+ // Check if existing list
+ java.util.List<ServiceValidator> svs=
+ m_inputValidators.get(endpoint);
+
+ if (svs == null) {
+ svs = new java.util.Vector<ServiceValidator>();
+ m_inputValidators.put(endpoint, svs);
+ }
+
+ if (svs.contains(sm) == false) {
+ svs.add(sm);
+ }
+
+ existingInputEndpoints.remove(endpoint);
+
+ // Check if dynamic replyTo
+ String dynamicReplyTo=((org.w3c.dom.Element)inputs.item(j)).
+ getAttribute(DYNAMIC_REPLY_TO_ATTR);
+
+ if (dynamicReplyTo != null && dynamicReplyTo.equalsIgnoreCase("true")) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Input endpoint '"+
+ endpoint+"' has dynamic replyTo destination");
+ }
+
+ m_inputDynaReplyTos.add(endpoint);
+
+ existingInputDynaReplyTos.remove(endpoint);
+ }
+ }
+ }
+
+ // Map outputs to service
+ org.w3c.dom.NodeList outputs=((org.w3c.dom.Element)services.item(i)).getElementsByTagName(OUTPUT_NODE);
+
+ for (int j=0; j < outputs.getLength(); j++) {
+ String epr=((org.w3c.dom.Element)outputs.item(j)).getAttribute(EPR_ATTR);
+
+ if (epr != null) {
+ Endpoint endpoint=new Endpoint(epr);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Storing output endpoint '"+
+ endpoint+"' against validator: "+sm);
+ }
+
+ // Check if existing list
+ java.util.List<ServiceValidator> svs=
+ m_outputValidators.get(endpoint);
+
+ if (svs == null) {
+ svs = new java.util.Vector<ServiceValidator>();
+ m_outputValidators.put(endpoint, svs);
+ }
+
+ if (svs.contains(sm) == false) {
+ svs.add(sm);
+ }
+
+ existingOutputEndpoints.remove(endpoint);
+
+ // Check if dynamic replyTo
+ String dynamicReplyTo=((org.w3c.dom.Element)outputs.item(j)).
+ getAttribute(DYNAMIC_REPLY_TO_ATTR);
+
+ if (dynamicReplyTo != null && dynamicReplyTo.equalsIgnoreCase("true")) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Output endpoint '"+
+ endpoint+"' has dynamic replyTo destination");
+ }
+
+ m_outputDynaReplyTos.add(endpoint);
+
+ existingOutputDynaReplyTos.remove(endpoint);
+ }
+ }
+ }
+ }
+ }
+ } catch(Exception e) {
+ logger.error("Failed to load validator config", e);
+ }
+ }
+ }
+
+ /**
+ * This method returns whether the service validator configuration
+ * is in 'manage' mode. If yes, then invalid messages will
+ * be blocked from being delivered to their destination.
+ *
+ * @return Whether the service validator is in 'manage' mode
+ */
+ public boolean isManagedMode() {
+ return(m_managedMode);
+ }
+
+ private static final Logger logger = Logger.getLogger(ServiceValidatorManager.class);
+
+ private static final String EPR_ATTR = "epr";
+ private static final String DYNAMIC_REPLY_TO_ATTR = "dynamicReplyTo";
+
+ private static final String OUTPUT_NODE = "output";
+ private static final String INPUT_NODE = "input";
+ private static final String SERVICE_NODE = "service";
+ private static final String ACTIVE_ATTR = "active";
+ private static final String MODE_ATTR = "mode";
+ private static final String REPLY_TO_TIMEOUT_ATTR = "replyToTimeout";
+ private static final String VALIDATOR_NODE = "validator";
+
+ private static final String CONFIG_FILE = "validator-config.xml";
+ private static final String MODEL_ATTR="model";
+ private static final String ROLE_ATTR="role";
+ private static final String VALIDATE_ATTR="validate";
+
+ private static ServiceValidatorManager m_instance=null;
+ private java.io.File m_validatorConfigFile=null;
+ private java.io.File m_modelsDir=null;
+ private java.util.Map<ValidatorName,ServiceValidator> m_serviceValidators=
+ new java.util.HashMap<ValidatorName,ServiceValidator>();
+ private java.util.Map<Endpoint,java.util.List<ServiceValidator>> m_inputValidators=new java.util.Hashtable<Endpoint,java.util.List<ServiceValidator>>();
+ private java.util.Map<Endpoint,java.util.List<ServiceValidator>> m_outputValidators=new java.util.Hashtable<Endpoint,java.util.List<ServiceValidator>>();
+ private java.util.Set<Endpoint> m_inputDynaReplyTos=new java.util.HashSet<Endpoint>();
+ private java.util.Set<Endpoint> m_outputDynaReplyTos=new java.util.HashSet<Endpoint>();
+ private boolean m_managedMode=false;
+ private DynamicReplyToEndpointManager m_replyToManager=new DynamicReplyToEndpointManager();
+
+ /**
+ * This class is responsible for monitoring the models folder,
+ * within the overlord validator ESB bundle, to determine when
+ * the configuration has changed.
+ */
+ public class ValidatorConfigChangeMonitor implements java.lang.Runnable {
+
+ public ValidatorConfigChangeMonitor() {
+ // Do initial check for updates, so monitors
+ // initialized before returning from construct,
+ // as remainder of checks will be in a separate
+ // thread - so we need to ensure that the monitors
+ // are configured before the first message is
+ // passed through the filter.
+ checkForUpdates();
+ }
+
+ public void run() {
+
+ while (true) {
+ checkForUpdates();
+
+ try {
+ synchronized(ValidatorConfigChangeMonitor.this) {
+ wait(30000);
+ }
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ protected void checkForUpdates() {
+ logger.debug("Checking for config updates");
+
+ // Get last update time
+ long lastUpdate=getLastUpdate();
+
+ if (lastUpdate > m_lastUpdate) {
+
+ updateConfigurations();
+
+ m_lastUpdate = lastUpdate;
+ }
+ }
+
+ protected long getLastUpdate() {
+ long ret=0;
+
+ if (m_validatorConfigFile != null) {
+ ret = m_validatorConfigFile.lastModified();
+ }
+
+ if (m_modelsDir != null) {
+ java.io.File[] files=m_modelsDir.listFiles();
+
+ for (int i=0; i < files.length; i++) {
+ if (files[i].getName().endsWith(".cdm") &&
+ ret < files[i].lastModified()) {
+ ret = files[i].lastModified();
+ }
+ }
+
+ if (ret < m_modelsDir.lastModified()) {
+ ret = m_modelsDir.lastModified();
+ }
+ }
+
+ return(ret);
+ }
+
+ private long m_lastUpdate=0;
+ }
+
+ public class DynamicReplyToEndpointManager extends Thread {
+
+ /**
+ * The default constructor
+ */
+ public DynamicReplyToEndpointManager() {
+ setDaemon(true);
+
+ start();
+ }
+
+ /**
+ * The run method is responsible for ensuring the dynamic
+ * 'reply-to' endpoints are cleaned up periodically.
+ */
+ public void run() {
+
+ while(true) {
+
+ try {
+ synchronized(this) {
+ wait(m_replyToTimeout);
+ }
+ } catch(Exception e) {
+ logger.error("Failed to wait");
+ }
+
+ // Shift main entries to an emptied 'pending delete'
+ // map
+ synchronized(m_inputs) {
+ if (logger.isDebugEnabled()) {
+ java.util.Iterator<Endpoint> iter=
+ m_inputsPendingDelete.keySet().iterator();
+ while (iter.hasNext()) {
+ Endpoint endpoint=iter.next();
+ java.util.List<ServiceValidator> validators=
+ m_inputsPendingDelete.get(endpoint);
+ logger.debug("Deleting input (reply-to) validators '"+
+ endpoint+"': "+validators);
+ }
+ }
+
+ m_inputsPendingDelete.clear();
+ m_inputsPendingDelete.putAll(m_inputs);
+ m_inputs.clear();
+ }
+
+ synchronized(m_outputs) {
+ if (logger.isDebugEnabled()) {
+ java.util.Iterator<Endpoint> iter=
+ m_outputsPendingDelete.keySet().iterator();
+ while (iter.hasNext()) {
+ Endpoint endpoint=iter.next();
+ java.util.List<ServiceValidator> validators=
+ m_outputsPendingDelete.get(endpoint);
+ logger.debug("Deleting output (reply-to) validators '"+
+ endpoint+"': "+validators);
+ }
+ }
+
+ m_outputsPendingDelete.clear();
+ m_outputsPendingDelete.putAll(m_outputs);
+ m_outputs.clear();
+ }
+ }
+ }
+
+ /**
+ * This method returns the list of service validators
+ * associated with the dynamic reply-to endpoint.
+ *
+ * @param endpoint The input endpoint
+ * @return The list of service validators, or null if
+ * not found
+ */
+ public java.util.List<ServiceValidator> getInputServiceValidators(Endpoint endpoint) {
+ java.util.List<ServiceValidator> ret=null;
+
+ synchronized(m_inputs) {
+ ret = m_inputs.get(endpoint);
+
+ if (ret == null) {
+ ret = m_inputsPendingDelete.get(endpoint);
+ }
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Return input (reply-to) validators '"+endpoint+"': "+ret);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the list of service validators
+ * associated with the dynamic reply-to endpoint.
+ *
+ * @param endpoint The output endpoint
+ * @return The list of service validators, or null if
+ * not found
+ */
+ public java.util.List<ServiceValidator> getOutputServiceValidators(Endpoint endpoint) {
+ java.util.List<ServiceValidator> ret=null;
+
+ synchronized(m_outputs) {
+ ret = m_outputs.get(endpoint);
+
+ if (ret == null) {
+ ret = m_outputsPendingDelete.get(endpoint);
+ }
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Return output (reply-to) validators '"+endpoint+"': "+ret);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method registers a list of service validators against
+ * a dynamic 'reply-to' endpoint.
+ *
+ * @param endpoint The endpoint
+ * @param validators The list of service validators
+ */
+ public void registerInputDynamicReplyTo(Endpoint endpoint,
+ java.util.List<ServiceValidator> validators) {
+
+ synchronized(m_inputs) {
+ m_inputs.put(endpoint, validators);
+
+ // May not be necessary, as entry would not be
+ // used - but could save memory?
+ m_inputsPendingDelete.remove(endpoint);
+ }
+ }
+
+ /**
+ * This method registers a list of service validators against
+ * a dynamic 'reply-to' endpoint.
+ *
+ * @param endpoint The endpoint
+ * @param validators The list of service validators
+ */
+ public void registerOutputDynamicReplyTo(Endpoint endpoint,
+ java.util.List<ServiceValidator> validators) {
+
+ synchronized(m_outputs) {
+ m_outputs.put(endpoint, validators);
+
+ // May not be necessary, as entry would not be
+ // used - but could save memory?
+ m_outputsPendingDelete.remove(endpoint);
+ }
+ }
+
+ /**
+ * This method sets the timeout period for purging the
+ * cache of reply-to endpoints.
+ *
+ * @param timeoutValue The timeout value
+ */
+ public void setReplyToTimeout(long timeoutValue) {
+ m_replyToTimeout = timeoutValue;
+ }
+
+ private java.util.Map<Endpoint,java.util.List<ServiceValidator>> m_inputs=
+ new java.util.HashMap<Endpoint,java.util.List<ServiceValidator>>();
+ private java.util.Map<Endpoint,java.util.List<ServiceValidator>> m_outputs=
+ new java.util.HashMap<Endpoint,java.util.List<ServiceValidator>>();
+ private java.util.Map<Endpoint,java.util.List<ServiceValidator>> m_inputsPendingDelete=
+ new java.util.HashMap<Endpoint,java.util.List<ServiceValidator>>();
+ private java.util.Map<Endpoint,java.util.List<ServiceValidator>> m_outputsPendingDelete=
+ new java.util.HashMap<Endpoint,java.util.List<ServiceValidator>>();
+ private long m_replyToTimeout=10000;
+ }
+}
Added: branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ValidatorConfig.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ValidatorConfig.java (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ValidatorConfig.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -0,0 +1,44 @@
+/*
+ * 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.savara.activity.validator.cdm;
+
+/**
+ * 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 org.w3c.dom.Element getConfiguration();
+
+}
Added: branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ValidatorConfigFactory.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ValidatorConfigFactory.java (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ValidatorConfigFactory.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.savara.activity.validator.cdm;
+
+import org.apache.log4j.Logger;
+
+/**
+ * This class provides a factory for ValidatorConfig objects
+ * based on supplied model file details.
+ */
+public class ValidatorConfigFactory {
+
+ /**
+ * This method retrieves a validator config associated with
+ * the supplied file. If the model associated with the
+ * file is not supported, then a null will be returned.
+ *
+ * @param file The file containing the model
+ * @return The validator config, or null if an unsupported type
+ * @exception IOException Failed to load supported model type
+ */
+ public static ValidatorConfig getValidatorConfig(java.io.File file)
+ throws java.io.IOException {
+ ValidatorConfig ret=null;
+
+ String modelType=null;
+
+ if (file != null && (modelType=getModelType(file.getName())) != null) {
+ ValidatorConfigLoader loader=null;
+
+ for (int i=0; loader == null &&
+ i < m_loaders.size(); i++) {
+
+ if (m_loaders.get(i).isSupported(modelType)) {
+ loader = m_loaders.get(i);
+ }
+ }
+
+ if (loader != null) {
+ java.io.FileInputStream fis=new java.io.FileInputStream(file);
+
+ ret = loader.loadValidatorConfig(fis, file.getName());
+
+ fis.close();
+ }
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Returning validator config for "+
+ file.getName()+": "+ret);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method determines the model type associated with the
+ * supplied model filename.
+ *
+ * @param name The model filename
+ * @return The model type, or null if not known
+ */
+ protected static String getModelType(String name) {
+ String ret=null;
+ int pos=name.lastIndexOf('.');
+
+ if (pos != -1) {
+ ret = name.substring(pos+1);
+ }
+
+ return(ret);
+ }
+
+ private static final Logger logger = Logger.getLogger(ValidatorConfigFactory.class);
+
+ private static java.util.List<ValidatorConfigLoader> m_loaders=
+ new java.util.Vector<ValidatorConfigLoader>();
+
+ static {
+ m_loaders.add(new org.savara.activity.validator.cdm.pi4soa.Pi4SOAValidatorConfigLoader());
+ }
+}
Added: branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ValidatorConfigLoader.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ValidatorConfigLoader.java (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ValidatorConfigLoader.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -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.savara.activity.validator.cdm;
+
+/**
+ * This interface is implemented by model specific loaders, to
+ * load a ValidatorConfig for the particular model type.
+ */
+public interface ValidatorConfigLoader {
+
+ /**
+ * This method determines if the validator config loader
+ * implementation supports the supplied model type.
+ *
+ * @param modelType The model type
+ * @return Whether the loader supports the model type
+ */
+ public boolean isSupported(String modelType);
+
+ /**
+ * This method loads the validator config, contained within
+ * the supplied input stream representing a model of the
+ * supported type.
+ *
+ * @param is The input stream
+ * @param modelPath The path to the model file
+ * @return The validator config
+ * @throws java.io.IOException Failed to load validator config
+ */
+ public ValidatorConfig loadValidatorConfig(java.io.InputStream is,
+ String modelPath) throws java.io.IOException;
+
+}
Added: branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ValidatorName.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ValidatorName.java (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/ValidatorName.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.savara.activity.validator.cdm;
+
+/**
+ * This class represents a key for looking up a service validator.
+ */
+public class ValidatorName {
+
+ /**
+ * This constructor is initialized with the details used to
+ * identify the validator.
+ *
+ * @param role The role
+ */
+ public ValidatorName(String role) {
+ m_role = role;
+ m_validate = false;
+ }
+
+ /**
+ * This constructor is initialized with the details used to
+ * identify the validator.
+ *
+ * @param modelName The model name
+ * @param role The role
+ * @param validate Whether to validate, or simply record
+ */
+ public ValidatorName(String modelName, String role) {
+ m_modelName = modelName;
+ m_role = role;
+ m_validate = true;
+ }
+
+ /**
+ * This method returns the model name associated with the
+ * service validator.
+ *
+ * @return The model name
+ */
+ public String getModelName() {
+ return(m_modelName);
+ }
+
+ /**
+ * This method returns the type associated with the model.
+ * If no model has been defined for the validator name,
+ * as in the case of a validator in record mode, then
+ * this method will return ValidatorName.NO_MODEL_TYPE.
+ *
+ * @return The model type
+ */
+ public String getModelType() {
+ String ret=null;
+ int pos=0;
+
+ if (m_modelName != null &&
+ (pos=m_modelName.lastIndexOf('.')) != -1) {
+ ret = m_modelName.substring(pos+1);
+ } else {
+ ret = NO_MODEL_TYPE;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the role associated with the Service
+ * Validator.
+ *
+ * @return The role
+ */
+ public String getRole() {
+ return(m_role);
+ }
+
+ /**
+ * This method determines whether the associated service
+ * validator is in validation or record mode.
+ *
+ * @return Whether in validation or record mode
+ */
+ public boolean isValidate() {
+ return(m_validate);
+ }
+
+ public boolean equals(Object obj) {
+ boolean ret=false;
+
+ if (obj instanceof ValidatorName) {
+ ret = (obj.toString().equals(toString()) &&
+ ((ValidatorName)obj).m_validate == m_validate);
+ }
+
+ return(ret);
+ }
+
+ public int hashCode() {
+ return(toString().hashCode());
+ }
+
+ public String toString() {
+ String ret=null;
+
+ if (isValidate()) {
+ ret = m_modelName+":"+m_role;
+ } else {
+ ret = m_role;
+ }
+
+ return(ret);
+ }
+
+ public static final String NO_MODEL_TYPE="NoModelType";
+
+ private String m_modelName=null;
+ private String m_role=null;
+ private boolean m_validate=false;
+}
\ No newline at end of file
Added: branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/osgi/Activator.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/osgi/Activator.java (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/osgi/Activator.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -0,0 +1,30 @@
+package org.savara.activity.validator.cdm.osgi;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
Added: branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/pi4soa/JMSServiceTracker.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/pi4soa/JMSServiceTracker.java (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/pi4soa/JMSServiceTracker.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -0,0 +1,1244 @@
+/*
+ * Copyright 2005 Pi4 Technologies Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ * Change History:
+ * Sep 12, 2005 : Initial version created by gary
+ */
+
+// Original version copied from pi4soa service tracker, licensed under Apache version 2
+
+/*
+ * 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.savara.activity.validator.cdm.pi4soa;
+
+import java.io.ByteArrayOutputStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.jms.QueueConnectionFactory;
+import javax.jms.TextMessage;
+import javax.naming.Context;
+
+import org.pi4soa.common.util.NamesUtil;
+import org.pi4soa.common.xml.XMLUtils;
+import org.pi4soa.service.Channel;
+import org.pi4soa.service.Identity;
+import org.pi4soa.service.Message;
+import org.pi4soa.service.ServiceException;
+import org.pi4soa.service.behavior.MessageClassification;
+import org.pi4soa.service.behavior.MessageDefinition;
+import org.pi4soa.service.behavior.Receive;
+import org.pi4soa.service.behavior.Send;
+import org.pi4soa.service.behavior.ServiceDescription;
+import org.pi4soa.service.session.Session;
+import org.pi4soa.service.tracker.ServiceTracker;
+import org.pi4soa.service.tracker.TrackerEvent;
+import org.savara.activity.model.Activity;
+import org.savara.activity.model.ExchangeType;
+import org.savara.activity.model.InteractionActivity;
+import org.savara.activity.model.MessageParameter;
+import org.savara.activity.model.ProtocolAnalysis;
+import org.savara.activity.util.ActivityModelUtil;
+
+/**
+ * This class provides an implementation of the publishing service
+ * tracker that sends the monitoring information using the JMS
+ * API.
+ *
+ */
+public class JMSServiceTracker implements ServiceTracker {
+
+ private static final String SAVARA_SERVICE_TRACKER_NS = "http://www.savara.org/service/tracker";
+ /**
+ * This is the default constructor for the JMS service
+ * tracker implementation.
+ *
+ */
+ public JMSServiceTracker() {
+ }
+
+ /**
+ * This method is invoked to initialize the JMS connection, based
+ * on the established properties.
+ *
+ */
+ public void initialize() {
+
+ logger.info("Initializing Savara JMS Service Tracker");
+
+ javax.naming.Context ctx=null;
+
+ try {
+ if (NamesUtil.isSet(m_jndiInitialContextFactory)) {
+ java.util.Properties jndiProps = new java.util.Properties();
+ jndiProps.setProperty(Context.INITIAL_CONTEXT_FACTORY,
+ m_jndiInitialContextFactory);
+ jndiProps.setProperty(Context.PROVIDER_URL,
+ m_jndiProviderURL);
+
+ if (m_jndiFactoryURLPackages != null) {
+ jndiProps.setProperty(Context.URL_PKG_PREFIXES,
+ m_jndiFactoryURLPackages);
+ }
+
+ ctx = new javax.naming.InitialContext(jndiProps);
+ } else {
+ if (logger.isLoggable(java.util.logging.Level.FINER)) {
+ logger.finer("Creating default initial context");
+ }
+ ctx = new javax.naming.InitialContext();
+ }
+ } catch(Exception e) {
+ logger.severe("Failed to create JNDI initial context: "+e);
+ }
+
+ // Get connection factory and destination topic
+ if (ctx != null) {
+
+ try {
+ try {
+ javax.jms.ConnectionFactory factory =
+ (javax.jms.ConnectionFactory)
+ ctx.lookup(m_jmsConnectionFactory);
+
+ m_connection = factory.createConnection();
+
+ if (logger.isLoggable(Level.FINER)) {
+ logger.finer("Connection: "+m_connection);
+ }
+
+ } catch(java.lang.RuntimeException re) {
+ if (m_jmsConnectionFactoryAlternate != null) {
+ QueueConnectionFactory qcf = (QueueConnectionFactory)
+ ctx.lookup(m_jmsConnectionFactoryAlternate);
+ m_connection = qcf.createQueueConnection();
+
+ if (logger.isLoggable(Level.FINER)) {
+ logger.finer("Alternate Connection: "+m_connection);
+ }
+
+ } else {
+ throw re;
+ }
+ }
+
+ javax.jms.Destination dest =
+ (javax.jms.Destination)ctx.lookup(m_jmsDestination);
+
+ m_session = m_connection.createSession(false,
+ javax.jms.Session.AUTO_ACKNOWLEDGE);
+
+ m_producer = m_session.createProducer(dest);
+
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine(Thread.currentThread()+
+ ": Created JMS ServiceTracker connection");
+ }
+
+ } catch(Exception e) {
+ logger.severe("Failed to create JMS connection: "+e);
+ }
+ }
+ }
+
+ /**
+ * This method sets the JNDI initial context factory class name.
+ *
+ * @param factory The factory class name
+ */
+ public void setJNDIInitialContextFactory(String factory) {
+ m_jndiInitialContextFactory = factory;
+ }
+
+ /**
+ * This method sets the provider URL that is used when publishing
+ * the tracker events.
+ *
+ * @param url The provider url
+ */
+ public void setJNDIProviderURL(String url) {
+ m_jndiProviderURL = url;
+ }
+
+ /**
+ * This method sets the JNDI factory URL packages.
+ *
+ * @param pkgs The packages
+ */
+ public void setJNDIFactoryURLPackages(String pkgs) {
+ m_jndiFactoryURLPackages = pkgs;
+ }
+
+ /**
+ * This method sets the JMS connection factory name, to
+ * be looked up within JNDI.
+ *
+ * @param cf The connection factory
+ */
+ public void setJMSConnectionFactory(String cf) {
+ m_jmsConnectionFactory = cf;
+ }
+
+ /**
+ * This method sets the alternate JMS connection factory name, to
+ * be looked up within JNDI.
+ *
+ * @param cf The connection factory
+ */
+ public void setJMSConnectionFactoryAlternate(String cf) {
+ m_jmsConnectionFactoryAlternate = cf;
+ }
+
+ /**
+ * This method sets the JMS destination name, to
+ * be looked up within JNDI.
+ *
+ * @param dest The destination
+ */
+ public void setJMSDestination(String dest) {
+ m_jmsDestination = dest;
+ }
+
+ /**
+ * This method is used to publish the service tracker message.
+ *
+ * @param serviceName The service name
+ * @param session The session
+ * @param mesg The message
+ */
+ protected synchronized void publish(String serviceName, Session session,
+ String mesg) {
+
+ // Establish JMS connection and topic
+ if (m_initialized == false &&
+ m_jmsConnectionFactory != null &&
+ m_jmsDestination != null) {
+ initialize();
+
+ m_initialized = true;
+ }
+
+ if (m_producer != null) {
+
+ try {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine(mesg);
+ }
+
+ TextMessage tm=m_session.createTextMessage(mesg);
+
+ if (logger.isLoggable(Level.FINEST)) {
+ logger.finest(Thread.currentThread()+
+ ": Sending JMS ServiceTracker record="+tm);
+ }
+
+ m_producer.send(tm);
+ } catch(Exception e) {
+ logger.severe("Failed to publish message: "+e);
+ }
+
+ } else {
+ logger.warning("Could not publish message: "+mesg);
+ }
+ }
+
+ /**
+ * This method is used to publish the service tracker message.
+ *
+ * @param serviceName The service name
+ * @param session The session
+ * @param mesg The message
+ */
+ protected synchronized void publish(Activity activity) {
+
+ // Establish JMS connection and topic
+ if (m_initialized == false &&
+ m_jmsConnectionFactory != null &&
+ m_jmsDestination != null) {
+ initialize();
+
+ m_initialized = true;
+ }
+
+ if (m_producer != null) {
+
+ try {
+ ByteArrayOutputStream os=new ByteArrayOutputStream();
+
+ ActivityModelUtil.serialize(activity, os);
+
+ String act=new String(os.toByteArray());
+
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine(act);
+ }
+
+ TextMessage tm=m_session.createTextMessage(act);
+
+ if (logger.isLoggable(Level.FINEST)) {
+ logger.finest(Thread.currentThread()+
+ ": Sending JMS ServiceTracker record="+tm);
+ }
+
+ m_producer.send(tm);
+ } catch(Exception e) {
+ logger.severe("Failed to publish message: "+e);
+ }
+
+ } else {
+ logger.warning("Could not publish message: "+activity);
+ }
+ }
+
+ /**
+ * This method closes the service tracker.
+ *
+ * @exception ServiceException Failed to close
+ */
+ public void close() throws ServiceException {
+
+ try {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine(Thread.currentThread()+
+ ": Closing JMS ServiceTracker connection");
+ }
+
+ if (m_session != null) {
+ m_session.close();
+ m_session = null;
+ }
+
+ if (m_connection != null) {
+ m_connection.close();
+ m_connection = null;
+ }
+
+ } catch(Exception e) {
+ logger.severe("Failed to close JMS connection: "+e);
+
+ m_initialized = false;
+
+ throw new ServiceException("Failed to close JMS connection", e);
+ }
+
+ m_initialized = false;
+ }
+
+ /**
+ * This method sets whether the message payload should be
+ * recorded as part of the service tracker send and receive
+ * events.
+ *
+ * @param val Whether to record the message payload
+ */
+ public void setRecordMessagePayload(Boolean val) {
+ if (val != null) {
+ m_recordMessagePayload = val.booleanValue();
+ } else {
+ m_recordMessagePayload = false;
+ }
+ }
+
+ /**
+ * This method indicates that a new service instance
+ * has started.
+ *
+ * @param service The service
+ * @param session The session
+ */
+ public void serviceStarted(ServiceDescription service,
+ Session session) {
+ }
+
+ /**
+ * This method indicates that a service instance
+ * has finished.
+ *
+ * @param service The service
+ * @param session The session
+ */
+ public void serviceFinished(ServiceDescription service,
+ Session session) {
+ }
+
+ /**
+ * This method indicates that a new sub session
+ * has started within an existing service instance.
+ *
+ * @param parent The parent session
+ * @param session The session
+ */
+ public void subSessionStarted(Session parent, Session session) {
+ }
+
+ /**
+ * This method indicates that an existing
+ * sub session has finished.
+ *
+ * @param parent The parent session
+ * @param session The session
+ */
+ public void subSessionFinished(Session parent, Session session) {
+ }
+
+ /**
+ * This method registers the fact that a message has been
+ * sent from a stateful service.
+ *
+ * @param activity The behavioral activity
+ * @param session The session
+ * @param channel The channel
+ * @param mesg The message that has been handled
+ */
+ public void sentMessage(Send activity, Session session,
+ Channel channel, Message mesg) {
+
+ InteractionActivity ia=createInteractionActivity(activity, session, mesg);
+
+ ia.setOutbound(true);
+
+ publish(ia);
+ }
+
+ protected InteractionActivity createInteractionActivity(org.pi4soa.service.behavior.MessageActivity activity,
+ Session session, Message mesg) {
+ InteractionActivity ia=new InteractionActivity();
+
+ ia.setOperationName(activity.getOperationName());
+ ia.setFaultName(activity.getFaultName());
+ ia.setDestinationType(mesg.getServiceType());
+
+ ia.setExchangeType(activity.getMessageDefinition().getClassification() ==
+ MessageClassification.REQUEST ?
+ ExchangeType.REQUEST : ExchangeType.RESPONSE);
+
+ MessageParameter mp=new MessageParameter();
+ mp.setType(mesg.getType());
+ mp.setValue(getMessagePayload(mesg));
+
+ ia.getParameter().add(mp);
+
+ ProtocolAnalysis pa=new ProtocolAnalysis();
+ pa.setExpected(Boolean.TRUE);
+ pa.setProtocol(activity.getServiceDescription().getFullyQualifiedName());
+
+ pa.setRole(XMLUtils.getLocalname(activity.getServiceDescription().getName()));
+
+ ia.getAnalysis().add(pa);
+
+ // Add context information from the identities info
+ java.util.Iterator<Identity> ids=null;
+
+ if (session != null) {
+ ids = session.getPrimaryIdentities().iterator();
+ }
+
+ // If session has no identity information, but a
+ // message is supplied, then try getting identity
+ // from it.
+ if ((ids == null || ids.hasNext() == false) &&
+ mesg != null && mesg.getMessageIdentities() != null) {
+ ids = mesg.getMessageIdentities().iterator();
+ }
+
+ if (ids != null && ids.hasNext()) {
+
+ while (ids.hasNext()) {
+ Identity cur=ids.next();
+
+ org.savara.activity.model.Context context=new org.savara.activity.model.Context();
+
+ String name=null;
+ for (String token : cur.getTokens()) {
+ if (name == null) {
+ name = token;
+ } else {
+ name += ":"+token;
+ }
+ }
+
+ context.setName(name);
+
+ String value=null;
+
+ for (Object val : cur.getValues()) {
+ if (value == null) {
+ value = val.toString();
+ } else {
+ value += ":"+val.toString();
+ }
+ }
+
+ context.setValue(value);
+
+ ia.getContext().add(context);
+ }
+ }
+
+ return(ia);
+ }
+
+ /**
+ * This method registers the fact that a message has been
+ * sent from a stateless service.
+ *
+ * @param defn The message definition
+ * @param mesg The message that has been handled
+ */
+ public void sentMessage(MessageDefinition defn, Message mesg) {
+ }
+
+ /**
+ * This method registers the fact that a message has been
+ * received from a stateful service.
+ *
+ * @param activity The behavioral activity
+ * @param session The session
+ * @param channel The channel
+ * @param mesg The message that has been handled
+ */
+ public void receivedMessage(Receive activity, Session session,
+ Channel channel, Message mesg) {
+ InteractionActivity ia=createInteractionActivity(activity, session, mesg);
+
+ ia.setOutbound(false);
+
+ publish(ia);
+ }
+
+ /**
+ * This method registers the fact that a message has been
+ * received from a stateless service.
+ *
+ * @param defn The message definition
+ * @param mesg The message that has been handled
+ */
+ public void receivedMessage(MessageDefinition defn, Message mesg) {
+ }
+
+ /**
+ * This method registers that a message was not expected.
+ *
+ * @param sdesc The service description, if known
+ * @param session The session, or null if a stateless service,
+ * or cannot be associated with a session
+ * @param mesg The message that was not expected
+ * @param reason The optional reason why the message was
+ * considered to be unexpected
+ */
+ public void unexpectedMessage(ServiceDescription sdesc,
+ Session session, Message mesg, String reason) {
+ String messageText=getMessageText(mesg, null);
+
+ // Process the reason field to ensure it has no
+ // character that would cause the XML a problem
+ reason = processAttributeContents(reason);
+
+ String xml="<sd:"+TrackerEvent.UNEXPECTED_MESSAGE+
+ " "+SERVICE_INSTANCE_ID_ATTR+"=\""+
+ getServiceInstanceId(session)+"\" "+
+ SESSION_ID_ATTR+"=\""+
+ getSessionId(session)+"\" "+TIMESTAMP_ATTR+"=\""+
+ System.currentTimeMillis()+"\" ><sd:"+DETAILS_NODE+">"+
+ reason+"</sd:"+DETAILS_NODE+">"+messageText+
+ "</sd:"+TrackerEvent.UNEXPECTED_MESSAGE+">";
+
+ String serviceName=null;
+
+ if (sdesc != null) {
+ serviceName = sdesc.getFullyQualifiedName();
+ } else {
+ serviceName = getServiceName(session);
+ }
+
+ String serviceVersion=null;
+
+ if (sdesc != null) {
+ serviceVersion = sdesc.getVersion();
+ }
+
+ record(serviceName, serviceVersion, session, mesg, xml, ERROR, null);
+ }
+
+ /**
+ * This method registers that an exception was not handled.
+ *
+ * @param session The session, or null if a stateless service
+ * @param excType The exception type
+ */
+ public void unhandledException(Session session, String excType) {
+
+ String xml="<sd:"+TrackerEvent.UNHANDLED_EXCEPTION+
+ " "+SERVICE_INSTANCE_ID_ATTR+"=\""+
+ getServiceInstanceId(session)+"\" "+
+ SESSION_ID_ATTR+"=\""+
+ getSessionId(session)+"\" "+TIMESTAMP_ATTR+"=\""+
+ System.currentTimeMillis()+"\" ><sd:"+DETAILS_NODE+">"+
+ excType+"</sd:"+DETAILS_NODE+"></sd:"+
+ TrackerEvent.UNHANDLED_EXCEPTION+">";
+
+ record(getServiceName(session), session, xml, ERROR, null);
+ }
+
+ /**
+ * This method reports information regarding the processing
+ * of a service session. The details can either be specified
+ * as a textual string (unstructured data),
+ * or as a structured XML fragment.<p>
+ *
+ * @param session The session, or null if a stateless service
+ * @param details The details
+ */
+ public void information(Session session, String details) {
+ String xml="<sd:"+TrackerEvent.INFORMATION+
+ " "+SERVICE_INSTANCE_ID_ATTR+"=\""+
+ getServiceInstanceId(session)+"\" "+
+ SESSION_ID_ATTR+"=\""+getSessionId(session)+
+ "\" "+TIMESTAMP_ATTR+"=\""+
+ System.currentTimeMillis()+"\" ><sd:"+DETAILS_NODE+">"+
+ XMLUtils.encodeXMLString(details)+
+ "</sd:"+DETAILS_NODE+"></sd:"+
+ TrackerEvent.INFORMATION+">";
+
+ record(getServiceName(session), session, xml, INFO, null);
+ }
+
+ /**
+ * This method reports information regarding the processing
+ * of a service session. The details can either be specified
+ * as a textual string (unstructured data),
+ * or as a structured XML fragment.<p>
+ *
+ * @param session The session, or null if a stateless service
+ * @param details The details
+ * @param exc The optional exception
+ */
+ public void warning(Session session, String details,
+ Throwable exc) {
+ String excText="";
+ if (exc != null) {
+ try {
+ java.io.StringWriter s=new java.io.StringWriter();
+ java.io.PrintWriter p=new java.io.PrintWriter(s);
+
+ exc.printStackTrace(p);
+
+ p.close();
+ s.close();
+
+ excText = "<sd:"+EXCEPTION_NODE+">"+s.toString()+"</sd:"+EXCEPTION_NODE+">";
+ } catch(Exception e) {
+ logger.severe("Failed to record exception stack trace: "+e);
+
+ excText = "<sd:"+EXCEPTION_NODE+">"+exc.getLocalizedMessage()+"</sd:"+EXCEPTION_NODE+">";
+ }
+ }
+
+ String xml="<sd:"+TrackerEvent.WARNING+
+ " "+SERVICE_INSTANCE_ID_ATTR+"=\""+
+ getServiceInstanceId(session)+"\" "+
+ SESSION_ID_ATTR+"=\""+getSessionId(session)+
+ "\" "+TIMESTAMP_ATTR+"=\""+
+ System.currentTimeMillis()+"\" ><sd:"+DETAILS_NODE+">"+
+ XMLUtils.encodeXMLString(details)+
+ "</sd:"+DETAILS_NODE+">"+excText+"</sd:"+
+ TrackerEvent.WARNING+">";
+
+ record(getServiceName(session), session, xml, WARNING, exc);
+ }
+
+ /**
+ * This method reports information regarding the processing
+ * of a service session. The details can either be specified
+ * as a textual string (unstructured data),
+ * or as a structured XML fragment.<p>
+ *
+ * @param session The session, or null if a stateless service
+ * @param details The details
+ * @param exc The optional exception
+ */
+ public void error(Session session, String details,
+ Throwable exc) {
+ String excText="";
+ if (exc != null) {
+ try {
+ java.io.StringWriter s=new java.io.StringWriter();
+ java.io.PrintWriter p=new java.io.PrintWriter(s);
+
+ exc.printStackTrace(p);
+
+ p.close();
+ s.close();
+
+ excText = "<sd:"+EXCEPTION_NODE+">"+s.toString()+"</sd:"+EXCEPTION_NODE+">";
+ } catch(Exception e) {
+ logger.severe("Failed to record exception stack trace: "+e);
+
+ excText = "<sd:"+EXCEPTION_NODE+">"+exc.getLocalizedMessage()+"</sd:"+EXCEPTION_NODE+">";
+ }
+ }
+
+
+ String xml="<sd:"+TrackerEvent.ERROR+
+ " "+SERVICE_INSTANCE_ID_ATTR+"=\""+
+ getServiceInstanceId(session)+"\" "+
+ SESSION_ID_ATTR+"=\""+getSessionId(session)+
+ "\" "+TIMESTAMP_ATTR+"=\""+
+ System.currentTimeMillis()+"\" ><sd:"+DETAILS_NODE+">"+
+ XMLUtils.encodeXMLString(details)+
+ "</sd:"+DETAILS_NODE+">"+excText+"</sd:"+
+ TrackerEvent.ERROR+">";
+
+ record(getServiceName(session), session, xml, ERROR, exc);
+ }
+
+ /**
+ * Check the format of the specified session id.
+ *
+ * @param session The initial session
+ * @return The reformatted session id
+ */
+ protected String getSessionId(Session session) {
+ String ret=null;
+
+ if (session != null) {
+ ret = session.getId().getSessionId();
+ }
+
+ if (ret == null) {
+ ret = "";
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method determines whether a long expanded form
+ * of id should be used for the service instance id.
+ *
+ * @return Whether the expanded form of id is used
+ */
+ protected boolean isIdExpanded() {
+ return(true);
+ }
+
+ /**
+ * This method returns the service instance id
+ * associated with the specified session.
+ *
+ * @param session The session
+ * @return The service instance id
+ */
+ protected String getServiceInstanceId(Session session) {
+ String ret=null;
+
+ if (session != null) {
+ if (isIdExpanded()) {
+ ret = session.getId().getServiceDescriptionName()+
+ "/"+session.getId().getServiceInstanceId();
+ } else {
+ ret = session.getId().getServiceInstanceId();
+ }
+ }
+
+ if (ret == null) {
+ ret = "";
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the service name associated with the
+ * supplied session.
+ *
+ * @param session The session
+ * @return The service name
+ */
+ protected String getServiceName(Session session) {
+ String ret="";
+
+ if (session != null && session.getId() != null) {
+ ret = session.getId().getServiceDescriptionName();
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the service name associated with the
+ * supplied message definition.
+ *
+ * @param defn The message definition
+ * @return The service name
+ */
+ protected String getServiceName(MessageDefinition defn) {
+ String ret="";
+
+ if (defn != null && defn.getServiceDescription() != null) {
+ ret = defn.getServiceDescription().getFullyQualifiedName();
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method constructs the session related information
+ * to be recorded.
+ *
+ * @param session The session
+ * @return The session text
+ */
+ protected String getSessionIdentityText(Session session) {
+ return(getSessionIdentityText(session, null));
+ }
+
+ /**
+ * This method constructs the session related information
+ * to be recorded.
+ *
+ * @param session The session
+ * @param mesg The optional message
+ * @return The session text
+ */
+ public String getSessionIdentityText(Session session, Message mesg) {
+ StringBuffer identities=new StringBuffer();
+
+ if (session != null && session.getSessionIdentity() != null) {
+ identities.append("<sd:"+SESSION_IDENTITY_NODE+">"+
+ "<sd:"+IDENTITY_NODE+" "+NAME_ATTR+"=\""+
+ session.getSessionIdentity().getName()+"\" >"+
+ XMLUtils.encodeXMLString(session.getSessionIdentity().getFullId())+
+ "</sd:"+IDENTITY_NODE+">"+
+ "</sd:"+SESSION_IDENTITY_NODE+">");
+ }
+
+ java.util.Iterator<Identity> ids=null;
+
+ if (session != null) {
+ ids = session.getPrimaryIdentities().iterator();
+ }
+
+ // If session has no identity information, but a
+ // message is supplied, then try getting identity
+ // from it.
+ if ((ids == null || ids.hasNext() == false) &&
+ mesg != null && mesg.getMessageIdentities() != null) {
+ ids = mesg.getMessageIdentities().iterator();
+ }
+
+ if (ids != null && ids.hasNext()) {
+ identities.append("<sd:"+PRIMARY_IDENTITIES_NODE+">");
+
+ while (ids.hasNext()) {
+ Identity cur=ids.next();
+
+ identities.append("<sd:"+IDENTITY_NODE+" "+NAME_ATTR+"=\""+
+ cur.getName()+"\" >");
+ identities.append(XMLUtils.encodeXMLString(cur.getFullId()));
+ identities.append("</sd:"+IDENTITY_NODE+">");
+ }
+
+ identities.append("</sd:"+PRIMARY_IDENTITIES_NODE+">");
+ }
+
+ return(identities.toString());
+ }
+
+ /**
+ * This method returns the XML text associated with the
+ * message.
+ *
+ * @param mesg The message
+ * @param defn The message definition from the description
+ * @return The message text
+ */
+ public String getMessageText(Message mesg, MessageDefinition defn) {
+ String type=null;
+
+ if (defn == null) {
+ type = (mesg.isRequest()?REQUEST_RPC_MESSAGE_TYPE:RESPONSE_RPC_MESSAGE_TYPE);
+
+ if (mesg.isRPCStyle() == false) {
+ type = MESSAGE_STYLE_MESSAGE_TYPE;
+ }
+ } else {
+ type = (defn.getClassification()==MessageClassification.REQUEST?
+ REQUEST_RPC_MESSAGE_TYPE:RESPONSE_RPC_MESSAGE_TYPE);
+ }
+
+ if (NamesUtil.isSet(mesg.getFaultName())) {
+ type = FAULT_RPC_MESSAGE_TYPE;
+ }
+
+ return(getMessageTextForType(mesg, type));
+ }
+
+ /**
+ * This method returns the XML text associated with the
+ * message.
+ *
+ * @param mesg The message
+ * @param type The message classification (request/response/message/fault)
+ * @return The message text
+ */
+ protected String getMessageTextForType(Message mesg, String type) {
+ String ret=null;
+ String fault="";
+ String messageType="";
+ String identities="";
+ String valueText=getMessagePayload(mesg);
+ String endpoint="";
+
+ if (NamesUtil.isSet(mesg.getFaultName())) {
+ fault = FAULT_ATTR+"=\""+mesg.getFaultName()+"\" ";
+ }
+
+ if (NamesUtil.isSet(mesg.getType())) {
+ messageType = MESSAGE_TYPE_ATTR+"=\""+mesg.getType()+"\" ";
+ }
+
+ if (mesg.getSessionIdentity() != null) {
+ identities = "<sd:"+SESSION_IDENTITY_NODE+">"+
+ "<sd:"+IDENTITY_NODE+" "+NAME_ATTR+"=\""+
+ mesg.getSessionIdentity().getName()+"\" >"+
+ mesg.getSessionIdentity().getFullId()+
+ "</sd:"+IDENTITY_NODE+">"+
+ "</sd:"+SESSION_IDENTITY_NODE+">";
+
+ if (mesg.getChannelIdentity() != null) {
+ identities += "<sd:"+CHANNEL_IDENTITY_NODE+">"+
+ "<sd:"+IDENTITY_NODE+" "+NAME_ATTR+"=\""+
+ mesg.getChannelIdentity().getName()+"\" >"+
+ mesg.getChannelIdentity().getFullId()+
+ "</sd:"+IDENTITY_NODE+">"+
+ "</sd:"+CHANNEL_IDENTITY_NODE+">";
+ }
+ } else if (mesg.getMessageIdentities() != null &&
+ mesg.getMessageIdentities().size() > 0) {
+
+ identities += "<sd:"+PRIMARY_IDENTITIES_NODE+">";
+
+ for (int i=0; i < mesg.getMessageIdentities().size(); i++) {
+ Identity id=(Identity)mesg.getMessageIdentities().get(i);
+
+ identities += "<sd:"+IDENTITY_NODE+" "+NAME_ATTR+"=\""+
+ id.getName()+"\" >";
+ identities += id.getFullId();
+ identities += "</sd:"+IDENTITY_NODE+">";
+ }
+
+ identities += "</sd:"+PRIMARY_IDENTITIES_NODE+">";
+ }
+
+ if (mesg.getServiceEndpoint() != null) {
+ endpoint = mesg.getServiceEndpoint().toText(null);
+ }
+
+ String serviceType=mesg.getServiceType();
+ if (serviceType == null) {
+ serviceType = "";
+ }
+
+ ret = "<sd:"+MESSAGE_NODE+" "+OPERATION_ATTR+"=\""+
+ (mesg.getOperationName()==null?"":mesg.getOperationName())+
+ "\" "+TYPE_ATTR+"=\""+type+"\" "+fault+
+ messageType+SERVICE_TYPE_ATTR+"=\""+
+ serviceType+"\" ><sd:"+ENDPOINT_NODE+">"+
+ endpoint+"</sd:"+ENDPOINT_NODE+">"+identities+
+ valueText+"</sd:"+MESSAGE_NODE+">";
+
+ return(ret);
+ }
+
+ /**
+ * This method constructs the message payload value for the
+ * send and receive tracker events. The information is only
+ * provided if the service tracker is configured to supply
+ * it, as the performance impact of transporting large
+ * message payloads in tracker messages would not be appropriate
+ * for production environments - however it may be useful
+ * in development and test environments. If the supplied
+ * message is a multi-part message containing a single part
+ * then the single part will be extracted and used. If a
+ * multi-part message with multiple parts, then the map
+ * textual representation will be provided. If the value is
+ * a DOM representation, then it will be converted to a
+ * string. All other situations will rely on the 'toString'
+ * representation of the value to be appropriate.
+ *
+ * @param mesg The message
+ * @return The payload
+ */
+ protected String getMessagePayload(Message mesg) {
+ String ret="";
+
+ if (m_recordMessagePayload) {
+ Object value=mesg.getValue();
+ if (mesg.isMultiPart() && ((java.util.Map)value).size() == 1) {
+ value = ((java.util.Map)value).values().iterator().next();
+ }
+
+ if (value instanceof org.w3c.dom.Node) {
+ try {
+ value = XMLUtils.getText((org.w3c.dom.Node)value);
+ } catch(Exception e) {
+ logger.severe("Failed to convert message DOM value" +
+ "to string: "+e);
+ value = "";
+ }
+ }
+
+ if (value != null) {
+ //ret = "<sd:"+VALUE_NODE+">"+value.toString()+
+ // "</sd:"+VALUE_NODE+">";
+ ret = value.toString();
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the XML text associated with the
+ * channel.
+ *
+ * @param channel The channel
+ * @return The channel text
+ */
+ protected String getChannelText(Channel channel) {
+
+ if (channel == null) {
+ return("");
+ }
+
+ StringBuffer identities=new StringBuffer();
+
+ java.util.Set<Identity> ids=channel.getPrimaryIdentities();
+
+ if (ids != null && ids.size() > 0) {
+ identities.append("<sd:"+PRIMARY_IDENTITIES_NODE+">");
+
+ java.util.Iterator<Identity> iter=ids.iterator();
+ while (iter.hasNext()) {
+ Identity id=iter.next();
+
+ identities.append("<sd:"+IDENTITY_NODE+" "+NAME_ATTR+"=\""+
+ id.getName()+"\" >");
+ identities.append(XMLUtils.encodeXMLString(id.getFullId()));
+ identities.append("</sd:"+IDENTITY_NODE+">");
+ }
+
+ identities.append("</sd:"+PRIMARY_IDENTITIES_NODE+">");
+ }
+
+ return("<sd:"+CHANNEL_NODE+" "+NAME_ATTR+"=\""+
+ channel.getName()+"\" "+TYPE_ATTR+"=\""+
+ channel.getType()+"\" >"+
+ identities.toString()+"</sd:"+CHANNEL_NODE+">");
+ }
+
+ /**
+ * This method processes the supplied value to deal with any
+ * unwanted characters that would be inappropriate for an
+ * XML attribute value.
+ *
+ * @param value The value
+ * @return The processed value
+ */
+ protected String processAttributeContents(String value) {
+ String ret=value;
+
+ ret = ret.replaceAll("\"", "");
+
+ return(ret);
+ }
+
+ /**
+ * This method records the tracker information. This method
+ * also takes the optional 'message', used to derive session
+ * identity, if the session does not currently have any
+ * identity. This situation should only occur if the first
+ * message to a service is an unexpected message.
+ *
+ * @param serviceName The service name
+ * @param serviceVersion The optional service version
+ * @param session The session
+ * @param mesg The message
+ * @param xml The information to be recorded
+ * @param type The type of information (INFO, WARNING, ERROR)
+ * @param exc The optional exception
+ */
+ protected void record(String serviceName, String serviceVersion,
+ Session session, Message mesg, String xml, String type, Throwable exc) {
+
+ String message=build(serviceName, serviceVersion,
+ session, mesg, xml);
+
+ publish(serviceName, session, message);
+ }
+
+ /**
+ * This method records the tracker information.
+ *
+ * @param serviceName The service name
+ * @param session The session
+ * @param xml The information to be recorded
+ * @param type The type of information (INFO, WARNING, ERROR)
+ * @param exc The optional exception
+ */
+ protected void record(String serviceName, Session session,
+ String xml, String type, Throwable exc) {
+ record(serviceName, null, session, null, xml, type, exc);
+ }
+
+ /**
+ * This method constructs the service tracker message to be
+ * published.
+ *
+ * @param serviceName The service name
+ * @param serviceVersion The optional service version
+ * @param session The session
+ * @param mesg The optional message
+ * @param xml The XML for the current tracker event
+ * @return The message
+ */
+ protected String build(String serviceName, String serviceVersion,
+ Session session, Message mesg, String xml) {
+ StringBuffer ret=new StringBuffer();
+ String versionText="";
+ String nameText="";
+
+ if (serviceName != null) {
+ nameText = NAME_ATTR+"=\""+serviceName+"\" ";
+ }
+
+ if (serviceVersion != null) {
+ versionText=VERSION_ATTR+"=\""+serviceVersion+"\" ";
+
+ } else if (session != null && session.getId() != null &&
+ session.getId().getServiceDescriptionVersion() != null) {
+ versionText=VERSION_ATTR+"=\""+
+ session.getId().getServiceDescriptionVersion()+
+ "\" ";
+ }
+
+ ret.append("<sd:record xmlns:sd=\""+
+ SAVARA_SERVICE_TRACKER_NS+"\" "+nameText+versionText+">");
+
+ ret.append(getSessionIdentityText(session, mesg));
+
+ ret.append("<sd:events>");
+
+ ret.append(xml);
+
+ ret.append("</sd:events>");
+ ret.append("</sd:record>");
+
+ return(ret.toString());
+ }
+
+ /**
+ * This method determines whether message payload will be
+ * recorded.
+ *
+ * @param bool Whether the message payload is recorded
+ */
+ public void setRecordMessagePayload(String bool) {
+ logger.info("Record message payload: "+bool);
+
+ if (bool != null && bool.equalsIgnoreCase("true")) {
+ m_recordMessagePayload = true;
+ } else {
+ m_recordMessagePayload = false;
+ }
+ }
+
+ private static Logger logger = Logger.getLogger(JMSServiceTracker.class.getName());
+
+ private boolean m_recordMessagePayload=false;
+
+ public static final String RECORD_MESSAGE_PAYLOAD = "pi4soa.tracker.messagePayload";
+
+ public static final String INFO="info";
+ public static final String WARNING="warning";
+ public static final String ERROR="error";
+
+ public static final String MESSAGE_NODE="message";
+ public static final String DETAILS_NODE="details";
+ public static final String OPERATION_ATTR="operation";
+ public static final String FAULT_ATTR="fault";
+ public static final String NAME_ATTR="name";
+ public static final String TIMESTAMP_ATTR="timestamp";
+ public static final String TYPE_ATTR="type";
+ public static final String MESSAGE_TYPE_ATTR="messageType";
+ public static final String SERVICE_TYPE_ATTR="serviceType";
+ public static final String EXCEPTION_NODE="exception";
+ public static final String SERVICE_INSTANCE_ID_ATTR="serviceInstanceId";
+ public static final String SESSION_ID_ATTR="sessionId";
+ public static final String PARENT_SESSION_ID_ATTR="parentSessionId";
+
+ public static final String VERSION_ATTR = "version";
+ public static final String FAULT_RPC_MESSAGE_TYPE = "fault";
+ public static final String RESPONSE_RPC_MESSAGE_TYPE = "response";
+ public static final String REQUEST_RPC_MESSAGE_TYPE = "request";
+ public static final String MESSAGE_STYLE_MESSAGE_TYPE = "message";
+ public static final String SESSION_IDENTITY_NODE = "sessionIdentity";
+ public static final String CHANNEL_IDENTITY_NODE = "channelIdentity";
+ public static final String IDENTITY_NODE = "identity";
+ public static final String PRIMARY_IDENTITIES_NODE = "primaryIdentities";
+ public static final String ENDPOINT_NODE = "endpoint";
+ public static final String CHANNEL_NODE = "channel";
+ public static final String VALUE_NODE = "value";
+
+ protected static final String TRACKER_JNDI_INITIAL_CONTEXT_FACTORY_PROPERTY = "pi4soa.tracker.jndi.initialContextFactory";
+ protected static final String TRACKER_JNDI_PROVIDER_URL_PROPERTY = "pi4soa.tracker.jndi.providerURL";
+ protected static final String TRACKER_JNDI_FACTORY_URL_PACKAGES_PROPERTY = "pi4soa.tracker.jndi.factoryURLPackages";
+ protected static final String TRACKER_JMS_TOPIC_CONNECTION_FACTORY_PROPERTY = "pi4soa.tracker.jms.topicConnectionFactory";
+ protected static final String TRACKER_JMS_TOPIC_PROPERTY = "pi4soa.tracker.jms.topic";
+ protected static final String TRACKER_JMS_CONNECTION_FACTORY_PROPERTY = "pi4soa.tracker.jms.connectionFactory";
+ protected static final String TRACKER_JMS_CONNECTION_FACTORY_ALTERNATE_PROPERTY = "pi4soa.tracker.jms.connectionFactoryAlternate";
+ protected static final String TRACKER_JMS_DESTINATION_PROPERTY = "pi4soa.tracker.jms.destination";
+ protected static final String TRACKER_JMS_CLIENT_ID_PROPERTY = "pi4soa.tracker.jms.clientId";
+ protected static final String TRACKER_JMS_DURABLE_SUBSCRIPTION_PROPERTY = "pi4soa.tracker.jms.durableSubscription";
+
+ private boolean m_initialized=false;
+ private String m_jndiInitialContextFactory=null;
+ private String m_jndiProviderURL=null;
+ private String m_jndiFactoryURLPackages=null;
+ private String m_jmsConnectionFactory=null;
+ private String m_jmsConnectionFactoryAlternate=null;
+ private String m_jmsDestination=null;
+
+ private javax.jms.Connection m_connection=null;
+ private javax.jms.Session m_session=null;
+ private javax.jms.MessageProducer m_producer=null;
+}
Added: branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/pi4soa/Pi4SOAServiceValidator.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/pi4soa/Pi4SOAServiceValidator.java (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/pi4soa/Pi4SOAServiceValidator.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -0,0 +1,282 @@
+/*
+ * 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.savara.activity.validator.cdm.pi4soa;
+
+import javax.xml.namespace.QName;
+
+import org.apache.log4j.Logger;
+
+import org.savara.activity.model.Context;
+import org.savara.activity.validator.cdm.AbstractServiceValidator;
+import org.savara.activity.validator.cdm.ValidatorName;
+import org.pi4soa.common.util.MessageUtil;
+import org.pi4soa.service.ServiceException;
+import org.pi4soa.service.behavior.*;
+import org.pi4soa.service.monitor.*;
+
+/**
+ * This class implements the pi4soa service validator responsible for
+ * validating a stream of ESB messages against a choreography model.
+ */
+public class Pi4SOAServiceValidator extends AbstractServiceValidator {
+
+ private static final String CDM_MODEL_TYPE = "cdm";
+
+ /**
+ * This is the constructor for the pi4soa service
+ * validator implementation.
+ *
+ * @param name The validator name
+ * @throws Exception Failed to initialize service validator
+ */
+ public Pi4SOAServiceValidator(ValidatorName name)
+ throws Exception {
+ super(name);
+
+ update();
+ }
+
+ /**
+ * This method returns the model type associated with this
+ * service validator.
+ *
+ * @return The model type
+ */
+ public static String getModelType() {
+ return CDM_MODEL_TYPE;
+ }
+
+ public String getProtocolName() {
+ return(m_protocolName);
+ }
+
+ /**
+ * This method is called to update the model associated
+ * with the service validator.
+ *
+ * @throws Exception Failed to update the service validator
+ */
+ public void update() throws Exception {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Update: "+getValidatorName());
+ }
+
+ java.io.InputStream is=getModel();
+
+ if (is != null) {
+ org.pi4soa.cdl.Package cdlpack=
+ org.pi4soa.service.util.DescriptionRetrievalUtil.instance().getCDLPackage(is);
+
+ if (cdlpack != null) {
+ m_protocolName = new QName(cdlpack.getTargetNamespace(), cdlpack.getName()).toString();
+ }
+
+ try {
+ is.close();
+ } catch(Exception e) {
+ logger.error("Failed to close model '"+
+ getValidatorName()+"' input stream", e);
+ }
+ }
+
+ // Get the endpoint description
+ is=getModel();
+
+ if (is != null) {
+ org.pi4soa.service.behavior.ServiceDescription sdesc=
+ org.pi4soa.service.util.DescriptionRetrievalUtil.instance().getServiceDescription(is,
+ getValidatorName().getRole());
+
+ try {
+ is.close();
+ } catch(Exception e) {
+ logger.error("Failed to close model '"+
+ getValidatorName()+"' input stream", e);
+ }
+
+ if (sdesc != null) {
+
+ if (m_monitor == null) {
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Service monitor for '"+
+ sdesc.getFullyQualifiedName()+
+ "' being created");
+ }
+
+ try {
+ // Use XML configuration, to enable alternative
+ // runtime configuration to be specified by
+ // including a pi4soa.xml file in the environment
+ DefaultMonitorConfiguration conf=
+ new XMLMonitorConfiguration();
+
+ conf.setValidateBehaviour(getValidatorName().isValidate());
+
+ m_monitor = ServiceMonitorFactory.getServiceMonitor(conf);
+
+ // Register service description
+ m_monitor.getConfiguration().getServiceRepository().
+ addServiceDescription(sdesc);
+
+ logger.debug("Created monitor for service description "+sdesc.getFullyQualifiedName());
+
+ } catch(Exception e) {
+ logger.error("Failed to initialize service monitor: "+e);
+ }
+ } else {
+
+ synchronized(m_monitor) {
+ // Service monitor already in use for the service
+ // description, so update description
+ try {
+ // Clear previous version of the service description
+ ServiceDescription[] sdescs=
+ m_monitor.getConfiguration().getServiceRepository().getServiceDescriptions();
+
+ for (int i=0; sdescs != null && i < sdescs.length; i++) {
+ m_monitor.getConfiguration().getServiceRepository().
+ removeServiceDescription(sdescs[i]);
+ }
+
+ logger.debug("Updating service description for "+sdesc.getFullyQualifiedName());
+
+ m_monitor.getConfiguration().getServiceRepository().addServiceDescription(sdesc);
+ } catch(Exception e) {
+ logger.error("Failed to update service description '"+
+ sdesc.getFullyQualifiedName()+"'", e);
+ }
+ }
+ }
+ } else {
+ logger.error("Unable to obtain service description for validator '"+
+ getValidatorName()+"'");
+ }
+ } else {
+ logger.error("Unable to obtain model for validator '"+
+ getValidatorName()+"'");
+
+ throw new java.io.IOException("Failed to locate model '"+
+ getValidatorName().getModelName()+"'");
+ }
+ }
+
+ /**
+ * This method processes a sent message against a service
+ * behavioural description.
+ *
+ * @param mesgType The optional message type
+ * @param msg The message
+ * @throws Exception Failed to process sent message
+ */
+ public java.util.List<Context> messageSent(String mesgType, java.io.Serializable msg) throws Exception {
+
+ if (msg == null) {
+ throw new ServiceException("Failed to obtain value from message: "+msg);
+ }
+
+ if (mesgType == null) {
+ mesgType = MessageUtil.getMessageType(msg);
+ }
+
+ org.pi4soa.service.Message mesg=
+ m_monitor.createMessage(mesgType,
+ null, null, msg, null, null);
+
+ synchronized(m_monitor) {
+ m_monitor.messageSent(mesg);
+ }
+
+ return(getContexts(mesg));
+ }
+
+ /**
+ * This method processes a received message against a service
+ * behavioural description.
+ *
+ * @param mesgType The optional message type
+ * @param msg The message
+ * @throws Exception Failed to process received message
+ */
+ public java.util.List<Context> messageReceived(String mesgType, java.io.Serializable msg) throws Exception {
+
+ if (msg == null) {
+ throw new ServiceException("Failed to obtain value from message: "+msg);
+ }
+
+ if (mesgType == null) {
+ mesgType = MessageUtil.getMessageType(msg);
+ }
+
+ org.pi4soa.service.Message mesg=
+ m_monitor.createMessage(mesgType,
+ null, null, msg, null, null);
+
+ synchronized(m_monitor) {
+ m_monitor.messageReceived(mesg);
+ }
+
+ return(getContexts(mesg));
+ }
+
+ protected java.util.List<Context> getContexts(org.pi4soa.service.Message mesg) {
+ java.util.List<Context> ret=new java.util.Vector<Context>();
+
+ for (org.pi4soa.service.Identity id : mesg.getMessageIdentities()) {
+ Context context=new Context();
+ String name=null;
+ for (String token : id.getTokens()) {
+ if (name == null) {
+ name = token;
+ } else {
+ name += ":"+token;
+ }
+ }
+ context.setName(name);
+
+ String value=null;
+ for (Object val : id.getValues()) {
+ if (value == null) {
+ value = val.toString();
+ } else {
+ value += ":"+val.toString();
+ }
+ }
+ context.setValue(value);
+
+ ret.add(context);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method closes the service validator.
+ *
+ * @throws Exception Failed to close the service validator
+ */
+ public void close() throws Exception {
+ m_monitor.close();
+ }
+
+ private static final Logger logger = Logger.getLogger(Pi4SOAServiceValidator.class);
+
+ private org.pi4soa.service.monitor.ServiceMonitor m_monitor=null;
+ private String m_protocolName=null;
+}
Added: branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/pi4soa/Pi4SOAValidatorConfigLoader.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/pi4soa/Pi4SOAValidatorConfigLoader.java (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/pi4soa/Pi4SOAValidatorConfigLoader.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.savara.activity.validator.cdm.pi4soa;
+
+import org.savara.activity.validator.cdm.DefaultValidatorConfig;
+import org.savara.activity.validator.cdm.ValidatorConfig;
+import org.savara.activity.validator.cdm.ValidatorConfigLoader;
+
+/**
+ * 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,
+ validator);
+
+ return(ret);
+ }
+}
Added: branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/pi4soa/ValidatorConfigGenerator.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/pi4soa/ValidatorConfigGenerator.java (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity.validator.cdm/src/main/java/org/savara/activity/validator/cdm/pi4soa/ValidatorConfigGenerator.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -0,0 +1,325 @@
+/*
+ * 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.savara.activity.validator.cdm.pi4soa;
+
+import java.util.Collections;
+import org.apache.log4j.Logger;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.pi4soa.cdl.*;
+import org.pi4soa.common.annotations.*;
+import org.pi4soa.common.xml.XMLUtils;
+
+/**
+ * This class provides a generator for the JBossESB Validator
+ * configuration.
+ */
+public class ValidatorConfigGenerator {
+
+ private static final String VALIDATE_ATTR = "validate";
+ 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";
+
+ public static void main(String[] args) {
+ if (args.length != 1) {
+ System.err.println("Usage: ValidatorConfigGenerator cdmPath");
+ System.exit(1);
+ }
+
+ try {
+ java.io.FileInputStream is=new java.io.FileInputStream(args[0]);
+
+ org.pi4soa.cdl.Package cdlpack=org.pi4soa.cdl.CDLManager.load(is);
+
+ is.close();
+
+ ValidatorConfigGenerator gen=new ValidatorConfigGenerator();
+
+ org.w3c.dom.Element config=gen.generate(cdlpack, args[0]);
+
+ System.out.println("CONFIG:\r\n"+XMLUtils.getText(config, true));
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * The default constructor.
+ */
+ public ValidatorConfigGenerator() {
+ }
+
+ /**
+ * This method generates the validator configuration associated
+ * with the supplied choreography.
+ *
+ * @param cdlpack The CDL package
+ * @param model The model (choreography file name)
+ * @return The validator config
+ */
+ public org.w3c.dom.Element generate(org.pi4soa.cdl.Package cdlpack,
+ String model) {
+ org.w3c.dom.Element ret=null;
+
+ try {
+ ret = createValidatorConfig();
+
+ // Create the new entries for the supplied choreography
+ if (cdlpack != null) {
+ createEntries(ret, model, cdlpack);
+ } else {
+ logger.error("Choreography not supplied for '"+model+"'");
+ }
+
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ if (logger.isDebugEnabled()) {
+ try {
+ logger.debug(XMLUtils.getText(ret, true));
+ } 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());
+ service.setAttribute(VALIDATE_ATTR, Boolean.TRUE.toString());
+
+ cdlpack.visit(new InputOutputAnalyser(ptype, service));
+
+ if (service.getFirstChild() != null) {
+ validator.appendChild(service);
+ }
+ }
+ }
+
+ private static Logger logger = Logger.getLogger(ValidatorConfigGenerator.class);
+
+ public class InputOutputAnalyser extends DefaultCDLVisitor {
+
+ private static final String DESTINATION_TYPE_ENDPOINT_ADDRESS = "endpoint address";
+ private static final String TYPE_ATTR = "type";
+ private static final String DYNAMIC_REPLY_TO_ATTR = "dynamicReplyTo";
+ private static final String VALIDATOR_ANNOTATION = "validator";
+ private static final String VALIDATOR_ELEMENT = "validator";
+ 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(VALIDATOR_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(VALIDATOR_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(
+ VALIDATOR_ELEMENT)) {
+ org.w3c.dom.NodeList nl=
+ doc.getDocumentElement().getElementsByTagName(DESTINATION_ELEMENT);
+
+ if (nl.getLength() == 1) {
+ dest = (org.w3c.dom.Element)nl.item(0);
+ } else if (nl.getLength() > 1) {
+ logger.error("Too many destination elements ("+
+ nl.getLength()+") found");
+ } else {
+ logger.error("No destinations found");
+ }
+ }
+
+ } catch(Exception e) {
+ logger.error("Failed to load validator annotation", e);
+ }
+ }
+
+ if (dest != null) {
+ processDestination(details, dest, from);
+ }
+ }
+ }
+
+ /**
+ * This method processes the destination information
+ * associated with the exchange details.
+ *
+ * @param details The exchange details
+ * @param dest The destination DOM element
+ * @param from Whether the 'from' or 'to' role should
+ * be considered
+ */
+ protected void processDestination(ExchangeDetails details,
+ org.w3c.dom.Element dest, boolean from) {
+ String elemName=null;
+
+ if (dest != null) {
+ if (from) {
+ if (details.getAction() == ExchangeActionType.REQUEST) {
+ elemName = OUTPUT_ELEMENT;
+ } else if (dest.getAttribute(TYPE_ATTR).trim().length() == 0 ||
+ dest.getAttribute(TYPE_ATTR).equals(DESTINATION_TYPE_ENDPOINT_ADDRESS)) {
+ elemName = INPUT_ELEMENT;
+ }
+ } else {
+ if (details.getAction() == ExchangeActionType.REQUEST) {
+ elemName = INPUT_ELEMENT;
+ } else if (dest.getAttribute(TYPE_ATTR).trim().length() == 0 ||
+ dest.getAttribute(TYPE_ATTR).equals(DESTINATION_TYPE_ENDPOINT_ADDRESS)) {
+ elemName = OUTPUT_ELEMENT;
+ }
+ }
+
+ if (elemName != null) {
+ org.w3c.dom.Element elem=m_service.getOwnerDocument().createElement(elemName);
+
+ // Parameter has been stored in a structured manner
+ // to support use of templates and presentations,
+ // so need to extract the value
+ java.util.List<TemplateParameter> params=
+ m_templateProcessor.getTemplateParameters(dest.getAttribute(NAME_ATTR));
+
+ if (params != null && params.size() > 0) {
+ elem.setAttribute(EPR_ATTR, params.get(0).getValue());
+ }
+
+ if (dest.hasAttribute(DYNAMIC_REPLY_TO_ATTR)) {
+ params=m_templateProcessor.getTemplateParameters(dest.getAttribute(DYNAMIC_REPLY_TO_ATTR));
+
+ if (params != null && params.size() > 0) {
+
+ if (params.get(0).getValue().equalsIgnoreCase("true")) {
+ elem.setAttribute(DYNAMIC_REPLY_TO_ATTR, "true");
+ }
+ }
+ }
+
+ if (elem.hasAttribute(EPR_ATTR)) {
+ m_service.appendChild(elem);
+ }
+ }
+ }
+ }
+
+ private ParticipantType m_participantType=null;
+ private org.w3c.dom.Element m_service=null;
+ private org.pi4soa.common.annotations.TemplateProcessor m_templateProcessor=null;
+ }
+}
Modified: branches/experimental/2.0.x/bundles/pom.xml
===================================================================
--- branches/experimental/2.0.x/bundles/pom.xml 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/bundles/pom.xml 2011-02-18 20:09:45 UTC (rev 689)
@@ -22,6 +22,7 @@
<modules>
<module>org.savara.activity</module>
<module>org.savara.activity.notifier.jms</module>
+ <module>org.savara.activity.validator.cdm</module>
<module>org.savara.bpel</module>
<module>org.savara.common</module>
<module>org.savara.common.config.file</module>
Modified: branches/experimental/2.0.x/integration/jboss/common/.classpath
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/.classpath 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/.classpath 2011-02-18 20:09:45 UTC (rev 689)
@@ -171,6 +171,7 @@
<classpathentry kind="var" path="M2_REPO/org/pi4soa/org.pi4soa.service/3.1.0.Final/org.pi4soa.service-3.1.0.Final.jar"/>
<classpathentry kind="var" path="M2_REPO/org/savara/bundles/org.savara.activity/2.0.0-SNAPSHOT/org.savara.activity-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/savara/bundles/org.savara.activity/2.0.0-SNAPSHOT/org.savara.activity-2.0.0-SNAPSHOT-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/savara/bundles/org.savara.activity.notifier.jms/2.0.0-SNAPSHOT/org.savara.activity.notifier.jms-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/savara/bundles/org.savara.activity.notifier.jms/2.0.0-SNAPSHOT/org.savara.activity.notifier.jms-2.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/savara/bundles/org.savara.activity.validator.cdm/2.0.0-SNAPSHOT/org.savara.activity.validator.cdm-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/savara/bundles/org.savara.activity.validator.cdm/2.0.0-SNAPSHOT/org.savara.activity.validator.cdm-2.0.0-SNAPSHOT-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/savara/bundles/org.savara.common/2.0.0-SNAPSHOT/org.savara.common-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/savara/bundles/org.savara.common/2.0.0-SNAPSHOT/org.savara.common-2.0.0-SNAPSHOT-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/savara/bundles/org.savara.common.config.file/2.0.0-SNAPSHOT/org.savara.common.config.file-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/savara/bundles/org.savara.common.config.file/2.0.0-SNAPSHOT/org.savara.common.config.file-2.0.0-SNAPSHOT-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/scribble/bundles/org.scribble.common/2.0.0-SNAPSHOT/org.scribble.common-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/scribble/bundles/org.scribble.common/2.0.0-SNAPSHOT/org.scribble.common-2.0.0-SNAPSHOT-sources.jar"/>
Modified: branches/experimental/2.0.x/integration/jboss/common/pom.xml
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/pom.xml 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/pom.xml 2011-02-18 20:09:45 UTC (rev 689)
@@ -48,36 +48,10 @@
<version>${savara.version}</version>
</dependency>
<dependency>
- <groupId>org.pi4soa</groupId>
- <artifactId>org.pi4soa.common</artifactId>
- <version>${pi4soa.version}</version>
+ <groupId>org.savara.bundles</groupId>
+ <artifactId>org.savara.activity.validator.cdm</artifactId>
+ <version>${savara.version}</version>
</dependency>
- <dependency>
- <groupId>org.pi4soa</groupId>
- <artifactId>org.pi4soa.cdl</artifactId>
- <version>${pi4soa.version}</version>
- </dependency>
- <dependency>
- <groupId>org.pi4soa</groupId>
- <artifactId>org.pi4soa.service</artifactId>
- <version>${pi4soa.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.savara.dependencies.eclipse</groupId>
- <artifactId>emf-common</artifactId>
- <version>2.3.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.savara.dependencies.eclipse</groupId>
- <artifactId>emf-ecore</artifactId>
- <version>2.3.1</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.savara.dependencies.eclipse</groupId>
- <artifactId>emf-ecore-xmi</artifactId>
- <version>2.3.1</version>
- </dependency>
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-client</artifactId>
Modified: branches/experimental/2.0.x/integration/jboss/common/src/main/configs/META-INF/jboss-beans.xml
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/configs/META-INF/jboss-beans.xml 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/configs/META-INF/jboss-beans.xml 2011-02-18 20:09:45 UTC (rev 689)
@@ -4,8 +4,6 @@
<bean class="org.savara.validator.service.ServiceValidatorService"
name="ServiceValidator">
<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.savara:service=ServiceValidatorManager", exposedInterface=org.savara.validator.service.ServiceValidatorServiceMBean.class,registerDirectly=true)</annotation>
- <property name="jndiName"><value>savara/ServiceValidatorManager</value></property>
- <depends>jboss:service=Naming</depends>
<depends>jboss.messaging.destination:service=Topic,name=tracker</depends>
</bean>
Modified: branches/experimental/2.0.x/integration/jboss/common/src/main/configs/common-assembly.xml
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/configs/common-assembly.xml 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/configs/common-assembly.xml 2011-02-18 20:09:45 UTC (rev 689)
@@ -24,6 +24,7 @@
<include>org.savara.bundles:org.savara.common.config.file</include>
<include>org.savara.bundles:org.savara.activity</include>
<include>org.savara.bundles:org.savara.activity.notifier.jms</include>
+ <include>org.savara.bundles:org.savara.activity.validator.cdm</include>
<include>org.pi4soa:org.pi4soa.common</include>
<include>org.pi4soa:org.pi4soa.cdl</include>
<include>org.pi4soa:org.pi4soa.service</include>
Deleted: branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/AbstractServiceValidator.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/AbstractServiceValidator.java 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/AbstractServiceValidator.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -1,70 +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.savara.validator;
-
-/**
- * Abstract base class representing the ServiceValidator.
- */
-public abstract class AbstractServiceValidator implements ServiceValidator {
-
- private static final String MODELS_PATH = "models/";
-
- /**
- * This is the constructor for the abstract
- * service validator, initialised with the validator
- * name.
- *
- * @param name The validator name
- */
- public AbstractServiceValidator(ValidatorName name) {
- m_name = name;
- }
-
- /**
- * This method returns the validator name.
- *
- * @return The validator name
- */
- public ValidatorName getValidatorName() {
- return(m_name);
- }
-
- /**
- * This method returns the input stream associated
- * with the model. Once the input stream has been
- * used, it is the caller's responsibility to close
- * the stream.
- *
- * @return The model's input stream, or null if
- * not found
- */
- protected java.io.InputStream getModel() {
- String filePath=MODELS_PATH+getValidatorName().getModelName();
-
- java.io.InputStream ret = AbstractServiceValidator.class.
- getClassLoader().getResourceAsStream(filePath);
-
- return(ret);
- }
-
- public String toString() {
- return("ServiceValidator["+getValidatorName()+"]");
- }
-
- private ValidatorName m_name=null;
-}
Deleted: branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/DefaultValidatorConfig.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/DefaultValidatorConfig.java 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/DefaultValidatorConfig.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -1,61 +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.savara.validator;
-
-/**
- * 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, org.w3c.dom.Element 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 org.w3c.dom.Element getConfiguration() {
- return(m_configuration);
- }
-
- private String m_modelType=null;
- private org.w3c.dom.Element m_configuration=null;
-}
Deleted: branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/Endpoint.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/Endpoint.java 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/Endpoint.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -1,87 +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.savara.validator;
-
-/**
- * This class represents an endpoint being monitored by one
- * or more service validator.
- */
-public class Endpoint {
-
- /**
- * This is the constructor for the endpoint, supplying
- * the destination associated with the endpoint.
- *
- * @param destination The destination
- */
- public Endpoint(String destination) {
- m_destination = destination;
- }
-
- /**
- * This method returns the destination for the endpoint.
- *
- * @return The destination
- */
- public String getDestination() {
- return(m_destination);
- }
-
- /**
- * This method returns the list of service validators
- * associated with this endpoint.
- *
- * @return The list of service validators for this endpoint
- */
- public java.util.List<ServiceValidator> getServiceValidators() {
- return(m_validators);
- }
-
- public boolean equals(Object obj) {
- boolean ret=false;
-
- if (obj instanceof Endpoint) {
- Endpoint ep=(Endpoint)obj;
-
- if (ep.getDestination() != null &&
- ep.getDestination().equals(m_destination)) {
- ret = true;
- }
- }
-
- return(ret);
- }
-
- public int hashCode() {
- int ret=0;
-
- if (m_destination != null) {
- ret = m_destination.hashCode();
- }
-
- return(ret);
- }
-
- public String toString() {
- return("Endpoint["+m_destination+"]");
- }
-
- private String m_destination=null;
- private java.util.List<ServiceValidator> m_validators=
- new java.util.Vector<ServiceValidator>();
-}
Deleted: branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ServiceValidator.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ServiceValidator.java 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ServiceValidator.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -1,77 +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.savara.validator;
-
-import org.savara.activity.model.Context;
-
-/**
- * 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();
-
- /**
- * The protocol name.
- *
- * @return The protocol name
- */
- public String getProtocolName();
-
- /**
- * This method processes a sent message against a service
- * behavioural description.
- *
- * @param mesgType The optional message type
- * @param msg The message
- * @throws Exception Failed to process sent message
- */
- public java.util.List<Context> messageSent(String mesgType, java.io.Serializable msg) throws Exception;
-
- /**
- * This method processes a received message against a service
- * behavioural description.
- *
- * @param mesgType The optional message type
- * @param msg The message
- * @throws Exception Failed to process received message
- */
- public java.util.List<Context> messageReceived(String mesgType, java.io.Serializable msg) throws Exception;
-
- /**
- * This method is called to update the model associated
- * with the service validator.
- *
- * @throws Exception Failed to update the service validator
- */
- public void update() throws Exception;
-
- /**
- * This method closes the service validator.
- *
- * @throws Exception Failed to close the service validator
- */
- public void close() throws Exception;
-
-}
Deleted: branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ServiceValidatorFactory.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ServiceValidatorFactory.java 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ServiceValidatorFactory.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -1,69 +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.savara.validator;
-
-import java.lang.reflect.Constructor;
-import org.apache.log4j.Logger;
-
-/**
- * This class provides a factory for Service Validators.
- */
-public class ServiceValidatorFactory {
-
- /**
- * This method returns the Service Validator appropriate
- * for the supplied validator name.
- *
- * @param name The validator name
- * @return The service validator
- * @exception IOException Failed to create the service validator
- */
- public static ServiceValidator getServiceValidator(ValidatorName name)
- throws Exception {
- ServiceValidator ret=null;
-
- String modelType=name.getModelType();
-
- if (modelType != null &&
- m_validatorClasses.containsKey(modelType)) {
- Class<?> cls=m_validatorClasses.get(modelType);
-
- Constructor<?> con=cls.getConstructor(
- new Class[]{ValidatorName.class});
-
- ret = (ServiceValidator)con.newInstance(new Object[]{name});
- }
-
- if (logger.isDebugEnabled()) {
- logger.debug("Returning service validator for "+
- name+": "+ret);
- }
-
- return(ret);
- }
-
- private static final Logger logger = Logger.getLogger(ServiceValidatorFactory.class);
-
- private static java.util.Map<String,Class<?>> m_validatorClasses=
- new java.util.HashMap<String,Class<?>>();
-
- static {
- m_validatorClasses.put(org.savara.validator.pi4soa.Pi4SOAServiceValidator.getModelType(),
- org.savara.validator.pi4soa.Pi4SOAServiceValidator.class);
- }
-}
Deleted: branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ServiceValidatorManager.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ServiceValidatorManager.java 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ServiceValidatorManager.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -1,972 +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.savara.validator;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.apache.log4j.Logger;
-
-/**
- * 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.
- */
- public ServiceValidatorManager() {
- initialize();
- }
-
- /**
- * This method initializes the service validator manager on
- * startup.
- */
- protected void initialize() {
-
- java.net.URL url=
- ServiceValidatorManager.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 closes the service validation manager.
- */
- public void close() {
- }
-
- /**
- * This method returns the list of service validators associated
- * with the supplied input endpoint.
- *
- * @param endpoint The input endpoint
- * @return The list of service validators, or null if the endpoint
- * is unknown
- */
- public java.util.List<ServiceValidator> getInputServiceValidators(Endpoint endpoint) {
- java.util.List<ServiceValidator> ret=
- m_inputValidators.get(endpoint);
-
- if (ret == null) {
- ret = m_replyToManager.getInputServiceValidators(endpoint);
- }
-
- if (logger.isDebugEnabled()) {
- logger.debug("Return input validators '"+endpoint+"': "+ret);
- }
-
- return(ret);
- }
-
- /**
- * This method determines whether the supplied endpoint will be
- * associated with a dynamic reply-to endpoint.
- *
- * @param endpoint The endpoint
- * @return Whether the endpoint has a dynamic reply-to
- */
- public boolean isInputDynamicReplyTo(Endpoint endpoint) {
- boolean ret=m_inputDynaReplyTos.contains(endpoint);
-
- if (logger.isDebugEnabled()) {
- logger.debug("Is input endpoint '"+endpoint+
- "' a dynamic reply-to: "+ret);
- }
-
- return(ret);
- }
-
- /**
- * This method returns the list of service validators associated
- * with the supplied output endpoint.
- *
- * @param endpoint The output endpoint
- * @return The list of service validators, or null if the endpoint
- * is unknown
- */
- public java.util.List<ServiceValidator> getOutputServiceValidators(Endpoint endpoint) {
- java.util.List<ServiceValidator> ret=
- m_outputValidators.get(endpoint);
-
- if (ret == null) {
- ret = m_replyToManager.getOutputServiceValidators(endpoint);
- }
-
- if (logger.isDebugEnabled()) {
- logger.debug("Return output validators '"+endpoint+"': "+ret);
- }
-
- return(ret);
- }
-
- /**
- * This method determines whether the supplied endpoint will be
- * associated with a dynamic reply-to endpoint.
- *
- * @param endpoint The endpoint
- * @return Whether the endpoint has a dynamic reply-to
- */
- public boolean isOutputDynamicReplyTo(Endpoint endpoint) {
- boolean ret=m_outputDynaReplyTos.contains(endpoint);
-
- if (logger.isDebugEnabled()) {
- logger.debug("Is output endpoint '"+endpoint+
- "' a dynamic reply-to: "+ret);
- }
-
- return(ret);
- }
-
- /**
- * This method registers a list of service validators against
- * a dynamic 'reply-to' endpoint.
- *
- * @param endpoint The endpoint
- * @param validators The list of service validators
- */
- public void registerInputReplyToValidators(Endpoint endpoint,
- java.util.List<ServiceValidator> validators) {
-
- if (logger.isDebugEnabled()) {
- logger.debug("Register input reply-to '"+endpoint+"': "+validators);
- }
-
- m_replyToManager.registerInputDynamicReplyTo(endpoint, validators);
- }
-
- /**
- * This method registers a list of service validators against
- * a dynamic 'reply-to' endpoint.
- *
- * @param endpoint The endpoint
- * @param validators The list of service validators
- */
- public void registerOutputReplyToValidators(Endpoint endpoint,
- java.util.List<ServiceValidator> validators) {
- if (logger.isDebugEnabled()) {
- logger.debug("Register output reply-to '"+endpoint+"': "+validators);
- }
-
- m_replyToManager.registerOutputDynamicReplyTo(endpoint, validators);
- }
-
- /**
- * This method returns a ServiceValidator associated with the
- * supplied validator name.
- *
- * @param name The validator name
- * @return The service validator
- * @throws Exception Failed to create service validator
- */
- public ServiceValidator createServiceValidator(ValidatorName name)
- throws Exception {
- ServiceValidator ret=null;
-
- synchronized(m_serviceValidators) {
- ret = m_serviceValidators.get(name);
-
- // If does not exist, then create, else update
- // the existing service validator
- if (ret == null) {
- ret = ServiceValidatorFactory.getServiceValidator(name);
-
- m_serviceValidators.put(name, ret);
- } else {
-
- // Update the description
- ret.update();
- }
- }
-
- if (logger.isDebugEnabled()) {
- logger.debug("Created Service Validator '"+name+"': "+ret);
- }
-
- return(ret);
- }
-
- /**
- * This method removes the service validator associated with
- * the supplied validator name.
- *
- * @param name The validator name
- * @throws Exception Failed to remove the service validator
- */
- protected void removeServiceValidator(ValidatorName name)
- throws Exception {
- synchronized(m_serviceValidators) {
- ServiceValidator validator=(ServiceValidator)
- m_serviceValidators.remove(name);
-
- // Check if validator should be removed from
- // input/output endpoint mappings
- java.util.Iterator<Endpoint> iter=m_inputValidators.keySet().iterator();
-
- while (iter.hasNext()) {
- Endpoint ep=iter.next();
- java.util.List<ServiceValidator> list=
- m_inputValidators.get(ep);
-
- if (list.contains(validator)) {
- list.remove(validator);
-
- if (list.size() == 0) {
- logger.error("Input validator list, associated with endpoint '"+
- ep+"' contains no entries after removal of validator '"+
- name+"' - this Endpoint should have previously been removed");
- }
- }
- }
-
- iter=m_outputValidators.keySet().iterator();
-
- while (iter.hasNext()) {
- Endpoint ep=iter.next();
- java.util.List<ServiceValidator> list=
- m_outputValidators.get(ep);
-
- if (list.contains(validator)) {
- list.remove(validator);
-
- if (list.size() == 0) {
- logger.error("Output validator list, associated with endpoint '"+
- ep+"' contains no entries after removal of validator '"+
- name+"' - this Endpoint should have previously been removed");
- }
- }
- }
-
- if (validator != null) {
- validator.close();
- }
- }
- }
-
- /**
- * This method returns the set of currently configured
- * service validator names.
- *
- * @return The set of validator names
- */
- protected java.util.Set<ValidatorName> getServiceValidatorNames() {
- java.util.Set<ValidatorName> ret=new java.util.HashSet<ValidatorName>();
-
- ret.addAll(m_serviceValidators.keySet());
-
- return(ret);
- }
-
- /**
- * This method updates the configuration of the service
- * validators and endpoint mappings.
- */
- protected void updateConfigurations() {
- java.util.Set<ValidatorName> existingValidatorNames=
- getServiceValidatorNames();
-
- java.util.Set<Endpoint> existingInputEndpoints=
- new java.util.HashSet<Endpoint>(m_inputValidators.keySet());
-
- java.util.Set<Endpoint> existingOutputEndpoints=
- new java.util.HashSet<Endpoint>(m_outputValidators.keySet());
-
- java.util.Set<Endpoint> existingInputDynaReplyTos=
- new java.util.HashSet<Endpoint>(m_inputDynaReplyTos);
-
- java.util.Set<Endpoint> existingOutputDynaReplyTos=
- new java.util.HashSet<Endpoint>(m_outputDynaReplyTos);
-
- java.io.InputStream is=ServiceValidatorManager.class.getClassLoader().
- getResourceAsStream(CONFIG_FILE);
-
- if (logger.isDebugEnabled()) {
- logger.debug("ValidationFilter: config="+CONFIG_FILE+" is="+is);
- }
-
- try {
- DocumentBuilderFactory fact=DocumentBuilderFactory.newInstance();
- fact.setNamespaceAware(true);
-
- DocumentBuilder builder=fact.newDocumentBuilder();
- org.w3c.dom.Document doc=builder.parse(is);
-
- org.w3c.dom.Element config=doc.getDocumentElement();
-
- if (config.getNodeName().equals(VALIDATOR_NODE)) {
-
- // Old 'active' attribute is now 'mode'
- String active=config.getAttribute(ACTIVE_ATTR);
-
- if (active != null && active.equalsIgnoreCase("true")) {
- m_managedMode = true;
- }
-
- String mode=config.getAttribute(MODE_ATTR);
-
- if (mode != null) {
- if (mode.equals("manage")) {
- m_managedMode = true;
- } else if (mode.equals("monitor")) {
- m_managedMode = false; // will override active=true
- } else {
- logger.error("Unknown mode '"+mode+"' - setting to 'monitor'");
- m_managedMode = false;
- }
- }
-
- if (m_managedMode) {
- logger.debug("Setting validators in 'manage' mode");
- } else {
- logger.debug("Setting validators in 'monitor' mode");
- }
-
- // Check for dynamic replyTo endpoint timeout
- String timeoutValue=config.getAttribute(REPLY_TO_TIMEOUT_ATTR);
-
- if (timeoutValue != null) {
- try {
- long tv=Long.parseLong(timeoutValue);
-
- m_replyToManager.setReplyToTimeout(tv);
- } catch(Exception e) {
- logger.error("Unable to set 'reply to' timeout", e);
- }
- }
- }
-
- updateConfiguration(config, existingValidatorNames,
- existingInputEndpoints, existingOutputEndpoints,
- existingInputDynaReplyTos, existingOutputDynaReplyTos);
-
- // Work through choreography files in the models directory
- java.io.File[] files=m_modelsDir.listFiles();
-
- for (int i=0; i < files.length; i++) {
-
- // Check if a ValidatorModel exists for the
- // file
- try {
- ValidatorConfig vm=
- ValidatorConfigFactory.getValidatorConfig(files[i]);
-
- if (vm != null) {
- org.w3c.dom.Element vConfig=vm.getConfiguration();
-
- if (vConfig != null) {
- updateConfiguration(vConfig,
- existingValidatorNames,
- existingInputEndpoints,
- existingOutputEndpoints,
- existingInputDynaReplyTos,
- existingOutputDynaReplyTos);
- } else {
- logger.error("Failed to obtain configuration for model '"+
- files[i].getName()+"'");
- }
- }
- } catch(Exception e) {
- logger.error("Failed to update configuration for model '"+
- files[i].getName()+"'", e);
- }
- }
-
- // Any remaining input keys need to be removed
- java.util.Iterator<Endpoint> iter=
- existingInputEndpoints.iterator();
-
- while (iter.hasNext()) {
- Endpoint key=iter.next();
- m_inputValidators.remove(key);
- }
-
- iter = existingInputDynaReplyTos.iterator();
-
- while (iter.hasNext()) {
- Endpoint key=iter.next();
- m_inputDynaReplyTos.remove(key);
- }
-
- // Any remaining output keys need to be removed
- iter = existingOutputEndpoints.iterator();
-
- while (iter.hasNext()) {
- Endpoint key=iter.next();
- m_outputValidators.remove(key);
- }
-
- iter = existingOutputDynaReplyTos.iterator();
-
- while (iter.hasNext()) {
- Endpoint key=iter.next();
- m_outputDynaReplyTos.remove(key);
- }
-
- // Any remaining service description names need to
- // have their associated monitors removed
- java.util.Iterator<ValidatorName> sviter=
- existingValidatorNames.iterator();
-
- while (sviter.hasNext()) {
- ValidatorName svkey=sviter.next();
-
- try {
- logger.debug("Removing service validator: "+svkey);
- removeServiceValidator(svkey);
- } catch(Exception e) {
- logger.error(
- "Failed to remove service validator: "+svkey, e);
- }
- }
- } catch(Exception e) {
- logger.error("Failed to update configuration from input stream", e);
- }
- }
-
- /**
- * This method performs the update of the configuration of
- * service monitors, based on the information in the validator
- * configuration XML file, and the choreographies defined in the
- * models folder.
- *
- * @param config The configuration
- * @param existingValidatorNames The list of validator names
- * @param existingInputEndpoints The list of input endpoints
- * @param existingOutputEndpoints The list of output endpoints
- * @param existingInputDynaReplyTos The set of input dynamic replyTo endpoints
- * @param existingOutputDynaReplyTos The set of output dynamic replyTo endpoints
- */
- protected void updateConfiguration(org.w3c.dom.Element config,
- java.util.Set<ValidatorName> existingValidatorNames,
- java.util.Set<Endpoint> existingInputEndpoints,
- java.util.Set<Endpoint> existingOutputEndpoints,
- java.util.Set<Endpoint> existingInputDynaReplyTos,
- java.util.Set<Endpoint> existingOutputDynaReplyTos) {
- logger.debug("Update Service Validator Configuration");
-
- if (config != null) {
- try {
- if (config.getNodeName().equals(VALIDATOR_NODE)) {
- String active=config.getAttribute(ACTIVE_ATTR);
-
- if (active != null && active.equalsIgnoreCase("true")) {
-
- logger.debug("Setting validator into active mode");
- m_managedMode = true;
- }
- }
-
- org.w3c.dom.NodeList services=config.getElementsByTagName(SERVICE_NODE);
-
- if (logger.isDebugEnabled()) {
- if (services != null) {
- logger.debug("ServiceValidationManager: services="+services.getLength());
- } else {
- logger.debug("ServiceValidationManager: services null");
- }
- }
-
- for (int i=0; i < services.getLength(); i++) {
- ServiceValidator sm=null;
-
- // Create service monitor for service
- String modelName=
- ((org.w3c.dom.Element)services.item(i)).getAttribute(MODEL_ATTR);
- String role=
- ((org.w3c.dom.Element)services.item(i)).getAttribute(ROLE_ATTR);
- String validate=
- ((org.w3c.dom.Element)services.item(i)).getAttribute(VALIDATE_ATTR);
-
- // Check for old attribute names, for
- // backward compatibility - only support
- // for a limited time
- if (role == null) {
- role = ((org.w3c.dom.Element)services.item(i)).getAttribute("participantType");
- }
-
- if (modelName == null) {
- modelName = ((org.w3c.dom.Element)services.item(i)).getAttribute("cdmFilePath");
-
- if (modelName != null) {
- // Remove path
- int pos=modelName.lastIndexOf('/');
- if (pos != -1) {
- modelName = modelName.substring(pos+1);
- }
- }
- }
-
- if (logger.isDebugEnabled()) {
- logger.debug("Initialize service validator for: model="+
- modelName+" role="+role+" validate="+validate);
- }
-
- if (role != null) {
- boolean f_validate=(validate != null && validate.equalsIgnoreCase("true"));
-
- if (modelName != null ||
- f_validate == false) {
- ValidatorName name=null;
-
- if (f_validate) {
- name = new ValidatorName(modelName, role);
- } else {
- name = new ValidatorName(role);
-
- }
-
- try {
- // Obtain the service container
- sm = createServiceValidator(name);
-
- if (logger.isDebugEnabled()) {
- logger.debug("Service validator for '"+modelName+
- "' and role '"+role+"' = "+sm);
- }
-
- // Remove validator name from list
- existingValidatorNames.remove(sm.getValidatorName());
- } catch(Exception e) {
- logger.error(
- "Failed to create service validator '"+
- name+"'", e);
- }
- } else {
- logger.error("Model name must be specified in validation mode");
- }
- } else {
- logger.error("Role must be specified");
- }
-
- if (sm != null) {
- // Map inputs to service
- org.w3c.dom.NodeList inputs=((org.w3c.dom.Element)services.item(i)).getElementsByTagName(INPUT_NODE);
-
- for (int j=0; j < inputs.getLength(); j++) {
- String epr=((org.w3c.dom.Element)inputs.item(j)).getAttribute(EPR_ATTR);
-
- if (epr != null) {
- Endpoint endpoint=new Endpoint(epr);
-
- if (logger.isDebugEnabled()) {
- logger.debug("Storing input endpoint '"+
- endpoint+"' against validator: "+sm);
- }
-
- // Check if existing list
- java.util.List<ServiceValidator> svs=
- m_inputValidators.get(endpoint);
-
- if (svs == null) {
- svs = new java.util.Vector<ServiceValidator>();
- m_inputValidators.put(endpoint, svs);
- }
-
- if (svs.contains(sm) == false) {
- svs.add(sm);
- }
-
- existingInputEndpoints.remove(endpoint);
-
- // Check if dynamic replyTo
- String dynamicReplyTo=((org.w3c.dom.Element)inputs.item(j)).
- getAttribute(DYNAMIC_REPLY_TO_ATTR);
-
- if (dynamicReplyTo != null && dynamicReplyTo.equalsIgnoreCase("true")) {
-
- if (logger.isDebugEnabled()) {
- logger.debug("Input endpoint '"+
- endpoint+"' has dynamic replyTo destination");
- }
-
- m_inputDynaReplyTos.add(endpoint);
-
- existingInputDynaReplyTos.remove(endpoint);
- }
- }
- }
-
- // Map outputs to service
- org.w3c.dom.NodeList outputs=((org.w3c.dom.Element)services.item(i)).getElementsByTagName(OUTPUT_NODE);
-
- for (int j=0; j < outputs.getLength(); j++) {
- String epr=((org.w3c.dom.Element)outputs.item(j)).getAttribute(EPR_ATTR);
-
- if (epr != null) {
- Endpoint endpoint=new Endpoint(epr);
-
- if (logger.isDebugEnabled()) {
- logger.debug("Storing output endpoint '"+
- endpoint+"' against validator: "+sm);
- }
-
- // Check if existing list
- java.util.List<ServiceValidator> svs=
- m_outputValidators.get(endpoint);
-
- if (svs == null) {
- svs = new java.util.Vector<ServiceValidator>();
- m_outputValidators.put(endpoint, svs);
- }
-
- if (svs.contains(sm) == false) {
- svs.add(sm);
- }
-
- existingOutputEndpoints.remove(endpoint);
-
- // Check if dynamic replyTo
- String dynamicReplyTo=((org.w3c.dom.Element)outputs.item(j)).
- getAttribute(DYNAMIC_REPLY_TO_ATTR);
-
- if (dynamicReplyTo != null && dynamicReplyTo.equalsIgnoreCase("true")) {
-
- if (logger.isDebugEnabled()) {
- logger.debug("Output endpoint '"+
- endpoint+"' has dynamic replyTo destination");
- }
-
- m_outputDynaReplyTos.add(endpoint);
-
- existingOutputDynaReplyTos.remove(endpoint);
- }
- }
- }
- }
- }
- } catch(Exception e) {
- logger.error("Failed to load validator config", e);
- }
- }
- }
-
- /**
- * This method returns whether the service validator configuration
- * is in 'manage' mode. If yes, then invalid messages will
- * be blocked from being delivered to their destination.
- *
- * @return Whether the service validator is in 'manage' mode
- */
- public boolean isManagedMode() {
- return(m_managedMode);
- }
-
- private static final Logger logger = Logger.getLogger(ServiceValidatorManager.class);
-
- private static final String EPR_ATTR = "epr";
- private static final String DYNAMIC_REPLY_TO_ATTR = "dynamicReplyTo";
-
- private static final String OUTPUT_NODE = "output";
- private static final String INPUT_NODE = "input";
- private static final String SERVICE_NODE = "service";
- private static final String ACTIVE_ATTR = "active";
- private static final String MODE_ATTR = "mode";
- private static final String REPLY_TO_TIMEOUT_ATTR = "replyToTimeout";
- private static final String VALIDATOR_NODE = "validator";
-
- private static final String CONFIG_FILE = "validator-config.xml";
- private static final String MODEL_ATTR="model";
- private static final String ROLE_ATTR="role";
- private static final String VALIDATE_ATTR="validate";
-
- private static ServiceValidatorManager m_instance=null;
- private java.io.File m_validatorConfigFile=null;
- private java.io.File m_modelsDir=null;
- private java.util.Map<ValidatorName,ServiceValidator> m_serviceValidators=
- new java.util.HashMap<ValidatorName,ServiceValidator>();
- private java.util.Map<Endpoint,java.util.List<ServiceValidator>> m_inputValidators=new java.util.Hashtable<Endpoint,java.util.List<ServiceValidator>>();
- private java.util.Map<Endpoint,java.util.List<ServiceValidator>> m_outputValidators=new java.util.Hashtable<Endpoint,java.util.List<ServiceValidator>>();
- private java.util.Set<Endpoint> m_inputDynaReplyTos=new java.util.HashSet<Endpoint>();
- private java.util.Set<Endpoint> m_outputDynaReplyTos=new java.util.HashSet<Endpoint>();
- private boolean m_managedMode=false;
- private DynamicReplyToEndpointManager m_replyToManager=new DynamicReplyToEndpointManager();
-
- /**
- * This class is responsible for monitoring the models folder,
- * within the overlord validator ESB bundle, to determine when
- * the configuration has changed.
- */
- public class ValidatorConfigChangeMonitor implements java.lang.Runnable {
-
- public ValidatorConfigChangeMonitor() {
- // Do initial check for updates, so monitors
- // initialized before returning from construct,
- // as remainder of checks will be in a separate
- // thread - so we need to ensure that the monitors
- // are configured before the first message is
- // passed through the filter.
- checkForUpdates();
- }
-
- public void run() {
-
- while (true) {
- checkForUpdates();
-
- try {
- synchronized(ValidatorConfigChangeMonitor.this) {
- wait(30000);
- }
- } catch(Exception e) {
- e.printStackTrace();
- }
- }
- }
-
- protected void checkForUpdates() {
- logger.debug("Checking for config updates");
-
- // Get last update time
- long lastUpdate=getLastUpdate();
-
- if (lastUpdate > m_lastUpdate) {
-
- updateConfigurations();
-
- m_lastUpdate = lastUpdate;
- }
- }
-
- protected long getLastUpdate() {
- long ret=0;
-
- if (m_validatorConfigFile != null) {
- ret = m_validatorConfigFile.lastModified();
- }
-
- if (m_modelsDir != null) {
- java.io.File[] files=m_modelsDir.listFiles();
-
- for (int i=0; i < files.length; i++) {
- if (files[i].getName().endsWith(".cdm") &&
- ret < files[i].lastModified()) {
- ret = files[i].lastModified();
- }
- }
-
- if (ret < m_modelsDir.lastModified()) {
- ret = m_modelsDir.lastModified();
- }
- }
-
- return(ret);
- }
-
- private long m_lastUpdate=0;
- }
-
- public class DynamicReplyToEndpointManager extends Thread {
-
- /**
- * The default constructor
- */
- public DynamicReplyToEndpointManager() {
- setDaemon(true);
-
- start();
- }
-
- /**
- * The run method is responsible for ensuring the dynamic
- * 'reply-to' endpoints are cleaned up periodically.
- */
- public void run() {
-
- while(true) {
-
- try {
- synchronized(this) {
- wait(m_replyToTimeout);
- }
- } catch(Exception e) {
- logger.error("Failed to wait");
- }
-
- // Shift main entries to an emptied 'pending delete'
- // map
- synchronized(m_inputs) {
- if (logger.isDebugEnabled()) {
- java.util.Iterator<Endpoint> iter=
- m_inputsPendingDelete.keySet().iterator();
- while (iter.hasNext()) {
- Endpoint endpoint=iter.next();
- java.util.List<ServiceValidator> validators=
- m_inputsPendingDelete.get(endpoint);
- logger.debug("Deleting input (reply-to) validators '"+
- endpoint+"': "+validators);
- }
- }
-
- m_inputsPendingDelete.clear();
- m_inputsPendingDelete.putAll(m_inputs);
- m_inputs.clear();
- }
-
- synchronized(m_outputs) {
- if (logger.isDebugEnabled()) {
- java.util.Iterator<Endpoint> iter=
- m_outputsPendingDelete.keySet().iterator();
- while (iter.hasNext()) {
- Endpoint endpoint=iter.next();
- java.util.List<ServiceValidator> validators=
- m_outputsPendingDelete.get(endpoint);
- logger.debug("Deleting output (reply-to) validators '"+
- endpoint+"': "+validators);
- }
- }
-
- m_outputsPendingDelete.clear();
- m_outputsPendingDelete.putAll(m_outputs);
- m_outputs.clear();
- }
- }
- }
-
- /**
- * This method returns the list of service validators
- * associated with the dynamic reply-to endpoint.
- *
- * @param endpoint The input endpoint
- * @return The list of service validators, or null if
- * not found
- */
- public java.util.List<ServiceValidator> getInputServiceValidators(Endpoint endpoint) {
- java.util.List<ServiceValidator> ret=null;
-
- synchronized(m_inputs) {
- ret = m_inputs.get(endpoint);
-
- if (ret == null) {
- ret = m_inputsPendingDelete.get(endpoint);
- }
- }
-
- if (logger.isDebugEnabled()) {
- logger.debug("Return input (reply-to) validators '"+endpoint+"': "+ret);
- }
-
- return(ret);
- }
-
- /**
- * This method returns the list of service validators
- * associated with the dynamic reply-to endpoint.
- *
- * @param endpoint The output endpoint
- * @return The list of service validators, or null if
- * not found
- */
- public java.util.List<ServiceValidator> getOutputServiceValidators(Endpoint endpoint) {
- java.util.List<ServiceValidator> ret=null;
-
- synchronized(m_outputs) {
- ret = m_outputs.get(endpoint);
-
- if (ret == null) {
- ret = m_outputsPendingDelete.get(endpoint);
- }
- }
-
- if (logger.isDebugEnabled()) {
- logger.debug("Return output (reply-to) validators '"+endpoint+"': "+ret);
- }
-
- return(ret);
- }
-
- /**
- * This method registers a list of service validators against
- * a dynamic 'reply-to' endpoint.
- *
- * @param endpoint The endpoint
- * @param validators The list of service validators
- */
- public void registerInputDynamicReplyTo(Endpoint endpoint,
- java.util.List<ServiceValidator> validators) {
-
- synchronized(m_inputs) {
- m_inputs.put(endpoint, validators);
-
- // May not be necessary, as entry would not be
- // used - but could save memory?
- m_inputsPendingDelete.remove(endpoint);
- }
- }
-
- /**
- * This method registers a list of service validators against
- * a dynamic 'reply-to' endpoint.
- *
- * @param endpoint The endpoint
- * @param validators The list of service validators
- */
- public void registerOutputDynamicReplyTo(Endpoint endpoint,
- java.util.List<ServiceValidator> validators) {
-
- synchronized(m_outputs) {
- m_outputs.put(endpoint, validators);
-
- // May not be necessary, as entry would not be
- // used - but could save memory?
- m_outputsPendingDelete.remove(endpoint);
- }
- }
-
- /**
- * This method sets the timeout period for purging the
- * cache of reply-to endpoints.
- *
- * @param timeoutValue The timeout value
- */
- public void setReplyToTimeout(long timeoutValue) {
- m_replyToTimeout = timeoutValue;
- }
-
- private java.util.Map<Endpoint,java.util.List<ServiceValidator>> m_inputs=
- new java.util.HashMap<Endpoint,java.util.List<ServiceValidator>>();
- private java.util.Map<Endpoint,java.util.List<ServiceValidator>> m_outputs=
- new java.util.HashMap<Endpoint,java.util.List<ServiceValidator>>();
- private java.util.Map<Endpoint,java.util.List<ServiceValidator>> m_inputsPendingDelete=
- new java.util.HashMap<Endpoint,java.util.List<ServiceValidator>>();
- private java.util.Map<Endpoint,java.util.List<ServiceValidator>> m_outputsPendingDelete=
- new java.util.HashMap<Endpoint,java.util.List<ServiceValidator>>();
- private long m_replyToTimeout=10000;
- }
-}
Deleted: branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ValidatorConfig.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ValidatorConfig.java 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ValidatorConfig.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -1,44 +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.savara.validator;
-
-/**
- * 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 org.w3c.dom.Element getConfiguration();
-
-}
Deleted: branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ValidatorConfigFactory.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ValidatorConfigFactory.java 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ValidatorConfigFactory.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -1,97 +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.savara.validator;
-
-import org.apache.log4j.Logger;
-
-/**
- * This class provides a factory for ValidatorConfig objects
- * based on supplied model file details.
- */
-public class ValidatorConfigFactory {
-
- /**
- * This method retrieves a validator config associated with
- * the supplied file. If the model associated with the
- * file is not supported, then a null will be returned.
- *
- * @param file The file containing the model
- * @return The validator config, or null if an unsupported type
- * @exception IOException Failed to load supported model type
- */
- public static ValidatorConfig getValidatorConfig(java.io.File file)
- throws java.io.IOException {
- ValidatorConfig ret=null;
-
- String modelType=null;
-
- if (file != null && (modelType=getModelType(file.getName())) != null) {
- ValidatorConfigLoader loader=null;
-
- for (int i=0; loader == null &&
- i < m_loaders.size(); i++) {
-
- if (m_loaders.get(i).isSupported(modelType)) {
- loader = m_loaders.get(i);
- }
- }
-
- if (loader != null) {
- java.io.FileInputStream fis=new java.io.FileInputStream(file);
-
- ret = loader.loadValidatorConfig(fis, file.getName());
-
- fis.close();
- }
- }
-
- if (logger.isDebugEnabled()) {
- logger.debug("Returning validator config for "+
- file.getName()+": "+ret);
- }
-
- return(ret);
- }
-
- /**
- * This method determines the model type associated with the
- * supplied model filename.
- *
- * @param name The model filename
- * @return The model type, or null if not known
- */
- protected static String getModelType(String name) {
- String ret=null;
- int pos=name.lastIndexOf('.');
-
- if (pos != -1) {
- ret = name.substring(pos+1);
- }
-
- return(ret);
- }
-
- private static final Logger logger = Logger.getLogger(ValidatorConfigFactory.class);
-
- private static java.util.List<ValidatorConfigLoader> m_loaders=
- new java.util.Vector<ValidatorConfigLoader>();
-
- static {
- m_loaders.add(new org.savara.validator.pi4soa.Pi4SOAValidatorConfigLoader());
- }
-}
Deleted: branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ValidatorConfigLoader.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ValidatorConfigLoader.java 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ValidatorConfigLoader.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -1,48 +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.savara.validator;
-
-/**
- * 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;
-
-}
Deleted: branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ValidatorName.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ValidatorName.java 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/ValidatorName.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -1,134 +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.savara.validator;
-
-/**
- * This class represents a key for looking up a service validator.
- */
-public class ValidatorName {
-
- /**
- * This constructor is initialized with the details used to
- * identify the validator.
- *
- * @param role The role
- */
- public ValidatorName(String role) {
- m_role = role;
- m_validate = false;
- }
-
- /**
- * This constructor is initialized with the details used to
- * identify the validator.
- *
- * @param modelName The model name
- * @param role The role
- * @param validate Whether to validate, or simply record
- */
- public ValidatorName(String modelName, String role) {
- m_modelName = modelName;
- m_role = role;
- m_validate = true;
- }
-
- /**
- * This method returns the model name associated with the
- * service validator.
- *
- * @return The model name
- */
- public String getModelName() {
- return(m_modelName);
- }
-
- /**
- * This method returns the type associated with the model.
- * If no model has been defined for the validator name,
- * as in the case of a validator in record mode, then
- * this method will return ValidatorName.NO_MODEL_TYPE.
- *
- * @return The model type
- */
- public String getModelType() {
- String ret=null;
- int pos=0;
-
- if (m_modelName != null &&
- (pos=m_modelName.lastIndexOf('.')) != -1) {
- ret = m_modelName.substring(pos+1);
- } else {
- ret = NO_MODEL_TYPE;
- }
-
- return(ret);
- }
-
- /**
- * This method returns the role associated with the Service
- * Validator.
- *
- * @return The role
- */
- public String getRole() {
- return(m_role);
- }
-
- /**
- * This method determines whether the associated service
- * validator is in validation or record mode.
- *
- * @return Whether in validation or record mode
- */
- public boolean isValidate() {
- return(m_validate);
- }
-
- public boolean equals(Object obj) {
- boolean ret=false;
-
- if (obj instanceof ValidatorName) {
- ret = (obj.toString().equals(toString()) &&
- ((ValidatorName)obj).m_validate == m_validate);
- }
-
- return(ret);
- }
-
- public int hashCode() {
- return(toString().hashCode());
- }
-
- public String toString() {
- String ret=null;
-
- if (isValidate()) {
- ret = m_modelName+":"+m_role;
- } else {
- ret = m_role;
- }
-
- return(ret);
- }
-
- public static final String NO_MODEL_TYPE="NoModelType";
-
- private String m_modelName=null;
- private String m_role=null;
- private boolean m_validate=false;
-}
\ No newline at end of file
Deleted: branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/JMSServiceTracker.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/JMSServiceTracker.java 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/JMSServiceTracker.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -1,1244 +0,0 @@
-/*
- * Copyright 2005 Pi4 Technologies Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- * Change History:
- * Sep 12, 2005 : Initial version created by gary
- */
-
-// Original version copied from pi4soa service tracker, licensed under Apache version 2
-
-/*
- * 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.savara.validator.pi4soa;
-
-import java.io.ByteArrayOutputStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.jms.QueueConnectionFactory;
-import javax.jms.TextMessage;
-import javax.naming.Context;
-
-import org.pi4soa.common.util.NamesUtil;
-import org.pi4soa.common.xml.XMLUtils;
-import org.pi4soa.service.Channel;
-import org.pi4soa.service.Identity;
-import org.pi4soa.service.Message;
-import org.pi4soa.service.ServiceException;
-import org.pi4soa.service.behavior.MessageClassification;
-import org.pi4soa.service.behavior.MessageDefinition;
-import org.pi4soa.service.behavior.Receive;
-import org.pi4soa.service.behavior.Send;
-import org.pi4soa.service.behavior.ServiceDescription;
-import org.pi4soa.service.session.Session;
-import org.pi4soa.service.tracker.ServiceTracker;
-import org.pi4soa.service.tracker.TrackerEvent;
-import org.savara.activity.model.Activity;
-import org.savara.activity.model.ExchangeType;
-import org.savara.activity.model.InteractionActivity;
-import org.savara.activity.model.MessageParameter;
-import org.savara.activity.model.ProtocolAnalysis;
-import org.savara.activity.util.ActivityModelUtil;
-
-/**
- * This class provides an implementation of the publishing service
- * tracker that sends the monitoring information using the JMS
- * API.
- *
- */
-public class JMSServiceTracker implements ServiceTracker {
-
- private static final String SAVARA_SERVICE_TRACKER_NS = "http://www.savara.org/service/tracker";
- /**
- * This is the default constructor for the JMS service
- * tracker implementation.
- *
- */
- public JMSServiceTracker() {
- }
-
- /**
- * This method is invoked to initialize the JMS connection, based
- * on the established properties.
- *
- */
- public void initialize() {
-
- logger.info("Initializing Savara JMS Service Tracker");
-
- javax.naming.Context ctx=null;
-
- try {
- if (NamesUtil.isSet(m_jndiInitialContextFactory)) {
- java.util.Properties jndiProps = new java.util.Properties();
- jndiProps.setProperty(Context.INITIAL_CONTEXT_FACTORY,
- m_jndiInitialContextFactory);
- jndiProps.setProperty(Context.PROVIDER_URL,
- m_jndiProviderURL);
-
- if (m_jndiFactoryURLPackages != null) {
- jndiProps.setProperty(Context.URL_PKG_PREFIXES,
- m_jndiFactoryURLPackages);
- }
-
- ctx = new javax.naming.InitialContext(jndiProps);
- } else {
- if (logger.isLoggable(java.util.logging.Level.FINER)) {
- logger.finer("Creating default initial context");
- }
- ctx = new javax.naming.InitialContext();
- }
- } catch(Exception e) {
- logger.severe("Failed to create JNDI initial context: "+e);
- }
-
- // Get connection factory and destination topic
- if (ctx != null) {
-
- try {
- try {
- javax.jms.ConnectionFactory factory =
- (javax.jms.ConnectionFactory)
- ctx.lookup(m_jmsConnectionFactory);
-
- m_connection = factory.createConnection();
-
- if (logger.isLoggable(Level.FINER)) {
- logger.finer("Connection: "+m_connection);
- }
-
- } catch(java.lang.RuntimeException re) {
- if (m_jmsConnectionFactoryAlternate != null) {
- QueueConnectionFactory qcf = (QueueConnectionFactory)
- ctx.lookup(m_jmsConnectionFactoryAlternate);
- m_connection = qcf.createQueueConnection();
-
- if (logger.isLoggable(Level.FINER)) {
- logger.finer("Alternate Connection: "+m_connection);
- }
-
- } else {
- throw re;
- }
- }
-
- javax.jms.Destination dest =
- (javax.jms.Destination)ctx.lookup(m_jmsDestination);
-
- m_session = m_connection.createSession(false,
- javax.jms.Session.AUTO_ACKNOWLEDGE);
-
- m_producer = m_session.createProducer(dest);
-
- if (logger.isLoggable(Level.FINE)) {
- logger.fine(Thread.currentThread()+
- ": Created JMS ServiceTracker connection");
- }
-
- } catch(Exception e) {
- logger.severe("Failed to create JMS connection: "+e);
- }
- }
- }
-
- /**
- * This method sets the JNDI initial context factory class name.
- *
- * @param factory The factory class name
- */
- public void setJNDIInitialContextFactory(String factory) {
- m_jndiInitialContextFactory = factory;
- }
-
- /**
- * This method sets the provider URL that is used when publishing
- * the tracker events.
- *
- * @param url The provider url
- */
- public void setJNDIProviderURL(String url) {
- m_jndiProviderURL = url;
- }
-
- /**
- * This method sets the JNDI factory URL packages.
- *
- * @param pkgs The packages
- */
- public void setJNDIFactoryURLPackages(String pkgs) {
- m_jndiFactoryURLPackages = pkgs;
- }
-
- /**
- * This method sets the JMS connection factory name, to
- * be looked up within JNDI.
- *
- * @param cf The connection factory
- */
- public void setJMSConnectionFactory(String cf) {
- m_jmsConnectionFactory = cf;
- }
-
- /**
- * This method sets the alternate JMS connection factory name, to
- * be looked up within JNDI.
- *
- * @param cf The connection factory
- */
- public void setJMSConnectionFactoryAlternate(String cf) {
- m_jmsConnectionFactoryAlternate = cf;
- }
-
- /**
- * This method sets the JMS destination name, to
- * be looked up within JNDI.
- *
- * @param dest The destination
- */
- public void setJMSDestination(String dest) {
- m_jmsDestination = dest;
- }
-
- /**
- * This method is used to publish the service tracker message.
- *
- * @param serviceName The service name
- * @param session The session
- * @param mesg The message
- */
- protected synchronized void publish(String serviceName, Session session,
- String mesg) {
-
- // Establish JMS connection and topic
- if (m_initialized == false &&
- m_jmsConnectionFactory != null &&
- m_jmsDestination != null) {
- initialize();
-
- m_initialized = true;
- }
-
- if (m_producer != null) {
-
- try {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine(mesg);
- }
-
- TextMessage tm=m_session.createTextMessage(mesg);
-
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest(Thread.currentThread()+
- ": Sending JMS ServiceTracker record="+tm);
- }
-
- m_producer.send(tm);
- } catch(Exception e) {
- logger.severe("Failed to publish message: "+e);
- }
-
- } else {
- logger.warning("Could not publish message: "+mesg);
- }
- }
-
- /**
- * This method is used to publish the service tracker message.
- *
- * @param serviceName The service name
- * @param session The session
- * @param mesg The message
- */
- protected synchronized void publish(Activity activity) {
-
- // Establish JMS connection and topic
- if (m_initialized == false &&
- m_jmsConnectionFactory != null &&
- m_jmsDestination != null) {
- initialize();
-
- m_initialized = true;
- }
-
- if (m_producer != null) {
-
- try {
- ByteArrayOutputStream os=new ByteArrayOutputStream();
-
- ActivityModelUtil.serialize(activity, os);
-
- String act=new String(os.toByteArray());
-
- if (logger.isLoggable(Level.FINE)) {
- logger.fine(act);
- }
-
- TextMessage tm=m_session.createTextMessage(act);
-
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest(Thread.currentThread()+
- ": Sending JMS ServiceTracker record="+tm);
- }
-
- m_producer.send(tm);
- } catch(Exception e) {
- logger.severe("Failed to publish message: "+e);
- }
-
- } else {
- logger.warning("Could not publish message: "+activity);
- }
- }
-
- /**
- * This method closes the service tracker.
- *
- * @exception ServiceException Failed to close
- */
- public void close() throws ServiceException {
-
- try {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine(Thread.currentThread()+
- ": Closing JMS ServiceTracker connection");
- }
-
- if (m_session != null) {
- m_session.close();
- m_session = null;
- }
-
- if (m_connection != null) {
- m_connection.close();
- m_connection = null;
- }
-
- } catch(Exception e) {
- logger.severe("Failed to close JMS connection: "+e);
-
- m_initialized = false;
-
- throw new ServiceException("Failed to close JMS connection", e);
- }
-
- m_initialized = false;
- }
-
- /**
- * This method sets whether the message payload should be
- * recorded as part of the service tracker send and receive
- * events.
- *
- * @param val Whether to record the message payload
- */
- public void setRecordMessagePayload(Boolean val) {
- if (val != null) {
- m_recordMessagePayload = val.booleanValue();
- } else {
- m_recordMessagePayload = false;
- }
- }
-
- /**
- * This method indicates that a new service instance
- * has started.
- *
- * @param service The service
- * @param session The session
- */
- public void serviceStarted(ServiceDescription service,
- Session session) {
- }
-
- /**
- * This method indicates that a service instance
- * has finished.
- *
- * @param service The service
- * @param session The session
- */
- public void serviceFinished(ServiceDescription service,
- Session session) {
- }
-
- /**
- * This method indicates that a new sub session
- * has started within an existing service instance.
- *
- * @param parent The parent session
- * @param session The session
- */
- public void subSessionStarted(Session parent, Session session) {
- }
-
- /**
- * This method indicates that an existing
- * sub session has finished.
- *
- * @param parent The parent session
- * @param session The session
- */
- public void subSessionFinished(Session parent, Session session) {
- }
-
- /**
- * This method registers the fact that a message has been
- * sent from a stateful service.
- *
- * @param activity The behavioral activity
- * @param session The session
- * @param channel The channel
- * @param mesg The message that has been handled
- */
- public void sentMessage(Send activity, Session session,
- Channel channel, Message mesg) {
-
- InteractionActivity ia=createInteractionActivity(activity, session, mesg);
-
- ia.setOutbound(true);
-
- publish(ia);
- }
-
- protected InteractionActivity createInteractionActivity(org.pi4soa.service.behavior.MessageActivity activity,
- Session session, Message mesg) {
- InteractionActivity ia=new InteractionActivity();
-
- ia.setOperationName(activity.getOperationName());
- ia.setFaultName(activity.getFaultName());
- ia.setDestinationType(mesg.getServiceType());
-
- ia.setExchangeType(activity.getMessageDefinition().getClassification() ==
- MessageClassification.REQUEST ?
- ExchangeType.REQUEST : ExchangeType.RESPONSE);
-
- MessageParameter mp=new MessageParameter();
- mp.setType(mesg.getType());
- mp.setValue(getMessagePayload(mesg));
-
- ia.getParameter().add(mp);
-
- ProtocolAnalysis pa=new ProtocolAnalysis();
- pa.setExpected(Boolean.TRUE);
- pa.setProtocol(activity.getServiceDescription().getFullyQualifiedName());
-
- pa.setRole(XMLUtils.getLocalname(activity.getServiceDescription().getName()));
-
- ia.getAnalysis().add(pa);
-
- // Add context information from the identities info
- java.util.Iterator<Identity> ids=null;
-
- if (session != null) {
- ids = session.getPrimaryIdentities().iterator();
- }
-
- // If session has no identity information, but a
- // message is supplied, then try getting identity
- // from it.
- if ((ids == null || ids.hasNext() == false) &&
- mesg != null && mesg.getMessageIdentities() != null) {
- ids = mesg.getMessageIdentities().iterator();
- }
-
- if (ids != null && ids.hasNext()) {
-
- while (ids.hasNext()) {
- Identity cur=ids.next();
-
- org.savara.activity.model.Context context=new org.savara.activity.model.Context();
-
- String name=null;
- for (String token : cur.getTokens()) {
- if (name == null) {
- name = token;
- } else {
- name += ":"+token;
- }
- }
-
- context.setName(name);
-
- String value=null;
-
- for (Object val : cur.getValues()) {
- if (value == null) {
- value = val.toString();
- } else {
- value += ":"+val.toString();
- }
- }
-
- context.setValue(value);
-
- ia.getContext().add(context);
- }
- }
-
- return(ia);
- }
-
- /**
- * This method registers the fact that a message has been
- * sent from a stateless service.
- *
- * @param defn The message definition
- * @param mesg The message that has been handled
- */
- public void sentMessage(MessageDefinition defn, Message mesg) {
- }
-
- /**
- * This method registers the fact that a message has been
- * received from a stateful service.
- *
- * @param activity The behavioral activity
- * @param session The session
- * @param channel The channel
- * @param mesg The message that has been handled
- */
- public void receivedMessage(Receive activity, Session session,
- Channel channel, Message mesg) {
- InteractionActivity ia=createInteractionActivity(activity, session, mesg);
-
- ia.setOutbound(false);
-
- publish(ia);
- }
-
- /**
- * This method registers the fact that a message has been
- * received from a stateless service.
- *
- * @param defn The message definition
- * @param mesg The message that has been handled
- */
- public void receivedMessage(MessageDefinition defn, Message mesg) {
- }
-
- /**
- * This method registers that a message was not expected.
- *
- * @param sdesc The service description, if known
- * @param session The session, or null if a stateless service,
- * or cannot be associated with a session
- * @param mesg The message that was not expected
- * @param reason The optional reason why the message was
- * considered to be unexpected
- */
- public void unexpectedMessage(ServiceDescription sdesc,
- Session session, Message mesg, String reason) {
- String messageText=getMessageText(mesg, null);
-
- // Process the reason field to ensure it has no
- // character that would cause the XML a problem
- reason = processAttributeContents(reason);
-
- String xml="<sd:"+TrackerEvent.UNEXPECTED_MESSAGE+
- " "+SERVICE_INSTANCE_ID_ATTR+"=\""+
- getServiceInstanceId(session)+"\" "+
- SESSION_ID_ATTR+"=\""+
- getSessionId(session)+"\" "+TIMESTAMP_ATTR+"=\""+
- System.currentTimeMillis()+"\" ><sd:"+DETAILS_NODE+">"+
- reason+"</sd:"+DETAILS_NODE+">"+messageText+
- "</sd:"+TrackerEvent.UNEXPECTED_MESSAGE+">";
-
- String serviceName=null;
-
- if (sdesc != null) {
- serviceName = sdesc.getFullyQualifiedName();
- } else {
- serviceName = getServiceName(session);
- }
-
- String serviceVersion=null;
-
- if (sdesc != null) {
- serviceVersion = sdesc.getVersion();
- }
-
- record(serviceName, serviceVersion, session, mesg, xml, ERROR, null);
- }
-
- /**
- * This method registers that an exception was not handled.
- *
- * @param session The session, or null if a stateless service
- * @param excType The exception type
- */
- public void unhandledException(Session session, String excType) {
-
- String xml="<sd:"+TrackerEvent.UNHANDLED_EXCEPTION+
- " "+SERVICE_INSTANCE_ID_ATTR+"=\""+
- getServiceInstanceId(session)+"\" "+
- SESSION_ID_ATTR+"=\""+
- getSessionId(session)+"\" "+TIMESTAMP_ATTR+"=\""+
- System.currentTimeMillis()+"\" ><sd:"+DETAILS_NODE+">"+
- excType+"</sd:"+DETAILS_NODE+"></sd:"+
- TrackerEvent.UNHANDLED_EXCEPTION+">";
-
- record(getServiceName(session), session, xml, ERROR, null);
- }
-
- /**
- * This method reports information regarding the processing
- * of a service session. The details can either be specified
- * as a textual string (unstructured data),
- * or as a structured XML fragment.<p>
- *
- * @param session The session, or null if a stateless service
- * @param details The details
- */
- public void information(Session session, String details) {
- String xml="<sd:"+TrackerEvent.INFORMATION+
- " "+SERVICE_INSTANCE_ID_ATTR+"=\""+
- getServiceInstanceId(session)+"\" "+
- SESSION_ID_ATTR+"=\""+getSessionId(session)+
- "\" "+TIMESTAMP_ATTR+"=\""+
- System.currentTimeMillis()+"\" ><sd:"+DETAILS_NODE+">"+
- XMLUtils.encodeXMLString(details)+
- "</sd:"+DETAILS_NODE+"></sd:"+
- TrackerEvent.INFORMATION+">";
-
- record(getServiceName(session), session, xml, INFO, null);
- }
-
- /**
- * This method reports information regarding the processing
- * of a service session. The details can either be specified
- * as a textual string (unstructured data),
- * or as a structured XML fragment.<p>
- *
- * @param session The session, or null if a stateless service
- * @param details The details
- * @param exc The optional exception
- */
- public void warning(Session session, String details,
- Throwable exc) {
- String excText="";
- if (exc != null) {
- try {
- java.io.StringWriter s=new java.io.StringWriter();
- java.io.PrintWriter p=new java.io.PrintWriter(s);
-
- exc.printStackTrace(p);
-
- p.close();
- s.close();
-
- excText = "<sd:"+EXCEPTION_NODE+">"+s.toString()+"</sd:"+EXCEPTION_NODE+">";
- } catch(Exception e) {
- logger.severe("Failed to record exception stack trace: "+e);
-
- excText = "<sd:"+EXCEPTION_NODE+">"+exc.getLocalizedMessage()+"</sd:"+EXCEPTION_NODE+">";
- }
- }
-
- String xml="<sd:"+TrackerEvent.WARNING+
- " "+SERVICE_INSTANCE_ID_ATTR+"=\""+
- getServiceInstanceId(session)+"\" "+
- SESSION_ID_ATTR+"=\""+getSessionId(session)+
- "\" "+TIMESTAMP_ATTR+"=\""+
- System.currentTimeMillis()+"\" ><sd:"+DETAILS_NODE+">"+
- XMLUtils.encodeXMLString(details)+
- "</sd:"+DETAILS_NODE+">"+excText+"</sd:"+
- TrackerEvent.WARNING+">";
-
- record(getServiceName(session), session, xml, WARNING, exc);
- }
-
- /**
- * This method reports information regarding the processing
- * of a service session. The details can either be specified
- * as a textual string (unstructured data),
- * or as a structured XML fragment.<p>
- *
- * @param session The session, or null if a stateless service
- * @param details The details
- * @param exc The optional exception
- */
- public void error(Session session, String details,
- Throwable exc) {
- String excText="";
- if (exc != null) {
- try {
- java.io.StringWriter s=new java.io.StringWriter();
- java.io.PrintWriter p=new java.io.PrintWriter(s);
-
- exc.printStackTrace(p);
-
- p.close();
- s.close();
-
- excText = "<sd:"+EXCEPTION_NODE+">"+s.toString()+"</sd:"+EXCEPTION_NODE+">";
- } catch(Exception e) {
- logger.severe("Failed to record exception stack trace: "+e);
-
- excText = "<sd:"+EXCEPTION_NODE+">"+exc.getLocalizedMessage()+"</sd:"+EXCEPTION_NODE+">";
- }
- }
-
-
- String xml="<sd:"+TrackerEvent.ERROR+
- " "+SERVICE_INSTANCE_ID_ATTR+"=\""+
- getServiceInstanceId(session)+"\" "+
- SESSION_ID_ATTR+"=\""+getSessionId(session)+
- "\" "+TIMESTAMP_ATTR+"=\""+
- System.currentTimeMillis()+"\" ><sd:"+DETAILS_NODE+">"+
- XMLUtils.encodeXMLString(details)+
- "</sd:"+DETAILS_NODE+">"+excText+"</sd:"+
- TrackerEvent.ERROR+">";
-
- record(getServiceName(session), session, xml, ERROR, exc);
- }
-
- /**
- * Check the format of the specified session id.
- *
- * @param session The initial session
- * @return The reformatted session id
- */
- protected String getSessionId(Session session) {
- String ret=null;
-
- if (session != null) {
- ret = session.getId().getSessionId();
- }
-
- if (ret == null) {
- ret = "";
- }
-
- return(ret);
- }
-
- /**
- * This method determines whether a long expanded form
- * of id should be used for the service instance id.
- *
- * @return Whether the expanded form of id is used
- */
- protected boolean isIdExpanded() {
- return(true);
- }
-
- /**
- * This method returns the service instance id
- * associated with the specified session.
- *
- * @param session The session
- * @return The service instance id
- */
- protected String getServiceInstanceId(Session session) {
- String ret=null;
-
- if (session != null) {
- if (isIdExpanded()) {
- ret = session.getId().getServiceDescriptionName()+
- "/"+session.getId().getServiceInstanceId();
- } else {
- ret = session.getId().getServiceInstanceId();
- }
- }
-
- if (ret == null) {
- ret = "";
- }
-
- return(ret);
- }
-
- /**
- * This method returns the service name associated with the
- * supplied session.
- *
- * @param session The session
- * @return The service name
- */
- protected String getServiceName(Session session) {
- String ret="";
-
- if (session != null && session.getId() != null) {
- ret = session.getId().getServiceDescriptionName();
- }
-
- return(ret);
- }
-
- /**
- * This method returns the service name associated with the
- * supplied message definition.
- *
- * @param defn The message definition
- * @return The service name
- */
- protected String getServiceName(MessageDefinition defn) {
- String ret="";
-
- if (defn != null && defn.getServiceDescription() != null) {
- ret = defn.getServiceDescription().getFullyQualifiedName();
- }
-
- return(ret);
- }
-
- /**
- * This method constructs the session related information
- * to be recorded.
- *
- * @param session The session
- * @return The session text
- */
- protected String getSessionIdentityText(Session session) {
- return(getSessionIdentityText(session, null));
- }
-
- /**
- * This method constructs the session related information
- * to be recorded.
- *
- * @param session The session
- * @param mesg The optional message
- * @return The session text
- */
- public String getSessionIdentityText(Session session, Message mesg) {
- StringBuffer identities=new StringBuffer();
-
- if (session != null && session.getSessionIdentity() != null) {
- identities.append("<sd:"+SESSION_IDENTITY_NODE+">"+
- "<sd:"+IDENTITY_NODE+" "+NAME_ATTR+"=\""+
- session.getSessionIdentity().getName()+"\" >"+
- XMLUtils.encodeXMLString(session.getSessionIdentity().getFullId())+
- "</sd:"+IDENTITY_NODE+">"+
- "</sd:"+SESSION_IDENTITY_NODE+">");
- }
-
- java.util.Iterator<Identity> ids=null;
-
- if (session != null) {
- ids = session.getPrimaryIdentities().iterator();
- }
-
- // If session has no identity information, but a
- // message is supplied, then try getting identity
- // from it.
- if ((ids == null || ids.hasNext() == false) &&
- mesg != null && mesg.getMessageIdentities() != null) {
- ids = mesg.getMessageIdentities().iterator();
- }
-
- if (ids != null && ids.hasNext()) {
- identities.append("<sd:"+PRIMARY_IDENTITIES_NODE+">");
-
- while (ids.hasNext()) {
- Identity cur=ids.next();
-
- identities.append("<sd:"+IDENTITY_NODE+" "+NAME_ATTR+"=\""+
- cur.getName()+"\" >");
- identities.append(XMLUtils.encodeXMLString(cur.getFullId()));
- identities.append("</sd:"+IDENTITY_NODE+">");
- }
-
- identities.append("</sd:"+PRIMARY_IDENTITIES_NODE+">");
- }
-
- return(identities.toString());
- }
-
- /**
- * This method returns the XML text associated with the
- * message.
- *
- * @param mesg The message
- * @param defn The message definition from the description
- * @return The message text
- */
- public String getMessageText(Message mesg, MessageDefinition defn) {
- String type=null;
-
- if (defn == null) {
- type = (mesg.isRequest()?REQUEST_RPC_MESSAGE_TYPE:RESPONSE_RPC_MESSAGE_TYPE);
-
- if (mesg.isRPCStyle() == false) {
- type = MESSAGE_STYLE_MESSAGE_TYPE;
- }
- } else {
- type = (defn.getClassification()==MessageClassification.REQUEST?
- REQUEST_RPC_MESSAGE_TYPE:RESPONSE_RPC_MESSAGE_TYPE);
- }
-
- if (NamesUtil.isSet(mesg.getFaultName())) {
- type = FAULT_RPC_MESSAGE_TYPE;
- }
-
- return(getMessageTextForType(mesg, type));
- }
-
- /**
- * This method returns the XML text associated with the
- * message.
- *
- * @param mesg The message
- * @param type The message classification (request/response/message/fault)
- * @return The message text
- */
- protected String getMessageTextForType(Message mesg, String type) {
- String ret=null;
- String fault="";
- String messageType="";
- String identities="";
- String valueText=getMessagePayload(mesg);
- String endpoint="";
-
- if (NamesUtil.isSet(mesg.getFaultName())) {
- fault = FAULT_ATTR+"=\""+mesg.getFaultName()+"\" ";
- }
-
- if (NamesUtil.isSet(mesg.getType())) {
- messageType = MESSAGE_TYPE_ATTR+"=\""+mesg.getType()+"\" ";
- }
-
- if (mesg.getSessionIdentity() != null) {
- identities = "<sd:"+SESSION_IDENTITY_NODE+">"+
- "<sd:"+IDENTITY_NODE+" "+NAME_ATTR+"=\""+
- mesg.getSessionIdentity().getName()+"\" >"+
- mesg.getSessionIdentity().getFullId()+
- "</sd:"+IDENTITY_NODE+">"+
- "</sd:"+SESSION_IDENTITY_NODE+">";
-
- if (mesg.getChannelIdentity() != null) {
- identities += "<sd:"+CHANNEL_IDENTITY_NODE+">"+
- "<sd:"+IDENTITY_NODE+" "+NAME_ATTR+"=\""+
- mesg.getChannelIdentity().getName()+"\" >"+
- mesg.getChannelIdentity().getFullId()+
- "</sd:"+IDENTITY_NODE+">"+
- "</sd:"+CHANNEL_IDENTITY_NODE+">";
- }
- } else if (mesg.getMessageIdentities() != null &&
- mesg.getMessageIdentities().size() > 0) {
-
- identities += "<sd:"+PRIMARY_IDENTITIES_NODE+">";
-
- for (int i=0; i < mesg.getMessageIdentities().size(); i++) {
- Identity id=(Identity)mesg.getMessageIdentities().get(i);
-
- identities += "<sd:"+IDENTITY_NODE+" "+NAME_ATTR+"=\""+
- id.getName()+"\" >";
- identities += id.getFullId();
- identities += "</sd:"+IDENTITY_NODE+">";
- }
-
- identities += "</sd:"+PRIMARY_IDENTITIES_NODE+">";
- }
-
- if (mesg.getServiceEndpoint() != null) {
- endpoint = mesg.getServiceEndpoint().toText(null);
- }
-
- String serviceType=mesg.getServiceType();
- if (serviceType == null) {
- serviceType = "";
- }
-
- ret = "<sd:"+MESSAGE_NODE+" "+OPERATION_ATTR+"=\""+
- (mesg.getOperationName()==null?"":mesg.getOperationName())+
- "\" "+TYPE_ATTR+"=\""+type+"\" "+fault+
- messageType+SERVICE_TYPE_ATTR+"=\""+
- serviceType+"\" ><sd:"+ENDPOINT_NODE+">"+
- endpoint+"</sd:"+ENDPOINT_NODE+">"+identities+
- valueText+"</sd:"+MESSAGE_NODE+">";
-
- return(ret);
- }
-
- /**
- * This method constructs the message payload value for the
- * send and receive tracker events. The information is only
- * provided if the service tracker is configured to supply
- * it, as the performance impact of transporting large
- * message payloads in tracker messages would not be appropriate
- * for production environments - however it may be useful
- * in development and test environments. If the supplied
- * message is a multi-part message containing a single part
- * then the single part will be extracted and used. If a
- * multi-part message with multiple parts, then the map
- * textual representation will be provided. If the value is
- * a DOM representation, then it will be converted to a
- * string. All other situations will rely on the 'toString'
- * representation of the value to be appropriate.
- *
- * @param mesg The message
- * @return The payload
- */
- protected String getMessagePayload(Message mesg) {
- String ret="";
-
- if (m_recordMessagePayload) {
- Object value=mesg.getValue();
- if (mesg.isMultiPart() && ((java.util.Map)value).size() == 1) {
- value = ((java.util.Map)value).values().iterator().next();
- }
-
- if (value instanceof org.w3c.dom.Node) {
- try {
- value = XMLUtils.getText((org.w3c.dom.Node)value);
- } catch(Exception e) {
- logger.severe("Failed to convert message DOM value" +
- "to string: "+e);
- value = "";
- }
- }
-
- if (value != null) {
- //ret = "<sd:"+VALUE_NODE+">"+value.toString()+
- // "</sd:"+VALUE_NODE+">";
- ret = value.toString();
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the XML text associated with the
- * channel.
- *
- * @param channel The channel
- * @return The channel text
- */
- protected String getChannelText(Channel channel) {
-
- if (channel == null) {
- return("");
- }
-
- StringBuffer identities=new StringBuffer();
-
- java.util.Set<Identity> ids=channel.getPrimaryIdentities();
-
- if (ids != null && ids.size() > 0) {
- identities.append("<sd:"+PRIMARY_IDENTITIES_NODE+">");
-
- java.util.Iterator<Identity> iter=ids.iterator();
- while (iter.hasNext()) {
- Identity id=iter.next();
-
- identities.append("<sd:"+IDENTITY_NODE+" "+NAME_ATTR+"=\""+
- id.getName()+"\" >");
- identities.append(XMLUtils.encodeXMLString(id.getFullId()));
- identities.append("</sd:"+IDENTITY_NODE+">");
- }
-
- identities.append("</sd:"+PRIMARY_IDENTITIES_NODE+">");
- }
-
- return("<sd:"+CHANNEL_NODE+" "+NAME_ATTR+"=\""+
- channel.getName()+"\" "+TYPE_ATTR+"=\""+
- channel.getType()+"\" >"+
- identities.toString()+"</sd:"+CHANNEL_NODE+">");
- }
-
- /**
- * This method processes the supplied value to deal with any
- * unwanted characters that would be inappropriate for an
- * XML attribute value.
- *
- * @param value The value
- * @return The processed value
- */
- protected String processAttributeContents(String value) {
- String ret=value;
-
- ret = ret.replaceAll("\"", "");
-
- return(ret);
- }
-
- /**
- * This method records the tracker information. This method
- * also takes the optional 'message', used to derive session
- * identity, if the session does not currently have any
- * identity. This situation should only occur if the first
- * message to a service is an unexpected message.
- *
- * @param serviceName The service name
- * @param serviceVersion The optional service version
- * @param session The session
- * @param mesg The message
- * @param xml The information to be recorded
- * @param type The type of information (INFO, WARNING, ERROR)
- * @param exc The optional exception
- */
- protected void record(String serviceName, String serviceVersion,
- Session session, Message mesg, String xml, String type, Throwable exc) {
-
- String message=build(serviceName, serviceVersion,
- session, mesg, xml);
-
- publish(serviceName, session, message);
- }
-
- /**
- * This method records the tracker information.
- *
- * @param serviceName The service name
- * @param session The session
- * @param xml The information to be recorded
- * @param type The type of information (INFO, WARNING, ERROR)
- * @param exc The optional exception
- */
- protected void record(String serviceName, Session session,
- String xml, String type, Throwable exc) {
- record(serviceName, null, session, null, xml, type, exc);
- }
-
- /**
- * This method constructs the service tracker message to be
- * published.
- *
- * @param serviceName The service name
- * @param serviceVersion The optional service version
- * @param session The session
- * @param mesg The optional message
- * @param xml The XML for the current tracker event
- * @return The message
- */
- protected String build(String serviceName, String serviceVersion,
- Session session, Message mesg, String xml) {
- StringBuffer ret=new StringBuffer();
- String versionText="";
- String nameText="";
-
- if (serviceName != null) {
- nameText = NAME_ATTR+"=\""+serviceName+"\" ";
- }
-
- if (serviceVersion != null) {
- versionText=VERSION_ATTR+"=\""+serviceVersion+"\" ";
-
- } else if (session != null && session.getId() != null &&
- session.getId().getServiceDescriptionVersion() != null) {
- versionText=VERSION_ATTR+"=\""+
- session.getId().getServiceDescriptionVersion()+
- "\" ";
- }
-
- ret.append("<sd:record xmlns:sd=\""+
- SAVARA_SERVICE_TRACKER_NS+"\" "+nameText+versionText+">");
-
- ret.append(getSessionIdentityText(session, mesg));
-
- ret.append("<sd:events>");
-
- ret.append(xml);
-
- ret.append("</sd:events>");
- ret.append("</sd:record>");
-
- return(ret.toString());
- }
-
- /**
- * This method determines whether message payload will be
- * recorded.
- *
- * @param bool Whether the message payload is recorded
- */
- public void setRecordMessagePayload(String bool) {
- logger.info("Record message payload: "+bool);
-
- if (bool != null && bool.equalsIgnoreCase("true")) {
- m_recordMessagePayload = true;
- } else {
- m_recordMessagePayload = false;
- }
- }
-
- private static Logger logger = Logger.getLogger(JMSServiceTracker.class.getName());
-
- private boolean m_recordMessagePayload=false;
-
- public static final String RECORD_MESSAGE_PAYLOAD = "pi4soa.tracker.messagePayload";
-
- public static final String INFO="info";
- public static final String WARNING="warning";
- public static final String ERROR="error";
-
- public static final String MESSAGE_NODE="message";
- public static final String DETAILS_NODE="details";
- public static final String OPERATION_ATTR="operation";
- public static final String FAULT_ATTR="fault";
- public static final String NAME_ATTR="name";
- public static final String TIMESTAMP_ATTR="timestamp";
- public static final String TYPE_ATTR="type";
- public static final String MESSAGE_TYPE_ATTR="messageType";
- public static final String SERVICE_TYPE_ATTR="serviceType";
- public static final String EXCEPTION_NODE="exception";
- public static final String SERVICE_INSTANCE_ID_ATTR="serviceInstanceId";
- public static final String SESSION_ID_ATTR="sessionId";
- public static final String PARENT_SESSION_ID_ATTR="parentSessionId";
-
- public static final String VERSION_ATTR = "version";
- public static final String FAULT_RPC_MESSAGE_TYPE = "fault";
- public static final String RESPONSE_RPC_MESSAGE_TYPE = "response";
- public static final String REQUEST_RPC_MESSAGE_TYPE = "request";
- public static final String MESSAGE_STYLE_MESSAGE_TYPE = "message";
- public static final String SESSION_IDENTITY_NODE = "sessionIdentity";
- public static final String CHANNEL_IDENTITY_NODE = "channelIdentity";
- public static final String IDENTITY_NODE = "identity";
- public static final String PRIMARY_IDENTITIES_NODE = "primaryIdentities";
- public static final String ENDPOINT_NODE = "endpoint";
- public static final String CHANNEL_NODE = "channel";
- public static final String VALUE_NODE = "value";
-
- protected static final String TRACKER_JNDI_INITIAL_CONTEXT_FACTORY_PROPERTY = "pi4soa.tracker.jndi.initialContextFactory";
- protected static final String TRACKER_JNDI_PROVIDER_URL_PROPERTY = "pi4soa.tracker.jndi.providerURL";
- protected static final String TRACKER_JNDI_FACTORY_URL_PACKAGES_PROPERTY = "pi4soa.tracker.jndi.factoryURLPackages";
- protected static final String TRACKER_JMS_TOPIC_CONNECTION_FACTORY_PROPERTY = "pi4soa.tracker.jms.topicConnectionFactory";
- protected static final String TRACKER_JMS_TOPIC_PROPERTY = "pi4soa.tracker.jms.topic";
- protected static final String TRACKER_JMS_CONNECTION_FACTORY_PROPERTY = "pi4soa.tracker.jms.connectionFactory";
- protected static final String TRACKER_JMS_CONNECTION_FACTORY_ALTERNATE_PROPERTY = "pi4soa.tracker.jms.connectionFactoryAlternate";
- protected static final String TRACKER_JMS_DESTINATION_PROPERTY = "pi4soa.tracker.jms.destination";
- protected static final String TRACKER_JMS_CLIENT_ID_PROPERTY = "pi4soa.tracker.jms.clientId";
- protected static final String TRACKER_JMS_DURABLE_SUBSCRIPTION_PROPERTY = "pi4soa.tracker.jms.durableSubscription";
-
- private boolean m_initialized=false;
- private String m_jndiInitialContextFactory=null;
- private String m_jndiProviderURL=null;
- private String m_jndiFactoryURLPackages=null;
- private String m_jmsConnectionFactory=null;
- private String m_jmsConnectionFactoryAlternate=null;
- private String m_jmsDestination=null;
-
- private javax.jms.Connection m_connection=null;
- private javax.jms.Session m_session=null;
- private javax.jms.MessageProducer m_producer=null;
-}
Deleted: branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/Pi4SOAServiceValidator.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/Pi4SOAServiceValidator.java 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/Pi4SOAServiceValidator.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -1,282 +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.savara.validator.pi4soa;
-
-import javax.xml.namespace.QName;
-
-import org.apache.log4j.Logger;
-
-import org.savara.activity.model.Context;
-import org.savara.validator.AbstractServiceValidator;
-import org.savara.validator.ValidatorName;
-import org.pi4soa.common.util.MessageUtil;
-import org.pi4soa.service.ServiceException;
-import org.pi4soa.service.behavior.*;
-import org.pi4soa.service.monitor.*;
-
-/**
- * This class implements the pi4soa service validator responsible for
- * validating a stream of ESB messages against a choreography model.
- */
-public class Pi4SOAServiceValidator extends AbstractServiceValidator {
-
- private static final String CDM_MODEL_TYPE = "cdm";
-
- /**
- * This is the constructor for the pi4soa service
- * validator implementation.
- *
- * @param name The validator name
- * @throws Exception Failed to initialize service validator
- */
- public Pi4SOAServiceValidator(ValidatorName name)
- throws Exception {
- super(name);
-
- update();
- }
-
- /**
- * This method returns the model type associated with this
- * service validator.
- *
- * @return The model type
- */
- public static String getModelType() {
- return CDM_MODEL_TYPE;
- }
-
- public String getProtocolName() {
- return(m_protocolName);
- }
-
- /**
- * This method is called to update the model associated
- * with the service validator.
- *
- * @throws Exception Failed to update the service validator
- */
- public void update() throws Exception {
-
- if (logger.isDebugEnabled()) {
- logger.debug("Update: "+getValidatorName());
- }
-
- java.io.InputStream is=getModel();
-
- if (is != null) {
- org.pi4soa.cdl.Package cdlpack=
- org.pi4soa.service.util.DescriptionRetrievalUtil.instance().getCDLPackage(is);
-
- if (cdlpack != null) {
- m_protocolName = new QName(cdlpack.getTargetNamespace(), cdlpack.getName()).toString();
- }
-
- try {
- is.close();
- } catch(Exception e) {
- logger.error("Failed to close model '"+
- getValidatorName()+"' input stream", e);
- }
- }
-
- // Get the endpoint description
- is=getModel();
-
- if (is != null) {
- org.pi4soa.service.behavior.ServiceDescription sdesc=
- org.pi4soa.service.util.DescriptionRetrievalUtil.instance().getServiceDescription(is,
- getValidatorName().getRole());
-
- try {
- is.close();
- } catch(Exception e) {
- logger.error("Failed to close model '"+
- getValidatorName()+"' input stream", e);
- }
-
- if (sdesc != null) {
-
- if (m_monitor == null) {
-
- if (logger.isDebugEnabled()) {
- logger.debug("Service monitor for '"+
- sdesc.getFullyQualifiedName()+
- "' being created");
- }
-
- try {
- // Use XML configuration, to enable alternative
- // runtime configuration to be specified by
- // including a pi4soa.xml file in the environment
- DefaultMonitorConfiguration conf=
- new XMLMonitorConfiguration();
-
- conf.setValidateBehaviour(getValidatorName().isValidate());
-
- m_monitor = ServiceMonitorFactory.getServiceMonitor(conf);
-
- // Register service description
- m_monitor.getConfiguration().getServiceRepository().
- addServiceDescription(sdesc);
-
- logger.debug("Created monitor for service description "+sdesc.getFullyQualifiedName());
-
- } catch(Exception e) {
- logger.error("Failed to initialize service monitor: "+e);
- }
- } else {
-
- synchronized(m_monitor) {
- // Service monitor already in use for the service
- // description, so update description
- try {
- // Clear previous version of the service description
- ServiceDescription[] sdescs=
- m_monitor.getConfiguration().getServiceRepository().getServiceDescriptions();
-
- for (int i=0; sdescs != null && i < sdescs.length; i++) {
- m_monitor.getConfiguration().getServiceRepository().
- removeServiceDescription(sdescs[i]);
- }
-
- logger.debug("Updating service description for "+sdesc.getFullyQualifiedName());
-
- m_monitor.getConfiguration().getServiceRepository().addServiceDescription(sdesc);
- } catch(Exception e) {
- logger.error("Failed to update service description '"+
- sdesc.getFullyQualifiedName()+"'", e);
- }
- }
- }
- } else {
- logger.error("Unable to obtain service description for validator '"+
- getValidatorName()+"'");
- }
- } else {
- logger.error("Unable to obtain model for validator '"+
- getValidatorName()+"'");
-
- throw new java.io.IOException("Failed to locate model '"+
- getValidatorName().getModelName()+"'");
- }
- }
-
- /**
- * This method processes a sent message against a service
- * behavioural description.
- *
- * @param mesgType The optional message type
- * @param msg The message
- * @throws Exception Failed to process sent message
- */
- public java.util.List<Context> messageSent(String mesgType, java.io.Serializable msg) throws Exception {
-
- if (msg == null) {
- throw new ServiceException("Failed to obtain value from message: "+msg);
- }
-
- if (mesgType == null) {
- mesgType = MessageUtil.getMessageType(msg);
- }
-
- org.pi4soa.service.Message mesg=
- m_monitor.createMessage(mesgType,
- null, null, msg, null, null);
-
- synchronized(m_monitor) {
- m_monitor.messageSent(mesg);
- }
-
- return(getContexts(mesg));
- }
-
- /**
- * This method processes a received message against a service
- * behavioural description.
- *
- * @param mesgType The optional message type
- * @param msg The message
- * @throws Exception Failed to process received message
- */
- public java.util.List<Context> messageReceived(String mesgType, java.io.Serializable msg) throws Exception {
-
- if (msg == null) {
- throw new ServiceException("Failed to obtain value from message: "+msg);
- }
-
- if (mesgType == null) {
- mesgType = MessageUtil.getMessageType(msg);
- }
-
- org.pi4soa.service.Message mesg=
- m_monitor.createMessage(mesgType,
- null, null, msg, null, null);
-
- synchronized(m_monitor) {
- m_monitor.messageReceived(mesg);
- }
-
- return(getContexts(mesg));
- }
-
- protected java.util.List<Context> getContexts(org.pi4soa.service.Message mesg) {
- java.util.List<Context> ret=new java.util.Vector<Context>();
-
- for (org.pi4soa.service.Identity id : mesg.getMessageIdentities()) {
- Context context=new Context();
- String name=null;
- for (String token : id.getTokens()) {
- if (name == null) {
- name = token;
- } else {
- name += ":"+token;
- }
- }
- context.setName(name);
-
- String value=null;
- for (Object val : id.getValues()) {
- if (value == null) {
- value = val.toString();
- } else {
- value += ":"+val.toString();
- }
- }
- context.setValue(value);
-
- ret.add(context);
- }
-
- return(ret);
- }
-
- /**
- * This method closes the service validator.
- *
- * @throws Exception Failed to close the service validator
- */
- public void close() throws Exception {
- m_monitor.close();
- }
-
- private static final Logger logger = Logger.getLogger(Pi4SOAServiceValidator.class);
-
- private org.pi4soa.service.monitor.ServiceMonitor m_monitor=null;
- private String m_protocolName=null;
-}
Deleted: branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/Pi4SOAValidatorConfigLoader.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/Pi4SOAValidatorConfigLoader.java 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/Pi4SOAValidatorConfigLoader.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -1,70 +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.savara.validator.pi4soa;
-
-import org.savara.validator.DefaultValidatorConfig;
-import org.savara.validator.ValidatorConfig;
-import org.savara.validator.ValidatorConfigLoader;
-
-/**
- * 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,
- validator);
-
- return(ret);
- }
-}
Deleted: branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/ValidatorConfigGenerator.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/ValidatorConfigGenerator.java 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/ValidatorConfigGenerator.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -1,322 +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.savara.validator.pi4soa;
-
-import java.util.Collections;
-import org.apache.log4j.Logger;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.jboss.util.xml.DOMWriter;
-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 ValidatorConfigGenerator {
-
- private static final String VALIDATE_ATTR = "validate";
- 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";
-
- public static void main(String[] args) {
- if (args.length != 1) {
- System.err.println("Usage: ValidatorConfigGenerator cdmPath");
- System.exit(1);
- }
-
- try {
- java.io.FileInputStream is=new java.io.FileInputStream(args[0]);
-
- org.pi4soa.cdl.Package cdlpack=org.pi4soa.cdl.CDLManager.load(is);
-
- is.close();
-
- ValidatorConfigGenerator gen=new ValidatorConfigGenerator();
-
- org.w3c.dom.Element config=gen.generate(cdlpack, args[0]);
-
- System.out.println("CONFIG:\r\n"+XMLUtils.getText(config, true));
- } catch(Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * The default constructor.
- */
- public ValidatorConfigGenerator() {
- }
-
- /**
- * This method generates the validator configuration associated
- * with the supplied choreography.
- *
- * @param cdlpack The CDL package
- * @param model The model (choreography file name)
- * @return The validator config
- */
- public org.w3c.dom.Element generate(org.pi4soa.cdl.Package cdlpack,
- String model) {
- org.w3c.dom.Element ret=null;
-
- try {
- ret = createValidatorConfig();
-
- // Create the new entries for the supplied choreography
- if (cdlpack != null) {
- createEntries(ret, model, cdlpack);
- } else {
- logger.error("Choreography not supplied for '"+model+"'");
- }
-
- } catch(Exception e) {
- e.printStackTrace();
- }
-
- if (logger.isDebugEnabled()) {
- logger.debug(DOMWriter.printNode(ret, true));
- }
-
- 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());
- service.setAttribute(VALIDATE_ATTR, Boolean.TRUE.toString());
-
- cdlpack.visit(new InputOutputAnalyser(ptype, service));
-
- if (service.getFirstChild() != null) {
- validator.appendChild(service);
- }
- }
- }
-
- private static Logger logger = Logger.getLogger(ValidatorConfigGenerator.class);
-
- public class InputOutputAnalyser extends DefaultCDLVisitor {
-
- private static final String DESTINATION_TYPE_ENDPOINT_ADDRESS = "endpoint address";
- private static final String TYPE_ATTR = "type";
- private static final String DYNAMIC_REPLY_TO_ATTR = "dynamicReplyTo";
- private static final String VALIDATOR_ANNOTATION = "validator";
- private static final String VALIDATOR_ELEMENT = "validator";
- 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(VALIDATOR_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(VALIDATOR_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(
- VALIDATOR_ELEMENT)) {
- org.w3c.dom.NodeList nl=
- doc.getDocumentElement().getElementsByTagName(DESTINATION_ELEMENT);
-
- if (nl.getLength() == 1) {
- dest = (org.w3c.dom.Element)nl.item(0);
- } else if (nl.getLength() > 1) {
- logger.error("Too many destination elements ("+
- nl.getLength()+") found");
- } else {
- logger.error("No destinations found");
- }
- }
-
- } catch(Exception e) {
- logger.error("Failed to load validator annotation", e);
- }
- }
-
- if (dest != null) {
- processDestination(details, dest, from);
- }
- }
- }
-
- /**
- * This method processes the destination information
- * associated with the exchange details.
- *
- * @param details The exchange details
- * @param dest The destination DOM element
- * @param from Whether the 'from' or 'to' role should
- * be considered
- */
- protected void processDestination(ExchangeDetails details,
- org.w3c.dom.Element dest, boolean from) {
- String elemName=null;
-
- if (dest != null) {
- if (from) {
- if (details.getAction() == ExchangeActionType.REQUEST) {
- elemName = OUTPUT_ELEMENT;
- } else if (dest.getAttribute(TYPE_ATTR).trim().length() == 0 ||
- dest.getAttribute(TYPE_ATTR).equals(DESTINATION_TYPE_ENDPOINT_ADDRESS)) {
- elemName = INPUT_ELEMENT;
- }
- } else {
- if (details.getAction() == ExchangeActionType.REQUEST) {
- elemName = INPUT_ELEMENT;
- } else if (dest.getAttribute(TYPE_ATTR).trim().length() == 0 ||
- dest.getAttribute(TYPE_ATTR).equals(DESTINATION_TYPE_ENDPOINT_ADDRESS)) {
- elemName = OUTPUT_ELEMENT;
- }
- }
-
- if (elemName != null) {
- org.w3c.dom.Element elem=m_service.getOwnerDocument().createElement(elemName);
-
- // Parameter has been stored in a structured manner
- // to support use of templates and presentations,
- // so need to extract the value
- java.util.List<TemplateParameter> params=
- m_templateProcessor.getTemplateParameters(dest.getAttribute(NAME_ATTR));
-
- if (params != null && params.size() > 0) {
- elem.setAttribute(EPR_ATTR, params.get(0).getValue());
- }
-
- if (dest.hasAttribute(DYNAMIC_REPLY_TO_ATTR)) {
- params=m_templateProcessor.getTemplateParameters(dest.getAttribute(DYNAMIC_REPLY_TO_ATTR));
-
- if (params != null && params.size() > 0) {
-
- if (params.get(0).getValue().equalsIgnoreCase("true")) {
- elem.setAttribute(DYNAMIC_REPLY_TO_ATTR, "true");
- }
- }
- }
-
- if (elem.hasAttribute(EPR_ATTR)) {
- m_service.appendChild(elem);
- }
- }
- }
- }
-
- private ParticipantType m_participantType=null;
- private org.w3c.dom.Element m_service=null;
- private org.pi4soa.common.annotations.TemplateProcessor m_templateProcessor=null;
- }
-}
Modified: branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/service/ServiceValidatorService.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/service/ServiceValidatorService.java 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/service/ServiceValidatorService.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -19,27 +19,14 @@
import java.util.logging.Logger;
-import org.savara.activity.ActivityNotifier;
import org.savara.activity.ActivityProcessor;
import org.savara.activity.ActivityProcessorFactory;
import org.savara.activity.ActivityValidator;
import org.savara.activity.DefaultActivityProcessor;
-import org.savara.activity.model.Activity;
-import org.savara.activity.model.ExchangeType;
-import org.savara.activity.model.InteractionActivity;
-import org.savara.activity.model.ProtocolAnalysis;
import org.savara.activity.notifier.jms.JMSActivityNotifier;
-import org.savara.activity.util.ActivityModelUtil;
-import org.savara.common.config.Configuration;
+import org.savara.activity.validator.cdm.CDMActivityValidator;
import org.savara.common.config.file.FileConfiguration;
-import org.savara.common.util.XMLUtils;
-import org.savara.validator.Endpoint;
-import org.savara.validator.ServiceValidator;
-import org.savara.validator.ServiceValidatorManager;
-import org.jboss.util.naming.NonSerializableFactory;
-import javax.naming.*;
-
/**
* This is the JBoss Savara Service Validator Service managing the Service Validator.
*
@@ -49,9 +36,6 @@
public class ServiceValidatorService extends org.jboss.system.ServiceMBeanSupport implements ServiceValidatorServiceMBean {
private final static Logger logger = Logger.getLogger(ServiceValidatorService.class.getName());
-
- private String m_jndiName=null;
- private ServiceValidatorManager m_serviceValidatorManager=null;
/**
* The default constructor.
@@ -66,10 +50,6 @@
protected void startService() throws Exception {
logger.info("Starting Savara Service Validator Manager");
- m_serviceValidatorManager = new ServiceValidatorManager();
-
- rebind();
-
// Create ActivityProcessor
ActivityProcessor dap=new DefaultActivityProcessor();
@@ -80,37 +60,16 @@
dap.addActivityNotifier(notifier);
- // TODO: Leave for now
- dap.addActivityNotifier(new ActivityNotifier() {
-
- public void setConfiguration(Configuration config) {
- }
-
- public void publish(Activity activity) {
- java.io.ByteArrayOutputStream baos=new java.io.ByteArrayOutputStream();
-
- try {
- ActivityModelUtil.serialize(activity, baos);
-
- logger.info("PUBLISH ACTIVITY: "+baos.toString());
-
- baos.close();
- } catch(Exception e) {
- logger.info("PUBLISH ACTIVITY: "+activity);
- }
- }
-
- public void close() {
- }
-
- });
+ ActivityValidator validator=new CDMActivityValidator();
- ActivityValidator validator=new SavaraActivityValidator();
-
dap.addActivityValidator(validator);
- ActivityProcessorFactory.setActivityProcessor(dap);
+ setActivityProcessor(dap);
}
+
+ public void setActivityProcessor(ActivityProcessor ap) {
+ ActivityProcessorFactory.setActivityProcessor(ap);
+ }
/**
* This method stops the service, closing the
@@ -118,144 +77,5 @@
*/
protected void stopService() throws Exception {
logger.info("Stopping Savara Service Validator Manager");
-
- unbind(m_jndiName);
-
- m_serviceValidatorManager.close();
-
- m_serviceValidatorManager = null;
}
-
- /**
- * This method returns the JNDI name used to register the
- * Service Validation Manager.
- */
- public String getJndiName() {
- return m_jndiName;
- }
-
- /**
- * This method sets the JNDI name associated with the
- * BPEL engine.
- *
- * @param jndiName The JNDI name
- * @throws NamingException Failed to register BPEL engine against
- * the JNDI name
- */
- public void setJndiName(String jndiName) throws NamingException {
- String oldName = m_jndiName;
- m_jndiName = jndiName;
-
- if (super.getState() == STARTED) {
- unbind(oldName);
- try {
- rebind();
- } catch(Exception e) {
- NamingException ne = new NamingException("Failed to update jndiName");
- ne.setRootCause(e);
- throw ne;
- }
- }
- }
-
- private void rebind() throws NamingException {
- InitialContext rootCtx = new InitialContext();
- Name fullName = rootCtx.getNameParser("").parse(m_jndiName);
- logger.info("fullName="+fullName);
- NonSerializableFactory.rebind(fullName, m_serviceValidatorManager, true);
- }
-
- private void unbind(String jndiName) {
- try {
- InitialContext rootCtx = new InitialContext();
- rootCtx.unbind(jndiName);
- NonSerializableFactory.unbind(jndiName);
- } catch(NamingException e) {
- logger.severe("Failed to unbind map: "+e);
- }
- }
-
- public class SavaraActivityValidator implements ActivityValidator {
-
- public void validate(Activity activity) {
-
- if (activity instanceof InteractionActivity) {
- InteractionActivity ia=(InteractionActivity)activity;
- java.util.List<ServiceValidator> validators=null;
- Endpoint endpoint=new Endpoint(ia.getDestinationType() != null ?
- ia.getDestinationType() : ia.getDestinationAddress());
-
- if (isOutputValidator(ia)) {
- validators = m_serviceValidatorManager.getOutputServiceValidators(endpoint);
- } else {
- validators = m_serviceValidatorManager.getInputServiceValidators(endpoint);
- }
-
- process(validators, ia);
-
- // Check whether a dynamic reply is expected
- if (isOutputValidator(ia)) {
- if (m_serviceValidatorManager.isOutputDynamicReplyTo(endpoint) &&
- ia.getReplyToAddress() != null) {
-
- // Register interest in the 'reply-to' endpoint
- Endpoint replyTo=new Endpoint(ia.getReplyToAddress());
-
- m_serviceValidatorManager.registerInputReplyToValidators(replyTo,
- validators);
- }
- } else if (m_serviceValidatorManager.isInputDynamicReplyTo(endpoint) &&
- ia.getReplyToAddress() != null) {
-
- // Register interest in the 'reply-to' endpoint
- Endpoint replyTo=new Endpoint(ia.getReplyToAddress());
-
- m_serviceValidatorManager.registerOutputReplyToValidators(replyTo,
- validators);
- }
- }
- }
-
- protected boolean isOutputValidator(InteractionActivity ia) {
- return((ia.getExchangeType() == ExchangeType.UNDEFINED && ia.isOutbound()) ||
- (ia.getExchangeType() != ExchangeType.UNDEFINED &&
- (ia.getExchangeType() == ExchangeType.REQUEST) == ia.isOutbound()));
- }
-
- public void process(java.util.List<ServiceValidator> validators, InteractionActivity ia) {
-
- if (validators != null && validators.size() > 0 && ia.getParameter().size() == 1) {
-
- for (int i=0; validators != null &&
- i < validators.size(); i++) {
- boolean validated=false;
- java.util.List<org.savara.activity.model.Context> contexts=null;
-
- try {
- if (ia.isOutbound()) {
- contexts = validators.get(i).messageSent(ia.getParameter().get(0).getType(),
- ia.getParameter().get(0).getValue());
- } else {
- contexts = validators.get(i).messageReceived(ia.getParameter().get(0).getType(),
- ia.getParameter().get(0).getValue());
- }
- validated = true;
- } catch(Exception t) {
- // Ignore
- }
-
- ProtocolAnalysis pa=new ProtocolAnalysis();
- pa.setProtocol(validators.get(i).getProtocolName());
- pa.setRole(XMLUtils.getLocalname(validators.get(i).getValidatorName().getRole()));
- pa.setExpected(validated);
-
- ia.getAnalysis().add(pa);
-
- if (contexts != null) {
- ia.getContext().addAll(contexts);
- }
- }
- }
- }
- }
}
Modified: branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/service/ServiceValidatorServiceMBean.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/service/ServiceValidatorServiceMBean.java 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/service/ServiceValidatorServiceMBean.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -17,9 +17,8 @@
*/
package org.savara.validator.service;
-import javax.naming.NamingException;
-
import org.jboss.system.ServiceMBean;
+import org.savara.activity.ActivityProcessor;
/**
* The MBean for the Service Validator Service.
@@ -29,20 +28,6 @@
*/
public interface ServiceValidatorServiceMBean extends ServiceMBean {
- /**
- * This method returns the JNDI name used to register the
- * Service Validator.
- */
- public String getJndiName();
-
- /**
- * This method sets the JNDI name associated with the
- * Service Validator.
- *
- * @param jndiName The JNDI name
- * @throws NamingException Failed to register Service Validator against
- * the JNDI name
- */
- public void setJndiName(String jndiName) throws javax.naming.NamingException;
-
+ public void setActivityProcessor(ActivityProcessor ap);
+
}
Modified: branches/experimental/2.0.x/integration/jboss/esb/.classpath
===================================================================
--- branches/experimental/2.0.x/integration/jboss/esb/.classpath 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/esb/.classpath 2011-02-18 20:09:45 UTC (rev 689)
@@ -4,6 +4,7 @@
<classpathentry kind="src" path="src/main/java" including="**/*.java"/>
<classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
<classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="var" path="M2_REPO/javax/jms/jms/1.1/jms-1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/savara/dependencies/eclipse/emf-common/2.3.0/emf-common-2.3.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/savara/dependencies/eclipse/emf-ecore/2.3.1/emf-ecore-2.3.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/savara/dependencies/eclipse/emf-ecore-xmi/2.3.1/emf-ecore-xmi-2.3.1.jar"/>
@@ -16,7 +17,10 @@
<classpathentry kind="var" path="M2_REPO/org/pi4soa/org.pi4soa.common/3.1.0.Final/org.pi4soa.common-3.1.0.Final.jar"/>
<classpathentry kind="var" path="M2_REPO/org/pi4soa/org.pi4soa.service/3.1.0.Final/org.pi4soa.service-3.1.0.Final.jar"/>
<classpathentry kind="var" path="M2_REPO/org/savara/bundles/org.savara.activity/2.0.0-SNAPSHOT/org.savara.activity-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/savara/bundles/org.savara.activity/2.0.0-SNAPSHOT/org.savara.activity-2.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/savara/bundles/org.savara.activity.notifier.jms/2.0.0-SNAPSHOT/org.savara.activity.notifier.jms-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/savara/bundles/org.savara.activity.notifier.jms/2.0.0-SNAPSHOT/org.savara.activity.notifier.jms-2.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/savara/bundles/org.savara.activity.validator.cdm/2.0.0-SNAPSHOT/org.savara.activity.validator.cdm-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/savara/bundles/org.savara.activity.validator.cdm/2.0.0-SNAPSHOT/org.savara.activity.validator.cdm-2.0.0-SNAPSHOT-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/savara/bundles/org.savara.common/2.0.0-SNAPSHOT/org.savara.common-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/savara/bundles/org.savara.common/2.0.0-SNAPSHOT/org.savara.common-2.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/savara/bundles/org.savara.common.config.file/2.0.0-SNAPSHOT/org.savara.common.config.file-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/savara/bundles/org.savara.common.config.file/2.0.0-SNAPSHOT/org.savara.common.config.file-2.0.0-SNAPSHOT-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/scribble/bundles/org.scribble.common/2.0.0-SNAPSHOT/org.scribble.common-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/scribble/bundles/org.scribble.common/2.0.0-SNAPSHOT/org.scribble.common-2.0.0-SNAPSHOT-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/scribble/bundles/org.scribble.protocol/2.0.0-SNAPSHOT/org.scribble.protocol-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/scribble/bundles/org.scribble.protocol/2.0.0-SNAPSHOT/org.scribble.protocol-2.0.0-SNAPSHOT-sources.jar"/>
<classpathentry kind="src" path="/savara-jboss"/>
Modified: branches/experimental/2.0.x/integration/jboss/esb/src/main/java/org/savara/validator/jbossesb/JBossESBInterceptor.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/esb/src/main/java/org/savara/validator/jbossesb/JBossESBInterceptor.java 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/esb/src/main/java/org/savara/validator/jbossesb/JBossESBInterceptor.java 2011-02-18 20:09:45 UTC (rev 689)
@@ -27,9 +27,6 @@
import org.savara.activity.model.InteractionActivity;
import org.savara.activity.model.MessageParameter;
import org.savara.common.util.MessageUtils;
-import org.savara.validator.Endpoint;
-import org.savara.validator.ServiceValidator;
-import org.savara.validator.ServiceValidatorManager;
import org.jboss.soa.esb.message.*;
import org.jboss.soa.esb.couriers.*;
@@ -45,8 +42,6 @@
private static final Logger logger = Logger.getLogger(JBossESBInterceptor.class);
- private ServiceValidatorManager m_serviceValidatorManager=null;
-
/**
* The default constructor.
*/
@@ -64,7 +59,7 @@
public Message onOutput(Message msg, java.util.Map params)
throws CourierException {
- Endpoint endpoint=getEndpoint(msg);
+ String endpoint=getEndpoint(msg);
java.io.Serializable message=ESBUtil.getMessage(msg);
@@ -75,7 +70,7 @@
InteractionActivity ia=new InteractionActivity();
- ia.setDestinationAddress(endpoint.getDestination());
+ ia.setDestinationAddress(endpoint);
ia.setOutbound(true);
@@ -85,10 +80,10 @@
ia.getParameter().add(mp);
- Endpoint replyTo=getReplyToEndpoint(msg);
+ String replyTo=getReplyToEndpoint(msg);
if (replyTo != null) {
- ia.setReplyToAddress(replyTo.getDestination());
+ ia.setReplyToAddress(replyTo);
}
ap.process(ia);
@@ -96,67 +91,6 @@
} catch(Exception e) {
logger.error("Failed to report interaction activity", e);
}
- /*
- java.util.List<ServiceValidator> validators=
- getServiceValidatorManager().getOutputServiceValidators(endpoint);
-
- if (validators != null && validators.size() > 0) {
- boolean validated=false;
- Exception ex=null;
-
- for (int i=0; validators != null &&
- i < validators.size(); i++) {
- try {
- validators.get(i).messageSent(null, ESBUtil.getMessage(msg));
- validated = true;
- } catch(Exception t) {
- // Ignore
- ex = t;
- }
- }
-
- // Only raise exception if none of the service
- // validators were able to validate the message
- if (validated == false) {
- String vnames="";
-
- for (int i=0; validators != null &&
- i < validators.size(); i++) {
- if (vnames.length() > 0) {
- vnames += ", ";
- }
- vnames += validators.get(i).getValidatorName();
- }
-
- logger.error("Failed to handle sent message on endpoint '"+
- endpoint+"' validated against: "+vnames);
-
- if (logger.isDebugEnabled()) {
- logger.debug("Invalid sent message", ex);
- }
-
- if (getServiceValidatorManager().isManagedMode()) {
- throw new CourierException("Failed to handle sent message on endpoint '"+
- endpoint+"' validated against: "+vnames, ex);
- }
- } else {
-
- // Check whether a dynamic reply is expected
- if (getServiceValidatorManager().isOutputDynamicReplyTo(endpoint)) {
-
- // Register interest in the 'reply-to' endpoint
- Endpoint replyTo=getReplyToEndpoint(msg);
-
- if (replyTo != null) {
- getServiceValidatorManager().registerInputReplyToValidators(replyTo,
- validators);
- } else {
- logger.error("Unable to get 'reply-to' endpoint for message: "+msg);
- }
- }
- }
- }
- */
}
return(msg);
@@ -173,7 +107,7 @@
public Message onInput(Message msg, java.util.Map params)
throws CourierException {
- Endpoint endpoint=getEndpoint(msg);
+ String endpoint=getEndpoint(msg);
java.io.Serializable message=ESBUtil.getMessage(msg);
@@ -184,7 +118,7 @@
InteractionActivity ia=new InteractionActivity();
- ia.setDestinationAddress(endpoint.getDestination());
+ ia.setDestinationAddress(endpoint);
ia.setOutbound(false);
@@ -194,10 +128,10 @@
ia.getParameter().add(mp);
- Endpoint replyTo=getReplyToEndpoint(msg);
+ String replyTo=getReplyToEndpoint(msg);
if (replyTo != null) {
- ia.setReplyToAddress(replyTo.getDestination());
+ ia.setReplyToAddress(replyTo);
}
ap.process(ia);
@@ -205,68 +139,6 @@
} catch(Exception e) {
logger.error("Failed to report interaction activity", e);
}
-
- /*
- java.util.List<ServiceValidator> validators=
- getServiceValidatorManager().getInputServiceValidators(endpoint);
-
- if (validators != null && validators.size() > 0) {
- boolean validated=false;
- Exception ex=null;
-
- for (int i=0; validators != null &&
- i < validators.size(); i++) {
- try {
- validators.get(i).messageReceived(null, ESBUtil.getMessage(msg));
- validated = true;
- } catch(Exception t) {
- // Ignore
- ex = t;
- }
- }
-
- // Only raise exception if none of the service
- // validators were able to validate the message
- if (validated == false) {
- String vnames="";
-
- for (int i=0; validators != null &&
- i < validators.size(); i++) {
- if (vnames.length() > 0) {
- vnames += ", ";
- }
- vnames += validators.get(i).getValidatorName();
- }
-
- logger.error("Failed to handle received message on endpoint '"+
- endpoint+"' validated against: "+vnames);
-
- if (logger.isDebugEnabled()) {
- logger.debug("Invalid received message", ex);
- }
-
- if (getServiceValidatorManager().isManagedMode()) {
- throw new CourierException("Failed to handle received message on endpoint '"+
- endpoint+"' validated against: "+vnames, ex);
- }
- } else {
-
- // Check whether a dynamic reply is expected
- if (getServiceValidatorManager().isInputDynamicReplyTo(endpoint)) {
-
- // Register interest in the 'reply-to' endpoint
- Endpoint replyTo=getReplyToEndpoint(msg);
-
- if (replyTo != null) {
- getServiceValidatorManager().registerOutputReplyToValidators(replyTo,
- validators);
- } else {
- logger.error("Unable to get 'reply-to' endpoint for message: "+msg);
- }
- }
- }
- }
- */
}
return(msg);
@@ -279,8 +151,8 @@
* @param msg The message
* @return The endpoint, or null if not relevant
*/
- protected Endpoint getEndpoint(Message msg) {
- Endpoint ret=null;
+ protected String getEndpoint(Message msg) {
+ String ret=null;
if (msg != null && msg.getHeader() != null &&
msg.getHeader().getCall() != null &&
@@ -293,7 +165,7 @@
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));
+ ret = JMS_PROTOCOL_PREFIX+key.substring(ind);
}
}
@@ -309,8 +181,8 @@
* @param msg The message
* @return The endpoint, or null if not relevant
*/
- protected Endpoint getReplyToEndpoint(Message msg) {
- Endpoint ret=null;
+ protected String getReplyToEndpoint(Message msg) {
+ String ret=null;
if (msg != null && msg.getHeader() != null &&
msg.getHeader().getCall() != null &&
@@ -323,7 +195,7 @@
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));
+ ret = JMS_PROTOCOL_PREFIX+key.substring(ind);
}
}
Modified: branches/experimental/2.0.x/integration/jboss/wsnative/.classpath
===================================================================
--- branches/experimental/2.0.x/integration/jboss/wsnative/.classpath 2011-02-18 17:34:20 UTC (rev 688)
+++ branches/experimental/2.0.x/integration/jboss/wsnative/.classpath 2011-02-18 20:09:45 UTC (rev 689)
@@ -9,6 +9,7 @@
<classpathentry kind="var" path="M2_REPO/javax/security/jacc/1.0/jacc-1.0.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/xml/ws/jaxws-api/2.1/jaxws-api-2.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/jms/jms/1.1/jms-1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/jws/jsr181-api/1.0-MR1/jsr181-api-1.0-MR1.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/transaction/jta/1.1/jta-1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/mail/mail/1.4/mail-1.4.jar"/>
@@ -189,7 +190,10 @@
<classpathentry kind="var" path="M2_REPO/org/pi4soa/org.pi4soa.common/3.1.0.Final/org.pi4soa.common-3.1.0.Final.jar"/>
<classpathentry kind="var" path="M2_REPO/org/pi4soa/org.pi4soa.service/3.1.0.Final/org.pi4soa.service-3.1.0.Final.jar"/>
<classpathentry kind="var" path="M2_REPO/org/savara/bundles/org.savara.activity/2.0.0-SNAPSHOT/org.savara.activity-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/savara/bundles/org.savara.activity/2.0.0-SNAPSHOT/org.savara.activity-2.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/savara/bundles/org.savara.activity.notifier.jms/2.0.0-SNAPSHOT/org.savara.activity.notifier.jms-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/savara/bundles/org.savara.activity.notifier.jms/2.0.0-SNAPSHOT/org.savara.activity.notifier.jms-2.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/savara/bundles/org.savara.activity.validator.cdm/2.0.0-SNAPSHOT/org.savara.activity.validator.cdm-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/savara/bundles/org.savara.activity.validator.cdm/2.0.0-SNAPSHOT/org.savara.activity.validator.cdm-2.0.0-SNAPSHOT-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/savara/bundles/org.savara.common/2.0.0-SNAPSHOT/org.savara.common-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/savara/bundles/org.savara.common/2.0.0-SNAPSHOT/org.savara.common-2.0.0-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/savara/bundles/org.savara.common.config.file/2.0.0-SNAPSHOT/org.savara.common.config.file-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/savara/bundles/org.savara.common.config.file/2.0.0-SNAPSHOT/org.savara.common.config.file-2.0.0-SNAPSHOT-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/scribble/bundles/org.scribble.common/2.0.0-SNAPSHOT/org.scribble.common-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/scribble/bundles/org.scribble.common/2.0.0-SNAPSHOT/org.scribble.common-2.0.0-SNAPSHOT-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/scribble/bundles/org.scribble.protocol/2.0.0-SNAPSHOT/org.scribble.protocol-2.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/scribble/bundles/org.scribble.protocol/2.0.0-SNAPSHOT/org.scribble.protocol-2.0.0-SNAPSHOT-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/aop/pluggable-instrumentor/2.1.1.GA/pluggable-instrumentor-2.1.1.GA.jar"/>
More information about the savara-commits
mailing list