use of org.apache.airavata.xbaya.ui.widgets.XBayaTextField in project airavata by apache.
the class TextWindow method init.
@SuppressWarnings("serial")
private void init() {
final JEditorPane editorPane = new JEditorPane(XmlConstants.CONTENT_TYPE_HTML, StringUtil.createHTMLUrlTaggedString(value));
editorPane.setEditable(false);
editorPane.setBackground(Color.WHITE);
editorPane.addHyperlinkListener(new HyperlinkListener() {
public void hyperlinkUpdate(HyperlinkEvent event) {
logger.debug("Event:" + event);
if (event.getEventType() == EventType.ACTIVATED) {
URL url = event.getURL();
try {
BrowserLauncher.openURL(url.toString());
} catch (Exception e) {
TextWindow.this.engine.getGUI().getErrorWindow().error(TextWindow.this.dialog.getDialog(), e.getMessage(), e);
}
}
}
});
JScrollPane pane = new JScrollPane(editorPane);
GridPanel gridPanel = new GridPanel();
XBayaTextField txtKey = new XBayaTextField(key);
txtKey.getTextField().setEditable(false);
gridPanel.add(txtKey);
gridPanel.add(pane);
gridPanel.getContentPanel().setBorder(BorderFactory.createEtchedBorder());
gridPanel.layout(2, 1, 1, 0);
JPanel buttonPanel = new JPanel();
JButton okButton = new JButton("Close");
okButton.setDefaultCapable(true);
okButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
hide();
}
});
JButton btnCopy = new JButton("Copy to clipboard");
btnCopy.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent arg0) {
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(value), null);
}
});
buttonPanel.add(btnCopy);
buttonPanel.add(okButton);
buttonPanel.setBorder(BorderFactory.createEtchedBorder());
this.dialog = new XBayaDialog(this.engine.getGUI(), title, gridPanel, buttonPanel);
dialog.getDialog().setMinimumSize(new Dimension(400, 400));
this.dialog.setDefaultButton(okButton);
}
use of org.apache.airavata.xbaya.ui.widgets.XBayaTextField in project airavata by apache.
the class AmazonEC2InvokerWindow method initGUI.
@SuppressWarnings("serial")
protected void initGUI() {
this.accessKeyIDTextField = new XBayaTextField();
XBayaLabel accessKeyIDLabel = new XBayaLabel("Access Key", this.accessKeyIDTextField);
this.secretAccessKeyTextField = new XBayaTextField();
XBayaLabel secretAccessKeyLabel = new XBayaLabel("Secret Access Key", this.secretAccessKeyTextField);
this.keyPairNameTextField = new XBayaTextField();
XBayaLabel keyPairNameLabel = new XBayaLabel("Key Pair Name", this.keyPairNameTextField);
this.numOfInstancesTextField = new XBayaTextField();
XBayaLabel numOfInstancesLabel = new XBayaLabel("Number of Instances", this.numOfInstancesTextField);
this.jobFlowNameTextField = new XBayaTextField();
XBayaLabel jobFlowNameLabel = new XBayaLabel("Job Flow Name", this.jobFlowNameTextField);
this.logLocationOnS3TextField = new XBayaTextField();
XBayaLabel logLocationOnS3Label = new XBayaLabel("Log Location(S3)", this.logLocationOnS3TextField);
this.inputLocationOnS3TextField = new XBayaTextField();
XBayaLabel inputLocationOnS3Label = new XBayaLabel("Input Location(S3)", this.inputLocationOnS3TextField);
this.outputLocationOnS3TextField = new XBayaTextField();
XBayaLabel outputLocationOnS3Label = new XBayaLabel("Output Location(S3)", this.outputLocationOnS3TextField);
this.jarFilePathOnS3TextField = new XBayaTextField();
XBayaLabel jarFilePathOnS3Label = new XBayaLabel("Jar File Location(S3)", this.jarFilePathOnS3TextField);
this.mainClassNameTextField = new XBayaTextField();
XBayaLabel mainClassNameLabel = new XBayaLabel("Main Class Name", this.mainClassNameTextField);
this.accessKeyIDTextField.setText("AKIAI3GNMQVYA5LSQNEQ");
this.secretAccessKeyTextField.setText("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");
this.keyPairNameTextField.setText("XbayaHadoopTest");
this.numOfInstancesTextField.setText("4");
this.jobFlowNameTextField.setText("Test-job-flow");
this.logLocationOnS3TextField.setText("s3n://xbaya-ec2-test/logs");
this.inputLocationOnS3TextField.setText("s3n://xbaya-ec2-test/input/");
this.outputLocationOnS3TextField.setText("s3n://xbaya-ec2-test/output/");
this.jarFilePathOnS3TextField.setText("s3n://xbaya-ec2-test/jars/Hadoopv400.jar");
this.mainClassNameTextField.setText("edu.indiana.extreme.HadoopRayTracer");
GridPanel infoPanel = new GridPanel();
infoPanel.add(accessKeyIDLabel);
infoPanel.add(this.accessKeyIDTextField);
infoPanel.add(secretAccessKeyLabel);
infoPanel.add(this.secretAccessKeyTextField);
infoPanel.add(keyPairNameLabel);
infoPanel.add(this.keyPairNameTextField);
infoPanel.add(numOfInstancesLabel);
infoPanel.add(this.numOfInstancesTextField);
infoPanel.add(jobFlowNameLabel);
infoPanel.add(this.jobFlowNameTextField);
infoPanel.add(logLocationOnS3Label);
infoPanel.add(this.logLocationOnS3TextField);
infoPanel.add(inputLocationOnS3Label);
infoPanel.add(this.inputLocationOnS3TextField);
infoPanel.add(outputLocationOnS3Label);
infoPanel.add(this.outputLocationOnS3TextField);
infoPanel.add(jarFilePathOnS3Label);
infoPanel.add(this.jarFilePathOnS3TextField);
infoPanel.add(mainClassNameLabel);
infoPanel.add(this.mainClassNameTextField);
infoPanel.layout(10, 2, GridPanel.WEIGHT_NONE, 1);
GridPanel mainPanel = new GridPanel();
mainPanel.add(infoPanel);
mainPanel.layout(1, 1, 0, 0);
JButton invokeButton = new JButton("Invoke");
invokeButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
execute();
}
});
JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
hide();
}
});
JPanel buttonPanel = new JPanel();
buttonPanel.add(invokeButton);
buttonPanel.add(cancelButton);
this.dialog = new XBayaDialog(this.engine.getGUI(), "Deploy Workflow", mainPanel, buttonPanel);
}
use of org.apache.airavata.xbaya.ui.widgets.XBayaTextField in project airavata by apache.
the class WorkflowInterpreterLaunchWindow method execute.
private void execute() throws AiravataClientConnectException, TException {
String instanceName = this.instanceNameTextField.getText();
if (instanceName.trim().equals("")) {
JOptionPane.showMessageDialog(engine.getGUI().getFrame(), "Experiment name cannot be empty", "Experiment Name", JOptionPane.ERROR_MESSAGE);
return;
}
ThriftClientData thriftClientData = engine.getConfiguration().getThriftClientData(ThriftServiceType.API_SERVICE);
Client airavataClient = XBayaUtil.getAiravataClient(thriftClientData);
String gatewayId = engine.getConfiguration().getThriftClientData(ThriftServiceType.API_SERVICE).getGatewayId();
final List<InputNode> inputNodes = GraphUtil.getInputNodes(this.workflow.getGraph());
List<InputDataObjectType> inputDataTypes = new ArrayList<InputDataObjectType>();
List<OutputDataObjectType> outputDataTypes = new ArrayList<OutputDataObjectType>();
InputDataObjectType input = null;
for (int i = 0; i < inputNodes.size(); i++) {
InputNode inputNode = inputNodes.get(i);
XBayaTextField parameterTextField = this.parameterTextFields.get(i);
inputNode.getID();
String value = parameterTextField.getText();
input = new InputDataObjectType();
// inputNode.setDefaultValue(value);
input.setName(inputNode.getID());
input.setType(inputNode.getDataType());
input.setValue(value);
input.setApplicationArgument(inputNode.getApplicationArgument());
input.setInputOrder(inputNode.getInputOrder());
inputDataTypes.add(input);
}
final List<OutputNode> outputNodes = GraphUtil.getOutputNodes(this.workflow.getGraph());
OutputDataObjectType output = null;
for (OutputNode outputNode : outputNodes) {
output = new OutputDataObjectType();
output.setName(outputNode.getID());
output.setType(DataType.STRING);
outputDataTypes.add(output);
}
Workflow workflowClone = workflow.clone();
workflowClone.setName(workflowClone.getName() + UUID.randomUUID().toString());
org.apache.airavata.model.Workflow workflowModel = new org.apache.airavata.model.Workflow();
workflowModel.setName(workflowClone.getName());
workflowModel.setGraph(JSONUtil.jsonElementToString(workflowClone.toJSON()));
for (InputDataObjectType inputDataType : inputDataTypes) {
workflowModel.addToWorkflowInputs(inputDataType);
}
for (OutputDataObjectType outputDataType : outputDataTypes) {
workflowModel.addToWorkflowOutputs(outputDataType);
}
workflowModel.setTemplateId(airavataClient.registerWorkflow(gatewayId, workflowModel));
// Use topic as a base of workflow instance ID so that the monitor can
// find it.
Project project = new Project();
project.setName("project1");
project.setOwner(thriftClientData.getUsername());
project.setProjectID(airavataClient.createProject(gatewayId, project));
final Experiment experiment = new Experiment();
experiment.setApplicationId(workflowModel.getTemplateId());
experiment.setName(instanceName);
experiment.setProjectID(project.getProjectID());
experiment.setUserName(thriftClientData.getUsername());
for (InputDataObjectType inputDataType : inputDataTypes) {
experiment.addToExperimentInputs(inputDataType);
}
for (OutputDataObjectType outputDataType : outputDataTypes) {
experiment.addToExperimentOutputs(outputDataType);
}
// Add scheduling configurations
if (host != null && host.getSelectedIndex() >= 0) {
String selectedHostName = host.getSelectedItem().toString();
String computeResouceId = hostNames.get(selectedHostName);
ComputationalResourceScheduling computationalResourceScheduling;
if (selectedHostName.equals("localhost")) {
computationalResourceScheduling = ExperimentModelUtil.createComputationResourceScheduling(computeResouceId, 1, 1, 1, "normal", 1, 0, 1, "test");
} else if (selectedHostName.equals("trestles.sdsc.xsede.org")) {
computationalResourceScheduling = ExperimentModelUtil.createComputationResourceScheduling(computeResouceId, 1, 1, 1, "normal", 1, 0, 1, "sds128");
} else if (selectedHostName.equals("stampede.tacc.xsede.org")) {
computationalResourceScheduling = ExperimentModelUtil.createComputationResourceScheduling(computeResouceId, 2, 32, 1, "development", 90, 0, 1, "TG-STA110014S");
} else if (selectedHostName.equals("bigred2.uits.iu.edu")) {
computationalResourceScheduling = ExperimentModelUtil.createComputationResourceScheduling(computeResouceId, 1, 1, 1, "normal", 1, 0, 1, null);
} else {
// TODO handle for other computer resources too.
throw new IllegalArgumentException("Computational resource scheduling is not configured for host :" + computeResouceId);
}
UserConfigurationData userConfigurationData = new UserConfigurationData();
userConfigurationData.setAiravataAutoSchedule(false);
userConfigurationData.setOverrideManualScheduledParams(false);
userConfigurationData.setComputationalResourceScheduling(computationalResourceScheduling);
experiment.setUserConfigurationData(userConfigurationData);
} else {
throw new RuntimeException("Resource scheduling failed, target computer resource host name is not defined");
}
/*
// code snippet for load test.
for (int i = 0; i < 20; i++) {
experiment.setName(instanceName + "_" + i);
experiment.setExperimentID(airavataClient.createExperiment(experiment));
try {
this.engine.getMonitor().subscribe(experiment.getExperimentID());
this.engine.getMonitor().fireStartMonitoring(workflow.getName());
} catch (MonitorException e) {
logger.error("Error while subscribing with experiment Id : " + experiment.getExperimentID(), e);
}
airavataClient.launchExperiment(experiment.getExperimentID(), "testToken");
}*/
experiment.setExperimentID(airavataClient.createExperiment(gatewayId, experiment));
try {
this.engine.getMonitor().subscribe(experiment.getExperimentID());
this.engine.getMonitor().fireStartMonitoring(workflow.getName());
} catch (MonitorException e) {
logger.error("Error while subscribing with experiment Id : " + experiment.getExperimentID(), e);
}
airavataClient.launchExperiment(experiment.getExperimentID(), token.getText());
clean();
hide();
}
use of org.apache.airavata.xbaya.ui.widgets.XBayaTextField in project airavata by apache.
the class RegistryWindow method initGUI.
/**
* Initializes the GUI.
*/
private void initGUI() {
this.serverTextField = new XBayaTextField();
this.portTextField = new XBayaTextField();
this.gatewayIdTextField = new XBayaTextField();
this.usernameTextField = new XBayaTextField();
this.serverTextField.setText("localhost");
this.portTextField.setText("8930");
this.gatewayIdTextField.setText("sample");
this.usernameTextField.setText("airavata");
ThriftClientData thriftClientData = engine.getConfiguration().getThriftClientData(ThriftServiceType.API_SERVICE);
if (thriftClientData != null) {
this.serverTextField.setText(thriftClientData.getServerAddress());
this.gatewayIdTextField.setText(thriftClientData.getGatewayId());
this.portTextField.setText(String.valueOf(thriftClientData.getServerPort()));
this.usernameTextField.setText(thriftClientData.getUsername());
}
try {
ClientSettings.initializeTrustStore();
} catch (ApplicationSettingsException e) {
throw new RuntimeException("An error occurred while initializing client configurations");
}
XBayaLabel serverAddressLabel = new XBayaLabel("Server Address", this.serverTextField);
XBayaLabel serverPortLabel = new XBayaLabel("Server Port", this.portTextField);
XBayaLabel gatewayNameLabel = new XBayaLabel("Gateway ID", this.gatewayIdTextField);
XBayaLabel gatewayUserLabel = new XBayaLabel("Gateway User", this.usernameTextField);
serviceTypeModel = new DefaultComboBoxModel(ThriftServiceType.values());
serviceTypeModel.setSelectedItem(getServiceType());
this.serviceTypeCombo = new XBayaComboBox(serviceTypeModel);
JLabel serviceTypeLabel = new JLabel("Airavata Service");
// serviceTypeCombo.addActionListener(new AbstractAction() {
// public void actionPerformed(ActionEvent e) {
// // createNewUser();
// }
// });
GridPanel infoPanel = new GridPanel();
infoPanel.add(serviceTypeLabel);
infoPanel.add(this.serviceTypeCombo);
infoPanel.add(serverAddressLabel);
infoPanel.add(this.serverTextField);
infoPanel.add(serverPortLabel);
infoPanel.add(this.portTextField);
infoPanel.add(gatewayNameLabel);
infoPanel.add(this.gatewayIdTextField);
infoPanel.add(gatewayUserLabel);
infoPanel.add(this.usernameTextField);
infoPanel.layout(5, 2, GridPanel.WEIGHT_NONE, 1);
// infoPanel.layout(2, 2, GridPanel.WEIGHT_NONE, 1);
infoPanel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
JButton okButton = new JButton("OK");
okButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
ok();
}
});
JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
hide();
}
});
GridPanel buttonPanel = new GridPanel();
buttonPanel.add(okButton);
buttonPanel.add(cancelButton);
buttonPanel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
this.dialog = new XBayaDialog(this.engine.getGUI(), "Configure Airavata Thrift Service", infoPanel, buttonPanel);
this.dialog.setDefaultButton(okButton);
}
use of org.apache.airavata.xbaya.ui.widgets.XBayaTextField in project airavata by apache.
the class LaunchApplicationWindow method initGUI.
private void initGUI() {
this.parameterPanel = new GridPanel(true);
this.instanceNameTextField = new XBayaTextField();
XBayaLabel instanceNameLabel = new XBayaLabel("Experiment name", this.instanceNameTextField);
GridPanel infoPanel = new GridPanel();
infoPanel.add(instanceNameLabel);
infoPanel.add(this.instanceNameTextField);
infoPanel.layout(1, 2, GridPanel.WEIGHT_NONE, 1);
GridPanel mainPanel = new GridPanel();
mainPanel.getContentPanel().setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
mainPanel.add(infoPanel);
mainPanel.add(this.parameterPanel);
mainPanel.layout(2, 1, 0, 0);
JButton okButton = new JButton("Run");
okButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent event) {
try {
execute();
} catch (AiravataClientConnectException e) {
logger.error(e.getMessage(), e);
} catch (InvalidRequestException e) {
logger.error(e.getMessage(), e);
} catch (AiravataClientException e) {
logger.error(e.getMessage(), e);
} catch (AiravataSystemException e) {
logger.error(e.getMessage(), e);
} catch (TException e) {
logger.error(e.getMessage(), e);
}
}
});
JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
hide();
}
});
JPanel buttonPanel = new JPanel();
buttonPanel.add(okButton);
buttonPanel.add(cancelButton);
buttonPanel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
this.dialog = new XBayaDialog(this.engine.getGUI(), "Launch workflow", mainPanel, buttonPanel);
this.dialog.setDefaultButton(okButton);
}
Aggregations