You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2011/11/01 15:31:09 UTC
svn commit: r1196012 - in /incubator/airavata/trunk/modules: distribution/
xbaya-gui/ xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/
xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/dynamic/gui/
Author: lahiru
Date: Tue Nov 1 14:31:09 2011
New Revision: 1196012
URL: http://svn.apache.org/viewvc?rev=1196012&view=rev
Log:
Applying the patch given by Heshan for AIRAVATA-147
Modified:
incubator/airavata/trunk/modules/distribution/pom.xml
incubator/airavata/trunk/modules/xbaya-gui/pom.xml
incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ApplicationDescriptionRegistrationWindow.java
incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ArgumentsConfigWindow.java
incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/HostDescriptionRegistrationWindow.java
incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/RegisterApplicationsMenu.java
incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ServiceDescriptionRegistrationWindow.java
incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/dynamic/gui/DynamicWorkflowRunnerWindow.java
Modified: incubator/airavata/trunk/modules/distribution/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/distribution/pom.xml?rev=1196012&r1=1196011&r2=1196012&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/distribution/pom.xml (original)
+++ incubator/airavata/trunk/modules/distribution/pom.xml Tue Nov 1 14:31:09 2011
@@ -192,11 +192,6 @@
<version>0.8.3</version>
</dependency-->
<dependency>
- <groupId>gfac</groupId>
- <artifactId>gfac-schema-utils</artifactId>
- <version>0.4.3</version>
- </dependency>
- <dependency>
<groupId>lead-security</groupId>
<artifactId>cryptix32</artifactId>
<version>versionless</version>
Modified: incubator/airavata/trunk/modules/xbaya-gui/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/pom.xml?rev=1196012&r1=1196011&r2=1196012&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/pom.xml (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/pom.xml Tue Nov 1 14:31:09 2011
@@ -336,11 +336,6 @@
<artifactId>layout</artifactId>
<version>1.0.4</version>
</dependency>
- <dependency>
- <groupId>gfac</groupId>
- <artifactId>gfac-schema-utils</artifactId>
- <version>0.4.3</version>
- </dependency>
<!-- AMAZON STUFFS -->
<dependency>
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ApplicationDescriptionRegistrationWindow.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ApplicationDescriptionRegistrationWindow.java?rev=1196012&r1=1196011&r2=1196012&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ApplicationDescriptionRegistrationWindow.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ApplicationDescriptionRegistrationWindow.java Tue Nov 1 14:31:09 2011
@@ -1,409 +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.appwrapper;
-
-import java.util.Map;
-
-import javax.swing.DefaultComboBoxModel;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-
-import com.amazonaws.services.importexport.model.JobType;
-import org.apache.airavata.common.utils.NameValidator;
-import org.apache.airavata.common.utils.StringUtil;
-import org.apache.airavata.commons.gfac.type.ApplicationDeploymentDescription;
-import org.apache.airavata.schemas.gfac.*;
-import org.apache.airavata.xbaya.XBayaEngine;
-import org.apache.airavata.xbaya.gui.GridPanel;
-import org.apache.airavata.xbaya.gui.XBayaComboBox;
-import org.apache.airavata.xbaya.gui.XBayaDialog;
-import org.apache.airavata.xbaya.gui.XBayaLabel;
-import org.apache.airavata.xbaya.gui.XBayaTextField;
-import org.ogce.schemas.gfac.beans.ApplicationBean;
-import org.ogce.schemas.gfac.documents.ApplicationDescriptionDocument;
-
-public class ApplicationDescriptionRegistrationWindow {
- private XBayaDialog dialog;
-
- private XBayaEngine engine;
-
- private JButton addApplicationButton;
- private XBayaLabel appParaFileLabel;
- private XBayaTextField appParaFileTextField;
- private XBayaLabel applicationNameLabel;
- private XBayaTextField applicationNameTextField;
- private JButton cancelButton;
- private XBayaLabel executableLabel;
- private XBayaTextField executableTextField;
- private XBayaLabel hostCountLabel;
- private XBayaTextField hostCountTextField;
- private XBayaComboBox hostNameComboBox;
- private XBayaLabel hostNameLabel;
- private JCheckBox isPublicCheckBox;
- private XBayaLabel isPublicLabel;
- private XBayaComboBox jobTypeComboBox;
- private XBayaLabel jobTypeLabel;
- private XBayaLabel maxWallTimeLabel;
- private XBayaTextField maxWallTimeTextField;
- private XBayaLabel minMemoryLabel;
- private XBayaTextField minMemoryTextField;
- private XBayaLabel procsCountLabel;
- private XBayaTextField procsCountTextField;
- private XBayaComboBox projectNameComboBox;
- private XBayaLabel projectNameLabel;
- private XBayaLabel queueLabel;
- private XBayaTextField queueTextField;
- private XBayaLabel rslParaNameLabel;
- private XBayaTextField rslParamNameTextField;
- private XBayaLabel rslParamValueLabel;
- private XBayaTextField rslParamValueTextField;
- private XBayaLabel tempDirLabel;
- private XBayaTextField tempDirTextField;
- private XBayaLabel workDirectoryLabel;
- private XBayaTextField workDirectoryTextField;
-
- private static ApplicationDescriptionRegistrationWindow window;
-
- /**
- * Constructs a ApplicationDescriptionRegistrationWindow.
- *
- * @param engine
- */
- private ApplicationDescriptionRegistrationWindow(XBayaEngine engine) {
- this.engine = engine;
- initGUI();
- }
-
- private ApplicationDescriptionRegistrationWindow() {
- // Intend to be blank;
- }
-
- /**
- * @return ApplicationDescriptionRegistrationWindow
- */
- public static ApplicationDescriptionRegistrationWindow getInstance() {
- if (window == null) {
- window = new ApplicationDescriptionRegistrationWindow();
- }
-
- return window;
- }
-
- // FIXME: Update this to get the documents from JCR Registry
- // private Object[] initHostNameList() {
- // XRegistryAccesser xRegAccesser = new XRegistryAccesser(this.engine);
- // HostDescData[] hostDataList = xRegAccesser.searchHostByName("");
- // List<String> nameList = new ArrayList<String>();
- // for (HostDescData hostData : hostDataList) {
- // nameList.add(hostData.getName().toString());
- // }
- // return nameList.toArray();
- // }
-
- // /**
- // * ReInit Host Name ComboBox
- // */
- // public void reinitHostComboBox() {
- // this.hostNameComboBox.setModel(new DefaultComboBoxModel(initHostNameList()));
- // }
-
- /**
- * Clear All the TextFields
- */
- private void clearAllTextFields() {
- this.appParaFileTextField.setText("");
- this.applicationNameTextField.setText("");
- this.executableTextField.setText("");
- this.hostCountTextField.setText("");
- this.maxWallTimeTextField.setText("");
- this.minMemoryTextField.setText("");
- this.procsCountTextField.setText("");
- this.queueTextField.setText("");
- this.rslParamNameTextField.setText("");
- this.rslParamValueTextField.setText("");
- this.tempDirTextField.setText("/tmp");
- this.workDirectoryTextField.setText("/tmp");
- }
-
- /**
- * @param appBean
- */
- public void initTextField(ApplicationBean appBean) {
- this.applicationNameTextField.setText(appBean.getApplicationName());
- this.hostNameComboBox.setSelectedItem(appBean.getHostName());
- this.executableTextField.setText(appBean.getExecutable());
- this.workDirectoryTextField.setText(appBean.getWorkDir());
- this.tempDirTextField.setText(appBean.getTmpDir());
- this.projectNameComboBox.setSelectedItem(appBean.getProjectName());
- if (appBean.getMaxWallTime() != null)
- this.maxWallTimeTextField.setText(appBean.getMaxWallTime().toString());
- this.queueTextField.setText(appBean.getQueue());
- if (appBean.getPcount() != null)
- this.procsCountTextField.setText(appBean.getPcount().toString());
-
- this.addApplicationButton.setText("Update Application");
- }
-
- private void initGUI() {
- GridPanel infoPanel = new GridPanel();
- this.applicationNameTextField = new XBayaTextField();
- this.applicationNameLabel = new XBayaLabel("Application Name", this.applicationNameTextField);
-
- // this.hostNameComboBox = new XBayaComboBox(new DefaultComboBoxModel(initHostNameList()));
- this.hostNameComboBox.setEditable(false);
- this.hostNameLabel = new XBayaLabel("Host Name", this.hostNameComboBox);
-
- this.executableTextField = new XBayaTextField();
- this.executableLabel = new XBayaLabel("Executable", this.executableTextField);
-
- this.workDirectoryTextField = new XBayaTextField("/tmp");
- this.workDirectoryLabel = new XBayaLabel("Work Directory", this.workDirectoryTextField);
-
- this.tempDirTextField = new XBayaTextField("/tmp");
- this.tempDirLabel = new XBayaLabel("Temp Dir", this.tempDirTextField);
-
- this.projectNameComboBox = new XBayaComboBox(new DefaultComboBoxModel());
- this.projectNameComboBox.setEditable(true);
- this.projectNameLabel = new XBayaLabel("TeraGrid Project Name (optional)", this.projectNameComboBox);
-
- this.jobTypeComboBox = new XBayaComboBox(new DefaultComboBoxModel(new String[] { "single", "mpi", "multiple",
- "condor" }));
- this.jobTypeComboBox.setEditable(false);
- this.jobTypeLabel = new XBayaLabel("Job Type (optional)", this.jobTypeComboBox);
-
- this.queueTextField = new XBayaTextField();
- this.queueLabel = new XBayaLabel("Queue (optional)", this.queueTextField);
-
- this.maxWallTimeTextField = new XBayaTextField();
- this.maxWallTimeLabel = new XBayaLabel("Max Wall Time (optional)", this.maxWallTimeTextField);
-
- this.procsCountTextField = new XBayaTextField();
- this.procsCountLabel = new XBayaLabel("Processors Count (optional)", this.procsCountTextField);
-
- this.appParaFileTextField = new XBayaTextField();
- this.appParaFileLabel = new XBayaLabel("Application Parameter File (optional)", this.appParaFileTextField);
-
- this.minMemoryTextField = new XBayaTextField();
- this.minMemoryLabel = new XBayaLabel("Min Memory (optional)", this.minMemoryTextField);
-
- this.hostCountTextField = new XBayaTextField();
- this.hostCountLabel = new XBayaLabel("Host Count (optional)", this.hostCountTextField);
-
- this.rslParamNameTextField = new XBayaTextField();
- this.rslParaNameLabel = new XBayaLabel("RSL Param Name (optional)", this.rslParamNameTextField);
-
- this.rslParamValueTextField = new XBayaTextField();
- this.rslParamValueLabel = new XBayaLabel("RSL Param Value (optional)", this.rslParamValueTextField);
-
- this.isPublicCheckBox = new JCheckBox();
- this.isPublicLabel = new XBayaLabel("Is Public (optional)", this.isPublicCheckBox);
-
- infoPanel.add(this.applicationNameLabel);
- infoPanel.add(this.applicationNameTextField);
- infoPanel.add(this.hostNameLabel);
- infoPanel.add(this.hostNameComboBox);
- infoPanel.add(this.executableLabel);
- infoPanel.add(this.executableTextField);
- infoPanel.add(this.workDirectoryLabel);
- infoPanel.add(this.workDirectoryTextField);
- infoPanel.add(this.tempDirLabel);
- infoPanel.add(this.tempDirTextField);
- infoPanel.add(this.projectNameLabel);
- infoPanel.add(this.projectNameComboBox);
- infoPanel.add(this.jobTypeLabel);
- infoPanel.add(this.jobTypeComboBox);
- infoPanel.add(this.queueLabel);
- infoPanel.add(this.queueTextField);
- infoPanel.add(this.maxWallTimeLabel);
- infoPanel.add(this.maxWallTimeTextField);
- infoPanel.add(this.procsCountLabel);
- infoPanel.add(this.procsCountTextField);
- infoPanel.add(this.appParaFileLabel);
- infoPanel.add(this.appParaFileTextField);
- infoPanel.add(this.minMemoryLabel);
- infoPanel.add(this.minMemoryTextField);
- infoPanel.add(this.hostCountLabel);
- infoPanel.add(this.hostCountTextField);
- infoPanel.add(this.rslParaNameLabel);
- infoPanel.add(this.rslParamNameTextField);
- infoPanel.add(this.rslParamValueLabel);
- infoPanel.add(this.rslParamValueTextField);
- infoPanel.add(this.isPublicLabel);
- infoPanel.add(this.isPublicCheckBox);
-
- infoPanel.layout(16, 2, GridPanel.WEIGHT_NONE, 1);
-
- JPanel buttonPanel = new JPanel();
- this.addApplicationButton = new JButton();
- this.addApplicationButton.setText("Add Application");
- this.addApplicationButton.addActionListener(new java.awt.event.ActionListener() {
- @Override
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- addApplicationButtonActionPerformed();
- }
- });
-
- this.cancelButton = new JButton();
- this.cancelButton.setText("Cancel");
- this.cancelButton.addActionListener(new java.awt.event.ActionListener() {
- @Override
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- cancelButtonActionPerformed();
- }
- });
-
- buttonPanel.add(this.addApplicationButton);
- buttonPanel.add(this.cancelButton);
-
- this.dialog = new XBayaDialog(this.engine, "Register Application Description", infoPanel, buttonPanel);
- this.dialog.setDefaultButton(this.cancelButton);
- }
-
- private void addApplicationButtonActionPerformed() {// GEN-FIRST:event_addApplicationButtonActionPerformed
-
- this.addApplicationButton.setText("Add Application");
-
- try {
-
- /* Input Validity Check */
- if (!NameValidator.validate(this.applicationNameTextField.getText())) {
- JOptionPane.showMessageDialog(this.dialog.getDialog(), "Application Name Invalid", "Error",
- JOptionPane.ERROR_MESSAGE);
- this.applicationNameTextField.getSwingComponent().requestFocus();
- return;
- }
-
- if (!this.procsCountTextField.getText().equals("")) {
- String numStr = this.procsCountTextField.getText();
- try {
- Integer.parseInt(numStr);
- } catch (java.lang.NumberFormatException e) {
- JOptionPane.showMessageDialog(this.dialog.getDialog(), "Processors Count Invalid", "Error",
- JOptionPane.ERROR_MESSAGE);
- this.applicationNameTextField.getSwingComponent().requestFocus();
- return;
- }
- }
-
- /* Generate Bean Object */
- String hostName = StringUtil.trimSpaceInString(this.hostNameComboBox.getText());
- String projectName = StringUtil.trimSpaceInString(this.projectNameComboBox.getText());
- String jobType = StringUtil.trimSpaceInString(this.jobTypeComboBox.getText());
- String queue = StringUtil.trimSpaceInString(this.queueTextField.getText());
- Integer maxWallTime = null;
- if (!this.maxWallTimeTextField.getText().equals("")) {
- maxWallTime = new Integer(Integer.parseInt(this.maxWallTimeTextField.getText()));
- }
- Integer pCount = null;
- if (!this.procsCountTextField.getText().equals("")) {
- pCount = new Integer(Integer.parseInt(this.procsCountTextField.getText()));
- }
- ApplicationDeploymentDescription deploymentDescription = new ApplicationDeploymentDescription();
- ApplicationDeploymentDescriptionType appDesc = deploymentDescription.getType();
- ApplicationDeploymentDescriptionType.ApplicationName applicationName = appDesc.addNewApplicationName();
- applicationName.setStringValue(StringUtil.trimSpaceInString(this.applicationNameTextField.getText()));
- appDesc.setExecutableLocation(StringUtil.trimSpaceInString(this.executableTextField.getText()));
- appDesc.setScratchWorkingDirectory(StringUtil.trimSpaceInString(this.tempDirTextField.getText()));
- appDesc.setStaticWorkingDirectory(StringUtil.trimSpaceInString(this.workDirectoryTextField.getText()));
- BatchApplicationDeploymentDescriptionType appDesc1 = (BatchApplicationDeploymentDescriptionType) appDesc;
- // this.tmpDirTextField.getText is not yet set to any value.
- // Don't know how the job type is setting Enum has three values
- appDesc1.getJobType();
- if(pCount != null){
- appDesc1.setCpuCount(pCount);
- }
- if(maxWallTime != null){
- appDesc1.setMaxWallTime(maxWallTime);
- }
- ProjectAccountType projectAccountType = appDesc1.addNewProjectAccount();
- projectAccountType.setProjectAccountNumber(projectName);
-
- QueueType queueType = appDesc1.addNewQueue();
- queueType.setQueueName(queue);
-
- /*--- save to registry ---*/
- this.engine.getConfiguration().getJcrComponentRegistry()
- .saveDeploymentDescription(projectName, hostName, deploymentDescription);
- } catch (Exception e) {
- e.printStackTrace();
- this.hide();
- return;
- }
-
- /* Clear All The Fields */
- clearAllTextFields();
-
- /* "Close" the windows */
- this.hide();
-
- }// GEN-LAST:event_addApplicationButtonActionPerformed
-
- private void cancelButtonActionPerformed() {// GEN-FIRST:event_cancelButtonActionPerformed
- this.addApplicationButton.setText("Add Application");
- clearAllTextFields();
- this.hide();
- }// GEN-LAST:event_cancelButtonActionPerformed
-
- /**
- * @return Status
- */
- public boolean isEngineSet() {
- if (this.engine == null) {
- return false;
- }
- return true;
- }
-
- /**
- * @param engine
- */
- public void setXBayaEngine(XBayaEngine engine) {
- this.engine = engine;
- initGUI();
- }
-
- /**
- * hide the dialog
- */
- public void hide() {
- this.dialog.hide();
- }
-
- /**
- * show the dialog
- */
- public void show() {
- // this.reinitHostComboBox();
- this.dialog.show();
- }
-
- /**
- * @param appBean
- */
- public void show(ApplicationBean appBean) {
- initTextField(appBean);
- this.dialog.show();
- }
-
-}
\ No newline at end of file
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ArgumentsConfigWindow.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ArgumentsConfigWindow.java?rev=1196012&r1=1196011&r2=1196012&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ArgumentsConfigWindow.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ArgumentsConfigWindow.java Tue Nov 1 14:31:09 2011
@@ -1,159 +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.appwrapper;
-
-import java.util.List;
-
-import javax.swing.DefaultComboBoxModel;
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.SwingConstants;
-
-import org.apache.airavata.xbaya.XBayaEngine;
-import org.apache.airavata.xbaya.gui.GridPanel;
-import org.apache.airavata.xbaya.gui.XBayaDialog;
-import org.apache.airavata.common.utils.StringUtil;
-import org.ogce.schemas.gfac.beans.utils.ParamObject;
-
-public class ArgumentsConfigWindow {
- private XBayaDialog dialog;
-
- private XBayaEngine engine;
-
- private GridPanel argsPanel;
-
- private List<ParamObject> arguments;
-
- private int rows;
-
- /**
- * Constructs a ArgumentsConfigWindow.
- *
- * @param numOfArgs
- * @param args
- * @param engine
- */
- public ArgumentsConfigWindow(int numOfArgs, List<ParamObject> args, XBayaEngine engine) {
- this.engine = engine;
- this.arguments = args;
- this.rows = numOfArgs;
- initArgsPanel();
- initGUI();
- }
-
- /**
- * Constructs a ArgumentsConfigWindow.
- *
- * @param args
- * @param engine
- */
- public ArgumentsConfigWindow(List<ParamObject> args, XBayaEngine engine) {
- this(args.size(), args, engine);
- }
-
- private void initArgsPanel() {
- // init argsPanel
- this.argsPanel = new GridPanel();
-
- this.argsPanel.add(new JLabel("Input Name", SwingConstants.CENTER));
- this.argsPanel.add(new JLabel("Input Description", SwingConstants.CENTER));
- this.argsPanel.add(new JLabel("Input Type", SwingConstants.CENTER));
-
- for (int i = 0; i < this.rows; i++) {
- String name;
- String desc;
- String type;
- if (i < this.arguments.size()) {
- name = this.arguments.get(i).getName();
- desc = this.arguments.get(i).getDesc();
- type = this.arguments.get(i).getType();
- } else {
- name = "";
- desc = "";
- type = "String";
- }
- this.argsPanel.add(new JTextField(name));
- this.argsPanel.add(new JTextField(desc));
- JComboBox typeComboBox = new JComboBox(new DefaultComboBoxModel(new String[] { "String", "Integer",
- "Float", "Double", "Boolean", "URI", "StringArray", "IntegerArray", "FloatArray", "DoubleArray",
- "BooleanArray", "URIArray", "XmlElement", "HostName" }));
- typeComboBox.setSelectedItem(type);
- this.argsPanel.add(typeComboBox);
- }
-
- this.argsPanel.layout(this.rows + 1, 3, GridPanel.WEIGHT_NONE, 1);
- }
-
- private void initGUI() {
-
- JPanel buttonsPanel = new JPanel();
- JButton okButton = new JButton("ok");
- JButton cancelButton = new JButton("cancel");
-
- okButton.addActionListener(new java.awt.event.ActionListener() {
- @Override
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- okButtonActionPerformed();
- }
- });
-
- cancelButton.addActionListener(new java.awt.event.ActionListener() {
- @Override
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- cancelButtonActionPerformed();
- }
- });
-
- buttonsPanel.add(okButton);
- buttonsPanel.add(cancelButton);
-
- this.dialog = new XBayaDialog(this.engine, "Arguments Configuration", this.argsPanel, buttonsPanel);
- this.dialog.setDefaultButton(cancelButton);
- this.dialog.show();
- }
-
- private void okButtonActionPerformed() {
- this.arguments.clear();
- for (int i = 0; i < this.rows; i++) {
- this.arguments.add(getParamAt(i));
- }
-
- this.dialog.getDialog().dispose();
- }
-
- private void cancelButtonActionPerformed() {
- this.dialog.getDialog().dispose();
- }
-
- private ParamObject getParamAt(int row) {
- String name = StringUtil.trimSpaceInString(((JTextField) this.argsPanel.getSwingComponent().getComponent(
- row * 3 + 3)).getText());
- String desc = ((JTextField) this.argsPanel.getSwingComponent().getComponent(row * 3 + 4)).getText();
- String type = (String) ((JComboBox) this.argsPanel.getSwingComponent().getComponent(row * 3 + 5))
- .getSelectedItem();
- ParamObject paramObject = new ParamObject(name, type, row, desc);
- return paramObject;
- }
-}
\ No newline at end of file
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/HostDescriptionRegistrationWindow.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/HostDescriptionRegistrationWindow.java?rev=1196012&r1=1196011&r2=1196012&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/HostDescriptionRegistrationWindow.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/HostDescriptionRegistrationWindow.java Tue Nov 1 14:31:09 2011
@@ -1,474 +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.appwrapper;
-
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
-
-import org.apache.airavata.common.utils.StringUtil;
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.xbaya.XBayaEngine;
-import org.apache.airavata.xbaya.gui.GridPanel;
-import org.apache.airavata.xbaya.gui.XBayaComboBox;
-import org.apache.airavata.xbaya.gui.XBayaDialog;
-import org.apache.airavata.xbaya.gui.XBayaLabel;
-import org.apache.airavata.xbaya.gui.XBayaTextField;
-import org.apache.airavata.xbaya.registry.RegistryAccesser;
-import org.ogce.schemas.gfac.beans.HostBean;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-
-public class HostDescriptionRegistrationWindow {
- private XBayaDialog dialog;
-
- private XBayaEngine engine;
-
- private JButton addHostButton;
- private JButton cancelButton;
- private XBayaLabel gateKeeperEndPointLabel;
- private XBayaLabel jobManagerLabel;
- private XBayaComboBox gateKeeprEndpointComboBox;
- private XBayaLabel gridFTPendpointLabel;
- private XBayaComboBox gridFTPEndPointComboBox;
- private XBayaLabel hostEnvLabel;
- private XBayaTextField hostEnvTextField;
- private XBayaComboBox hostNameComboBox;
- private XBayaLabel hostNameLabel;
- private XBayaLabel isPublicLabel;
- private JCheckBox isPublicCheckBox;
- private JList serviceTypesList;
- private JScrollPane serviceTypesScrollPanel;
- private XBayaComboBox jobManagerComboBox;
- private XBayaLabel serviceTypesLabel;
- private JCheckBox sshEnabledCheckBox;
- private XBayaLabel sshEnabledLabel;
- private XBayaLabel tempDirLabel;
- private XBayaTextField tempDirTextField;
- private XBayaLabel wsGramLabel;
- private JCheckBox wsGramPresentCheckBox;
- private XBayaLabel gfacPathLabel;
- private XBayaTextField gfacPathTextField;
- private XBayaLabel jdkNameLabel;
- private XBayaComboBox jdkNameComboBox;
- private XBayaLabel jdkPathLabel;
- private XBayaTextField jdkPathTextField;
-
- private boolean isEditing = false;
-
- private HostBean editingHostBean;
-
- private static HostDescriptionRegistrationWindow window;
-
- /**
- * Constructs a AmazonS3UtilsWindow.
- *
- * @param engine
- */
- private HostDescriptionRegistrationWindow(XBayaEngine engine) {
- this.engine = engine;
- initGUI();
- }
-
- private HostDescriptionRegistrationWindow() {
- // Intend to be blank;
- }
-
- /**
- * @return ApplicationRegistrationWindow
- */
- public static HostDescriptionRegistrationWindow getInstance() {
- if (window == null) {
- window = new HostDescriptionRegistrationWindow();
- }
-
- return window;
- }
-
- private Object[] initHostNameList() {
-
- Document document = XMLUtil.retrievalXMLDocFromUrl("http://info.teragrid.org/web-apps/XML/ctss-resources-v1/");
- NodeList nodeList = document.getElementsByTagName("Resource");
- List<String> nameList = new ArrayList<String>();
- for (int i = 0; i < nodeList.getLength(); i++) {
- nameList.add(nodeList.item(i).getAttributes().getNamedItem("UniqueID").getNodeValue());
- }
- return nameList.toArray();
-
- }
-
- private Object[] initGridFtpEndPoint() {
- Document document = XMLUtil.retrievalXMLDocFromUrl("http://info.teragrid.org/restdemo/xml/tg/services/gridftp");
- NodeList nodeList = document.getElementsByTagName("Service");
- List<String> endPointList = new ArrayList<String>();
- for (int i = 0; i < nodeList.getLength(); i++) {
- String resourceID = nodeList.item(i).getAttributes().getNamedItem("ResourceID").getNodeValue();
- if (resourceID.equals(this.hostNameComboBox.getText())) {
- endPointList.add(nodeList.item(i).getAttributes().getNamedItem("Endpoint").getNodeValue());
- }
- }
- return endPointList.toArray();
- }
-
- private Object[] gateWayEndPoint() {
-
- Document document = XMLUtil
- .retrievalXMLDocForParse("http://info.teragrid.org/web-apps/xml/ctss-services-v1/resource/"
- + this.hostNameComboBox.getText());
- NamespaceContext ctx = new NamespaceContext() {
- public String getNamespaceURI(String prefix) {
- String uri;
- if (prefix.equals("tg"))
- uri = "http://mds.teragrid.org/2007/02/ctss";
- else if (prefix.equals("xlink"))
- uri = "http://www.w3.org/1999/xlink";
- else
- uri = null;
- return uri;
- }
-
- // Dummy implementation - not used!
- @SuppressWarnings("unchecked")
- public Iterator getPrefixes(String val) {
- return null;
- }
-
- // Dummy implemenation - not used!
- public String getPrefix(String uri) {
- return null;
- }
- };
-
- // Now the XPath expression
- String xpathStr = "/tg:Kit.Services/Service/Endpoint/text()";
- XPathFactory xpathFact = XPathFactory.newInstance();
- XPath xpath = xpathFact.newXPath();
- xpath.setNamespaceContext(ctx);
-
- try {
- Object endPoint;
-
- endPoint = xpath.evaluate(xpathStr, document, XPathConstants.NODESET);
-
- NodeList nodeList = (NodeList) endPoint;
-
- Set<String> endPoints = new HashSet<String>();
- for (int i = 0; i < nodeList.getLength(); i++) {
- String ep = nodeList.item(i).getNodeValue();
- if (ep.indexOf("jobmanager") > 0) {
- endPoints.add(ep);
- }
- }
-
- return endPoints.toArray();
- } catch (XPathExpressionException e) {
- e.printStackTrace();
- }
-
- return null;
- }
-
- /**
- * Clear All TextFields
- */
- private void clearAllTextFields() {
- this.hostEnvTextField.setText("");
- this.tempDirTextField.setText("/tmp");
- this.gfacPathTextField.setText("");
- this.jdkPathTextField.setText("");
- this.jdkNameComboBox.setSelectedItem("jdk1.5");
- }
-
- /**
- * @param hostBean
- */
- public void initTextField(HostBean hostBean) {
- this.isEditing = true;
- this.editingHostBean = hostBean;
- this.hostNameComboBox.setSelectedItem(hostBean.getHostName());
- if (!(hostBean.getServiceType() == null)) {
- for (String serviceType : hostBean.getServiceType()) {
- this.serviceTypesList.setSelectedValue(serviceType, false);
- }
- }
- this.gateKeeprEndpointComboBox.setModel(new javax.swing.DefaultComboBoxModel(gateWayEndPoint()));
-
- this.gridFTPEndPointComboBox.setModel(new javax.swing.DefaultComboBoxModel(initGridFtpEndPoint()));
- this.hostEnvTextField.setText(hostBean.getHostEnv());
- this.tempDirTextField.setText(hostBean.getTmpDir());
- this.sshEnabledCheckBox.setSelected(hostBean.isSshEnabled());
- this.jobManagerComboBox.setSelectedItem(hostBean.getGateKeeperName());
- this.gateKeeprEndpointComboBox.setSelectedItem(hostBean.getGateKeeperendPointReference());
- this.wsGramPresentCheckBox.setSelected(hostBean.isWsGram());
- this.gridFTPEndPointComboBox.setSelectedItem(hostBean.getGridFtpendPointReference());
-
- if (hostBean.getgFacPath() != null && !hostBean.getgFacPath().isEmpty()) {
- this.gfacPathTextField.setText(hostBean.getgFacPath());
- }
-
- if (hostBean.getJdkPath() != null && !hostBean.getJdkPath().isEmpty()) {
- this.jdkPathTextField.setText(hostBean.getJdkPath());
- this.jdkNameComboBox.setSelectedItem(hostBean.getJdkName());
- }
-
- this.addHostButton.setText("Update Host");
- }
-
- private void initGUI() {
- GridPanel infoPanel = new GridPanel();
- this.hostNameComboBox = new XBayaComboBox(new javax.swing.DefaultComboBoxModel(initHostNameList()));
- this.hostNameComboBox.setEditable(true);
- this.hostNameComboBox.getJComboBox().addItemListener(new ItemListener() {
- @Override
- public void itemStateChanged(ItemEvent arg0) {
- HostDescriptionRegistrationWindow.this.gateKeeprEndpointComboBox
- .setModel(new javax.swing.DefaultComboBoxModel(gateWayEndPoint()));
-
- HostDescriptionRegistrationWindow.this.gridFTPEndPointComboBox
- .setModel(new javax.swing.DefaultComboBoxModel(initGridFtpEndPoint()));
- }
- });
- this.hostNameLabel = new XBayaLabel("Host Name", this.hostNameComboBox);
-
- this.serviceTypesScrollPanel = new JScrollPane();
- this.serviceTypesList = new JList();
- this.serviceTypesList.setModel(new javax.swing.AbstractListModel() {
- String[] strings = { "gram5", "ws-gram" };
-
- @Override
- public int getSize() {
- return this.strings.length;
- }
-
- @Override
- public Object getElementAt(int i) {
- return this.strings[i];
- }
- });
- this.serviceTypesScrollPanel.setViewportView(this.serviceTypesList);
- this.serviceTypesLabel = new XBayaLabel("Service Types", this.serviceTypesList);
-
- this.hostEnvTextField = new XBayaTextField();
- this.hostEnvLabel = new XBayaLabel("Host Environment", this.hostEnvTextField);
-
- this.tempDirTextField = new XBayaTextField("/tmp");
- this.tempDirLabel = new XBayaLabel("Temp Dir", this.tempDirTextField);
-
- this.sshEnabledCheckBox = new JCheckBox();
- this.sshEnabledCheckBox.setSelected(false);
- this.sshEnabledLabel = new XBayaLabel("SSH Enabled", this.sshEnabledCheckBox);
-
- this.jobManagerComboBox = new XBayaComboBox(new javax.swing.DefaultComboBoxModel(new String[] { "PBS", "FORK",
- "LSF", "MULTI", "CONDOR", "SPRUCE", "LoadLeveler" }));
- this.jobManagerLabel = new XBayaLabel("Gate Keeper JobManager", this.jobManagerComboBox);
-
- this.gateKeeprEndpointComboBox = new XBayaComboBox(new javax.swing.DefaultComboBoxModel(gateWayEndPoint()));
- this.gateKeeperEndPointLabel = new XBayaLabel("GateKeeper EndPoint", this.gateKeeprEndpointComboBox);
-
- this.wsGramPresentCheckBox = new JCheckBox();
- this.wsGramPresentCheckBox.setSelected(false);
- this.wsGramLabel = new XBayaLabel("WSGram Present", this.wsGramPresentCheckBox);
-
- this.gridFTPEndPointComboBox = new XBayaComboBox(new javax.swing.DefaultComboBoxModel(initGridFtpEndPoint()));
- this.gridFTPendpointLabel = new XBayaLabel("GridFtp Endpoint", this.gridFTPEndPointComboBox);
-
- this.isPublicCheckBox = new JCheckBox();
- this.isPublicCheckBox.setSelected(false);
- this.isPublicLabel = new XBayaLabel("Is Public", this.isPublicCheckBox);
-
- this.gfacPathTextField = new XBayaTextField();
- this.gfacPathLabel = new XBayaLabel("GFac Path (Optional)", this.gfacPathTextField);
-
- this.jdkNameComboBox = new XBayaComboBox(new javax.swing.DefaultComboBoxModel(new String[] { "jdk 1.4",
- "jdk 1.5", "jdk 1.6" }));
- this.jdkNameComboBox.setSelectedItem("jdk 1.5");
- this.jdkNameLabel = new XBayaLabel("JDK Name (Optional)", this.jdkNameComboBox);
-
- this.jdkPathTextField = new XBayaTextField();
- this.jdkPathLabel = new XBayaLabel("JDK Path (Optional)", this.jdkPathTextField);
-
- infoPanel.add(this.hostNameLabel);
- infoPanel.add(this.hostNameComboBox);
- infoPanel.add(this.serviceTypesLabel);
- infoPanel.add(this.serviceTypesScrollPanel);
- infoPanel.add(this.hostEnvLabel);
- infoPanel.add(this.hostEnvTextField);
- infoPanel.add(this.tempDirLabel);
- infoPanel.add(this.tempDirTextField);
- infoPanel.add(this.sshEnabledLabel);
- infoPanel.add(this.sshEnabledCheckBox);
- infoPanel.add(this.jobManagerLabel);
- infoPanel.add(this.jobManagerComboBox);
- infoPanel.add(this.gateKeeperEndPointLabel);
- infoPanel.add(this.gateKeeprEndpointComboBox);
- infoPanel.add(this.wsGramLabel);
- infoPanel.add(this.wsGramPresentCheckBox);
- infoPanel.add(this.gridFTPendpointLabel);
- infoPanel.add(this.gridFTPEndPointComboBox);
- infoPanel.add(this.isPublicLabel);
- infoPanel.add(this.isPublicCheckBox);
- infoPanel.add(this.gfacPathLabel);
- infoPanel.add(this.gfacPathTextField);
- infoPanel.add(this.jdkNameLabel);
- infoPanel.add(this.jdkNameComboBox);
- infoPanel.add(this.jdkPathLabel);
- infoPanel.add(this.jdkPathTextField);
-
- infoPanel.layout(13, 2, GridPanel.WEIGHT_NONE, 1);
-
- JPanel buttonPanel = new JPanel();
- this.addHostButton = new JButton();
- this.addHostButton.setText("Add Host");
- this.addHostButton.addActionListener(new java.awt.event.ActionListener() {
- @Override
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- addHostButtonActionPerformed();
- }
- });
-
- this.cancelButton = new JButton();
- this.cancelButton.setText("Cancel");
- this.cancelButton.addActionListener(new java.awt.event.ActionListener() {
- @Override
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- cancelButtonActionPerformed();
- }
- });
-
- buttonPanel.add(this.addHostButton);
- buttonPanel.add(this.cancelButton);
-
- this.dialog = new XBayaDialog(this.engine, "Register Host Description", infoPanel, buttonPanel);
- this.dialog.setDefaultButton(this.cancelButton);
- }
-
- private void addHostButtonActionPerformed() {// GEN-FIRST:event_addHostButtonActionPerformed
-
- this.addHostButton.setText("Add Host");
-
- /* Input Validity Check */
- // TODO
-
- try {
- /* Generate Bean Object */
- HostBean hostBean = new HostBean();
- hostBean.setHostName(this.hostNameComboBox.getText());
- Object[] serviceTypes = this.serviceTypesList.getSelectedValues();
- List<String> serviceTypesArrayList = new ArrayList<String>();
- for (Object obj : serviceTypes) {
- serviceTypesArrayList.add((String) obj);
- }
- hostBean.setServiceType(serviceTypesArrayList);
- hostBean.setHostEnv(StringUtil.trimSpaceInString(this.hostEnvTextField.getText()));
- hostBean.setTmpDir(StringUtil.trimSpaceInString(this.tempDirTextField.getText()));
- hostBean.setSshEnabled(this.sshEnabledCheckBox.isSelected());
- hostBean.setGateKeeperJobManager(this.jobManagerComboBox.getText());
- hostBean.setGateKeeperendPointReference(this.gateKeeprEndpointComboBox.getText());
- hostBean.setWsGram(this.wsGramPresentCheckBox.isSelected());
- hostBean.setGridFtpendPointReference(this.gridFTPEndPointComboBox.getText());
-
- if (!this.gfacPathTextField.getText().isEmpty()) {
- hostBean.setgFacPath(this.gfacPathTextField.getText());
- }
-
- if (!this.jdkPathTextField.getText().isEmpty()) {
- hostBean.setJdkPath(this.jdkPathTextField.getText());
- hostBean.setJdkName(this.jdkNameComboBox.getText());
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- this.hide();
- return;
- }
-
- /* Clear All The Fields */
- clearAllTextFields();
-
- /* "Close" the windows */
- this.hide();
-
- }// GEN-LAST:event_addHostButtonActionPerformed
-
- private void cancelButtonActionPerformed() {// GEN-FIRST:event_cancelButtonActionPerformed
- this.isEditing = false;
- this.addHostButton.setText("Add Host");
- clearAllTextFields();
- this.hide();
- }// GEN-LAST:event_cancelButtonActionPerformed
-
- /**
- * @return Status
- */
- public boolean isEngineSet() {
- if (this.engine == null) {
- return false;
- }
- return true;
- }
-
- /**
- * @param engine
- */
- public void setXBayaEngine(XBayaEngine engine) {
- this.engine = engine;
- initGUI();
- }
-
- /**
- * hide the dialog
- */
- public void hide() {
- this.dialog.hide();
- }
-
- /**
- * show the dialog
- */
- public void show() {
- this.dialog.show();
- }
-
- /**
- * @param hostBean
- */
- public void show(HostBean hostBean) {
- initTextField(hostBean);
- this.show();
- }
-
-}
\ No newline at end of file
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/RegisterApplicationsMenu.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/RegisterApplicationsMenu.java?rev=1196012&r1=1196011&r2=1196012&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/RegisterApplicationsMenu.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/RegisterApplicationsMenu.java Tue Nov 1 14:31:09 2011
@@ -126,7 +126,6 @@ public class RegisterApplicationsMenu {
this.registerServiceDesc = new JMenuItem("Register Application Service Description");
this.registerServiceDesc.addActionListener(new AbstractAction() {
- private ServiceDescriptionRegistrationWindow window;
@Override
public void actionPerformed(ActionEvent e) {
@@ -149,7 +148,6 @@ public class RegisterApplicationsMenu {
this.registerApplicationDesc = new JMenuItem("Register Application Deployment Description");
this.registerApplicationDesc.addActionListener(new AbstractAction() {
- private ApplicationDescriptionRegistrationWindow window;
@Override
public void actionPerformed(ActionEvent e) {
@@ -172,7 +170,6 @@ public class RegisterApplicationsMenu {
this.registerHostDesc = new JMenuItem("Register Compute/Service Host Description");
this.registerHostDesc.addActionListener(new AbstractAction() {
- private HostDescriptionRegistrationWindow window;
@Override
public void actionPerformed(ActionEvent e) {
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ServiceDescriptionRegistrationWindow.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ServiceDescriptionRegistrationWindow.java?rev=1196012&r1=1196011&r2=1196012&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ServiceDescriptionRegistrationWindow.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ServiceDescriptionRegistrationWindow.java Tue Nov 1 14:31:09 2011
@@ -1,364 +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.appwrapper;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.DefaultComboBoxModel;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JSpinner;
-import javax.swing.SpinnerNumberModel;
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.common.utils.NameValidator;
-import org.apache.airavata.xbaya.XBayaEngine;
-import org.apache.airavata.xbaya.gui.GridPanel;
-import org.apache.airavata.xbaya.gui.XBayaComboBox;
-import org.apache.airavata.xbaya.gui.XBayaDialog;
-import org.apache.airavata.xbaya.gui.XBayaLabel;
-import org.apache.airavata.xbaya.gui.XBayaTextField;
-import org.apache.airavata.common.utils.StringUtil;
-import org.apache.airavata.xbaya.registry.RegistryAccesser;
-import org.ogce.schemas.gfac.beans.MethodBean;
-import org.ogce.schemas.gfac.beans.ServiceBean;
-import org.ogce.schemas.gfac.beans.utils.ParamObject;
-
-public class ServiceDescriptionRegistrationWindow {
- private XBayaDialog dialog;
-
- private XBayaEngine engine;
-
- private XBayaComboBox appNameComboBox;
- private XBayaLabel appNameLabel;
- private XBayaLabel inactivityLimitLabel;
- private XBayaTextField inactivityLimitTextField;
- private XBayaLabel inputNumLabel;
- private JSpinner outputNumSpinner;
- private XBayaLabel methodDescLabel;
- private XBayaTextField methodDescTextField;
- private XBayaLabel methodNameLabel;
- private XBayaTextField methodNameTextField;
- private XBayaLabel outputNumLabel;
- private JSpinner inputNumSpinner;
- private XBayaLabel serviceNameLabel;
- private XBayaTextField serviceNameTextField;
-
- private JButton configInputsButton;
- private JButton configOutputsButton;
- private JButton addServiceButton;
- private JButton cancelButton;
-
- private boolean isEditing = false;
-
- private ServiceBean editingServiceBean;
-
- private List<ParamObject> inputArguments = new ArrayList<ParamObject>();
- private List<ParamObject> outputArguments = new ArrayList<ParamObject>();
-
- private static ServiceDescriptionRegistrationWindow window;
-
- /**
- * Constructs a ServiceDescriptionRegistrationWindow.
- *
- * @param engine
- */
- private ServiceDescriptionRegistrationWindow(XBayaEngine engine) {
- this.engine = engine;
- initGUI();
- }
-
- private ServiceDescriptionRegistrationWindow() {
- // Intend to be blank;
- }
-
- /**
- * @return ServiceDescriptionRegistrationWindow
- */
- public static ServiceDescriptionRegistrationWindow getInstance() {
- if (window == null) {
- window = new ServiceDescriptionRegistrationWindow();
- }
-
- return window;
- }
-
- /**
- * Clear ALl the TextFields
- */
- private void clearAllTextFields() {
- this.inactivityLimitTextField.setText("15");
- this.methodDescTextField.setText("");
- this.methodNameTextField.setText("");
- this.serviceNameTextField.setText("");
- this.inputNumSpinner.setValue(0);
- this.outputNumSpinner.setValue(0);
- this.inputArguments.clear();
- this.outputArguments.clear();
- }
-
- /**
- * @param serviceBean
- */
- public void initTextFields(ServiceBean serviceBean) {
- this.isEditing = true;
- this.editingServiceBean = serviceBean;
- this.serviceNameTextField.setText(serviceBean.getServiceName());
- this.appNameComboBox.setSelectedItem(serviceBean.getApplicationName());
- this.inactivityLimitTextField.setText(Integer.toString(serviceBean.getNotAfterInactiveMinutes()));
- MethodBean methodBean = serviceBean.getMethodBean();
- this.methodNameTextField.setText(methodBean.getMethodName());
- this.methodDescTextField.setText(methodBean.getMethodDescription());
- this.inputNumSpinner.setValue(methodBean.getInputParms().size());
- this.outputNumSpinner.setValue(methodBean.getOutputParms().size());
-
- this.inputArguments = methodBean.getInputParms();
- this.outputArguments = methodBean.getOutputParms();
-
- this.addServiceButton.setText("Update Service");
- }
-
- private void initGUI() {
- GridPanel infoPanel = new GridPanel();
-
- this.serviceNameTextField = new XBayaTextField();
- this.serviceNameLabel = new XBayaLabel("Service Name", this.serviceNameTextField);
-
- this.inactivityLimitTextField = new XBayaTextField("15");
- this.inactivityLimitLabel = new XBayaLabel("Inactivity Limit", this.inactivityLimitTextField);
-
- this.methodNameTextField = new XBayaTextField();
- this.methodNameLabel = new XBayaLabel("Method Name", this.methodNameTextField);
-
- this.methodDescTextField = new XBayaTextField();
- this.methodDescLabel = new XBayaLabel("Method Description", this.methodDescTextField);
-
- // this.appNameComboBox = new XBayaComboBox(new DefaultComboBoxModel(initApplicationNameList()));
- this.appNameLabel = new XBayaLabel("Application Name", this.appNameComboBox);
-
- this.inputNumSpinner = new JSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1));
- this.inputNumLabel = new XBayaLabel("Number of Inputs", this.inputNumSpinner);
-
- JLabel inputDumpLabel = new JLabel();
- this.configInputsButton = new JButton("Config Inputs");
- this.configInputsButton.addActionListener(new java.awt.event.ActionListener() {
- @Override
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- configInputsButtonActionPerformed();
- }
- });
-
- this.outputNumSpinner = new JSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1));
- this.outputNumLabel = new XBayaLabel("Number of Outputs", this.outputNumSpinner);
-
- JLabel outputDumpLabel = new JLabel();
- this.configOutputsButton = new JButton("Config Outputs");
- this.configOutputsButton.addActionListener(new java.awt.event.ActionListener() {
- @Override
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- configOutputsButtonActionPerformed();
- }
- });
-
- infoPanel.add(this.serviceNameLabel);
- infoPanel.add(this.serviceNameTextField);
- infoPanel.add(this.inactivityLimitLabel);
- infoPanel.add(this.inactivityLimitTextField);
- infoPanel.add(this.methodNameLabel);
- infoPanel.add(this.methodNameTextField);
- infoPanel.add(this.methodDescLabel);
- infoPanel.add(this.methodDescTextField);
- infoPanel.add(this.appNameLabel);
- infoPanel.add(this.appNameComboBox);
- infoPanel.add(this.inputNumLabel);
- infoPanel.add(this.inputNumSpinner);
- infoPanel.add(inputDumpLabel);
- infoPanel.add(this.configInputsButton);
- infoPanel.add(this.outputNumLabel);
- infoPanel.add(this.outputNumSpinner);
- infoPanel.add(outputDumpLabel);
- infoPanel.add(this.configOutputsButton);
-
- infoPanel.layout(9, 2, GridPanel.WEIGHT_NONE, 1);
-
- JPanel buttonPanel = new JPanel();
- this.addServiceButton = new JButton("Add Service");
- this.addServiceButton.addActionListener(new java.awt.event.ActionListener() {
- @Override
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- addServiceButtonActionPerformed();
- }
- });
- this.cancelButton = new JButton("Cancel");
- this.cancelButton.addActionListener(new java.awt.event.ActionListener() {
- @Override
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- cancelButtonActionPerformed();
- }
- });
-
- buttonPanel.add(this.addServiceButton);
- buttonPanel.add(this.cancelButton);
-
- this.dialog = new XBayaDialog(this.engine, "Register Service Description", infoPanel, buttonPanel);
- this.dialog.setDefaultButton(this.cancelButton);
- }
-
- private void addServiceButtonActionPerformed() {// GEN-FIRST:event_addServiceButtonActionPerformed
-
- this.addServiceButton.setText("Add Service");
-
- /* Input Validity Check */
- if (!NameValidator.validate(this.serviceNameTextField.getText())) {
- JOptionPane.showMessageDialog(this.dialog.getDialog(), "Service Name Invalid", "Error",
- JOptionPane.ERROR_MESSAGE);
- this.serviceNameTextField.getSwingComponent().requestFocus();
- return;
- }
-
- if (!NameValidator.validate(this.methodNameTextField.getText())) {
- JOptionPane.showMessageDialog(this.dialog.getDialog(), "Method Name Invalid", "Error",
- JOptionPane.ERROR_MESSAGE);
- this.methodNameTextField.getSwingComponent().requestFocus();
- return;
- }
-
- /* Generate Bean Object */
- try {
- ServiceBean serviceBean = new ServiceBean();
- serviceBean.setServiceName(StringUtil.trimSpaceInString(this.serviceNameTextField.getText()));
- serviceBean.setApplicationName(this.appNameComboBox.getText());
- serviceBean.setNotAfterInactiveMinutes(Integer.parseInt(this.inactivityLimitTextField.getText()));
-
- MethodBean methodBean = new MethodBean();
- methodBean.setMethodName(StringUtil.trimSpaceInString(this.methodNameTextField.getText()));
- methodBean.setMethodDescription(this.methodDescTextField.getText());
-
- // input arguments setup
- for (ParamObject paraObject : this.inputArguments) {
- methodBean.addInputParms(paraObject);
- }
-
- // output arguments setup
- for (ParamObject paraObject : this.outputArguments) {
- methodBean.addOutputParms(paraObject);
- }
-
- serviceBean.setMethodBean(methodBean);
-
- } catch (Exception e) {
- this.engine.getErrorWindow().error(this.dialog.getDialog(), e.getMessage(), e);
- this.hide();
- return;
- }
-
- /* Clear All The Fields */
- clearAllTextFields();
-
- /* "Close" the windows */
- this.hide();
-
- }// GEN-LAST:event_addServiceButtonActionPerformed
-
- private void cancelButtonActionPerformed() {// GEN-FIRST:event_cancelButtonActionPerformed
- this.isEditing = false;
- this.addServiceButton.setText("Add Service");
- clearAllTextFields();
- this.hide();
- }// GEN-LAST:event_cancelButtonActionPerformed
-
- private void configInputsButtonActionPerformed() {// GEN-FIRST:event_configInputsButtonActionPerformed
- try {
- if (((Integer) this.inputNumSpinner.getValue()).intValue() != 0) {
- int number = ((Integer) this.inputNumSpinner.getValue()).intValue();
- new ArgumentsConfigWindow(number, this.inputArguments, this.engine);
- } else {
- JOptionPane.showMessageDialog(this.dialog.getDialog(), "Please input the number of inputs", "Message",
- JOptionPane.INFORMATION_MESSAGE);
- }
- } catch (Exception e) {
- JOptionPane.showMessageDialog(this.dialog.getDialog(), "Invalid Input Parameter", "Error",
- JOptionPane.ERROR_MESSAGE);
- }
-
- }// GEN-LAST:event_configInputsButtonActionPerformed
-
- private void configOutputsButtonActionPerformed() {// GEN-FIRST:event_configOutputsButtonActionPerformed
- try {
- if (((Integer) this.outputNumSpinner.getValue()).intValue() != 0) {
- int number = ((Integer) this.outputNumSpinner.getValue()).intValue();
- new ArgumentsConfigWindow(number, this.outputArguments, this.engine);
- } else {
- JOptionPane.showMessageDialog(this.dialog.getDialog(), "Please input the number of outputs", "Message",
- JOptionPane.INFORMATION_MESSAGE);
- }
- } catch (Exception e) {
- JOptionPane.showMessageDialog(this.dialog.getDialog(), "Invalid Output Parameter", "Error",
- JOptionPane.ERROR_MESSAGE);
- }
-
- }// GEN-LAST:event_configOutputsButtonActionPerformed
-
- /**
- * @return Status
- */
- public boolean isEngineSet() {
- if (this.engine == null) {
- return false;
- }
- return true;
- }
-
- /**
- * @param engine
- */
- public void setXBayaEngine(XBayaEngine engine) {
- this.engine = engine;
- initGUI();
- }
-
- /**
- * hide the dialog
- */
- public void hide() {
- this.dialog.hide();
- }
-
- /**
- * show the dialog
- */
- public void show() {
- // this.reinitApplicationComboBox();
- this.dialog.show();
- }
-
- /**
- * @param serviceBean
- */
- public void show(ServiceBean serviceBean) {
- initTextFields(serviceBean);
- this.dialog.show();
- }
-}
\ No newline at end of file
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/dynamic/gui/DynamicWorkflowRunnerWindow.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/dynamic/gui/DynamicWorkflowRunnerWindow.java?rev=1196012&r1=1196011&r2=1196012&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/dynamic/gui/DynamicWorkflowRunnerWindow.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/graph/dynamic/gui/DynamicWorkflowRunnerWindow.java Tue Nov 1 14:31:09 2011
@@ -21,42 +21,15 @@
package org.apache.airavata.xbaya.graph.dynamic.gui;
-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.DefaultComboBoxModel;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.xml.namespace.QName;
-
import org.apache.airavata.common.utils.StringUtil;
import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.xbaya.XBayaConfiguration;
-import org.apache.airavata.xbaya.XBayaConstants;
import org.apache.airavata.xbaya.XBayaEngine;
import org.apache.airavata.xbaya.XBayaException;
-import org.apache.airavata.xbaya.appwrapper.HostDescriptionRegistrationWindow;
import org.apache.airavata.xbaya.graph.system.InputNode;
import org.apache.airavata.xbaya.graph.util.GraphUtil;
import org.apache.airavata.xbaya.graph.ws.WSNode;
import org.apache.airavata.xbaya.graph.ws.gui.WSNodeGUI;
-import org.apache.airavata.xbaya.gui.ErrorMessages;
-import org.apache.airavata.xbaya.gui.GridPanel;
-import org.apache.airavata.xbaya.gui.XBayaComboBox;
-import org.apache.airavata.xbaya.gui.XBayaDialog;
-import org.apache.airavata.xbaya.gui.XBayaLabel;
-import org.apache.airavata.xbaya.gui.XBayaTextField;
+import org.apache.airavata.xbaya.gui.*;
import org.apache.airavata.xbaya.interpretor.WorkflowInterpreter;
import org.apache.airavata.xbaya.jython.script.JythonScript;
import org.apache.airavata.xbaya.monitor.MonitorConfiguration;
@@ -64,15 +37,20 @@ import org.apache.airavata.xbaya.monitor
import org.apache.airavata.xbaya.ode.ODEClient;
import org.apache.airavata.xbaya.util.XBayaUtil;
import org.apache.airavata.xbaya.wf.Workflow;
-import org.ogce.schemas.gfac.beans.HostBean;
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;
+import javax.swing.*;
+import javax.xml.namespace.QName;
+import java.awt.event.ActionEvent;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.*;
+
public class DynamicWorkflowRunnerWindow {
private static final Logger logger = LoggerFactory.getLogger(DynamicWorkflowRunnerWindow.class);