Index: src/nongnu/cashews/eclipse/gui/Cashews.java =================================================================== RCS file: src/nongnu/cashews/eclipse/gui/Cashews.java diff -N src/nongnu/cashews/eclipse/gui/Cashews.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/nongnu/cashews/eclipse/gui/Cashews.java 11 May 2005 07:14:06 -0000 @@ -0,0 +1,84 @@ +/* Cashews.java -- Main interface for the Java side of CASheW-s. + Copyright (C) 2005 The University of Sheffield. + + This file is part of the CASheW-s editor. + + The CASheW-s editor is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + The CASheW-s editor is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with The CASheW-s editor; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. +*/ + +package nongnu.cashews.eclipse.gui; + +import org.eclipse.jface.window.ApplicationWindow; +import org.eclipse.jface.wizard.WizardDialog; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; + +/** + * The main application window. + * + * @author Andrew John Hughes (address@hidden) + */ +public class Cashews + extends ApplicationWindow +{ + /** + * Constructs a new CASheW-s application. + */ + public Cashews() + { + super(null); + } + + /** + * Create the contents of the window. + * + * @param parent the parent composite. + * @return the created composite. + */ + public Control createContents(Composite parent) + { + Button button = new Button(parent, SWT.PUSH); + button.setText("Create a composite process"); + button.addSelectionListener(new SelectionAdapter() + { + public void widgetSelected(SelectionEvent e) + { + new WizardDialog(getShell(), new CashewsWizard()).open(); + } + }); + return button; + } + + /** + * Entry point for the application. + * + * @param args the command-line arguments. + */ + public static void main(String[] args) + { + Cashews cw = new Cashews(); + cw.setBlockOnOpen(true); + cw.open(); + Display.getCurrent().dispose(); + } + +} Index: src/nongnu/cashews/eclipse/gui/CashewsWizard.java =================================================================== RCS file: src/nongnu/cashews/eclipse/gui/CashewsWizard.java diff -N src/nongnu/cashews/eclipse/gui/CashewsWizard.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/nongnu/cashews/eclipse/gui/CashewsWizard.java 11 May 2005 07:14:06 -0000 @@ -0,0 +1,101 @@ +/* CashewsWizard.java -- The wizard for creating CASheW-s instances. + Copyright (C) 2005 The University of Sheffield. + + This file is part of the CASheW-s editor. + + The CASheW-s editor is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + The CASheW-s editor is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with The CASheW-s editor; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. +*/ + +package nongnu.cashews.eclipse.gui; + +import java.net.URISyntaxException; + +import nongnu.cashews.language.process.CompositeProcess; + +import org.eclipse.jface.wizard.Wizard; + +/** + * The wizard for creating a composite process. + * + * @author Andrew John Hughes (address@hidden) + */ +public class CashewsWizard + extends Wizard +{ + + /** + * The created composite process. + */ + private CompositeProcess cp; + + /** + * Constructs a new CASheW-s wizard. + */ + public CashewsWizard() + { + super(); + setNeedsProgressMonitor(true); + try + { + cp = new CompositeProcess("CompProc"); + } + catch (URISyntaxException e) + { + throw new InternalError("Couldn't initialise composite process."); + } + } + + /** + * Add the pages needed by the wizard. + */ + public void addPages() + { + addPage(new CompositeChoicePage()); + addPage(new OperationChoicePage()); + addPage(new ConnectionPage()); + } + + /** + * Performs the finish operations. + * + * @returns true if it is okay to finish. + */ + public boolean performFinish() + { + return true; + } + + /** + * Retrieves the composite process being created. + * + * @return the composite process. + */ + public CompositeProcess getProcess() + { + return cp; + } + + /** + * Sets the composite process to the one supplied. + * + * @param cp the new composite process. + */ + public void setProcess(CompositeProcess cp) + { + this.cp = cp; + } + +} Index: src/nongnu/cashews/eclipse/gui/CompositeChoicePage.java =================================================================== RCS file: src/nongnu/cashews/eclipse/gui/CompositeChoicePage.java diff -N src/nongnu/cashews/eclipse/gui/CompositeChoicePage.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/nongnu/cashews/eclipse/gui/CompositeChoicePage.java 11 May 2005 07:14:06 -0000 @@ -0,0 +1,109 @@ +/* CompositeChoicePage.java -- The wizard page for choosing the CP. + Copyright (C) 2005 The University of Sheffield. + + This file is part of the CASheW-s editor. + + The CASheW-s editor is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + The CASheW-s editor is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with The CASheW-s editor; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. +*/ + +package nongnu.cashews.eclipse.gui; + +import nongnu.cashews.language.process.AnyOrder; +import nongnu.cashews.language.process.ChooseOne; +import nongnu.cashews.language.process.Sequence; +import nongnu.cashews.language.process.Split; +import nongnu.cashews.language.process.SplitJoin; + +import org.eclipse.jface.wizard.WizardPage; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.List; + +/** + * The wizard page for selecting a composite process. + * + * @author Andrew John Hughes (address@hidden) + */ +public class CompositeChoicePage + extends WizardPage +{ + + private List list; + + /** + * Construct a new CompositeChoicePage. + */ + public CompositeChoicePage() + { + super("Choose a composite process type"); + } + + /** + * Create the controls for this page. + * + * @param parent the parent wizard. + */ + public void createControl(Composite parent) + { + Composite container = new Composite(parent, SWT.NULL); + RowLayout layout = new RowLayout(SWT.VERTICAL); + layout.justify = true; + layout.fill = false; + container.setLayout(layout); + Label label = new Label(container, SWT.LEFT); + label.setText("Choose a composite process type:"); + list = new List(container, SWT.SINGLE); + list.add("Sequence"); + list.add("AnyOrder"); + list.add("Split"); + list.add("SplitJoin"); + list.add("ChooseOne"); + list.addSelectionListener(new SelectionAdapter() + { + public void widgetSelected(SelectionEvent e) + { + CashewsWizard wizard = (CashewsWizard) getWizard(); + int index = list.getSelectionIndex(); + switch (index) + { + case 0: + wizard.getProcess().setControlStructure(new Sequence()); + break; + case 1: + wizard.getProcess().setControlStructure(new AnyOrder()); + break; + case 2: + wizard.getProcess().setControlStructure(new Split()); + break; + case 3: + wizard.getProcess().setControlStructure(new SplitJoin()); + break; + case 4: + wizard.getProcess().setControlStructure(new ChooseOne()); + break; + } + } + }); + setControl(container); + setPageComplete(true); + } + +} Index: src/nongnu/cashews/eclipse/gui/ConnectionPage.java =================================================================== RCS file: src/nongnu/cashews/eclipse/gui/ConnectionPage.java diff -N src/nongnu/cashews/eclipse/gui/ConnectionPage.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/nongnu/cashews/eclipse/gui/ConnectionPage.java 11 May 2005 07:14:06 -0000 @@ -0,0 +1,116 @@ +/* ConnectionPage.java -- The wizard page for connecting two performances. + Copyright (C) 2005 The University of Sheffield. + + This file is part of the CASheW-s editor. + + The CASheW-s editor is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + The CASheW-s editor is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with The CASheW-s editor; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. +*/ + +package nongnu.cashews.eclipse.gui; + +import java.io.File; +import java.io.IOException; + +import java.net.URISyntaxException; + +import java.util.HashMap; +import java.util.Map; +import java.util.logging.ConsoleHandler; + +import nongnu.cashews.language.process.AtomicProcess; +import nongnu.cashews.language.process.MultiPerform; +import nongnu.cashews.language.process.MultiPerformElement; +import nongnu.cashews.language.process.Performance; + +import nongnu.cashews.language.grounding.SoapOperation; +import nongnu.cashews.wsdl.WsdlParser; + +import org.eclipse.core.runtime.Status; + +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.wizard.WizardPage; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.List; + +import org.xml.sax.SAXException; + +/** + * The wizard page for creating a connection. + * + * @author Andrew John Hughes (address@hidden) + */ +public class ConnectionPage + extends WizardPage +{ + + /** + * The map of strings in the list to performances. + */ + private Map performanceMap; + + /** + * Construct a new ConnectionPage. + */ + public ConnectionPage() + { + super("Create a connection"); + } + + /** + * Create the controls for this page. + * + * @param parent the parent wizard. + */ + public void createControl(Composite parent) + { + Composite container = new Composite(parent, SWT.NULL); + RowLayout layout = new RowLayout(SWT.HORIZONTAL); + layout.justify = true; + layout.fill = false; + container.setLayout(layout); + List list1 = new List(container, SWT.CENTER | SWT.SINGLE); + List list2 = new List(container, SWT.CENTER | SWT.SINGLE); + performanceMap = new HashMap(); + /* + CashewsWizard wizard = (CashewsWizard) getWizard(); + MultiPerform mp = (MultiPerform) wizard.getProcess().getControlStructure(); + for (MultiPerformElement e : mp.getContent()) + { + Performance p = (Performance) e; + String name = p.getName().toString(); + AtomicProcess ap = (AtomicProcess) p.getProcess(); + SoapOperation op = (SoapOperation) ap.getGrounding(); + String endpoint = op.getEndpoint().toString(); + String listString = name + ":" + endpoint; + list1.add(listString); + list2.add(listString); + performanceMap.put(listString, p); + } + */ + setControl(container); + setPageComplete(false); + } + + +} Index: src/nongnu/cashews/eclipse/gui/OperationChoicePage.java =================================================================== RCS file: src/nongnu/cashews/eclipse/gui/OperationChoicePage.java diff -N src/nongnu/cashews/eclipse/gui/OperationChoicePage.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/nongnu/cashews/eclipse/gui/OperationChoicePage.java 11 May 2005 07:14:06 -0000 @@ -0,0 +1,170 @@ +/* OperationChoicePage.java -- The wizard page for choosing the operation. + Copyright (C) 2005 The University of Sheffield. + + This file is part of the CASheW-s editor. + + The CASheW-s editor is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + The CASheW-s editor is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with The CASheW-s editor; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. +*/ + +package nongnu.cashews.eclipse.gui; + +import java.io.File; +import java.io.IOException; + +import java.net.URISyntaxException; + +import java.util.HashMap; +import java.util.Map; +import java.util.logging.ConsoleHandler; + +import nongnu.cashews.language.process.AtomicProcess; +import nongnu.cashews.language.process.MultiPerform; +import nongnu.cashews.language.process.Performance; + +import nongnu.cashews.language.grounding.SoapOperation; +import nongnu.cashews.wsdl.WsdlParser; + +import org.eclipse.core.runtime.Status; + +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.wizard.WizardPage; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.List; + +import org.xml.sax.SAXException; + +/** + * The wizard page for selecting an operation. + * + * @author Andrew John Hughes (address@hidden) + */ +public class OperationChoicePage + extends WizardPage +{ + + /** + * The list of operations. + */ + private List list; + + /** + * A map of Strings to operations. + */ + private Map operationMap; + + /** + * Construct a new OperationChoicePage. + */ + public OperationChoicePage() + { + super("Choose an operation"); + } + + /** + * Create the controls for this page. + * + * @param parent the parent wizard. + */ + public void createControl(Composite parent) + { + Composite container = new Composite(parent, SWT.NULL); + RowLayout layout = new RowLayout(SWT.VERTICAL); + layout.justify = true; + layout.fill = false; + container.setLayout(layout); + Label label = new Label(container, SWT.LEFT); + label.setText("Choose an operation from the list, or click Browse... " + + "to add more from a WSDL file."); + Button button = new Button(container, SWT.CENTER); + button.setText("Browse..."); + button.addSelectionListener(new SelectionAdapter() + { + public void widgetSelected(SelectionEvent event) + { + FileDialog dialog = new FileDialog(getShell(), SWT.OPEN); + dialog.setFilterExtensions(new String[]{"wsdl"}); + dialog.open(); + String filename = dialog.getFilterPath() + "/" + + dialog.getFileName(); + try + { + WsdlParser parser = new WsdlParser(new ConsoleHandler()); + parser.parse(new File(filename)); + for (SoapOperation op: parser.getWsdlHandler().getOperations()) + { + String name = op.getEndpoint().toString(); + list.add(name); + operationMap.put(name, op); + } + list.pack(); + setPageComplete(true); + int index = 0; + CashewsWizard wizard = (CashewsWizard) getWizard(); + for (SoapOperation op: operationMap.values()) + { + try + { + AtomicProcess ap = new AtomicProcess("Atomic" + index); + ap.setGrounding(op); + Performance performance = new Performance("Perform" + + index); + performance.setProcess(ap); + MultiPerform mp = (MultiPerform) + wizard.getProcess().getControlStructure(); + mp.add(performance); + ++index; + } + catch (URISyntaxException e) + { + System.err.println(e); + ErrorDialog.openError(getShell(), "I/O Error", + e.toString(), + Status.CANCEL_STATUS); + } + } + operationMap = new HashMap(); + System.out.println(wizard.getProcess()); + } + catch (IOException e) + { + System.err.println(e); + ErrorDialog.openError(getShell(), "I/O Error", e.toString(), + Status.CANCEL_STATUS); + } + catch (SAXException e) + { + System.err.println(e); + ErrorDialog.openError(getShell(), "Parsing error", e.toString(), + Status.CANCEL_STATUS); + } + } + }); + list = new List(container, SWT.CENTER | SWT.SINGLE); + setControl(container); + setPageComplete(false); + operationMap = new HashMap(); + } + + +} Index: src/nongnu/cashews/language/process/AtomicProcess.java =================================================================== RCS file: /cvsroot/cashew-s-editor/cashews/src/nongnu/cashews/language/process/AtomicProcess.java,v retrieving revision 1.4 diff -u -3 -p -u -r1.4 AtomicProcess.java --- src/nongnu/cashews/language/process/AtomicProcess.java 8 May 2005 12:03:41 -0000 1.4 +++ src/nongnu/cashews/language/process/AtomicProcess.java 11 May 2005 07:14:06 -0000 @@ -91,5 +91,29 @@ public class AtomicProcess this.grounding = grounding; } + /** + * Retrieves the grounding of this atomic process. + * + * @return the atomic process grounding. + */ + public Grounding getGrounding() + { + return grounding; + } + + /** + * Returns a String representation of this atomic process. + * + * @return a textual representation. + */ + public String toString() + { + String superString = super.toString(); + return superString.substring(0, superString.length() - 1) + + ", grounding=" + + grounding + + "]"; + } + } Index: src/nongnu/cashews/language/process/CompositeProcess.java =================================================================== RCS file: /cvsroot/cashew-s-editor/cashews/src/nongnu/cashews/language/process/CompositeProcess.java,v retrieving revision 1.4 diff -u -3 -p -u -r1.4 CompositeProcess.java --- src/nongnu/cashews/language/process/CompositeProcess.java 7 May 2005 21:22:54 -0000 1.4 +++ src/nongnu/cashews/language/process/CompositeProcess.java 11 May 2005 07:14:06 -0000 @@ -134,6 +134,16 @@ public class CompositeProcess } /** + * Retrieves the control structure of this composite process. + * + * @return the control structure. + */ + public CProcess getControlStructure() + { + return controlStructure; + } + + /** * Returns a String representation of this process. * * @return a textual representation. Index: src/nongnu/cashews/language/process/MultiPerform.java =================================================================== RCS file: /cvsroot/cashew-s-editor/cashews/src/nongnu/cashews/language/process/MultiPerform.java,v retrieving revision 1.4 diff -u -3 -p -u -r1.4 MultiPerform.java --- src/nongnu/cashews/language/process/MultiPerform.java 7 May 2005 21:22:54 -0000 1.4 +++ src/nongnu/cashews/language/process/MultiPerform.java 11 May 2005 07:14:06 -0000 @@ -68,6 +68,16 @@ public abstract class MultiPerform } /** + * Retrieves a shallow clone of the content. + * + * @return a shallow clone of the content list. + */ + public List getContent() + { + return new ArrayList(content); + } + + /** * Returns a String representation of this * MultiPerform. *