Initial commit for MarshallingWebServiceInboundGateway (INT-162).

This commit is contained in:
Mark Fisher
2009-02-20 22:52:36 +00:00
parent 64188597e2
commit 5945cc19ce
2 changed files with 132 additions and 1 deletions

View File

@@ -0,0 +1,130 @@
/*
* Copyright 2002-2009 the original author or authors.
*
* 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.
*/
package org.springframework.integration.ws;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.Lifecycle;
import org.springframework.integration.core.MessageChannel;
import org.springframework.integration.gateway.SimpleMessagingGateway;
import org.springframework.integration.scheduling.TaskScheduler;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.Unmarshaller;
import org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint;
/**
* @author Mark Fisher
* @since 1.0.2
*/
public class MarshallingWebServiceInboundGateway extends AbstractMarshallingPayloadEndpoint
implements BeanNameAware, BeanFactoryAware, InitializingBean, Lifecycle {
private final SimpleMessagingGateway gatewayDelegate = new SimpleMessagingGateway();
/**
* Creates a new <code>MarshallingWebServiceInboundGateway</code>.
* The {@link Marshaller} and {@link Unmarshaller} must be injected using properties.
*/
public MarshallingWebServiceInboundGateway() {
}
/**
* Creates a new <code>MarshallingWebServiceInboundGateway</code> with the given marshaller.
* The Marshaller must also implement {@link Unmarshaller}, since it is used for both marshalling and
* unmarshalling.
* <p/>
* Note that all {@link Marshaller} implementations in Spring-OXM also implement the {@link Unmarshaller}
* interface, so you can safely use this constructor for any of those implementations.
*
* @param marshaller object used as marshaller and unmarshaller
* @throws IllegalArgumentException when <code>marshaller</code> does not implement {@link Unmarshaller}
* @see #MarshallingWebServiceInboundGateway(Marshaller, Unmarshaller)
*/
public MarshallingWebServiceInboundGateway(Marshaller marshaller) {
super(marshaller);
}
/**
* Creates a new <code>MarshallingWebServiceInboundGateway</code> with the given marshaller and unmarshaller.
*/
public MarshallingWebServiceInboundGateway(Marshaller marshaller, Unmarshaller unmarshaller) {
super(marshaller, unmarshaller);
}
public void setRequestChannel(MessageChannel requestChannel) {
this.gatewayDelegate.setRequestChannel(requestChannel);
}
public void setRequestTimeout(long requestTimeout) {
this.gatewayDelegate.setRequestTimeout(requestTimeout);
}
public void setReplyChannel(MessageChannel replyChannel) {
this.gatewayDelegate.setRequestChannel(replyChannel);
}
public void setReplyTimeout(long replyTimeout) {
this.gatewayDelegate.setReplyTimeout(replyTimeout);
}
public void setTaskScheduler(TaskScheduler taskScheduler) {
this.gatewayDelegate.setTaskScheduler(taskScheduler);
}
public void setAutoStartup(boolean autoStartup) {
this.gatewayDelegate.setAutoStartup(autoStartup);
}
public void setBeanName(String beanName) {
this.gatewayDelegate.setBeanName(beanName);
}
public void setBeanFactory(BeanFactory beanFactory) {
this.gatewayDelegate.setBeanFactory(beanFactory);
}
public void afterPropertiesSet() throws Exception {
super.afterPropertiesSet();
this.gatewayDelegate.afterPropertiesSet();
}
@Override
protected Object invokeInternal(Object requestObject) throws Exception {
return this.gatewayDelegate.sendAndReceive(requestObject);
}
// Lifecycle implementation
public boolean isRunning() {
return this.gatewayDelegate.isRunning();
}
public void start() {
this.gatewayDelegate.start();
}
public void stop() {
this.gatewayDelegate.stop();
}
}

View File

@@ -5,10 +5,11 @@ Bundle-ManifestVersion: 2
Import-Template:
org.springframework.integration.*;version="[1.0.1, 1.0.2)",
org.springframework.beans.factory.*;version="[2.5.6.A, 3.0.0)",
org.springframework.context;version="[2.5.6.A, 3.0.0)",
org.springframework.util;version="[2.5.6.A, 3.0.0)",
org.springframework.oxm;version="[1.5.5.A, 2.0.0)",
org.springframework.ws.*;version="[1.5.5.A, 2.0.0)",
org.springframework.xml.transform;version="[1.5.5.A, 2.0.0)"
Unversioned-Imports:
org.w3c.dom,
javax.xml.transform.*
javax.xml.*