ading files

This commit is contained in:
Josh Long
2010-09-09 03:13:34 -07:00
parent a30bd927e8
commit 0bfa8c81bc
4 changed files with 52 additions and 36 deletions

View File

@@ -8,12 +8,15 @@ import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.config.AbstractFactoryBean;
import org.springframework.integration.MessageChannel;
import org.springframework.transaction.PlatformTransactionManager;
public class ActivityBehaviorMessagingGatewayFactoryBean implements FactoryBean, BeanFactoryAware, BeanNameAware {
public class ActivityBehaviorMessagingGatewayFactoryBean
extends AbstractFactoryBean<Object> implements
BeanFactoryAware, BeanNameAware {
private volatile boolean updateProcessVariablesFromReplyMessageHeaders = false;
private volatile boolean forwardProcessVariablesAsMessageHeaders = false;
private volatile PlatformTransactionManager platformTransactionManager;
@@ -29,6 +32,38 @@ public class ActivityBehaviorMessagingGatewayFactoryBean implements FactoryBean,
this.async = async;
}
@Override
protected Object createInstance() throws Exception {
if (this.async) {
AsyncActivityBehaviorMessagingGateway asyncActivityBehaviorMessagingGateway = new AsyncActivityBehaviorMessagingGateway();
asyncActivityBehaviorMessagingGateway.setForwardProcessVariablesAsMessageHeaders(this.forwardProcessVariablesAsMessageHeaders);
asyncActivityBehaviorMessagingGateway.setUpdateProcessVariablesFromReplyMessageHeaders(this.updateProcessVariablesFromReplyMessageHeaders);
asyncActivityBehaviorMessagingGateway.setPlatformTransactionManager(this.platformTransactionManager);
asyncActivityBehaviorMessagingGateway.setReplyChannel(this.replyChannel);
asyncActivityBehaviorMessagingGateway.setProcessEngine(this.processEngine);
asyncActivityBehaviorMessagingGateway.setRequestChannel(this.requestChannel);
asyncActivityBehaviorMessagingGateway.setBeanFactory(this.beanFactory);
asyncActivityBehaviorMessagingGateway.setBeanName(this.beanName);
asyncActivityBehaviorMessagingGateway.afterPropertiesSet();
return asyncActivityBehaviorMessagingGateway;
} else {
SyncActivityBehaviorMessagingGateway syncActivityBehaviorMessagingGateway = new SyncActivityBehaviorMessagingGateway();
syncActivityBehaviorMessagingGateway.setForwardProcessVariablesAsMessageHeaders(this.forwardProcessVariablesAsMessageHeaders);
syncActivityBehaviorMessagingGateway.setUpdateProcessVariablesFromReplyMessageHeaders(this.updateProcessVariablesFromReplyMessageHeaders);
syncActivityBehaviorMessagingGateway.setPlatformTransactionManager(this.platformTransactionManager);
syncActivityBehaviorMessagingGateway.setReplyChannel(this.replyChannel);
syncActivityBehaviorMessagingGateway.setProcessEngine(this.processEngine);
syncActivityBehaviorMessagingGateway.setRequestChannel(this.requestChannel);
syncActivityBehaviorMessagingGateway.setBeanFactory(this.beanFactory);
syncActivityBehaviorMessagingGateway.setBeanName(this.beanName);
syncActivityBehaviorMessagingGateway.afterPropertiesSet();
return syncActivityBehaviorMessagingGateway;
}
}
@SuppressWarnings("unused")
public void setProcessEngine(ProcessEngine processEngine) {
this.processEngine = processEngine;
@@ -65,35 +100,6 @@ public class ActivityBehaviorMessagingGatewayFactoryBean implements FactoryBean,
this.replyChannel = replyChannel;
}
public Object getObject() throws Exception {
if (this.async) {
AsyncActivityBehaviorMessagingGateway asyncActivityBehaviorMessagingGateway = new AsyncActivityBehaviorMessagingGateway();
asyncActivityBehaviorMessagingGateway.setForwardProcessVariablesAsMessageHeaders(this.forwardProcessVariablesAsMessageHeaders);
asyncActivityBehaviorMessagingGateway.setUpdateProcessVariablesFromReplyMessageHeaders(this.updateProcessVariablesFromReplyMessageHeaders);
asyncActivityBehaviorMessagingGateway.setPlatformTransactionManager(this.platformTransactionManager);
asyncActivityBehaviorMessagingGateway.setReplyChannel(this.replyChannel);
asyncActivityBehaviorMessagingGateway.setProcessEngine(this.processEngine);
asyncActivityBehaviorMessagingGateway.setRequestChannel(this.requestChannel);
asyncActivityBehaviorMessagingGateway.setBeanFactory(this.beanFactory);
asyncActivityBehaviorMessagingGateway.setBeanName(this.beanName);
asyncActivityBehaviorMessagingGateway.afterPropertiesSet();
return asyncActivityBehaviorMessagingGateway;
} else {
SyncActivityBehaviorMessagingGateway syncActivityBehaviorMessagingGateway = new SyncActivityBehaviorMessagingGateway();
syncActivityBehaviorMessagingGateway.setForwardProcessVariablesAsMessageHeaders(this.forwardProcessVariablesAsMessageHeaders);
syncActivityBehaviorMessagingGateway.setUpdateProcessVariablesFromReplyMessageHeaders(this.updateProcessVariablesFromReplyMessageHeaders);
syncActivityBehaviorMessagingGateway.setPlatformTransactionManager(this.platformTransactionManager);
syncActivityBehaviorMessagingGateway.setReplyChannel(this.replyChannel);
syncActivityBehaviorMessagingGateway.setProcessEngine(this.processEngine);
syncActivityBehaviorMessagingGateway.setRequestChannel(this.requestChannel);
syncActivityBehaviorMessagingGateway.setBeanFactory(this.beanFactory);
syncActivityBehaviorMessagingGateway.setBeanName(this.beanName);
syncActivityBehaviorMessagingGateway.afterPropertiesSet();
return syncActivityBehaviorMessagingGateway;
}
}
public Class<?> getObjectType() {
return this.async ? AsyncActivityBehaviorMessagingGateway.class : SyncActivityBehaviorMessagingGateway.class;

View File

@@ -8,9 +8,10 @@
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/integration/activiti http://www.springframework.org/schema/integration/activiti/spring-integration-activiti-2.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/integration/activiti http://www.springframework.org/schema/integration/activiti/spring-integration-activiti-2.0.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.0.xsd

View File

@@ -71,10 +71,14 @@
<bean class="org.springframework.integration.activiti.impls.AnnouncingServiceActivator" id="activator"/>
<int:channel id="tc">
<int:channel id="triggerChannl">
<int:queue capacity="100"/>
</int:channel>
<activiti:outbound-channel-adapter channel="tc" process-engine="processEngine" process-definition-name="helloWorldProcess"/>
<activiti:outbound-channel-adapter
channel="triggerChannl"
process-engine="processEngine"
process-definition-name="helloWorldProcess"
/>
</beans>

View File

@@ -10,9 +10,14 @@
xmlns:int-http="http://www.springframework.org/schema/integration/http">
<int-http:inbound-channel-adapter id="httpInboundAdapter" channel="receiveChannel" name="/inboundAdapter.htm" supported-methods="GET, POST" />
<int:channel id="receiveChannel"/>
<int-http:inbound-channel-adapter id="httpInboundAdapter"
channel="receiveChannel"
name="/inboundAdapter.htm"
supported-methods="GET, POST" />
<int:channel id="receiveChannel"/>
<int:service-activator id="multipartReceiver" input-channel="receiveChannel">
<bean class="org.springframework.integration.samples.multipart.MultipartReceiever"/>