}
}
this.workflow = this.engine.getWorkflow();
MonitorConfiguration notifConfig = this.engine.getMonitor()
.getConfiguration();
if (notifConfig.getBrokerURL() == null) {
this.engine.getErrorWindow().error(
ErrorMessages.BROKER_URL_NOT_SET_ERROR);
return;
}
BPELScript bpel = new BPELScript(this.workflow);
// Check if there is any errors in the workflow first.
ArrayList<String> warnings = new ArrayList<String>();
if (!bpel.validate(warnings)) {
StringBuilder buf = new StringBuilder();
for (String warning : warnings) {
buf.append("- ");
buf.append(warning);
buf.append("\n");
}
this.engine.getErrorWindow().warning(buf.toString());
return;
}
try {
// Generate a BPEL process.
bpel.create(BPELScriptType.BPEL2);
this.workflow.setGpelProcess(bpel.getGpelProcess());
this.workflow.setWorkflowWSDL(bpel.getWorkflowWSDL()
.getWsdlDefinitions());
} catch (GraphException e) {
this.engine.getErrorWindow().error(
ErrorMessages.GRAPH_NOT_READY_ERROR, e);
return;
}
// Create a GUI without depending on the graph.
List<WSComponentPort> inputs;
try {
inputs = this.workflow.getInputs();
} catch (ComponentException e) {
// This should not happen when we create WSDL here, but if we use
// precompiled workflow, it might happen.
this.engine.getErrorWindow().error(
ErrorMessages.WORKFLOW_WSDL_ERROR, e);
return;
}
List<Double> columnWeights = new ArrayList<Double>();
long timeNow = System.currentTimeMillis();
SimpleDateFormat format = new SimpleDateFormat(
"yyyy.MM.dd G 'at' HH:mm:ss z");
for (WSComponentPort input : inputs) {
// Somethign special for the control workflow
if (-1 != engine.getWorkflow().getName().indexOf("Control_")) {
if ("epr".equals(input.getName())) {
input
.setDefaultValue("https://pagodatree.cs.indiana.edu:17443/ode/processes/"
+ engine.getWorkflow().getName() + "?wsdl");
} else if ("operation".equals(input.getName())) {
input.setDefaultValue("Run");
} else if ("startTime".equals(input.getName())) {
Date now = new Date(timeNow);
input.setDefaultValue(format.format(now));
} else if ("endTime".equals(input.getName())) {
input.setDefaultValue(format.format(new Date(timeNow + 2
* 60 * 60 * 1000)));
} else if ("eql".equals(input.getName())) {
input
.setDefaultValue("select * from java.lang.String.win:length_batch(1)");
}
}
String id = input.getName();
QName type = input.getType();
JLabel paramLabel = new JLabel(id, SwingConstants.TRAILING);
JLabel typeLabel = new JLabel(type.getLocalPart());
XBayaTextComponent paramField;
if (LEADTypes.isKnownType(type)) {
paramField = new XBayaTextField();
columnWeights.add(new Double(0));
} else {
paramField = new XBayaTextArea();
columnWeights.add(new Double(1.0));
}
paramLabel.setLabelFor(paramField.getSwingComponent());
// default value
Object value = input.getDefaultValue();
String valueString = null;
if (value != null) {
if (value instanceof XmlElement) {
XmlElement valueElement = (XmlElement) value;
valueString = XMLUtil.xmlElementToString(valueElement);
} else {
// Only string comes here for now.
valueString = value.toString();
}
}
if (valueString == null) {
// show some sample URI to ease inputs.
final String sampleURI = "gsiftp://rainier.extreme.indiana.edu//tmp/foo.txt";
if (LEADTypes.isURIType(type)) {
valueString = sampleURI;
} else if (LEADTypes.isURIArrayType(type)) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < 4; i++) {
buf.append(sampleURI).append(" ");
}
valueString = buf.toString();
}
}
paramField.setText(valueString);
this.parameterPanel.add(paramLabel);
this.parameterPanel.add(typeLabel);
this.parameterPanel.add(paramField);
this.parameterTextFields.add(paramField);
}
List<Double> rowWeights = new ArrayList<Double>();
rowWeights.add(new Double(0));
rowWeights.add(new Double(0));
rowWeights.add(new Double(1));
this.parameterPanel.layout(columnWeights, rowWeights);
XBayaConfiguration configuration = this.engine.getConfiguration();
MonitorConfiguration monitorConfiguration = this.engine.getMonitor()
.getConfiguration();
// Topic
String topic = monitorConfiguration.getTopic();
if (topic != null) {
this.topicTextField.setText(topic);
} else {
this.topicTextField.setText(UUID.randomUUID().toString());
}