📄 startlistenersbuilder.java
字号:
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the JBPM BPEL PUBLIC LICENSE AGREEMENT as
* published by JBoss Inc.; either version 1.0 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
package org.jbpm.bpel.integration.jms;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.jms.JMSException;
import org.jbpm.bpel.BpelException;
import org.jbpm.bpel.graph.basic.Receive;
import org.jbpm.bpel.graph.def.Activity;
import org.jbpm.bpel.graph.def.BpelDefinition;
import org.jbpm.bpel.graph.def.BpelVisitorSupport;
import org.jbpm.bpel.graph.struct.Pick;
import org.jbpm.bpel.graph.struct.Sequence;
import org.jbpm.bpel.integration.def.Receiver;
/**
* @author Alejandro Gu韟ar
* @version $Revision: 1.3 $ $Date: 2006/09/27 03:53:01 $
*/
class StartListenersBuilder extends BpelVisitorSupport {
private final IntegrationControl integrationControl;
private List startListeners = new ArrayList();
public StartListenersBuilder(IntegrationControl integrationControl) {
this.integrationControl = integrationControl;
}
public List getStartListeners() {
return startListeners;
}
public void visit(Receive receive) {
if (receive.isCreateInstance()) {
createListener(receive.getBpelDefinition(), receive.getReceiver());
}
}
public void visit(Pick pick) {
if (pick.isCreateInstance()) {
Iterator onMessageIt = pick.getOnMessages().iterator();
while (onMessageIt.hasNext()) {
createListener(pick.getBpelDefinition(), (Receiver) onMessageIt.next());
}
}
}
public void visit(Sequence sequence) {
// visit only the first activity
((Activity) sequence.getNodes().get(0)).accept(this);
}
private void createListener(BpelDefinition process, Receiver receiver) {
try {
StartListener listener = new StartListener(process, receiver,
integrationControl);
startListeners.add(listener);
}
catch (JMSException e) {
throw new BpelException("could not open start listener", e);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -