ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google

Mail Archive Home | shark List | December 2004 Index

<--  Date Index  --> <--  Thread Index  -->

output from JavaClassToolAgent to a workflow variable

I have a question about output from JavaClassToolAgent to a workflow variable.
The only example java code witch does some outputing is
and multiplication and substraction.
Those are very simple procedures. And there is little debuggin involved.
Are there any better examples ??
Please have mercy....
I am spending days and weeks on my trial and error strategy....
I am attaching my own JavaClass Agent which works (but not always and I don't know why)  (no reply to my previous post)
I mainly need lines with code like
result.the_value = .....
and coresponding xpdl.
Although the AppParameter.java is commented, it is so hard to figure out the authors's design from just the code....
Also is there any tips and tricks on how to debug your own Java tool.
Like can my class still have a main method when I compile it, put it to a jar, load it to shark, etc......Will it bother Shark?.
There is so many try-and-error questions which is much easier answered by some little documentation rather then hours of my own try-and-error. And finding where the error was is SO HARD and so tedious. Restartign Shark and loading different versions. 
I do a pseudomain (vojtamain) method which is then called in the execute method.
And when debugging, I use simple main calling this pseudomain method.
Can anyone post their examples when a java code needs to output something to Shark.
Are other people also using just Swing or is there a better User interface to use.
There must be people writing their own tools which are called by Shark with input and output parameters.
I searched for the new ASAP code in the CVS
I would be EXTREMELY gratefull.
Vojtech Huser
P.S. can you please create a folder examples in the CVS and keep them separate from the shark code. Location of the MailProc.java in the CVS is really strange. Under modules.
package tdialog02;

 * CelsiusConverter.java is a 1.4 application that
 * demonstrates the use of JButton, JTextField and
 * JLabel.  It requires no other files.

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import org.enhydra.shark.api.internal.toolagent.AppParameter;

public class CelsiusConverter implements ActionListener {
    JFrame converterFrame;
    JPanel converterPanel;
    //JTextField tempCelsius;
    JTextField butt1_clicked;
    JLabel  output_Label;

    JLabel  d1Label, q1Label;
    //vojta added his labels above
    JButton button1;
    static boolean b1_clicked;
    JLabel butt1_clickedLabel;
    public CelsiusConverter(String ks2,
                            String ks3,
                            String ks4,
                            String ks5,
                            String ks6,
                            String ks7,
                            String ks8,
                            String ks9,
                            String ks10,
                            String ks11,
                            String ks12,
                            String ks13,
                            String ks14,
                            String ks15,
                            String ks16,
                            String ks17
                            ) {

    //Create and set up the window.
        converterFrame = new JFrame(ks5+": "+ks6+" "+ks7);
        converterFrame.setSize(new Dimension(120, 40));

        //Create and set up the panel.
        converterPanel = new JPanel(new GridLayout(2, 2));

        //Add the widgets.---------------------------------------------------

     * Create and add the widgets.
    // private void addWidgets() {
        //Create widgets.
    //    tempCelsius = new JTextField(2);

        butt1_clickedLabel = new JLabel("0", SwingConstants.LEFT);

        d1Label = new JLabel(ks9, SwingConstants.LEFT);
        q1Label = new JLabel(ks2, SwingConstants.LEFT);
        //celsiusLabel = new JLabel("Celsius", SwingConstants.LEFT);
        button1 = new JButton(ks3);
        output_Label = new JLabel("submitted reply: No", SwingConstants.LEFT);

        //Listen to events from the Convert button.

        //Add the widgets to the container.
       // converterPanel.add(tempCelsius);


//    }  end of addwidgets
//----------------------------END OF ADDWIDGETS

        //Set the default button.

        //Add the panel to the window.
        converterFrame.getContentPane().add(converterPanel, BorderLayout.CENTER);

        //Display the window.

    public void actionPerformed(ActionEvent event) {

    //Parse degrees Celsius as a double and convert to Fahrenheit.
      //  int tempFahr = (int)((Double.parseDouble(tempCelsius.getText()))
      //                       * 1.8 + 32);
      String replys="Yes";
      output_Label.setText("submitted reply: "+replys);



    public static void main(String[] args) {
       int moutput;
      moutput=vojtamain("Is it high risc uterine bleeding?", //2
                         "YES",  //b1
                         "NO",   //b2
                         "title", //7
                         "",   //9 description 1




//vojta specific

    public static int vojtamain(
                                 String s2,
                                 String s3,
                                 String s4,
                                 String s5,
                                 String s6,
                                 String s7,
                                 String s8,
                                 String s9,
                                 String s10,
                                 String s11,
                                 String s12,
                                 String s13,
                                 String s14,
                                 String s15,
                                 String s16,
                                 String s17

    //start create and show gui


    CelsiusConverter converter = new CelsiusConverter(s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17);

    //end createandshowgui

    int tempInt =0;

         // = new Long(0);
         // if (butt1_clickedLabel.getText()="1") {templong = new Long(1);} else templong=new Long(0);
         //if (b1_clicked)  {tempInt = new Long(1);} else tempInt=new Long(0);
       if (b1_clicked) tempInt =1;
       return tempInt;

//end vojtamain

    /**   SHARK SPECIFIC */

    public static void execute (AppParameter p1,
                                AppParameter p2,
                                AppParameter p3,
                                AppParameter p4,
                                AppParameter p5,
                                AppParameter p6,
                                AppParameter p7,
                                AppParameter p8,
                                AppParameter p9,
                                AppParameter p10,
                                AppParameter p11,
                                AppParameter p12,
                                AppParameter p13,
                                AppParameter p14,
                                AppParameter p15,
                                AppParameter p16,
                                AppParameter p17
                                ) {
     try {


         //HERE COPY MAIN

         int execoutput;
         execoutput=vojtamain((String) p2.the_value,
                   (String) p3.the_value,
                   (String) p4.the_value,
                   (String) p5.the_value,
                   (String) p6.the_value,
                   (String) p7.the_value,
                   (String) p8.the_value,
                   (String) p9.the_value,
                   (String) p10.the_value,
                   (String) p11.the_value,
                   (String) p12.the_value,
                   (String) p13.the_value,
                   (String) p14.the_value,
                   (String) p15.the_value,
                   (String) p16.the_value,
                   (String) p17.the_value
        if (execoutput==1) {p1.the_value=new Long(1);} else
          {p1.the_value=new Long(0);}

//         result.the_value=new Long(10);

       // END OF MAIN

     } catch (Exception ex) {
  System.out.println("Problems while executing procedure");

//end class

<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.