You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2014/07/12 00:21:18 UTC
[05/20] updating xbaya gui to the new airavata
http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/ServiceDescriptionDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/ServiceDescriptionDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/ServiceDescriptionDialog.java
deleted file mode 100644
index 98277ce..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/ServiceDescriptionDialog.java
+++ /dev/null
@@ -1,727 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.airavata.xbaya.ui.dialogs.descriptors;
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.jcr.PathNotFoundException;
-import javax.swing.BorderFactory;
-import javax.swing.DefaultCellEditor;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JMenuItem;
-import javax.swing.JPanel;
-import javax.swing.JPopupMenu;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.WindowConstants;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableColumn;
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-import org.apache.airavata.registry.api.exception.RegistryException;
-import org.apache.airavata.common.utils.SwingUtil;
-import org.apache.airavata.commons.gfac.type.ServiceDescription;
-//import org.apache.airavata.registry.api.AiravataRegistry2;
-import org.apache.airavata.schemas.gfac.DataType;
-import org.apache.airavata.schemas.gfac.InputParameterType;
-import org.apache.airavata.schemas.gfac.OutputParameterType;
-import org.apache.airavata.schemas.gfac.ParameterType;
-import org.apache.airavata.schemas.gfac.ServiceDescriptionType;
-import org.apache.airavata.xbaya.ui.dialogs.descriptors.DescriptorListDialog.DescriptorType;
-import org.apache.airavata.xbaya.ui.widgets.GridPanel;
-import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
-import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
-import org.apache.xmlbeans.XmlCursor;
-
-public class ServiceDescriptionDialog extends JDialog {
-
- private static final long serialVersionUID = 2705760838264284423L;
- private final GridPanel contentPanel = new GridPanel();
- private XBayaLabel lblServiceName;
- private XBayaTextField txtServiceName;
- private JTable tblParameters;
- private boolean serviceCreated = false;
- private JLabel lblError;
- private ServiceDescription serviceDescription;
- private ServiceDescription orginalServiceDescription;
- private JButton okButton;
- private JButton btnDeleteParameter;
- private DefaultTableModel defaultTableModel;
- private AiravataAPI registry;
- private boolean newDescription;
- private boolean ignoreTableChanges=false;
- private JCheckBox chkForceFileStagingToWorkDir;
- private boolean serviceDescriptionMode;
- private String suggestedNamePrefix;
- private String titlePrefix;
-
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- try {
- ServiceDescriptionDialog dialog = new ServiceDescriptionDialog(null,true,null);
- dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
- dialog.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public ServiceDescriptionDialog(AiravataAPI registry) {
- this(registry,true,null);
- }
-
- public ServiceDescriptionDialog(AiravataAPI registry, boolean newDescription, ServiceDescription serviceDescription) {
- this(registry, newDescription, serviceDescription, true, null);
- }
-
- /**
- * Create the dialog.
- */
- public ServiceDescriptionDialog(AiravataAPI registry, boolean newDescription, ServiceDescription serviceDescription, boolean serviceDescriptionMode, String suggestedNamePrefix) {
- setNewDescription(newDescription);
- this.setOrginalServiceDescription(serviceDescription);
- setServiceDescriptionMode(serviceDescriptionMode);
- setSuggestedNamePrefix(suggestedNamePrefix);
- if (isNewDescription()) {
- setTitlePrefix(isServiceDescriptionMode()? "New Service Description":"Input/Output parameters for "+getSuggestedNamePrefix());
- }else{
- setTitlePrefix(isServiceDescriptionMode()? "Update Service Description: "+getOrginalServiceDescription().getType().getName():"Update Input/Output parameters for "+getSuggestedNamePrefix());
- }
- addWindowListener(new WindowAdapter() {
- @Override
- public void windowOpened(WindowEvent arg0) {
- if (isNewDescription() && !isServiceDescriptionMode()) {
- String baseName = isServiceDescriptionMode()? "Service":getSuggestedNamePrefix()+"_Service";
- int i;
- String defaultName;
- if (isServiceDescriptionMode()) {
- i = 1;
- defaultName = baseName+i;
- }else{
- i = 0;
- defaultName = baseName;
- }
- try {
- while (getRegistry().getApplicationManager().isServiceDescriptorExists(defaultName)) {
- defaultName = baseName + (++i);
- }
- } catch (Exception e) {
- }
- txtServiceName.setText(defaultName);
- setServiceName(txtServiceName.getText());
- }
- }
- });
- setRegistry(registry);
- initGUI();
-
- }
-
- public void open() {
- setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
- setVisible(true);
- }
-
- protected ServiceDescriptionDialog getDialog() {
- return this;
- }
-
- private void initGUI() {
- setTitle(getTitlePrefix());
-// if (isNewDescription()) {
-// setTitle("New Service Description");
-// }else{
-// setTitle("Update Service Description: "+getOrginalServiceDescription().getType().getName());
-// }
- setBounds(100, 100, 463, 459);
- setModal(true);
- setLocationRelativeTo(null);
- BorderLayout borderLayout = new BorderLayout();
- borderLayout.setVgap(5);
- borderLayout.setHgap(5);
- getContentPane().setLayout(borderLayout);
-
- txtServiceName = new XBayaTextField();
- txtServiceName.getSwingComponent().addKeyListener(new KeyAdapter() {
- @Override
- public void keyReleased(KeyEvent e) {
- setServiceName(txtServiceName.getText());
- }
- });
- txtServiceName.setColumns(10);
- lblServiceName = new XBayaLabel(isServiceDescriptionMode()? "Service name":"Bind parameters to service",txtServiceName);
- if (!isServiceDescriptionMode()){
- lblServiceName.getSwingComponent().setFont(new Font("Tahoma", Font.ITALIC, 11));
- }
- JLabel lblInputParameters = new JLabel(isServiceDescriptionMode()? "Service Parameters":"Input/Output Parameters");
- lblInputParameters.setFont(new Font("Tahoma", Font.BOLD, 11));
-
- JScrollPane scrollPane = new JScrollPane();
-
- btnDeleteParameter = new JButton("Delete parameter");
- btnDeleteParameter.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- deleteSelectedRows();
- }
- });
- btnDeleteParameter.setEnabled(false);
-
- tblParameters = new JTable();
- tblParameters.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
- tblParameters.setFillsViewportHeight(true);
- defaultTableModel = new DefaultTableModel(new Object[][] { { null, null, null, null }, }, new String[] { "I/O",
- "Parameter Name", "Type", "Description" });
- tblParameters.setModel(defaultTableModel);
- defaultTableModel.addTableModelListener(new TableModelListener() {
-
- @Override
- public void tableChanged(TableModelEvent arg0) {
- if (!ignoreTableChanges) {
- int selectedRow = tblParameters.getSelectedRow();
- if (selectedRow != -1
- && defaultTableModel.getRowCount() > 0) {
- Object parameterIOType = defaultTableModel.getValueAt(
- selectedRow, 0);
- Object parameterDataType = defaultTableModel
- .getValueAt(selectedRow, 2);
- if (parameterIOType == null
- || parameterIOType.equals("")) {
- defaultTableModel.setValueAt(getIOStringList()[0],
- selectedRow, 0);
- }
- if (parameterDataType == null
- || parameterDataType.equals("")) {
- defaultTableModel.setValueAt(getDataTypes()[0],
- selectedRow, 2);
- }
- }
- addNewRowIfLastIsNotEmpty();
- }
- }
-
- });
- TableColumn ioColumn = tblParameters.getColumnModel().getColumn(0);
- String[] ioStringList = getIOStringList();
- ioColumn.setCellEditor(new StringArrayComboBoxEditor(ioStringList));
-
- TableColumn datatypeColumn = tblParameters.getColumnModel().getColumn(2);
- String[] dataTypeStringList = getDataTypes();
- datatypeColumn.setCellEditor(new StringArrayComboBoxEditor(dataTypeStringList));
-
- TableColumn parameterNameCol = tblParameters.getColumnModel().getColumn(1);
- parameterNameCol.setPreferredWidth(190);
- scrollPane.setViewportView(tblParameters);
- ListSelectionModel selectionModel = tblParameters.getSelectionModel();
- selectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
-
- selectionModel.addListSelectionListener(new ListSelectionListener() {
- @Override
- public void valueChanged(ListSelectionEvent e) {
- btnDeleteParameter.setEnabled(tblParameters.getSelectedRows().length > 0);
- }
-
- });
- JLabel lblTableParameterNote=null;
- if (!isServiceDescriptionMode()) {
- final JPopupMenu popup = new JPopupMenu();
- JMenuItem menuItem = new JMenuItem(
- "Bind to parameters in existing service...");
- menuItem.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- bindExistingServiceDescriptionAsParameters();
- }
-
- });
- popup.add(menuItem);
- tblParameters.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent e) {
- showPopup(e);
- }
-
- public void mousePressed(MouseEvent e) {
- showPopup(e);
- }
-
- public void mouseReleased(MouseEvent e) {
- showPopup(e);
- }
-
- private void showPopup(MouseEvent e) {
- if (e.isPopupTrigger()) {
- popup.show(tblParameters, e.getX(), e.getY());
- }
- }
- });
- lblTableParameterNote = new JLabel("*Note: Right click on the table to bind an existing service");
- lblTableParameterNote.setFont(new Font("Tahoma", Font.ITALIC, 11));
- }
- chkForceFileStagingToWorkDir=new JCheckBox("Advanced: Force input file staging to working directory");
- chkForceFileStagingToWorkDir.addActionListener(new ActionListener(){
-
- @Override
- public void actionPerformed(ActionEvent arg0) {
- setForceFileStagingToWorkDir(chkForceFileStagingToWorkDir.isSelected());
- }
-
- });
- GridPanel buttonPane = new GridPanel();
- {
- GridBagLayout gbl_buttonPane = new GridBagLayout();
- gbl_buttonPane.columnWidths = new int[] { 307, 136, 0 };
- gbl_buttonPane.rowHeights = new int[] { 33, 0 };
- gbl_buttonPane.columnWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
- gbl_buttonPane.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
-
-
- lblError = new JLabel("");
- lblError.setForeground(Color.RED);
- GridBagConstraints gbc_lblError = new GridBagConstraints();
- gbc_lblError.insets = new Insets(0, 0, 0, 5);
- gbc_lblError.gridx = 0;
- gbc_lblError.gridy = 0;
- buttonPane.add(lblError);
- JPanel panel = new JPanel();
- GridBagConstraints gbc_panel = new GridBagConstraints();
- gbc_panel.anchor = GridBagConstraints.NORTHWEST;
- gbc_panel.gridx = 1;
- gbc_panel.gridy = 0;
- buttonPane.add(panel);
- {
- JButton resetButton = new JButton("Reset");
- resetButton.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- loadData();
- }
- });
- panel.add(resetButton);
- }
- {
- okButton = new JButton("Save");
- if (!isNewDescription()){
- okButton.setText("Update");
- }
- okButton.setEnabled(false);
- okButton.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- saveServiceDescription();
- close();
- }
- });
- panel.add(okButton);
- okButton.setActionCommand("OK");
- getRootPane().setDefaultButton(okButton);
- }
- {
- JButton cancelButton = new JButton("Cancel");
- cancelButton.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- setServiceCreated(false);
- close();
- }
- });
- panel.add(cancelButton);
- cancelButton.setActionCommand("Cancel");
- }
- }
-
- contentPanel.add(lblServiceName);
- contentPanel.add(txtServiceName);
- GridPanel parameterPanel=new GridPanel();
- if (isServiceDescriptionMode()) {
- parameterPanel.add(lblInputParameters);
- }
- if (lblTableParameterNote!=null) {
- parameterPanel.add(lblTableParameterNote);
- }
- parameterPanel.add(scrollPane);
- // if (isServiceDescriptionMode()){
- parameterPanel.add(btnDeleteParameter);
-// }else{
-// GridPanel parameterOptionPanel=new GridPanel();
-// JButton btnLoadExistingServiceData = new JButton("Bind to parameters in existing service description...");
-// btnLoadExistingServiceData.addActionListener(new ActionListener(){
-// @Override
-// public void actionPerformed(ActionEvent arg0) {
-// bindExistingServiceDescriptionAsParameters();
-// }
-// });
-// parameterOptionPanel.add(btnLoadExistingServiceData);
-// parameterOptionPanel.add(btnDeleteParameter);
-// parameterPanel.add(parameterOptionPanel);
-// }
-
- SwingUtil.layoutToGrid(contentPanel.getSwingComponent(), 1, 2, SwingUtil.WEIGHT_NONE, 1);
-// if (lblTableParameterNote==null){
- SwingUtil.layoutToGrid(parameterPanel.getSwingComponent(), 3, 1, 1, 0);
-// }else{
-// SwingUtil.layoutToGrid(parameterPanel.getSwingComponent(), 4, 1, 2, 0);
-// }
- GridPanel infoPanel = new GridPanel();
- if (isServiceDescriptionMode()) {
- infoPanel.add(contentPanel);
- }
- infoPanel.add(parameterPanel);
- infoPanel.add(chkForceFileStagingToWorkDir);
- if (!isServiceDescriptionMode()) {
- infoPanel.add(contentPanel);
- }
- infoPanel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
- if (isServiceDescriptionMode()) {
- infoPanel.layout(3, 1, 1, 0);
- }else{
- infoPanel.layout(3, 1, 0, 0);
- }
- getContentPane().add(infoPanel.getSwingComponent());
- getContentPane().add(buttonPane.getSwingComponent());
- buttonPane.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
- SwingUtil.layoutToGrid(getContentPane(), 2, 1, 0, 0);
- setResizable(true);
- getRootPane().setDefaultButton(okButton);
- if (!isNewDescription()){
- loadData();
- }
- }
-
- private void loadData() {
- ServiceDescriptionType descType = getOrginalServiceDescription().getType();
- txtServiceName.setText(descType.getName());
- setServiceName(txtServiceName.getText());
-
- txtServiceName.setEditable(!isServiceDescriptionMode() || isNewDescription());
- ignoreTableChanges=true;
- while(defaultTableModel.getRowCount()>0){
- defaultTableModel.removeRow(0);
- }
- InputParameterType[] iparameters = descType.getInputParametersArray();
- for (InputParameterType parameter : iparameters) {
- defaultTableModel.addRow(new Object[] { getIOStringList()[0], parameter.getParameterName(),parameter.getParameterType().getName(),parameter.getParameterDescription()});
- }
- OutputParameterType[] oparameters = descType.getOutputParametersArray();
- for (OutputParameterType parameter : oparameters) {
- defaultTableModel.addRow(new Object[] { getIOStringList()[1], parameter.getParameterName(), parameter.getParameterType().getName(),parameter.getParameterDescription()});
- }
- addNewRowIfLastIsNotEmpty();
- Boolean selected = false;
- if (descType.getPortType()!=null && descType.getPortType().getMethod()!=null) {
- XmlCursor cursor = descType.getPortType().getMethod().newCursor();
-// cursor.toNextToken();
- String value = cursor.getAttributeText(new QName("forceFileStagingToWorkDir"));
- cursor.dispose();
- selected = false;
- if (value != null) {
- selected = Boolean.parseBoolean(value);
- }
- }
- chkForceFileStagingToWorkDir.setSelected(selected);
- setForceFileStagingToWorkDir(selected);
- ignoreTableChanges=false;
- }
-
- private String[] getIOStringList() {
- String[] ioStringList = new String[] { "Input", "Output" };
- return ioStringList;
- }
-
- private String[] getDataTypes() {
- String[] type = new String[DataType.Enum.table.lastInt()];
- for (int i = 1; i <= DataType.Enum.table.lastInt(); i++) {
- type[i - 1] = DataType.Enum.forInt(i).toString();
- }
- return type;
- }
-
- public boolean isServiceCreated() {
- return serviceCreated;
- }
-
- public void setServiceCreated(boolean serviceCreated) {
- this.serviceCreated = serviceCreated;
- }
-
- public ServiceDescription getServiceDescription() {
- if (serviceDescription == null) {
- serviceDescription = new ServiceDescription();
- }
- return serviceDescription;
- }
-
- public ServiceDescriptionType getServiceDescriptionType() {
- return getServiceDescription().getType();
- }
-
- public String getServiceName() {
- return getServiceDescription().getType().getName();
- }
-
- public void setServiceName(String serviceName) {
- getServiceDescription().getType().setName(serviceName);
- updateDialogStatus();
- }
-
- private void setupMethod(){
- if (getServiceDescriptionType().getPortType()==null){
- getServiceDescriptionType().setPortType(getServiceDescriptionType().addNewPortType());
- }
- if (getServiceDescriptionType().getPortType().getMethod()==null){
- getServiceDescriptionType().getPortType().setMethod(getServiceDescriptionType().getPortType().addNewMethod());
- }
- }
- public void setForceFileStagingToWorkDir(Boolean force){
- setupMethod();
- XmlCursor cursor = getServiceDescriptionType().getPortType().getMethod().newCursor();
- cursor.toNextToken();
- if (!cursor.setAttributeText(new QName("http://airavata.apache.org/schemas/gfac/2012/12","forceFileStagingToWorkDir"),force.toString())){
- cursor.insertAttributeWithValue("forceFileStagingToWorkDir",force.toString());
- }
- cursor.dispose();
- }
-
- public Boolean getForceFileStagingToWorkDir(){
- setupMethod();
- XmlCursor cursor = getServiceDescriptionType().getPortType().getMethod().newCursor();
- cursor.toNextToken();
- String value = cursor.getAttributeText(new QName("forceFileStagingToWorkDir"));
- cursor.dispose();
- if (value==null){
- return false;
- }else{
- return Boolean.parseBoolean(value);
- }
-
- }
-
- private void updateDialogStatus() {
- String message = null;
- try {
- validateDialog();
- } catch (Exception e) {
- message = e.getLocalizedMessage();
- }
- okButton.setEnabled(message == null);
- setError(message);
- }
-
- private void validateDialog() throws Exception {
- if (getServiceName() == null || getServiceName().trim().equals("")) {
- throw new Exception("Name of the service cannot be empty!!!");
- }
-
- ServiceDescription serviceDescription2 = null;
- try {
- serviceDescription2 = getRegistry().getApplicationManager().getServiceDescription(getServiceName());
- } catch (AiravataAPIInvocationException e) {
- if (e.getCause() instanceof PathNotFoundException) {
- // non-existant name. just want we want
- } else {
- throw e;
- }
- }
- if (isNewDescription() && serviceDescription2 != null) {
- throw new Exception("Service descriptor with the given name already exists!!!");
- }
- }
-
- public void saveServiceDescription() {
- List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
- List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
-
- for (int i = 0; i < defaultTableModel.getRowCount(); i++) {
- String parameterName = (String) defaultTableModel.getValueAt(i, 1);
- String paramType = (String) defaultTableModel.getValueAt(i, 2);
- String parameterDescription = (String) defaultTableModel.getValueAt(i, 3);
- if (parameterName != null && !parameterName.trim().equals("")) {
- // todo how to handle Enum
- if (getIOStringList()[0].equals(defaultTableModel.getValueAt(i, 0))) {
- InputParameterType parameter = InputParameterType.Factory.newInstance();
- parameter.setParameterName(parameterName);
- parameter.setParameterDescription(parameterDescription);
- ParameterType parameterType = parameter.addNewParameterType();
- parameterType.setType(DataType.Enum.forString(paramType));
- parameterType.setName(paramType);
- inputParameters.add(parameter);
-
- } else {
- OutputParameterType parameter = OutputParameterType.Factory.newInstance();
- parameter.setParameterName(parameterName);
- parameter.setParameterDescription(parameterDescription);
- ParameterType parameterType = parameter.addNewParameterType();
- parameterType.setType(DataType.Enum.forString(paramType));
- parameterType.setName(paramType);
- outputParameters.add(parameter);
- }
- }
- }
- getServiceDescriptionType().setInputParametersArray(inputParameters.toArray(new InputParameterType[] {}));
- getServiceDescriptionType().setOutputParametersArray(outputParameters.toArray(new OutputParameterType[] {}));
-
- try {
- if (getRegistry().getApplicationManager().isServiceDescriptorExists(getServiceDescription().getType().getName())) {
- getRegistry().getApplicationManager().updateServiceDescriptor(getServiceDescription());
- }else{
- getRegistry().getApplicationManager().saveServiceDescription(getServiceDescription());
- }
- setServiceCreated(true);
- } catch (AiravataAPIInvocationException e) {
- e.printStackTrace();
- setError(e.getMessage());
- }
- }
-
- public void close() {
- getDialog().setVisible(false);
- }
-
- private void setError(String errorMessage) {
- if (errorMessage == null || errorMessage.trim().equals("")) {
- lblError.setText("");
- } else {
- lblError.setText(errorMessage.trim());
- }
- }
-
- private void deleteSelectedRows() {
- // TODO confirm deletion of selected rows
- int selectedRow = tblParameters.getSelectedRow();
- while (selectedRow >= 0 && tblParameters.getRowCount()>0) {
- defaultTableModel.removeRow(selectedRow);
- selectedRow = tblParameters.getSelectedRow();
- }
- addNewRowIfLastIsNotEmpty();
- }
-
- private void addNewRowIfLastIsNotEmpty() {
-
- if (defaultTableModel.getRowCount()>0) {
- Object parameterName = defaultTableModel.getValueAt(
- defaultTableModel.getRowCount() - 1, 1);
- if (parameterName != null && !parameterName.equals("")) {
- defaultTableModel
- .addRow(new Object[] { null, null, null, null });
- }
- }else{
- if (tblParameters.getSelectedRow()==-1){
- defaultTableModel.addRow(new Object[] { null, null, null, null });
- }
-
- }
- }
-
- public AiravataAPI getRegistry() {
- return registry;
- }
-
- public void setRegistry(AiravataAPI registry) {
- this.registry = registry;
- }
-
- public boolean isNewDescription() {
- return newDescription;
- }
-
- public void setNewDescription(boolean newDescription) {
- this.newDescription = newDescription;
- }
-
- public ServiceDescription getOrginalServiceDescription() {
- return orginalServiceDescription;
- }
-
- public void setOrginalServiceDescription(ServiceDescription orginalServiceDescription) {
- this.orginalServiceDescription = orginalServiceDescription;
- }
-
- public boolean isServiceDescriptionMode() {
- return serviceDescriptionMode;
- }
-
- public void setServiceDescriptionMode(boolean serviceDescriptionMode) {
- this.serviceDescriptionMode = serviceDescriptionMode;
- }
-
- public String getSuggestedNamePrefix() {
- return suggestedNamePrefix;
- }
-
- public void setSuggestedNamePrefix(String suggestedNamePrefix) {
- this.suggestedNamePrefix = suggestedNamePrefix;
- }
-
- public String getTitlePrefix() {
- return titlePrefix;
- }
-
- public void setTitlePrefix(String titlePrefix) {
- this.titlePrefix = titlePrefix;
- }
-
- private void bindExistingServiceDescriptionAsParameters() {
- DescriptorListDialog descriptorListDialog = new DescriptorListDialog(getRegistry(),DescriptorType.SERVICE);
- descriptorListDialog.open();
- if (descriptorListDialog.isServiceSelected()){
- setOrginalServiceDescription((ServiceDescription) descriptorListDialog.getSelected());
- setNewDescription(false);
- loadData();
- }
- }
-
- private class StringArrayComboBoxEditor extends DefaultCellEditor {
- private static final long serialVersionUID = -304464739219209395L;
-
- public StringArrayComboBoxEditor(Object[] items) {
- super(new JComboBox(items));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicWorkflowRunnerWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicWorkflowRunnerWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicWorkflowRunnerWindow.java
index 0b18de4..0de972a 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicWorkflowRunnerWindow.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/dynamic/DynamicWorkflowRunnerWindow.java
@@ -1,394 +1,394 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.airavata.xbaya.ui.dialogs.graph.dynamic;
-
-import java.awt.event.ActionEvent;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.UUID;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-import org.apache.airavata.common.utils.StringUtil;
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-import org.apache.airavata.workflow.model.graph.system.InputNode;
-import org.apache.airavata.workflow.model.graph.util.GraphUtil;
-import org.apache.airavata.workflow.model.graph.ws.WSNode;
-import org.apache.airavata.workflow.model.ode.ODEClient;
-import org.apache.airavata.workflow.model.wf.Workflow;
-import org.apache.airavata.ws.monitor.MonitorConfiguration;
-import org.apache.airavata.ws.monitor.MonitorException;
-import org.apache.airavata.xbaya.XBayaConfiguration;
-import org.apache.airavata.xbaya.XBayaEngine;
-import org.apache.airavata.xbaya.graph.controller.NodeController;
-import org.apache.airavata.xbaya.interpretor.GUIWorkflowInterpreterInteractorImpl;
-import org.apache.airavata.xbaya.interpretor.WorkflowInterpreter;
-import org.apache.airavata.xbaya.interpretor.WorkflowInterpreterConfiguration;
-import org.apache.airavata.xbaya.jython.script.JythonScript;
-import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
-import org.apache.airavata.xbaya.ui.graph.ws.WSNodeGUI;
-import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
-import org.apache.airavata.xbaya.ui.widgets.GridPanel;
-import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
-import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
-import org.apache.airavata.xbaya.util.XBayaUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xmlpull.infoset.XmlElement;
-import org.xmlpull.v1.builder.XmlInfosetBuilder;
-
-import xsul.XmlConstants;
-import xsul.lead.LeadResourceMapping;
-
-public class DynamicWorkflowRunnerWindow {
-
- private static final Logger logger = LoggerFactory.getLogger(DynamicWorkflowRunnerWindow.class);
-
- private XBayaEngine engine;
-
- private Workflow workflow;
-
- private XBayaDialog dialog;
-
- private GridPanel parameterPanel;
-
- private XBayaTextField topicTextField;
-
- private List<XBayaTextField> parameterTextFields = new ArrayList<XBayaTextField>();
-
- private XBayaLabel resourceSelectionLabel;
-
- // private XBayaComboBox resourceSelectionComboBox;
-
-// private JComboBox gfacUrlListField;
-
- private JCheckBox interactChkBox;
-
- private JCheckBox chkRunWithCrossProduct;
-
- private XBayaTextField instanceNameTextField;
-
- protected final static XmlInfosetBuilder builder = XmlConstants.BUILDER;
-
- /**
- * Constructs a TavernaRunnerWindow.
- *
- * @param engine
- *
- */
- public DynamicWorkflowRunnerWindow(XBayaEngine engine) {
- this.engine = engine;
- if (XBayaUtil.acquireJCRRegistry(this.engine)) {
- initGUI();
- }
- }
-
- /**
- * Shows the dialog.
- */
- public void show() {
- this.workflow = this.engine.getGUI().getWorkflow();
-// List<URI> urlList=null;
-// try {
-// urlList = this.engine.getConfiguration().getAiravataAPI().getAiravataManager().getGFaCURLs();
-// } catch (AiravataAPIInvocationException e) {
-// e.printStackTrace();
+///*
+// *
+// * Licensed to the Apache Software Foundation (ASF) under one
+// * or more contributor license agreements. See the NOTICE file
+// * distributed with this work for additional information
+// * regarding copyright ownership. The ASF licenses this file
+// * to you 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.apache.airavata.xbaya.ui.dialogs.graph.dynamic;
+//
+//import java.awt.event.ActionEvent;
+//import java.net.URI;
+//import java.net.URISyntaxException;
+//import java.util.ArrayList;
+//import java.util.Collection;
+//import java.util.Iterator;
+//import java.util.LinkedList;
+//import java.util.List;
+//import java.util.UUID;
+//
+//import javax.swing.AbstractAction;
+//import javax.swing.JButton;
+//import javax.swing.JCheckBox;
+//import javax.swing.JComboBox;
+//import javax.swing.JLabel;
+//import javax.swing.JOptionPane;
+//import javax.swing.JPanel;
+//import javax.xml.namespace.QName;
+//
+//import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+//import org.apache.airavata.common.utils.StringUtil;
+//import org.apache.airavata.common.utils.XMLUtil;
+//import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+//import org.apache.airavata.workflow.model.graph.system.InputNode;
+//import org.apache.airavata.workflow.model.graph.util.GraphUtil;
+//import org.apache.airavata.workflow.model.graph.ws.WSNode;
+//import org.apache.airavata.workflow.model.ode.ODEClient;
+//import org.apache.airavata.workflow.model.wf.Workflow;
+//import org.apache.airavata.ws.monitor.MonitorConfiguration;
+//import org.apache.airavata.ws.monitor.MonitorException;
+//import org.apache.airavata.xbaya.XBayaConfiguration;
+//import org.apache.airavata.xbaya.XBayaEngine;
+//import org.apache.airavata.xbaya.graph.controller.NodeController;
+//import org.apache.airavata.xbaya.interpretor.GUIWorkflowInterpreterInteractorImpl;
+//import org.apache.airavata.xbaya.interpretor.WorkflowInterpreter;
+//import org.apache.airavata.xbaya.interpretor.WorkflowInterpreterConfiguration;
+//import org.apache.airavata.xbaya.jython.script.JythonScript;
+//import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+//import org.apache.airavata.xbaya.ui.graph.ws.WSNodeGUI;
+//import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
+//import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+//import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
+//import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+//import org.apache.airavata.xbaya.util.XBayaUtil;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//import org.xmlpull.infoset.XmlElement;
+//import org.xmlpull.v1.builder.XmlInfosetBuilder;
+//
+//import xsul.XmlConstants;
+//import xsul.lead.LeadResourceMapping;
+//
+//public class DynamicWorkflowRunnerWindow {
+//
+// private static final Logger logger = LoggerFactory.getLogger(DynamicWorkflowRunnerWindow.class);
+//
+// private XBayaEngine engine;
+//
+// private Workflow workflow;
+//
+// private XBayaDialog dialog;
+//
+// private GridPanel parameterPanel;
+//
+// private XBayaTextField topicTextField;
+//
+// private List<XBayaTextField> parameterTextFields = new ArrayList<XBayaTextField>();
+//
+// private XBayaLabel resourceSelectionLabel;
+//
+// // private XBayaComboBox resourceSelectionComboBox;
+//
+//// private JComboBox gfacUrlListField;
+//
+// private JCheckBox interactChkBox;
+//
+// private JCheckBox chkRunWithCrossProduct;
+//
+// private XBayaTextField instanceNameTextField;
+//
+// protected final static XmlInfosetBuilder builder = XmlConstants.BUILDER;
+//
+// /**
+// * Constructs a TavernaRunnerWindow.
+// *
+// * @param engine
+// *
+// */
+// public DynamicWorkflowRunnerWindow(XBayaEngine engine) {
+// this.engine = engine;
+// if (XBayaUtil.acquireJCRRegistry(this.engine)) {
+// initGUI();
// }
- // When run xbaya continously urls can be repeating, so first remove everything and then add
-// this.gfacUrlListField.removeAllItems();
-// for (URI gfacUrl : urlList) {
-// if (XBayaUtil.isURLExists(gfacUrl + "?wsdl")) {
-// this.gfacUrlListField.addItem(gfacUrl);
+// }
+//
+// /**
+// * Shows the dialog.
+// */
+// public void show() {
+// this.workflow = this.engine.getGUI().getWorkflow();
+//// List<URI> urlList=null;
+//// try {
+//// urlList = this.engine.getConfiguration().getAiravataAPI().getAiravataManager().getGFaCURLs();
+//// } catch (AiravataAPIInvocationException e) {
+//// e.printStackTrace();
+//// }
+// // When run xbaya continously urls can be repeating, so first remove everything and then add
+//// this.gfacUrlListField.removeAllItems();
+//// for (URI gfacUrl : urlList) {
+//// if (XBayaUtil.isURLExists(gfacUrl + "?wsdl")) {
+//// this.gfacUrlListField.addItem(gfacUrl);
+//// }
+//// }
+//// this.gfacUrlListField.setEditable(true);
+// MonitorConfiguration notifConfig = this.engine.getMonitor().getConfiguration();
+// if (notifConfig.getBrokerURL() == null) {
+// this.engine.getGUI().getErrorWindow().error(ErrorMessages.BROKER_URL_NOT_SET_ERROR);
+// return;
+// }
+//
+// // Create input fields
+// List<InputNode> inputNodes = GraphUtil.getInputNodes(this.workflow.getGraph());
+// for (Iterator<InputNode> iterator = inputNodes.iterator(); iterator.hasNext();) {
+// InputNode node = iterator.next();
+// String id = node.getID();
+// QName parameterType = node.getParameterType();
+//
+// /*
+// * If input node has no connection, skip it
+// */
+// if (parameterType == null) {
+// iterator.remove();
+// continue;
+// }
+//
+// JLabel nameLabel = new JLabel(id);
+// JLabel typeField = new JLabel(parameterType.getLocalPart());
+// XBayaTextField paramField = new XBayaTextField();
+// Object value = node.getDefaultValue();
+//
+// String valueString;
+// if (value == null) {
+// valueString = "";
+// } else {
+// if (value instanceof XmlElement) {
+// XmlElement valueElement = (XmlElement) value;
+// valueString = XMLUtil.xmlElementToString(valueElement);
+// } else {
+// // Only string comes here for now.
+// valueString = value.toString();
+// }
+// }
+//
+// if (!node.isVisibility()) {
+// paramField.setEditable(false);
// }
+// paramField.setText(valueString);
+// this.parameterPanel.add(nameLabel);
+// this.parameterPanel.add(typeField);
+// this.parameterPanel.add(paramField);
+// this.parameterTextFields.add(paramField);
// }
-// this.gfacUrlListField.setEditable(true);
- MonitorConfiguration notifConfig = this.engine.getMonitor().getConfiguration();
- if (notifConfig.getBrokerURL() == null) {
- this.engine.getGUI().getErrorWindow().error(ErrorMessages.BROKER_URL_NOT_SET_ERROR);
- return;
- }
-
- // Create input fields
- List<InputNode> inputNodes = GraphUtil.getInputNodes(this.workflow.getGraph());
- for (Iterator<InputNode> iterator = inputNodes.iterator(); iterator.hasNext();) {
- InputNode node = iterator.next();
- String id = node.getID();
- QName parameterType = node.getParameterType();
-
- /*
- * If input node has no connection, skip it
- */
- if (parameterType == null) {
- iterator.remove();
- continue;
- }
-
- JLabel nameLabel = new JLabel(id);
- JLabel typeField = new JLabel(parameterType.getLocalPart());
- XBayaTextField paramField = new XBayaTextField();
- Object value = node.getDefaultValue();
-
- String valueString;
- if (value == null) {
- valueString = "";
- } else {
- if (value instanceof XmlElement) {
- XmlElement valueElement = (XmlElement) value;
- valueString = XMLUtil.xmlElementToString(valueElement);
- } else {
- // Only string comes here for now.
- valueString = value.toString();
- }
- }
-
- if (!node.isVisibility()) {
- paramField.setEditable(false);
- }
- paramField.setText(valueString);
- this.parameterPanel.add(nameLabel);
- this.parameterPanel.add(typeField);
- this.parameterPanel.add(paramField);
- this.parameterTextFields.add(paramField);
- }
- this.parameterPanel.layout(inputNodes.size(), 3, GridPanel.WEIGHT_NONE, 2);
-
-// this.instanceNameTextField.setText(workflow.getName()+"_"+Calendar.getInstance().getTime().toString());
-
- this.topicTextField.setText(UUID.randomUUID().toString());
-
- this.dialog.show();
- }
-
- /**
- * Hides the dialog.
- */
- public void hide() {
- this.dialog.hide();
-
- this.parameterPanel.resetPanel();
- this.parameterTextFields.clear();
- }
-
- /**
- * ReInit Host Name ComboBox
- */
- // public void reinitHostComboBox() {
- // if (this.resourceSelectionComboBox == null)
- // this.resourceSelectionComboBox = new XBayaComboBox(new DefaultComboBoxModel(initHostNameList()));
- // else
- // this.resourceSelectionComboBox.setModel(new DefaultComboBoxModel(initHostNameList()));
- // }
-
- private void initGUI() {
- this.parameterPanel = new GridPanel(true);
-
- // reinitHostComboBox();
- // this.resourceSelectionLabel = new XBayaLabel("Select a Compute Resource", this.resourceSelectionComboBox);
- this.instanceNameTextField = new XBayaTextField();
- XBayaLabel instanceNameLabel = new XBayaLabel("Experiment name", this.instanceNameTextField);
-
- this.topicTextField = new XBayaTextField();
- XBayaLabel topicLabel = new XBayaLabel("Notification topic", this.topicTextField);
-// this.gfacUrlListField = new JComboBox();
-// XBayaLabel gfacURLLabel = new XBayaLabel("GFac URL", this.gfacUrlListField);
- this.interactChkBox = new JCheckBox();
- this.interactChkBox.setSelected(false);
- XBayaLabel interactLabel = new XBayaLabel("Enable Service Interactions", this.interactChkBox);
-
- chkRunWithCrossProduct=new JCheckBox();
- XBayaLabel crossProductLabel = new XBayaLabel("Execute in cross product", chkRunWithCrossProduct);
-
- GridPanel infoPanel = new GridPanel();
- // infoPanel.add(this.resourceSelectionLabel);
- // infoPanel.add(this.resourceSelectionComboBox);
- infoPanel.add(instanceNameLabel);
- infoPanel.add(this.instanceNameTextField);
- infoPanel.add(topicLabel);
- infoPanel.add(this.topicTextField);
-// infoPanel.add(gfacURLLabel);
-// infoPanel.add(this.gfacUrlListField);
- infoPanel.add(interactLabel);
- infoPanel.add(this.interactChkBox);
- infoPanel.add(crossProductLabel);
- infoPanel.add(chkRunWithCrossProduct);
-
- infoPanel.layout(5, 2, GridPanel.WEIGHT_NONE, 1);
-
- GridPanel mainPanel = new GridPanel();
- mainPanel.add(this.parameterPanel);
- mainPanel.add(infoPanel);
- mainPanel.layout(2, 1, 0, 0);
-
- JButton okButton = new JButton("Run");
- okButton.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(okButton);
- buttonPanel.add(cancelButton);
-
- this.dialog = new XBayaDialog(this.engine.getGUI(), "Invoke workflow", mainPanel, buttonPanel);
- this.dialog.setDefaultButton(okButton);
- }
-
- private void execute() {
- final List<String> arguments = new ArrayList<String>();
- 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;
- }
-// if (instanceName.equals("")){
-// instanceName=workflow.getName();
+// this.parameterPanel.layout(inputNodes.size(), 3, GridPanel.WEIGHT_NONE, 2);
+//
+//// this.instanceNameTextField.setText(workflow.getName()+"_"+Calendar.getInstance().getTime().toString());
+//
+// this.topicTextField.setText(UUID.randomUUID().toString());
+//
+// this.dialog.show();
+// }
+//
+// /**
+// * Hides the dialog.
+// */
+// public void hide() {
+// this.dialog.hide();
+//
+// this.parameterPanel.resetPanel();
+// this.parameterTextFields.clear();
+// }
+//
+// /**
+// * ReInit Host Name ComboBox
+// */
+// // public void reinitHostComboBox() {
+// // if (this.resourceSelectionComboBox == null)
+// // this.resourceSelectionComboBox = new XBayaComboBox(new DefaultComboBoxModel(initHostNameList()));
+// // else
+// // this.resourceSelectionComboBox.setModel(new DefaultComboBoxModel(initHostNameList()));
+// // }
+//
+// private void initGUI() {
+// this.parameterPanel = new GridPanel(true);
+//
+// // reinitHostComboBox();
+// // this.resourceSelectionLabel = new XBayaLabel("Select a Compute Resource", this.resourceSelectionComboBox);
+// this.instanceNameTextField = new XBayaTextField();
+// XBayaLabel instanceNameLabel = new XBayaLabel("Experiment name", this.instanceNameTextField);
+//
+// this.topicTextField = new XBayaTextField();
+// XBayaLabel topicLabel = new XBayaLabel("Notification topic", this.topicTextField);
+//// this.gfacUrlListField = new JComboBox();
+//// XBayaLabel gfacURLLabel = new XBayaLabel("GFac URL", this.gfacUrlListField);
+// this.interactChkBox = new JCheckBox();
+// this.interactChkBox.setSelected(false);
+// XBayaLabel interactLabel = new XBayaLabel("Enable Service Interactions", this.interactChkBox);
+//
+// chkRunWithCrossProduct=new JCheckBox();
+// XBayaLabel crossProductLabel = new XBayaLabel("Execute in cross product", chkRunWithCrossProduct);
+//
+// GridPanel infoPanel = new GridPanel();
+// // infoPanel.add(this.resourceSelectionLabel);
+// // infoPanel.add(this.resourceSelectionComboBox);
+// infoPanel.add(instanceNameLabel);
+// infoPanel.add(this.instanceNameTextField);
+// infoPanel.add(topicLabel);
+// infoPanel.add(this.topicTextField);
+//// infoPanel.add(gfacURLLabel);
+//// infoPanel.add(this.gfacUrlListField);
+// infoPanel.add(interactLabel);
+// infoPanel.add(this.interactChkBox);
+// infoPanel.add(crossProductLabel);
+// infoPanel.add(chkRunWithCrossProduct);
+//
+// infoPanel.layout(5, 2, GridPanel.WEIGHT_NONE, 1);
+//
+// GridPanel mainPanel = new GridPanel();
+// mainPanel.add(this.parameterPanel);
+// mainPanel.add(infoPanel);
+// mainPanel.layout(2, 1, 0, 0);
+//
+// JButton okButton = new JButton("Run");
+// okButton.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(okButton);
+// buttonPanel.add(cancelButton);
+//
+// this.dialog = new XBayaDialog(this.engine.getGUI(), "Invoke workflow", mainPanel, buttonPanel);
+// this.dialog.setDefaultButton(okButton);
+// }
+//
+// private void execute() {
+// final List<String> arguments = new ArrayList<String>();
+// 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;
// }
- final String instanceNameFinal=instanceName;
- String topic = this.topicTextField.getText();
- if (topic.length() == 0) {
- this.engine.getGUI().getErrorWindow().error(ErrorMessages.TOPIC_EMPTY_ERROR);
- return;
- }
-
- // Use topic as a base of workflow instance ID so that the monitor can
- // find it.
- URI workfowInstanceID = URI.create(StringUtil.convertToJavaIdentifier(topic));
- this.workflow.setGPELInstanceID(workfowInstanceID);
-
- MonitorConfiguration notifConfig = this.engine.getMonitor().getConfiguration();
- notifConfig.setTopic(topic);
- arguments.add("-" + JythonScript.TOPIC_VARIABLE);
- arguments.add(topic);
- Collection<WSNode> wsNodes = GraphUtil.getWSNodes(this.engine.getGUI().getWorkflow().getGraph());
- // This is to enable service interaction with the back end
- if (this.interactChkBox.isSelected()) {
- LinkedList<String> nodeIDs = new LinkedList<String>();
- for (WSNode node : wsNodes) {
- nodeIDs.add(node.getID());
- ((WSNodeGUI) NodeController.getGUI(node)).setInteractiveMode(true);
- }
- notifConfig.setInteractiveNodeIDs(nodeIDs);
- } else {
- for (WSNode node : wsNodes) {
- ((WSNodeGUI) NodeController.getGUI(node)).setInteractiveMode(false);
- }
- }
-
- final boolean isRunCrossProduct=chkRunWithCrossProduct.isSelected();
- // TODO error check for user inputs
-
- final List<InputNode> inputNodes = GraphUtil.getInputNodes(this.workflow.getGraph());
- builder.newFragment("inputs");
- new ODEClient();
- 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();
- inputNode.setDefaultValue(value);
- }
-
-// final String gFacUrl = ((URI) this.gfacUrlListField.getSelectedItem()).toASCIIString();
-// if (null != gFacUrl && !"".equals(gFacUrl)) {
-// try {
-// this.engine.getConfiguration().setGFacURL(new URI(gFacUrl));
-// } catch (URISyntaxException e) {
-// this.engine.getGUI().getErrorWindow().error(e);
+//// if (instanceName.equals("")){
+//// instanceName=workflow.getName();
+//// }
+// final String instanceNameFinal=instanceName;
+// String topic = this.topicTextField.getText();
+// if (topic.length() == 0) {
+// this.engine.getGUI().getErrorWindow().error(ErrorMessages.TOPIC_EMPTY_ERROR);
+// return;
+// }
+//
+// // Use topic as a base of workflow instance ID so that the monitor can
+// // find it.
+// URI workfowInstanceID = URI.create(StringUtil.convertToJavaIdentifier(topic));
+// this.workflow.setGPELInstanceID(workfowInstanceID);
+//
+// MonitorConfiguration notifConfig = this.engine.getMonitor().getConfiguration();
+// notifConfig.setTopic(topic);
+// arguments.add("-" + JythonScript.TOPIC_VARIABLE);
+// arguments.add(topic);
+// Collection<WSNode> wsNodes = GraphUtil.getWSNodes(this.engine.getGUI().getWorkflow().getGraph());
+// // This is to enable service interaction with the back end
+// if (this.interactChkBox.isSelected()) {
+// LinkedList<String> nodeIDs = new LinkedList<String>();
+// for (WSNode node : wsNodes) {
+// nodeIDs.add(node.getID());
+// ((WSNodeGUI) NodeController.getGUI(node)).setInteractiveMode(true);
+// }
+// notifConfig.setInteractiveNodeIDs(nodeIDs);
+// } else {
+// for (WSNode node : wsNodes) {
+// ((WSNodeGUI) NodeController.getGUI(node)).setInteractiveMode(false);
// }
// }
- this.engine.getConfiguration().setTopic(topic);
-
- /*
- * Load host description from xregistry and add to interpreter
- */
- LeadResourceMapping mapping = null;
-
- final LeadResourceMapping resourceMapping = mapping;
- final String topicString = topic;
- new Thread() {
- /**
- * @see java.lang.Thread#run()
- */
- @Override
- public void run() {
- XBayaConfiguration conf = DynamicWorkflowRunnerWindow.this.engine.getConfiguration();
- WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(engine.getGUI().getWorkflow(),topicString,conf.getMessageBoxURL(), conf.getBrokerURL(), conf.getAiravataAPI(), conf, DynamicWorkflowRunnerWindow.this.engine.getGUI(), DynamicWorkflowRunnerWindow.this.engine.getMonitor());
- workflowInterpreterConfiguration.setRunWithCrossProduct(isRunCrossProduct);
-
- WorkflowInterpreter workflowInterpreter = new WorkflowInterpreter(
- workflowInterpreterConfiguration, new GUIWorkflowInterpreterInteractorImpl(engine, engine.getGUI().getWorkflow()));
- DynamicWorkflowRunnerWindow.this.engine.registerWorkflowInterpreter(workflowInterpreter);
- try {
- MonitorConfiguration notifConfig = DynamicWorkflowRunnerWindow.this.engine.getMonitor()
- .getConfiguration();
- notifConfig.setTopic(topicString);
- DynamicWorkflowRunnerWindow.this.engine.getMonitor().start();
-
- if (resourceMapping != null)
- workflowInterpreter.setResourceMapping(resourceMapping);
-
- workflowInterpreter.scheduleDynamically();
+//
+// final boolean isRunCrossProduct=chkRunWithCrossProduct.isSelected();
+// // TODO error check for user inputs
+//
+// final List<InputNode> inputNodes = GraphUtil.getInputNodes(this.workflow.getGraph());
+// builder.newFragment("inputs");
+// new ODEClient();
+// 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();
+// inputNode.setDefaultValue(value);
+// }
+//
+//// final String gFacUrl = ((URI) this.gfacUrlListField.getSelectedItem()).toASCIIString();
+//// if (null != gFacUrl && !"".equals(gFacUrl)) {
+//// try {
+//// this.engine.getConfiguration().setGFacURL(new URI(gFacUrl));
+//// } catch (URISyntaxException e) {
+//// this.engine.getGUI().getErrorWindow().error(e);
+//// }
+//// }
+// this.engine.getConfiguration().setTopic(topic);
+//
+// /*
+// * Load host description from xregistry and add to interpreter
+// */
+// LeadResourceMapping mapping = null;
+//
+// final LeadResourceMapping resourceMapping = mapping;
+// final String topicString = topic;
+// new Thread() {
+// /**
+// * @see java.lang.Thread#run()
+// */
+// @Override
+// public void run() {
+// XBayaConfiguration conf = DynamicWorkflowRunnerWindow.this.engine.getConfiguration();
+// WorkflowInterpreterConfiguration workflowInterpreterConfiguration = new WorkflowInterpreterConfiguration(engine.getGUI().getWorkflow(),topicString,conf.getMessageBoxURL(), conf.getBrokerURL(), conf.getAiravataAPI(), conf, DynamicWorkflowRunnerWindow.this.engine.getGUI(), DynamicWorkflowRunnerWindow.this.engine.getMonitor());
+// workflowInterpreterConfiguration.setRunWithCrossProduct(isRunCrossProduct);
+//
+// WorkflowInterpreter workflowInterpreter = new WorkflowInterpreter(
+// workflowInterpreterConfiguration, new GUIWorkflowInterpreterInteractorImpl(engine, engine.getGUI().getWorkflow()));
+// DynamicWorkflowRunnerWindow.this.engine.registerWorkflowInterpreter(workflowInterpreter);
+// try {
+// MonitorConfiguration notifConfig = DynamicWorkflowRunnerWindow.this.engine.getMonitor()
+// .getConfiguration();
+// notifConfig.setTopic(topicString);
+// DynamicWorkflowRunnerWindow.this.engine.getMonitor().start();
+//
+// if (resourceMapping != null)
+// workflowInterpreter.setResourceMapping(resourceMapping);
+//
+// workflowInterpreter.scheduleDynamically();
+//// try {
+//// engine.getConfiguration().getJcrComponentRegistry().getRegistry().saveWorkflowExecutionName(topicString, instanceNameFinal);
+//// } catch (RegistryException e) {
+//// e.printStackTrace();
+//// }
+// } catch (WorkflowException e) {
// try {
-// engine.getConfiguration().getJcrComponentRegistry().getRegistry().saveWorkflowExecutionName(topicString, instanceNameFinal);
-// } catch (RegistryException e) {
-// e.printStackTrace();
-// }
- } catch (WorkflowException e) {
- try {
- workflowInterpreter.cleanup();
- } catch (MonitorException e1) {
- DynamicWorkflowRunnerWindow.this.engine.getGUI().getErrorWindow().error(e1);
- }
- DynamicWorkflowRunnerWindow.this.engine.getGUI().getErrorWindow().error(e);
- }
-
- }
- }.start();
-
- hide();
- }
-}
\ No newline at end of file
+// workflowInterpreter.cleanup();
+// } catch (MonitorException e1) {
+// DynamicWorkflowRunnerWindow.this.engine.getGUI().getErrorWindow().error(e1);
+// }
+// DynamicWorkflowRunnerWindow.this.engine.getGUI().getErrorWindow().error(e);
+// }
+//
+// }
+// }.start();
+//
+// hide();
+// }
+//}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/ws/WSNodeWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/ws/WSNodeWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/ws/WSNodeWindow.java
index 56809b3..f5ce749 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/ws/WSNodeWindow.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/ws/WSNodeWindow.java
@@ -73,20 +73,20 @@ public class WSNodeWindow {
*/
public void show() {
- WsdlDefinitions wsdl = this.node.getComponent().getWSDL();
+// WsdlDefinitions wsdl = this.node.getComponent().getWSDL();
String type;
- if (WSDLUtil.isAWSDL(wsdl)) {
+// if (WSDLUtil.isAWSDL(wsdl)) {
type = "Abstract WSDL";
- } else {
- type = "Concrete WSDL";
- }
+// } else {
+// type = "Concrete WSDL";
+// }
this.nameTextField.setText(this.node.getName());
this.idTextField.setText(this.node.getID());
this.typeTextField.setText(type);
// wsdl.toStringPretty uses tab, which doesn't look good in the editor
// pane.
- this.wsdlTextArea.setText(XMLUtil.BUILDER.serializeToStringPretty(wsdl.xml()));
+// this.wsdlTextArea.setText(XMLUtil.BUILDER.serializeToStringPretty(wsdl.xml()));
this.dialog.show();
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java
index e1c9f80..2e1d7de 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/RegistryWindow.java
@@ -22,32 +22,26 @@
package org.apache.airavata.xbaya.ui.dialogs.registry;
import java.awt.event.ActionEvent;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
+import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JLabel;
-import javax.swing.JPasswordField;
-import org.apache.airavata.client.AiravataAPIFactory;
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.api.client.AiravataClientFactory;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ClientSettings;
+import org.apache.airavata.model.error.AiravataClientConnectException;
+import org.apache.airavata.xbaya.ThriftClientData;
+import org.apache.airavata.xbaya.ThriftServiceType;
import org.apache.airavata.xbaya.XBayaConfiguration;
-import org.apache.airavata.xbaya.XBayaConstants;
import org.apache.airavata.xbaya.XBayaEngine;
import org.apache.airavata.xbaya.component.registry.ComponentRegistryLoader;
-import org.apache.airavata.xbaya.registry.PasswordCallbackImpl;
import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
-import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaComboBox;
import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
-import org.apache.airavata.xbaya.ui.widgets.XBayaLinkButton;
import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
import org.apache.airavata.xbaya.util.RegistryConstants;
@@ -57,28 +51,31 @@ public class RegistryWindow {
private XBayaDialog dialog;
- private XBayaTextField urlTextField;
+ private XBayaTextField serverTextField;
- private XBayaTextField gatewayTextField;
+ private XBayaTextField portTextField;
- private XBayaTextField usernameTextField;
+ private XBayaTextField gatewayNameTextField;
- private JPasswordField passwordTextField;
+ private XBayaTextField usernameTextField;
- private XBayaLinkButton newUserButton;
+ private XBayaComboBox serviceTypeCombo;
- private NewRegistryUserDialog newUserWindow;
- private String userName;
+ private String gatewayName;
- private String password;
+ private String username;
- private String regURL;
+ private String serverName;
- private String gateway;
+ private String serverPort;
- private static String previousRegURL;
+ private static String previousServerName;
+ private ThriftServiceType serviceType;
+
+ private DefaultComboBoxModel<ThriftServiceType> serviceTypeModel;
+
/**
* @param engine
*/
@@ -100,98 +97,39 @@ public class RegistryWindow {
}
private void ok() {
- setRegURL(this.urlTextField.getText());
- setPreviousRegURL(this.urlTextField.getText());
- setUserName(this.usernameTextField.getText());
- setPassword(new String(this.passwordTextField.getPassword()));
- setGateway(this.gatewayTextField.getText());
-
- if (getRegURL().length() == 0) {
- this.engine.getGUI().getErrorWindow().error(ErrorMessages.URL_EMPTY);
- return;
- }
- URI url;
- try {
- url = new URI(regURL);
- } catch (URISyntaxException e) {
- this.engine.getGUI().getErrorWindow().error(ErrorMessages.URL_WRONG, e);
- return;
- }
-
- AiravataAPI airavataAPI = getAiravataAPI();
-
-// JCRComponentRegistry registry = null;
-// try {
-// registry = new JCRComponentRegistry(airavataAPI);
-// } catch (Exception e) {
-// this.engine.getGUI().getErrorWindow().error(e.getMessage());
-// return;
-// }
- XBayaConfiguration configuration = this.engine.getConfiguration();
- this.engine.setAiravataAPI(airavataAPI);
- configuration.setAiravataAPI(airavataAPI);
- configuration.setRegigstryUserName(userName);
- configuration.setRegistryPassphrase(password);
- configuration.setRegistryURL(url);
- configuration.setDefaultGateway(gateway);
- engine.updateXBayaConfigurationServiceURLs();
- hide();
-
-// this.loader.load(registry);
- }
-
- private void createNewUser() {
- URL specifiedURL = null;
+ setServerName(this.serverTextField.getText());
+ setPreviousServerName(this.serverTextField.getText());
+ setGatewayName(this.gatewayNameTextField.getText());
+ setUsername(new String(this.usernameTextField.getText()));
+ setServerPort(this.portTextField.getText());
+ setServiceType((ThriftServiceType)serviceTypeModel.getSelectedItem());
try {
- specifiedURL = new URL(urlTextField.getText());
- } catch (MalformedURLException e1) {
- // the text box contains invalid url, we'll just ignore it
- }
- if (newUserWindow == null) {
- newUserWindow = new NewRegistryUserDialog(engine);
- }
-// newUserWindow.setUrl(specifiedURL);
- newUserWindow.setUsername(usernameTextField.getText());
- newUserWindow.updateControlData();
- newUserWindow.show();
- if (newUserWindow.isUserCreated()) {
-// urlTextField.setText(newUserWindow.getUrl().toString());
- usernameTextField.setText(newUserWindow.getUsername());
- passwordTextField.setText(newUserWindow.getPassword());
- }
+ validateData();
+ XBayaConfiguration configuration = this.engine.getConfiguration();
+ configuration.addThriftClientData(new ThriftClientData(getServiceType(),serverName, Integer.parseInt(serverPort),gatewayName, username));
+ hide();
+ } catch (Exception e) {
+ this.engine.getGUI().getErrorWindow().error(e.getMessage());
+ }
}
/**
* Initializes the GUI.
*/
private void initGUI() {
- this.urlTextField = new XBayaTextField();
- this.gatewayTextField = new XBayaTextField();
+ this.serverTextField = new XBayaTextField();
+ this.portTextField = new XBayaTextField();
+ this.gatewayNameTextField = new XBayaTextField();
this.usernameTextField = new XBayaTextField();
- this.passwordTextField = new JPasswordField();
- try {
- if (getPreviousRegURL() != null){
- this.urlTextField.setText(engine.getConfiguration().getRegistryURL().toASCIIString());
- } else if (engine.getConfiguration().isRegURLSetByCMD()){
- this.urlTextField.setText(engine.getConfiguration().getRegistryURL().toASCIIString());
- } else if (ClientSettings.isSettingDefined(XBayaConstants.XBAYA_REGISTRY_URL)){
- this.urlTextField.setText(ClientSettings.getSetting(XBayaConstants.XBAYA_REGISTRY_URL));
- } else {
- this.urlTextField.setText(engine.getConfiguration().getRegistryURL().toASCIIString());
- }
- if (ClientSettings.isSettingDefined(XBayaConstants.XBAYA_REGISTRY_USER)){
- this.usernameTextField.setText(ClientSettings.getSetting(XBayaConstants.XBAYA_REGISTRY_USER));
- } else {
- this.usernameTextField.setText(engine.getConfiguration().getRegistryUserName());
- }
- if (ClientSettings.isSettingDefined(XBayaConstants.XBAYA_DEFAULT_GATEWAY)){
- this.gatewayTextField.setText(ClientSettings.getSetting(XBayaConstants.XBAYA_DEFAULT_GATEWAY));
- } else {
- this.gatewayTextField.setText(engine.getConfiguration().getDefaultGateway());
- }
- } catch (ApplicationSettingsException e) {
- e.printStackTrace();
- }
+ this.serverTextField.setText("localhost");
+ this.portTextField.setText("8930");
+ ThriftClientData thriftClientData = engine.getConfiguration().getThriftClientData(ThriftServiceType.WORKFLOW_SERVICE);
+ if (thriftClientData!=null){
+ this.serverTextField.setText(thriftClientData.getServerAddress());
+ this.gatewayNameTextField.setText(thriftClientData.getGatewayId());
+ this.portTextField.setText(String.valueOf(thriftClientData.getServerPort()));
+ this.usernameTextField.setText(thriftClientData.getUsername());
+ }
try {
ClientSettings.initializeTrustStore();
@@ -199,32 +137,32 @@ public class RegistryWindow {
throw new RuntimeException("An error occurred while initializing client configurations");
}
- this.passwordTextField.setText(engine.getConfiguration().getRegistryPassphrase());
- XBayaLabel urlLabel = new XBayaLabel("Registry URL", this.urlTextField);
- XBayaLabel gatewayLabel = new XBayaLabel("Gateway", this.gatewayTextField);
- XBayaLabel nameLabel = new XBayaLabel("Username", this.usernameTextField);
- XBayaLabel passLabel = new XBayaLabel("Password", this.usernameTextField);
- this.newUserButton = new XBayaLinkButton("Create new user...");
- newUserButton.setHorizontalAlignment(XBayaLinkButton.RIGHT);
- JLabel emptyLabel = new JLabel("");
-
- newUserButton.addActionListener(new AbstractAction() {
- public void actionPerformed(ActionEvent e) {
- createNewUser();
- }
- });
+ XBayaLabel serverAddressLabel = new XBayaLabel("Server Address", this.serverTextField);
+ XBayaLabel serverPortLabel = new XBayaLabel("Server Port", this.portTextField);
+ XBayaLabel gatewayNameLabel = new XBayaLabel("Gateway Name", this.gatewayNameTextField);
+ XBayaLabel gatewayUserLabel = new XBayaLabel("Gateway TUser", this.usernameTextField);
+ serviceTypeModel = new DefaultComboBoxModel<ThriftServiceType>(ThriftServiceType.values());
+ serviceTypeModel.setSelectedItem(ThriftServiceType.API_SERVICE);
+ 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(urlLabel);
- infoPanel.add(this.urlTextField);
- infoPanel.add(gatewayLabel);
- infoPanel.add(this.gatewayTextField);
- infoPanel.add(nameLabel);
+ 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.gatewayNameTextField);
+ infoPanel.add(gatewayUserLabel);
infoPanel.add(this.usernameTextField);
- infoPanel.add(passLabel);
- infoPanel.add(this.passwordTextField);
- infoPanel.add(emptyLabel);
- infoPanel.add(this.newUserButton);
infoPanel.layout(5, 2, GridPanel.WEIGHT_NONE, 1);
// infoPanel.layout(2, 2, GridPanel.WEIGHT_NONE, 1);
@@ -253,61 +191,61 @@ public class RegistryWindow {
this.dialog.setDefaultButton(okButton);
}
- public AiravataAPI getAiravataAPI(){
- try {
- URI regURI = new URI(getRegURL());
- PasswordCallbackImpl passwordCallback = new PasswordCallbackImpl(userName, password);
- AiravataAPI airavataAPI = AiravataAPIFactory.getAPI(regURI, getGateway(), userName, passwordCallback);
- return airavataAPI;
- } catch (URISyntaxException e) {
- e.printStackTrace();
- }catch (AiravataAPIInvocationException e) {
- e.printStackTrace();
- engine.getGUI().getErrorWindow().error("Some error has occurred while initialize. Please check whether you " +
- "entered correct credentials...", e);
-
- }
- return null;
-
+ private void validateData() throws NumberFormatException, AiravataClientConnectException{
+ switch(getServiceType()){
+ case API_SERVICE:
+ AiravataClientFactory.createAiravataClient(getServerName(), Integer.parseInt(getServerPort())); break;
+ case WORKFLOW_SERVICE:
+ AiravataClientFactory.createWorkflowClient(getServerName(), Integer.parseInt(getServerPort())); break;
+ }
+
}
public String getUserName() {
- return userName;
+ return username;
}
- public String getPassword() {
- return password;
+ public String getServerPort() {
+ return serverPort;
}
- public String getRegURL() {
- return regURL;
+ public String getServerName() {
+ return serverName;
}
- public void setRegURL(String regURL) {
- this.regURL = regURL;
+ public String getGatewayName() {
+ return gatewayName;
}
- public void setUserName(String userName) {
- this.userName = userName;
+ public void setServerName(String serverName) {
+ this.serverName = serverName;
}
- public void setPassword(String password) {
- this.password = password;
+ public void setGatewayName(String gateway) {
+ this.gatewayName = gateway;
}
- public String getGateway() {
- return gateway;
+ public void setUsername(String username) {
+ this.username = username;
}
- public void setGateway(String gateway) {
- this.gateway = gateway;
+ public void setServerPort(String serverPort) {
+ this.serverPort = serverPort;
}
- public static String getPreviousRegURL() {
- return previousRegURL;
+ public static String getPreviousServerName() {
+ return previousServerName;
}
- public static void setPreviousRegURL(String previousRegURL) {
- RegistryWindow.previousRegURL = previousRegURL;
+ public static void setPreviousServerName(String previousServerName) {
+ RegistryWindow.previousServerName = previousServerName;
}
+
+ public ThriftServiceType getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(ThriftServiceType serviceType) {
+ this.serviceType = serviceType;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/browser/JCRBrowserDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/browser/JCRBrowserDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/browser/JCRBrowserDialog.java
index 2268c03..6400a98 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/browser/JCRBrowserDialog.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/registry/browser/JCRBrowserDialog.java
@@ -31,7 +31,6 @@ import javax.swing.JDialog;
import javax.swing.JPanel;
import org.apache.airavata.xbaya.XBayaEngine;
-import org.apache.airavata.xbaya.ui.views.JCRBrowserPanel;
public class JCRBrowserDialog extends JDialog {
@@ -68,7 +67,7 @@ public class JCRBrowserDialog extends JDialog {
setLocationRelativeTo(null);
setBounds(100, 100, 450, 300);
getContentPane().setLayout(new BorderLayout());
- contentPanel = new JCRBrowserPanel(getEngine());
+// contentPanel = new JCRBrowserPanel(getEngine());
getContentPane().add(contentPanel, BorderLayout.CENTER);
// contentPanel.setLayout(new BorderLayout(0, 0));
// {
http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/ExperimentMenu.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/ExperimentMenu.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/ExperimentMenu.java
index a33dd49..11aba5c 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/ExperimentMenu.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/experiment/ExperimentMenu.java
@@ -28,18 +28,13 @@ import javax.swing.AbstractAction;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-import org.apache.airavata.registry.api.exception.RegistryException;
-import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
import org.apache.airavata.xbaya.XBayaEngine;
-import org.apache.airavata.xbaya.registry.RegistryAccesser;
import org.apache.airavata.xbaya.util.XBayaUtil;
public class ExperimentMenu {
private JMenu experimentMenu;
- protected RegistryAccesser registryAccesser;
private JMenuItem configureRegistryItem;
@@ -55,24 +50,22 @@ public class ExperimentMenu {
*/
public ExperimentMenu(XBayaEngine engine) {
this.engine = engine;
- this.registryAccesser = new RegistryAccesser(engine);
-
createExperimentMenu();
}
private void createExperimentMenu() {
createConfigureRegistryItem();
- createDeleteWorkflowtoRegistryItem();
+// createDeleteWorkflowtoRegistryItem();
this.experimentMenu = new JMenu("Experiment");
this.experimentMenu.setMnemonic(KeyEvent.VK_F);
- this.experimentMenu.add(this.configureRegistryItem);
- this.experimentMenu.addSeparator();
- this.experimentMenu.add(this.deleteWorkflowfromRegistryItem);
- this.experimentMenu.addSeparator();
- this.experimentMenu.addSeparator();
+// this.experimentMenu.add(this.configureRegistryItem);
+// this.experimentMenu.addSeparator();
+// this.experimentMenu.add(this.deleteWorkflowfromRegistryItem);
+// this.experimentMenu.addSeparator();
+// this.experimentMenu.addSeparator();
}
/**
@@ -93,18 +86,18 @@ public class ExperimentMenu {
});
}
- private void createDeleteWorkflowtoRegistryItem() {
- this.deleteWorkflowfromRegistryItem = new JMenuItem("Delete Workflows in Registry");
- this.deleteWorkflowfromRegistryItem.addActionListener(new AbstractAction() {
- public void actionPerformed(ActionEvent e) {
- try {
- ExperimentMenu.this.registryAccesser.deleteOGCEWorkflow(ExperimentMenu.this.engine.getGUI().getWorkflow()
- .getQname());
- } catch (AiravataAPIInvocationException e1) {
- throw new WorkflowRuntimeException(e1);
- }
- }
- });
- }
+// private void createDeleteWorkflowtoRegistryItem() {
+// this.deleteWorkflowfromRegistryItem = new JMenuItem("Delete Workflows in Registry");
+// this.deleteWorkflowfromRegistryItem.addActionListener(new AbstractAction() {
+// public void actionPerformed(ActionEvent e) {
+// try {
+// ExperimentMenu.this.registryAccesser.deleteOGCEWorkflow(ExperimentMenu.this.engine.getGUI().getWorkflow()
+// .getQname());
+// } catch (AiravataAPIInvocationException e1) {
+// throw new WorkflowRuntimeException(e1);
+// }
+// }
+// });
+// }
}
\ No newline at end of file