Permalink
Browse files

[SWITCHYARD-1943] Upgraded Camel to 2.12.2; and fixed resulting issues

  • Loading branch information...
1 parent aa43466 commit d6a5290907a6df328f768efa5c9b1e5ff5d2176b @douglaspalmer douglaspalmer committed with rcernich Jan 23, 2014
@@ -1,30 +0,0 @@
-package org.switchyard.component.camel.netty.deploy;
-
-import javax.xml.namespace.QName;
-
-import org.switchyard.common.camel.SwitchYardCamelContext;
-import org.switchyard.component.camel.common.deploy.BaseBindingActivator;
-import org.switchyard.component.camel.common.handler.InboundHandler;
-import org.switchyard.component.camel.common.model.CamelBindingModel;
-import org.switchyard.component.camel.netty.model.CamelNettyBindingModel;
-
-/**
- * Camel netty activator.
- */
-public class CamelNettyActivator extends BaseBindingActivator {
- /**
- * Creates new activator instance.
- *
- * @param context Camel context.
- * @param types Activation types.
- */
- public CamelNettyActivator(SwitchYardCamelContext context, String[] types) {
- super(context, types);
- }
-
- @SuppressWarnings("unchecked")
- protected <T extends CamelBindingModel> InboundHandler<T> createInboundHandler(QName serviceName, T binding) {
- return (InboundHandler<T>) new CamelNettyInboundHandler((CamelNettyBindingModel) binding, getCamelContext(), serviceName, getServiceDomain());
- }
-
-}
@@ -13,8 +13,6 @@
*/
package org.switchyard.component.camel.netty.deploy;
-import org.switchyard.common.camel.SwitchYardCamelContext;
-import org.switchyard.component.camel.common.deploy.BaseBindingActivator;
import org.switchyard.component.camel.common.deploy.BaseBindingComponent;
import org.switchyard.component.camel.netty.model.v1.V1CamelNettyTcpBindingModel;
import org.switchyard.component.camel.netty.model.v1.V1CamelNettyUdpBindingModel;
@@ -31,9 +29,4 @@ public CamelNettyComponent() {
super("CamelNettyComponent", V1CamelNettyTcpBindingModel.TCP, V1CamelNettyUdpBindingModel.UDP);
}
- @Override
- protected BaseBindingActivator createActivator(SwitchYardCamelContext context, String... types) {
- return new CamelNettyActivator(context, types);
- }
-
}
@@ -1,46 +0,0 @@
-package org.switchyard.component.camel.netty.deploy;
-
-import javax.xml.namespace.QName;
-
-import org.apache.camel.Route;
-import org.apache.camel.component.netty.NettyConsumer;
-import org.jboss.netty.channel.socket.DatagramChannelFactory;
-import org.switchyard.ServiceDomain;
-import org.switchyard.common.camel.SwitchYardCamelContext;
-import org.switchyard.component.camel.common.handler.InboundHandler;
-import org.switchyard.component.camel.netty.model.CamelNettyBindingModel;
-
-
-/**
- * Inbound handler for Netty binding. Used to cleanly shutdown the DatagramChannelFactory.
- * This fixes SwitchYard-1633 and can be remove once Camel 2.10.8 is released.
- */
-public class CamelNettyInboundHandler extends InboundHandler<CamelNettyBindingModel> {
-
- /**
- * Sole constructor.
- *
- * @param camelBindingModel The CamelBindingModel.
- * @param camelContext The camel context instance.
- * @param serviceName The target service name.
- * @param domain the service domain.
- */
- public CamelNettyInboundHandler(CamelNettyBindingModel camelBindingModel,
- SwitchYardCamelContext camelContext, QName serviceName, ServiceDomain domain) {
- super(camelBindingModel, camelContext, serviceName, domain);
- }
-
- @Override
- protected void doStop() {
- String routeId = this.getRouteId();
- SwitchYardCamelContext context = this.getSwitchYardCamelContext();
- Route route = context.getRoute(routeId);
- NettyConsumer consumer = (NettyConsumer)route.getConsumer();
- DatagramChannelFactory datagramChannelFactory = consumer.getDatagramChannelFactory();
- if (datagramChannelFactory != null) {
- datagramChannelFactory.releaseExternalResources();
- }
- super.doStop();
- }
-
-}
@@ -57,13 +57,14 @@ protected RouteDefinition createRouteDefinition() {
RouteDefinition definition = new RouteDefinition();
definition.routeId(getRouteId())
- .from(getBindingModel().getTimerURI(getRouteId()).toString())
+ .from(getBindingModel().getTimerURI(getRouteId()).toString());
+ return addTransactionPolicy(definition)
.to(getBindingModel().getComponentURI().toString())
.setProperty(ExchangeCompletionEvent.GATEWAY_NAME).simple(getBindingModel().getName(), String.class)
.setProperty(CamelConstants.APPLICATION_NAMESPACE).constant(serviceName.getNamespaceURI())
.process(new MessageComposerProcessor(getBindingModel()))
- .process(new OperationSelectorProcessor(serviceName, bindingModel));
- return addTransactionPolicy(definition);
+ .process(new OperationSelectorProcessor(serviceName, bindingModel))
+ .to(getSwitchyardEndpointUri());
}
return super.createRouteDefinition();
}
@@ -27,7 +27,7 @@
<extension base="tns:BaseCamelBinding">
<sequence>
<element name="query" type="string" />
- <element name="dataSourceRef" type="string" />
+ <element name="dataSourceRef" type="string" minOccurs="0" maxOccurs="1"/>
<element name="batch" type="boolean" minOccurs="0" maxOccurs="1"/>
<element name="placeholder" type="string" minOccurs="0" maxOccurs="1"/>
</sequence>
@@ -78,12 +78,13 @@ public InboundHandler(final T camelBindingModel, final SwitchYardCamelContext ca
protected RouteDefinition createRouteDefinition() {
final RouteDefinition route = new RouteDefinition();
- route.routeId(getRouteId()).from(getComponentUri().toString())
+ route.routeId(getRouteId()).from(getComponentUri().toString());
+ return addTransactionPolicy(route)
.setProperty(ExchangeCompletionEvent.GATEWAY_NAME).simple(getBindingModel().getName(), String.class)
.setProperty(CamelConstants.APPLICATION_NAMESPACE).constant(_serviceName.getNamespaceURI())
.process(new MessageComposerProcessor(getBindingModel()))
- .process(new OperationSelectorProcessor(getServiceName(), getBindingModel()));
- return addTransactionPolicy(route);
+ .process(new OperationSelectorProcessor(getServiceName(), getBindingModel()))
+ .to(getSwitchyardEndpointUri());
}
/**
@@ -111,13 +112,9 @@ protected QName getServiceName() {
* @return
*/
protected RouteDefinition addTransactionPolicy(final RouteDefinition route) {
- if (!TransactionHelper.useTransactionManager(getComponentUri(), _camelContext)) {
- // namespace will be added by SwitchYardRouteDefinition
- return route.to(getSwitchyardEndpointUri());
+ if (TransactionHelper.useTransactionManager(getComponentUri(), _camelContext)) {
+ route.transacted(CamelConstants.TRANSACTED_REF);
}
-
- // Tell Camel the route is transacted
- route.transacted(CamelConstants.TRANSACTED_REF).to(getSwitchyardEndpointUri());
return route;
}
@@ -26,7 +26,7 @@
<sca:reference name="SampleRESTEasyConsumerService" promote="resteasy-consumer" multiplicity="1..1">
<rest:binding.rest name="testGateway">
- <rest:contextMapper class="org.switchyard.component.resteasy.AnotherCustomMapper"/>
+ <rest:contextMapper class="org.switchyard.component.resteasy.AnotherCustomMapper" includes="bar"/>
<rest:interfaces>org.switchyard.component.resteasy.HelloResource</rest:interfaces>
</rest:binding.rest>
</sca:reference>

0 comments on commit d6a5290

Please sign in to comment.