You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2010/07/09 17:44:26 UTC

svn commit: r962566 - in /servicemix/components/engines/servicemix-exec/trunk/src/main: java/org/apache/servicemix/exec/ resources/META-INF/ resources/OSGI-INF/ resources/OSGI-INF/blueprint/

Author: gnodet
Date: Fri Jul  9 15:44:26 2010
New Revision: 962566

URL: http://svn.apache.org/viewvc?rev=962566&view=rev
Log:
SMXCOMP-777: Support for blueprint in components

Added:
    servicemix/components/engines/servicemix-exec/trunk/src/main/resources/OSGI-INF/
    servicemix/components/engines/servicemix-exec/trunk/src/main/resources/OSGI-INF/blueprint/
    servicemix/components/engines/servicemix-exec/trunk/src/main/resources/OSGI-INF/blueprint/servicemix-exec.xml
Removed:
    servicemix/components/engines/servicemix-exec/trunk/src/main/resources/META-INF/
Modified:
    servicemix/components/engines/servicemix-exec/trunk/src/main/java/org/apache/servicemix/exec/ExecEndpoint.java

Modified: servicemix/components/engines/servicemix-exec/trunk/src/main/java/org/apache/servicemix/exec/ExecEndpoint.java
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-exec/trunk/src/main/java/org/apache/servicemix/exec/ExecEndpoint.java?rev=962566&r1=962565&r2=962566&view=diff
==============================================================================
--- servicemix/components/engines/servicemix-exec/trunk/src/main/java/org/apache/servicemix/exec/ExecEndpoint.java (original)
+++ servicemix/components/engines/servicemix-exec/trunk/src/main/java/org/apache/servicemix/exec/ExecEndpoint.java Fri Jul  9 15:44:26 2010
@@ -16,6 +16,8 @@
  */
 package org.apache.servicemix.exec;
 
+import java.io.IOException;
+import java.io.InputStream;
 import javax.jbi.management.DeploymentException;
 import javax.jbi.messaging.ExchangeStatus;
 import javax.jbi.messaging.InOut;
@@ -23,16 +25,20 @@ import javax.jbi.messaging.MessageExchan
 import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.NormalizedMessage;
 import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.ParserConfigurationException;
 
 import org.apache.servicemix.common.endpoints.ProviderEndpoint;
+import org.apache.servicemix.common.util.DOMUtil;
 import org.apache.servicemix.exec.marshaler.DefaultExecMarshaler;
 import org.apache.servicemix.exec.marshaler.ExecMarshalerSupport;
 import org.apache.servicemix.exec.marshaler.ExecRequest;
 import org.apache.servicemix.exec.marshaler.ExecResponse;
 import org.apache.servicemix.exec.utils.ExecUtils;
-import org.apache.servicemix.soap.util.DomUtil;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.Resource;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
 
 /**
  * Represents an exec endpoint.
@@ -114,7 +120,7 @@ public class ExecEndpoint extends Provid
 	        }
 	        
 	        // load the WSDL
-	        description = DomUtil.parse(wsdl.getInputStream());
+	        description = parse(wsdl.getInputStream());
 	        definition = javax.wsdl.factory.WSDLFactory.newInstance().newWSDLReader().readWSDL(null, description);
 	        
 	        // cleanup WSDL to be sure thats it's an abstract one
@@ -133,6 +139,15 @@ public class ExecEndpoint extends Provid
 	        throw new DeploymentException("Can't load the WSDL.", e);
 	    }
 	}
+	
+	protected Document parse(InputStream is) throws IOException, SAXException, ParserConfigurationException {
+		DocumentBuilder builder = DOMUtil.getBuilder();
+		try {
+			return builder.parse(is);
+		} finally {
+			DOMUtil.releaseBuilder(builder);
+		}
+	}
 
 	/*
 	 * (non-Javadoc)

Added: servicemix/components/engines/servicemix-exec/trunk/src/main/resources/OSGI-INF/blueprint/servicemix-exec.xml
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-exec/trunk/src/main/resources/OSGI-INF/blueprint/servicemix-exec.xml?rev=962566&view=auto
==============================================================================
--- servicemix/components/engines/servicemix-exec/trunk/src/main/resources/OSGI-INF/blueprint/servicemix-exec.xml (added)
+++ servicemix/components/engines/servicemix-exec/trunk/src/main/resources/OSGI-INF/blueprint/servicemix-exec.xml Fri Jul  9 15:44:26 2010
@@ -0,0 +1,75 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
+           xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">
+
+    <bean id="servicemix-exec" class="org.apache.servicemix.exec.ExecComponent">
+        <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-exec" />
+    </bean>
+
+    <reference-list id="endpoints"
+               interface="org.apache.servicemix.common.osgi.EndpointWrapper"
+               availability="optional">
+        <reference-listener ref="endpoint-tracker" bind-method="register" unbind-method="unregister" />
+    </reference-list>
+
+    <service ref="servicemix-exec" interface="javax.jbi.component.Component">
+        <service-properties>
+            <entry key="NAME" value="servicemix-exec" />
+            <entry key="TYPE" value="service-engine" />
+        </service-properties>
+    </service>
+
+    <service interface="org.apache.aries.blueprint.NamespaceHandler">
+        <service-properties>
+            <entry key="osgi.service.blueprint.namespace" value="http://servicemix.apache.org/exec/1.0"/>
+        </service-properties>
+        <bean class="org.apache.xbean.blueprint.context.impl.XBeanNamespaceHandler">
+            <argument value="http://servicemix.apache.org/exec/1.0"/>
+            <argument value="servicemix-exec.xsd"/>
+            <argument ref="blueprintBundle"/>
+            <argument value="META-INF/services/org/apache/xbean/spring/http/servicemix.apache.org/exec/1.0"/>
+        </bean>
+    </service>
+
+    <cm:property-placeholder persistent-id="org.apache.servicemix.components.exec">
+        <cm:default-properties>
+            <cm:property name="threadPoolCorePoolSize" value="8"/>
+            <cm:property name="threadPoolMaximumPoolSize" value="32"/>
+            <cm:property name="threadPoolQueueSize" value="256"/>
+	    </cm:default-properties>
+    </cm:property-placeholder>
+    
+</blueprint>