Author: gnodet
Date: Mon Jul 28 06:39:02 2008
New Revision: 680355
URL: http://svn.apache.org/viewvc?rev=680355&view=rev
Log:
SM-1387: make servicemix-validation OSGi friendly and independant of
servicemix-core
Added:
servicemix/components/engines/servicemix-validation/trunk/src/main/resources/META-INF/
servicemix/components/engines/servicemix-validation/trunk/src/main/resources/META-INF/spring/
servicemix/components/engines/servicemix-validation/trunk/src/main/resources/META-INF/spring/servicemix-validation.xml
Modified:
servicemix/components/engines/servicemix-validation/trunk/pom.xml
servicemix/components/engines/servicemix-validation/trunk/src/main/java/org/apache/servicemix/validation/ValidationEndpoint.java
Modified: servicemix/components/engines/servicemix-validation/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-validation/trunk/pom.xml?rev=680355&r1=680354&r2=680355&view=diff
==============================================================================
--- servicemix/components/engines/servicemix-validation/trunk/pom.xml (original)
+++ servicemix/components/engines/servicemix-validation/trunk/pom.xml Mon Jul
28 06:39:02 2008
@@ -42,6 +42,18 @@
<previous.releases>3.1.2,3.2,3.2.1</previous.releases>
<servicemix-version>3.2.1</servicemix-version>
<servicemix-shared-version>4.0-SNAPSHOT</servicemix-shared-version>
+ <servicemix.osgi.import>
+ org.apache.servicemix.common,
+ org.apache.servicemix.common.osgi,
+ org.apache.servicemix.executors.impl,
+ org.apache.xbean.spring.context.v2,
+ org.springframework.beans.factory.xml,
+ *
+ </servicemix.osgi.import>
+ <servicemix.osgi.export>
+ org.apache.servicemix.validation*;version=${project.version},
+
META-INF.services.org.apache.xbean.spring.http.servicemix.apache.org.validation
+ </servicemix.osgi.export>
</properties>
<dependencies>
Modified:
servicemix/components/engines/servicemix-validation/trunk/src/main/java/org/apache/servicemix/validation/ValidationEndpoint.java
URL:
http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-validation/trunk/src/main/java/org/apache/servicemix/validation/ValidationEndpoint.java?rev=680355&r1=680354&r2=680355&view=diff
==============================================================================
---
servicemix/components/engines/servicemix-validation/trunk/src/main/java/org/apache/servicemix/validation/ValidationEndpoint.java
(original)
+++
servicemix/components/engines/servicemix-validation/trunk/src/main/java/org/apache/servicemix/validation/ValidationEndpoint.java
Mon Jul 28 06:39:02 2008
@@ -36,10 +36,9 @@
import org.xml.sax.SAXException;
import org.apache.servicemix.common.endpoints.ProviderEndpoint;
-import org.apache.servicemix.jbi.FaultException;
+import org.apache.servicemix.common.util.MessageUtil;
import org.apache.servicemix.jbi.jaxp.SourceTransformer;
import org.apache.servicemix.jbi.jaxp.StringSource;
-import org.apache.servicemix.jbi.util.MessageUtil;
import org.apache.servicemix.validation.handler.CountingErrorHandlerFactory;
import org.apache.servicemix.validation.handler.MessageAwareErrorHandler;
import
org.apache.servicemix.validation.handler.MessageAwareErrorHandlerFactory;
@@ -259,9 +258,8 @@
if (!handlingErrorMethod.equalsIgnoreCase(FAULT_FLOW)) {
// HANDLE AS JBI FAULT
- throw new FaultException(
- "Failed to validate against schema: " + schema,
- exchange, fault);
+ throw new JBIException(
+ "Failed to validate against schema: " + schema +
"\n" + new SourceTransformer().toString(fault.getContent()));
} else {
MessageUtil.transfer(fault, out);
}
Added:
servicemix/components/engines/servicemix-validation/trunk/src/main/resources/META-INF/spring/servicemix-validation.xml
URL:
http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-validation/trunk/src/main/resources/META-INF/spring/servicemix-validation.xml?rev=680355&view=auto
==============================================================================
---
servicemix/components/engines/servicemix-validation/trunk/src/main/resources/META-INF/spring/servicemix-validation.xml
(added)
+++
servicemix/components/engines/servicemix-validation/trunk/src/main/resources/META-INF/spring/servicemix-validation.xml
Mon Jul 28 06:39:02 2008
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:osgi="http://www.springframework.org/schema/osgi"
+ xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util.xsd
+ http://www.springframework.org/schema/osgi
+ http://www.springframework.org/schema/osgi/spring-osgi.xsd
+ http://www.springframework.org/schema/osgi-compendium
+
http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">
+
+ <bean id="servicemix-validation"
class="org.apache.servicemix.validation.ValidationComponent">
+ <property name="executorFactory" ref="executorFactory" />
+ </bean>
+
+ <bean id="executorFactory"
class="org.apache.servicemix.executors.impl.ExecutorFactoryImpl">
+ <property name="defaultConfig">
+ <bean class="org.apache.servicemix.executors.impl.ExecutorConfig">
+ <property name="corePoolSize"
value="${threadPoolCorePoolSize}"/>
+ <property name="maximumPoolSize"
value="${threadPoolMaximumPoolSize}"/>
+ <property name="queueSize" value="${threadPoolQueueSize}"/>
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="endpoint-tracker"
class="org.apache.servicemix.common.osgi.EndpointTracker">
+ <property name="component" ref="servicemix-validation" />
+ </bean>
+
+ <osgi:list id="endpoints"
+ interface="org.apache.servicemix.common.osgi.EndpointWrapper"
+ cardinality="0..N">
+ <osgi:listener ref="endpoint-tracker" bind-method="register"
unbind-method="unregister" />
+ </osgi:list>
+
+ <osgi:service ref="servicemix-validation"
interface="javax.jbi.component.Component">
+ <osgi:service-properties>
+ <entry key="NAME" value="servicemix-validation" />
+ <entry key="TYPE" value="service-engine" />
+ </osgi:service-properties>
+ </osgi:service>
+
+ <osgix:property-placeholder persistent-id="servicemix-validation">
+ <osgix:default-properties>
+ <prop key="threadPoolCorePoolSize">8</prop>
+ <prop key="threadPoolMaximumPoolSize">32</prop>
+ <prop key="threadPoolQueueSize">256</prop>
+ </osgix:default-properties>
+ </osgix:property-placeholder>
+
+</beans>