Instantiate process from application

View: New views
9 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

AW: RE: Shark List Issue again sorry.....

by Manfred Hagenauer-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Pedro,

using complex Java Types in Shark is not very complicate.
Look at this example where we use the Parser object of a XML Document.

First you had to define your external Reference in XPDL:
   <xpdl:FormalParameter Id="Document" Mode="INOUT">
        <xpdl:DataType>
             <xpdl:ExternalReference location="com.hico.xprocess.DocDeclaration"/>
        </xpdl:DataType>
   </xpdl:FormalParameter>
 
Then your Class should look like this:
/**
 * Copyright 2001-2007 HiCo ICS Gesmbh
 * $RCSfile: DocDeclaration,v $ - $Author: manfred.hagenauer $
 * $Source: DocDeclaration.java,v $
 * $Revision: 1.1 $
 *
 * $Log$
 */
package com.hico.xprocess;

import java.io.Serializable;
import org.w3c.dom.Document;

public class DocDeclaration implements Serializable, Cloneable
{
        private static final long serialVersionUID = 1L;
        private static Document xmlDocument = null;

        public Object clone()
        {
                try
                {
                        return super.clone();
                }
                catch( Exception ex )
                {
                        return null;
                }
        }

        public DocDeclaration()
        {
        }

        public DocDeclaration( Document document )
        {
                xmlDocument = document;
        }

        public Document getXmlDocument()
        {
                return xmlDocument;
        }

        public void setXmlDocument( Document document )
        {
                xmlDocument = document;
        }
}


Of Course the Parameter must be set in another Class:

public void execute( AppParameter documentFileName,
                AppParameter document)
{
...
        Document xmlDocument = XMLDocument.readDocument( .....
                               
        DocDeclaration doc = new DocDeclaration();
        doc.setXmlDocument(xmlDocument);
....

And in your Applications used in the Workflow you can access your class like this:

public void execute( AppParameter documentName, AppParameter document )
{
        String strDocumentName = (String) documentName.the_value;
               
        try
        {
                Document doc = ((DocDeclaration) document.the_value).getXmlDocument();
...


That's all.

You can write your own code and use it like you want (for Lists).
Hope this helps.

Regards Manfred



-----Ursprüngliche Nachricht-----
Von: PedroUninova [mailto:pd@...]
Gesendet: 2009-02-13 17:03
An: shark@...
Betreff: [shark] RE: Shark List Issue again sorry.....

Hello again

Sorry for long absence.... but I have been working on other project....

Geeta
Before the start of this issue I had already build up several process's with simple types....
I'm not sure, but are you saying that I should use simple types as external references to see if I understand the process off instantiate external classes???

After some tries I continue to not understand how an activity will instantiate my custom made class....

Could you, or some one, help me with this long time problem???
Thanks,
        Pedro

-----Mensagem original-----
De: gramani@... [mailto:gramani@...]
Enviada: sábado, 24 de Janeiro de 2009 16:52
Para: shark@...
Assunto: [shark] Re: RE:Shark List Issue

Hi Pedro, the reason you got thsi error ""type not supported"" is because List is not supported as a type for a process variable. Only basic types like String, Integer, Boolean etc are supported. So if you want to start out building a "simple process" then start with one of the basic types.
Once you have that working then move on to more complex Java types. As I mentioned earlier if you want a process variable which is of type List the only way that i know how to do it is to build a Java class which will have the List functionalty and then use it as I described earlier: "

> > you can define any
> > Java object to be a workflow variable (through the use of XPDL
> > ExternalReference data type), and then use it in shark (of course,
> > this class has to be on shark's classpath). "

So go step by step. Make sure you get a Basic type like Integer/String working, then move on to an arbitrary java class.

Regards,
Geeta

"PedroUninova" <pd@...> wrote on 01/23/2009 10:32:21 PM:

> Hello,
> Can any body help me with this subject?
>
> Thanks in advance,
>    Pedro
>
> -----Mensagem original-----
> De: PedroUninova [mailto:pd@...]
> Enviada: terça-feira, 20 de Janeiro de 2009 14:49
> Para: shark@...
> Assunto: [shark] RE: Re: RE: Re: Shark List Issue
>
> Hi Geeta,
>
> I was trying to follow what you said and some problems came...
> - So I started to build a new process called "simple_process" (this
> way I can learn, without destroying things I have already done).
> - create a new workflow variable (list_var) of type LIST(basic type
string);
> - created a workflow participant (sys_participant) of type system;
> - defined a Formal Parameter (list_input) of type LIST(basic type
string);

> - from my previous tests I can't introduce a list to this formal
> parameter.....
>    An error of something like "type not supported" always come up.
>
> How can I use your way to do what I want?! Is this the right way?!
> For sure it's something very simple but I'm not getting it! Sorry :(
>
> Regards,
>             Pedro
>
> -----Mensagem original-----
> De: gramani@... [mailto:gramani@...]
> Enviada: sábado, 17 de Janeiro de 2009 14:04
> Para: shark@...
> Assunto: [shark] Re: RE: Re: Shark List Issue
>
> Hi Pedro:
>
> Here's how i would define my xpdl (again, I apologise if I do not
understand
> your situation correctly):
>
> 1. The xpdl has your custom defined process variable of class
> MyListType, and MyListType is of course in your class path .
> 1. The xpdl has a start activity, which leads to an activity in the
> *System* lane (ie performer is System and the activity is mapped to a
Java
> class, say, MyInstantiater which is also in in your class path). The
> path out of this system activity leads to the rest of the activities
> for your app.
> 2. The above Java class, MyInstantiater, has the logic needed to
instantiate

> your class MyListType as well as populate the custom defined process
> variable.
>
> Why won't this work?
>
> Regards,
> Geeta
>
> "uninova" <pd@...> wrote on 01/15/2009 04:44:01 PM:
>
> > Hello again,
> > I already familiar with that feature, and already tried a classed
> > build
> by
> > me. But I couldn't solve the situation. For sure I'm not doing the
> > things right.
> >
> > The only resolution that come to my mind was (using the example
bellow):

> > (its different from the past one but I think the point is the same)
> > Let's suppose I have a start activity.
> > The transition from this activity loads the values(Static values) to
> > the variable defined using the class build by me, lets say "my list
> type"...
> > A is an instance of "my_list_type"!!! how can I create an instance?!?!
> This
> > is not the right way....
> > a.add(2);
> > a.add(3);
> > a.add(7);
> >
> >
> > The problem now, at least for me, is how do you instantiate the
> class?!you
> > need an instance right?!?! What I need to change?
> >
> > So let's suppose:
> > MY_list_type is defined using the class my_personal_list.java bellow:
> > #########################################
> > private List real_list;
> > My_personal_list()
> > {
> >
> > }
> > Add_value(int value)
> > {
> > Real_list.add(value);
> > }
> > Retrieve_list()
> > {
> > Return real_list;
> > }
> > #####################################
> >
> >
> >
> > Regards,
> >          Pedro
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > -----Mensagem original-----
> > De: gramani@... [mailto:gramani@...]
> > Enviada: quinta-feira, 15 de Janeiro de 2009 14:54
> > Para: shark@...
> > Assunto: [shark] Re: Shark List Issue
> >
> > Hello Pedro,
> >
> > I am not sure if maybe I misunderstand your question, but I hope you
> > know that arbitrary (custome defined) Java classes can be used as
> > process variables..? From the current version docs I see this: "you
> > can define
> any
> > Java object to be a workflow variable (through the use of XPDL
> > ExternalReference data type), and then use it in shark (of course,
> > this class has to be on shark's classpath). "
> >
> > In earlier version's docs, there was more on this topic here:
> >
> > http://shark.objectweb.org/doc/1.1/HowTo/how_to.html#d0e360
> >
> > Again, I apologise if I didn't get your question :) Geeta
> >
> > "uninova" <pd@...> wrote on 01/15/2009 02:33:00 PM:
> >
> > > Hello all,
> > >
> > > Its difficult to explain the situation but lets try....
> > >
> > > I have a problem with lists and shark....
> > > The shark process starts to run when a request from an outside
> > > program is made (my program).
> > >
> > > Situation:
> > > My program first receives a list of arguments to a list variable
> > > type; Sends it to shark let say "LIST_IN_VAR", also starting the
> > > process; And after doing some work sends the same list to my
> > > program which will
> > use
> > > it to do more things...;
> > > Shark don't really uses the list, at least in this example. It
> > > simply receives and resend it to my program, but the list needs to
> > > enter in
> > shark.
> > >
> > > Problem:
> > > The problem is that I can't used Lists in shark... so what I do
> > > now
is:

> > > LIST_IN_VAR is now defined as a string.
> > > When a request is made, my program converts the list to a string
> > > and
> > sends
> > > it to shark
> > > Shark do is work....And in the end My program receives the "where
> > > to send" and the list as a String Converts the string back to LIST
> > > and sends and continue doing its
> job....
> > >
> > > How can I use the list type from shark?
> > > It's possible to create a variable of type list and define a
> > > initial
> > value??
> > >
> > > Regards and thanks,
> > >    Pedro
> > >
> > >
> > >
> > > --
> > > This message has been scanned for viruses and dangerous content by
> > > MailScanner, and is believed to be clean.
> > >
> > >
> > > --
> > > You receive this message as a subscriber of the shark@...
> > > mailing
> > list.
> > > To unsubscribe: mailto:shark-unsubscribe@... For general help:
> > > mailto:sympa@...?subject=help
> > > OW2 mailing lists service home page: http://www.ow2.org/wws
> >
> >
> >
> >
> > --
> > This message has been scanned for viruses and dangerous content by
> > MailScanner, and is believed to be clean.
> >
> >
> > --
> > You receive this message as a subscriber of the shark@...
> > mailing
> list.
> > To unsubscribe: mailto:shark-unsubscribe@... For general help:
> > mailto:sympa@...?subject=help
> > OW2 mailing lists service home page: http://www.ow2.org/wws
>
>
>
>
>
>
> --
> This message has been scanned for viruses and dangerous content by
> MailScanner, and is believed to be clean.
>
>
> --
> You receive this message as a subscriber of the shark@... mailing
list.
> To unsubscribe: mailto:shark-unsubscribe@... For general help:
> mailto:sympa@...?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws






--
You receive this message as a subscriber of the shark@... mailing list.
To unsubscribe: mailto:shark-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

RE: AW: RE: Shark List Issue again sorry.....

by PedroUninova :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello and many thanks Manfred,

I'm following your explanation but i don’t understand some things...

Sorry for being so slowly to understand this process :(

 (1)Where did you get the "XMLDocument" object with the method
"readDocument" present on this line: "Document xmlDocument =
XMLDocument.readDocument( ....."

 (2) the execute method belongs to some interface?

Regards,
        Pedro



-----Mensagem original-----
De: Manfred Hagenauer [mailto:manfred.hagenauer@...]
Enviada: segunda-feira, 16 de Fevereiro de 2009 7:27
Para: shark@...
Assunto: [shark] AW: RE: Shark List Issue again sorry.....

Hello Pedro,

using complex Java Types in Shark is not very complicate.
Look at this example where we use the Parser object of a XML Document.

First you had to define your external Reference in XPDL:
   <xpdl:FormalParameter Id="Document" Mode="INOUT">
        <xpdl:DataType>
             <xpdl:ExternalReference
location="com.hico.xprocess.DocDeclaration"/>
        </xpdl:DataType>
   </xpdl:FormalParameter>
 
Then your Class should look like this:
/**
 * Copyright 2001-2007 HiCo ICS Gesmbh
 * $RCSfile: DocDeclaration,v $ - $Author: manfred.hagenauer $
 * $Source: DocDeclaration.java,v $
 * $Revision: 1.1 $
 *
 * $Log$
 */
package com.hico.xprocess;

import java.io.Serializable;
import org.w3c.dom.Document;

public class DocDeclaration implements Serializable, Cloneable {
        private static final long serialVersionUID = 1L;
        private static Document xmlDocument = null;

        public Object clone()
        {
                try
                {
                        return super.clone();
                }
                catch( Exception ex )
                {
                        return null;
                }
        }

        public DocDeclaration()
        {
        }

        public DocDeclaration( Document document )
        {
                xmlDocument = document;
        }

        public Document getXmlDocument()
        {
                return xmlDocument;
        }

        public void setXmlDocument( Document document )
        {
                xmlDocument = document;
        }
}


Of Course the Parameter must be set in another Class:

public void execute( AppParameter documentFileName,
                AppParameter document)
{
...
        Document xmlDocument = XMLDocument.readDocument( .....
                               
        DocDeclaration doc = new DocDeclaration();
        doc.setXmlDocument(xmlDocument);
....

And in your Applications used in the Workflow you can access your class like
this:

public void execute( AppParameter documentName, AppParameter document ) {
        String strDocumentName = (String) documentName.the_value;
               
        try
        {
                Document doc = ((DocDeclaration)
document.the_value).getXmlDocument();
...


That's all.

You can write your own code and use it like you want (for Lists).
Hope this helps.

Regards Manfred



-----Ursprüngliche Nachricht-----
Von: PedroUninova [mailto:pd@...]
Gesendet: 2009-02-13 17:03
An: shark@...
Betreff: [shark] RE: Shark List Issue again sorry.....

Hello again

Sorry for long absence.... but I have been working on other project....

Geeta
Before the start of this issue I had already build up several process's with
simple types....
I'm not sure, but are you saying that I should use simple types as external
references to see if I understand the process off instantiate external
classes???

After some tries I continue to not understand how an activity will
instantiate my custom made class....

Could you, or some one, help me with this long time problem???
Thanks,
        Pedro

-----Mensagem original-----
De: gramani@... [mailto:gramani@...]
Enviada: sábado, 24 de Janeiro de 2009 16:52
Para: shark@...
Assunto: [shark] Re: RE:Shark List Issue

Hi Pedro, the reason you got thsi error ""type not supported"" is because
List is not supported as a type for a process variable. Only basic types
like String, Integer, Boolean etc are supported. So if you want to start out
building a "simple process" then start with one of the basic types.
Once you have that working then move on to more complex Java types. As I
mentioned earlier if you want a process variable which is of type List the
only way that i know how to do it is to build a Java class which will have
the List functionalty and then use it as I described earlier: "

> > you can define any
> > Java object to be a workflow variable (through the use of XPDL
> > ExternalReference data type), and then use it in shark (of course,
> > this class has to be on shark's classpath). "

So go step by step. Make sure you get a Basic type like Integer/String
working, then move on to an arbitrary java class.

Regards,
Geeta

"PedroUninova" <pd@...> wrote on 01/23/2009 10:32:21 PM:

> Hello,
> Can any body help me with this subject?
>
> Thanks in advance,
>    Pedro
>
> -----Mensagem original-----
> De: PedroUninova [mailto:pd@...]
> Enviada: terça-feira, 20 de Janeiro de 2009 14:49
> Para: shark@...
> Assunto: [shark] RE: Re: RE: Re: Shark List Issue
>
> Hi Geeta,
>
> I was trying to follow what you said and some problems came...
> - So I started to build a new process called "simple_process" (this
> way I can learn, without destroying things I have already done).
> - create a new workflow variable (list_var) of type LIST(basic type
string);
> - created a workflow participant (sys_participant) of type system;
> - defined a Formal Parameter (list_input) of type LIST(basic type
string);

> - from my previous tests I can't introduce a list to this formal
> parameter.....
>    An error of something like "type not supported" always come up.
>
> How can I use your way to do what I want?! Is this the right way?!
> For sure it's something very simple but I'm not getting it! Sorry :(
>
> Regards,
>             Pedro
>
> -----Mensagem original-----
> De: gramani@... [mailto:gramani@...]
> Enviada: sábado, 17 de Janeiro de 2009 14:04
> Para: shark@...
> Assunto: [shark] Re: RE: Re: Shark List Issue
>
> Hi Pedro:
>
> Here's how i would define my xpdl (again, I apologise if I do not
understand
> your situation correctly):
>
> 1. The xpdl has your custom defined process variable of class
> MyListType, and MyListType is of course in your class path .
> 1. The xpdl has a start activity, which leads to an activity in the
> *System* lane (ie performer is System and the activity is mapped to a
Java
> class, say, MyInstantiater which is also in in your class path). The
> path out of this system activity leads to the rest of the activities
> for your app.
> 2. The above Java class, MyInstantiater, has the logic needed to
instantiate

> your class MyListType as well as populate the custom defined process
> variable.
>
> Why won't this work?
>
> Regards,
> Geeta
>
> "uninova" <pd@...> wrote on 01/15/2009 04:44:01 PM:
>
> > Hello again,
> > I already familiar with that feature, and already tried a classed
> > build
> by
> > me. But I couldn't solve the situation. For sure I'm not doing the
> > things right.
> >
> > The only resolution that come to my mind was (using the example
bellow):

> > (its different from the past one but I think the point is the same)
> > Let's suppose I have a start activity.
> > The transition from this activity loads the values(Static values) to
> > the variable defined using the class build by me, lets say "my list
> type"...
> > A is an instance of "my_list_type"!!! how can I create an instance?!?!
> This
> > is not the right way....
> > a.add(2);
> > a.add(3);
> > a.add(7);
> >
> >
> > The problem now, at least for me, is how do you instantiate the
> class?!you
> > need an instance right?!?! What I need to change?
> >
> > So let's suppose:
> > MY_list_type is defined using the class my_personal_list.java bellow:
> > #########################################
> > private List real_list;
> > My_personal_list()
> > {
> >
> > }
> > Add_value(int value)
> > {
> > Real_list.add(value);
> > }
> > Retrieve_list()
> > {
> > Return real_list;
> > }
> > #####################################
> >
> >
> >
> > Regards,
> >          Pedro
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > -----Mensagem original-----
> > De: gramani@... [mailto:gramani@...]
> > Enviada: quinta-feira, 15 de Janeiro de 2009 14:54
> > Para: shark@...
> > Assunto: [shark] Re: Shark List Issue
> >
> > Hello Pedro,
> >
> > I am not sure if maybe I misunderstand your question, but I hope you
> > know that arbitrary (custome defined) Java classes can be used as
> > process variables..? From the current version docs I see this: "you
> > can define
> any
> > Java object to be a workflow variable (through the use of XPDL
> > ExternalReference data type), and then use it in shark (of course,
> > this class has to be on shark's classpath). "
> >
> > In earlier version's docs, there was more on this topic here:
> >
> > http://shark.objectweb.org/doc/1.1/HowTo/how_to.html#d0e360
> >
> > Again, I apologise if I didn't get your question :) Geeta
> >
> > "uninova" <pd@...> wrote on 01/15/2009 02:33:00 PM:
> >
> > > Hello all,
> > >
> > > Its difficult to explain the situation but lets try....
> > >
> > > I have a problem with lists and shark....
> > > The shark process starts to run when a request from an outside
> > > program is made (my program).
> > >
> > > Situation:
> > > My program first receives a list of arguments to a list variable
> > > type; Sends it to shark let say "LIST_IN_VAR", also starting the
> > > process; And after doing some work sends the same list to my
> > > program which will
> > use
> > > it to do more things...;
> > > Shark don't really uses the list, at least in this example. It
> > > simply receives and resend it to my program, but the list needs to
> > > enter in
> > shark.
> > >
> > > Problem:
> > > The problem is that I can't used Lists in shark... so what I do
> > > now
is:

> > > LIST_IN_VAR is now defined as a string.
> > > When a request is made, my program converts the list to a string
> > > and
> > sends
> > > it to shark
> > > Shark do is work....And in the end My program receives the "where
> > > to send" and the list as a String Converts the string back to LIST
> > > and sends and continue doing its
> job....
> > >
> > > How can I use the list type from shark?
> > > It's possible to create a variable of type list and define a
> > > initial
> > value??
> > >
> > > Regards and thanks,
> > >    Pedro
> > >
> > >
> > >
> > > --
> > > This message has been scanned for viruses and dangerous content by
> > > MailScanner, and is believed to be clean.
> > >
> > >
> > > --
> > > You receive this message as a subscriber of the shark@...
> > > mailing
> > list.
> > > To unsubscribe: mailto:shark-unsubscribe@... For general help:
> > > mailto:sympa@...?subject=help
> > > OW2 mailing lists service home page: http://www.ow2.org/wws
> >
> >
> >
> >
> > --
> > This message has been scanned for viruses and dangerous content by
> > MailScanner, and is believed to be clean.
> >
> >
> > --
> > You receive this message as a subscriber of the shark@...
> > mailing
> list.
> > To unsubscribe: mailto:shark-unsubscribe@... For general help:
> > mailto:sympa@...?subject=help
> > OW2 mailing lists service home page: http://www.ow2.org/wws
>
>
>
>
>
>
> --
> This message has been scanned for viruses and dangerous content by
> MailScanner, and is believed to be clean.
>
>
> --
> You receive this message as a subscriber of the shark@... mailing
list.
> To unsubscribe: mailto:shark-unsubscribe@... For general help:
> mailto:sympa@...?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws








--
You receive this message as a subscriber of the shark@... mailing list.
To unsubscribe: mailto:shark-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

Parent Message unknown AW: RE: AW: RE: Shark List Issue again sorry.....

by Manfred Hagenauer-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 Hello Pedro,

this was only an example, it means

1) in our case we had written our own class named "XMLDocument" for parsing a XMLDocument.
        The AppParameter "documentFileName" supplied from the workflow is given to this Class
        and we pass the Parser object through the Workflow. The Idea behind is that we must parse
        this XML file several times in the workflow and we want to avoid creating a new Object each time.
        So the external Reference "DocDeclaration" has only one function: to be a Data Holder
        for the Parser object "Document" which was created itself with the class "XMLDocument".

2) the execute methods shown in the example are that which are necessary in any case for a Java
        Application called from the Workflow (especially the Toolagent which calls this class)

Hope this clarifies what we had done.

Best regards, Manfred



-----Ursprüngliche Nachricht-----
Von: PedroUninova [mailto:pd@...]
Gesendet: 2009-02-23 16:42
An: shark@...
Betreff: [shark] RE: AW: RE: Shark List Issue again sorry.....

Hello and many thanks Manfred,

I'm following your explanation but i don't understand some things...

Sorry for being so slowly to understand this process :(

 (1)Where did you get the "XMLDocument" object with the method "readDocument" present on this line: "Document xmlDocument = XMLDocument.readDocument( ....."

 (2) the execute method belongs to some interface?

Regards,
        Pedro



-----Mensagem original-----
De: Manfred Hagenauer [mailto:manfred.hagenauer@...]
Enviada: segunda-feira, 16 de Fevereiro de 2009 7:27
Para: shark@...
Assunto: [shark] AW: RE: Shark List Issue again sorry.....

Hello Pedro,

using complex Java Types in Shark is not very complicate.
Look at this example where we use the Parser object of a XML Document.

First you had to define your external Reference in XPDL:
   <xpdl:FormalParameter Id="Document" Mode="INOUT">
        <xpdl:DataType>
             <xpdl:ExternalReference
location="com.hico.xprocess.DocDeclaration"/>
        </xpdl:DataType>
   </xpdl:FormalParameter>
 
Then your Class should look like this:
/**
 * Copyright 2001-2007 HiCo ICS Gesmbh
 * $RCSfile: DocDeclaration,v $ - $Author: manfred.hagenauer $
 * $Source: DocDeclaration.java,v $
 * $Revision: 1.1 $
 *
 * $Log$
 */
package com.hico.xprocess;

import java.io.Serializable;
import org.w3c.dom.Document;

public class DocDeclaration implements Serializable, Cloneable {
        private static final long serialVersionUID = 1L;
        private static Document xmlDocument = null;

        public Object clone()
        {
                try
                {
                        return super.clone();
                }
                catch( Exception ex )
                {
                        return null;
                }
        }

        public DocDeclaration()
        {
        }

        public DocDeclaration( Document document )
        {
                xmlDocument = document;
        }

        public Document getXmlDocument()
        {
                return xmlDocument;
        }

        public void setXmlDocument( Document document )
        {
                xmlDocument = document;
        }
}


Of Course the Parameter must be set in another Class:

public void execute( AppParameter documentFileName,
                AppParameter document)
{
...
        Document xmlDocument = XMLDocument.readDocument( .....
                               
        DocDeclaration doc = new DocDeclaration();
        doc.setXmlDocument(xmlDocument);
....

And in your Applications used in the Workflow you can access your class like
this:

public void execute( AppParameter documentName, AppParameter document ) {
        String strDocumentName = (String) documentName.the_value;
               
        try
        {
                Document doc = ((DocDeclaration)
document.the_value).getXmlDocument();
...


That's all.

You can write your own code and use it like you want (for Lists).
Hope this helps.

Regards Manfred



-----Ursprüngliche Nachricht-----
Von: PedroUninova [mailto:pd@...]
Gesendet: 2009-02-13 17:03
An: shark@...
Betreff: [shark] RE: Shark List Issue again sorry.....

Hello again

Sorry for long absence.... but I have been working on other project....

Geeta
Before the start of this issue I had already build up several process's with simple types....
I'm not sure, but are you saying that I should use simple types as external references to see if I understand the process off instantiate external classes???

After some tries I continue to not understand how an activity will instantiate my custom made class....

Could you, or some one, help me with this long time problem???
Thanks,
        Pedro

-----Mensagem original-----
De: gramani@... [mailto:gramani@...]
Enviada: sábado, 24 de Janeiro de 2009 16:52
Para: shark@...
Assunto: [shark] Re: RE:Shark List Issue

Hi Pedro, the reason you got thsi error ""type not supported"" is because List is not supported as a type for a process variable. Only basic types like String, Integer, Boolean etc are supported. So if you want to start out building a "simple process" then start with one of the basic types.
Once you have that working then move on to more complex Java types. As I mentioned earlier if you want a process variable which is of type List the only way that i know how to do it is to build a Java class which will have the List functionalty and then use it as I described earlier: "

> > you can define any
> > Java object to be a workflow variable (through the use of XPDL
> > ExternalReference data type), and then use it in shark (of course,
> > this class has to be on shark's classpath). "

So go step by step. Make sure you get a Basic type like Integer/String working, then move on to an arbitrary java class.

Regards,
Geeta

"PedroUninova" <pd@...> wrote on 01/23/2009 10:32:21 PM:

> Hello,
> Can any body help me with this subject?
>
> Thanks in advance,
>    Pedro
>
> -----Mensagem original-----
> De: PedroUninova [mailto:pd@...]
> Enviada: terça-feira, 20 de Janeiro de 2009 14:49
> Para: shark@...
> Assunto: [shark] RE: Re: RE: Re: Shark List Issue
>
> Hi Geeta,
>
> I was trying to follow what you said and some problems came...
> - So I started to build a new process called "simple_process" (this
> way I can learn, without destroying things I have already done).
> - create a new workflow variable (list_var) of type LIST(basic type
string);
> - created a workflow participant (sys_participant) of type system;
> - defined a Formal Parameter (list_input) of type LIST(basic type
string);

> - from my previous tests I can't introduce a list to this formal
> parameter.....
>    An error of something like "type not supported" always come up.
>
> How can I use your way to do what I want?! Is this the right way?!
> For sure it's something very simple but I'm not getting it! Sorry :(
>
> Regards,
>             Pedro
>
> -----Mensagem original-----
> De: gramani@... [mailto:gramani@...]
> Enviada: sábado, 17 de Janeiro de 2009 14:04
> Para: shark@...
> Assunto: [shark] Re: RE: Re: Shark List Issue
>
> Hi Pedro:
>
> Here's how i would define my xpdl (again, I apologise if I do not
understand
> your situation correctly):
>
> 1. The xpdl has your custom defined process variable of class
> MyListType, and MyListType is of course in your class path .
> 1. The xpdl has a start activity, which leads to an activity in the
> *System* lane (ie performer is System and the activity is mapped to a
Java
> class, say, MyInstantiater which is also in in your class path). The
> path out of this system activity leads to the rest of the activities
> for your app.
> 2. The above Java class, MyInstantiater, has the logic needed to
instantiate

> your class MyListType as well as populate the custom defined process
> variable.
>
> Why won't this work?
>
> Regards,
> Geeta
>
> "uninova" <pd@...> wrote on 01/15/2009 04:44:01 PM:
>
> > Hello again,
> > I already familiar with that feature, and already tried a classed
> > build
> by
> > me. But I couldn't solve the situation. For sure I'm not doing the
> > things right.
> >
> > The only resolution that come to my mind was (using the example
bellow):

> > (its different from the past one but I think the point is the same)
> > Let's suppose I have a start activity.
> > The transition from this activity loads the values(Static values) to
> > the variable defined using the class build by me, lets say "my list
> type"...
> > A is an instance of "my_list_type"!!! how can I create an instance?!?!
> This
> > is not the right way....
> > a.add(2);
> > a.add(3);
> > a.add(7);
> >
> >
> > The problem now, at least for me, is how do you instantiate the
> class?!you
> > need an instance right?!?! What I need to change?
> >
> > So let's suppose:
> > MY_list_type is defined using the class my_personal_list.java bellow:
> > #########################################
> > private List real_list;
> > My_personal_list()
> > {
> >
> > }
> > Add_value(int value)
> > {
> > Real_list.add(value);
> > }
> > Retrieve_list()
> > {
> > Return real_list;
> > }
> > #####################################
> >
> >
> >
> > Regards,
> >          Pedro
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > -----Mensagem original-----
> > De: gramani@... [mailto:gramani@...]
> > Enviada: quinta-feira, 15 de Janeiro de 2009 14:54
> > Para: shark@...
> > Assunto: [shark] Re: Shark List Issue
> >
> > Hello Pedro,
> >
> > I am not sure if maybe I misunderstand your question, but I hope you
> > know that arbitrary (custome defined) Java classes can be used as
> > process variables..? From the current version docs I see this: "you
> > can define
> any
> > Java object to be a workflow variable (through the use of XPDL
> > ExternalReference data type), and then use it in shark (of course,
> > this class has to be on shark's classpath). "
> >
> > In earlier version's docs, there was more on this topic here:
> >
> > http://shark.objectweb.org/doc/1.1/HowTo/how_to.html#d0e360
> >
> > Again, I apologise if I didn't get your question :) Geeta
> >
> > "uninova" <pd@...> wrote on 01/15/2009 02:33:00 PM:
> >
> > > Hello all,
> > >
> > > Its difficult to explain the situation but lets try....
> > >
> > > I have a problem with lists and shark....
> > > The shark process starts to run when a request from an outside
> > > program is made (my program).
> > >
> > > Situation:
> > > My program first receives a list of arguments to a list variable
> > > type; Sends it to shark let say "LIST_IN_VAR", also starting the
> > > process; And after doing some work sends the same list to my
> > > program which will
> > use
> > > it to do more things...;
> > > Shark don't really uses the list, at least in this example. It
> > > simply receives and resend it to my program, but the list needs to
> > > enter in
> > shark.
> > >
> > > Problem:
> > > The problem is that I can't used Lists in shark... so what I do
> > > now
is:

> > > LIST_IN_VAR is now defined as a string.
> > > When a request is made, my program converts the list to a string
> > > and
> > sends
> > > it to shark
> > > Shark do is work....And in the end My program receives the "where
> > > to send" and the list as a String Converts the string back to LIST
> > > and sends and continue doing its
> job....
> > >
> > > How can I use the list type from shark?
> > > It's possible to create a variable of type list and define a
> > > initial
> > value??
> > >
> > > Regards and thanks,
> > >    Pedro
> > >
> > >
> > >
> > > --
> > > This message has been scanned for viruses and dangerous content by
> > > MailScanner, and is believed to be clean.
> > >
> > >
> > > --
> > > You receive this message as a subscriber of the shark@...
> > > mailing
> > list.
> > > To unsubscribe: mailto:shark-unsubscribe@... For general help:
> > > mailto:sympa@...?subject=help
> > > OW2 mailing lists service home page: http://www.ow2.org/wws
> >
> >
> >
> >
> > --
> > This message has been scanned for viruses and dangerous content by
> > MailScanner, and is believed to be clean.
> >
> >
> > --
> > You receive this message as a subscriber of the shark@...
> > mailing
> list.
> > To unsubscribe: mailto:shark-unsubscribe@... For general help:
> > mailto:sympa@...?subject=help
> > OW2 mailing lists service home page: http://www.ow2.org/wws
>
>
>
>
>
>
> --
> This message has been scanned for viruses and dangerous content by
> MailScanner, and is believed to be clean.
>
>
> --
> You receive this message as a subscriber of the shark@... mailing
list.
> To unsubscribe: mailto:shark-unsubscribe@... For general help:
> mailto:sympa@...?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws









--
You receive this message as a subscriber of the shark@... mailing list.
To unsubscribe: mailto:shark-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

RE: AW: RE: AW: RE: Shark List Issue again sorry.....

by PedroUninova :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Manfred and thanks,
I have searched for the execute method in the toolagents area but no luck...
this is confusing me... sorry.

Resuming to see if I understand the process:
Done: Define the formal parameter that has an external reference pointing to
the class MYLIST;
Done: Create the class MYLIST that will represent my complex type. With the
required getters and setters;
Done: Create the class MYLISTInstantiator. This will be used to create an
instance of my class; This class must extend the abstracttoolagent?!?!

if I understand what you told me and from the beginning of this issues:
I need to :

not done: create a "systemparticipant" that call for this toolagent;
creating the list entity and saving the reference
not done: create the rest of the process
not done: give the list in an activity that my java code will receive
.....

Note: creating a system participant, generates a error when I'm loading
process to shark.....invalid xpdl (the problem is really system
participant!)

Regards and thanks,
Pedro
 

-----Mensagem original-----
De: Manfred Hagenauer [mailto:manfred.hagenauer@...]
Enviada: terça-feira, 24 de Fevereiro de 2009 7:02
Para: shark@...
Assunto: [shark] AW: RE: AW: RE: Shark List Issue again sorry.....

 Hello Pedro,

this was only an example, it means

1) in our case we had written our own class named "XMLDocument" for parsing
a XMLDocument.
        The AppParameter "documentFileName" supplied from the workflow is
given to this Class
        and we pass the Parser object through the Workflow. The Idea behind
is that we must parse
        this XML file several times in the workflow and we want to avoid
creating a new Object each time.
        So the external Reference "DocDeclaration" has only one function: to
be a Data Holder
        for the Parser object "Document" which was created itself with the
class "XMLDocument".

2) the execute methods shown in the example are that which are necessary in
any case for a Java
        Application called from the Workflow (especially the Toolagent which
calls this class)

Hope this clarifies what we had done.

Best regards, Manfred



-----Ursprüngliche Nachricht-----
Von: PedroUninova [mailto:pd@...]
Gesendet: 2009-02-23 16:42
An: shark@...
Betreff: [shark] RE: AW: RE: Shark List Issue again sorry.....

Hello and many thanks Manfred,

I'm following your explanation but i don't understand some things...

Sorry for being so slowly to understand this process :(

 (1)Where did you get the "XMLDocument" object with the method
"readDocument" present on this line: "Document xmlDocument =
XMLDocument.readDocument( ....."

 (2) the execute method belongs to some interface?

Regards,
        Pedro



-----Mensagem original-----
De: Manfred Hagenauer [mailto:manfred.hagenauer@...]
Enviada: segunda-feira, 16 de Fevereiro de 2009 7:27
Para: shark@...
Assunto: [shark] AW: RE: Shark List Issue again sorry.....

Hello Pedro,

using complex Java Types in Shark is not very complicate.
Look at this example where we use the Parser object of a XML Document.

First you had to define your external Reference in XPDL:
   <xpdl:FormalParameter Id="Document" Mode="INOUT">
        <xpdl:DataType>
             <xpdl:ExternalReference
location="com.hico.xprocess.DocDeclaration"/>
        </xpdl:DataType>
   </xpdl:FormalParameter>
 
Then your Class should look like this:
/**
 * Copyright 2001-2007 HiCo ICS Gesmbh
 * $RCSfile: DocDeclaration,v $ - $Author: manfred.hagenauer $
 * $Source: DocDeclaration.java,v $
 * $Revision: 1.1 $
 *
 * $Log$
 */
package com.hico.xprocess;

import java.io.Serializable;
import org.w3c.dom.Document;

public class DocDeclaration implements Serializable, Cloneable {
        private static final long serialVersionUID = 1L;
        private static Document xmlDocument = null;

        public Object clone()
        {
                try
                {
                        return super.clone();
                }
                catch( Exception ex )
                {
                        return null;
                }
        }

        public DocDeclaration()
        {
        }

        public DocDeclaration( Document document )
        {
                xmlDocument = document;
        }

        public Document getXmlDocument()
        {
                return xmlDocument;
        }

        public void setXmlDocument( Document document )
        {
                xmlDocument = document;
        }
}


Of Course the Parameter must be set in another Class:

public void execute( AppParameter documentFileName,
                AppParameter document)
{
...
        Document xmlDocument = XMLDocument.readDocument( .....
                               
        DocDeclaration doc = new DocDeclaration();
        doc.setXmlDocument(xmlDocument);
....

And in your Applications used in the Workflow you can access your class like
this:

public void execute( AppParameter documentName, AppParameter document ) {
        String strDocumentName = (String) documentName.the_value;
               
        try
        {
                Document doc = ((DocDeclaration)
document.the_value).getXmlDocument();
...


That's all.

You can write your own code and use it like you want (for Lists).
Hope this helps.

Regards Manfred



-----Ursprüngliche Nachricht-----
Von: PedroUninova [mailto:pd@...]
Gesendet: 2009-02-13 17:03
An: shark@...
Betreff: [shark] RE: Shark List Issue again sorry.....

Hello again

Sorry for long absence.... but I have been working on other project....

Geeta
Before the start of this issue I had already build up several process's with
simple types....
I'm not sure, but are you saying that I should use simple types as external
references to see if I understand the process off instantiate external
classes???

After some tries I continue to not understand how an activity will
instantiate my custom made class....

Could you, or some one, help me with this long time problem???
Thanks,
        Pedro

-----Mensagem original-----
De: gramani@... [mailto:gramani@...]
Enviada: sábado, 24 de Janeiro de 2009 16:52
Para: shark@...
Assunto: [shark] Re: RE:Shark List Issue

Hi Pedro, the reason you got thsi error ""type not supported"" is because
List is not supported as a type for a process variable. Only basic types
like String, Integer, Boolean etc are supported. So if you want to start out
building a "simple process" then start with one of the basic types.
Once you have that working then move on to more complex Java types. As I
mentioned earlier if you want a process variable which is of type List the
only way that i know how to do it is to build a Java class which will have
the List functionalty and then use it as I described earlier: "

> > you can define any
> > Java object to be a workflow variable (through the use of XPDL
> > ExternalReference data type), and then use it in shark (of course,
> > this class has to be on shark's classpath). "

So go step by step. Make sure you get a Basic type like Integer/String
working, then move on to an arbitrary java class.

Regards,
Geeta

"PedroUninova" <pd@...> wrote on 01/23/2009 10:32:21 PM:

> Hello,
> Can any body help me with this subject?
>
> Thanks in advance,
>    Pedro
>
> -----Mensagem original-----
> De: PedroUninova [mailto:pd@...]
> Enviada: terça-feira, 20 de Janeiro de 2009 14:49
> Para: shark@...
> Assunto: [shark] RE: Re: RE: Re: Shark List Issue
>
> Hi Geeta,
>
> I was trying to follow what you said and some problems came...
> - So I started to build a new process called "simple_process" (this
> way I can learn, without destroying things I have already done).
> - create a new workflow variable (list_var) of type LIST(basic type
string);
> - created a workflow participant (sys_participant) of type system;
> - defined a Formal Parameter (list_input) of type LIST(basic type
string);

> - from my previous tests I can't introduce a list to this formal
> parameter.....
>    An error of something like "type not supported" always come up.
>
> How can I use your way to do what I want?! Is this the right way?!
> For sure it's something very simple but I'm not getting it! Sorry :(
>
> Regards,
>             Pedro
>
> -----Mensagem original-----
> De: gramani@... [mailto:gramani@...]
> Enviada: sábado, 17 de Janeiro de 2009 14:04
> Para: shark@...
> Assunto: [shark] Re: RE: Re: Shark List Issue
>
> Hi Pedro:
>
> Here's how i would define my xpdl (again, I apologise if I do not
understand
> your situation correctly):
>
> 1. The xpdl has your custom defined process variable of class
> MyListType, and MyListType is of course in your class path .
> 1. The xpdl has a start activity, which leads to an activity in the
> *System* lane (ie performer is System and the activity is mapped to a
Java
> class, say, MyInstantiater which is also in in your class path). The
> path out of this system activity leads to the rest of the activities
> for your app.
> 2. The above Java class, MyInstantiater, has the logic needed to
instantiate

> your class MyListType as well as populate the custom defined process
> variable.
>
> Why won't this work?
>
> Regards,
> Geeta
>
> "uninova" <pd@...> wrote on 01/15/2009 04:44:01 PM:
>
> > Hello again,
> > I already familiar with that feature, and already tried a classed
> > build
> by
> > me. But I couldn't solve the situation. For sure I'm not doing the
> > things right.
> >
> > The only resolution that come to my mind was (using the example
bellow):

> > (its different from the past one but I think the point is the same)
> > Let's suppose I have a start activity.
> > The transition from this activity loads the values(Static values) to
> > the variable defined using the class build by me, lets say "my list
> type"...
> > A is an instance of "my_list_type"!!! how can I create an instance?!?!
> This
> > is not the right way....
> > a.add(2);
> > a.add(3);
> > a.add(7);
> >
> >
> > The problem now, at least for me, is how do you instantiate the
> class?!you
> > need an instance right?!?! What I need to change?
> >
> > So let's suppose:
> > MY_list_type is defined using the class my_personal_list.java bellow:
> > #########################################
> > private List real_list;
> > My_personal_list()
> > {
> >
> > }
> > Add_value(int value)
> > {
> > Real_list.add(value);
> > }
> > Retrieve_list()
> > {
> > Return real_list;
> > }
> > #####################################
> >
> >
> >
> > Regards,
> >          Pedro
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > -----Mensagem original-----
> > De: gramani@... [mailto:gramani@...]
> > Enviada: quinta-feira, 15 de Janeiro de 2009 14:54
> > Para: shark@...
> > Assunto: [shark] Re: Shark List Issue
> >
> > Hello Pedro,
> >
> > I am not sure if maybe I misunderstand your question, but I hope you
> > know that arbitrary (custome defined) Java classes can be used as
> > process variables..? From the current version docs I see this: "you
> > can define
> any
> > Java object to be a workflow variable (through the use of XPDL
> > ExternalReference data type), and then use it in shark (of course,
> > this class has to be on shark's classpath). "
> >
> > In earlier version's docs, there was more on this topic here:
> >
> > http://shark.objectweb.org/doc/1.1/HowTo/how_to.html#d0e360
> >
> > Again, I apologise if I didn't get your question :) Geeta
> >
> > "uninova" <pd@...> wrote on 01/15/2009 02:33:00 PM:
> >
> > > Hello all,
> > >
> > > Its difficult to explain the situation but lets try....
> > >
> > > I have a problem with lists and shark....
> > > The shark process starts to run when a request from an outside
> > > program is made (my program).
> > >
> > > Situation:
> > > My program first receives a list of arguments to a list variable
> > > type; Sends it to shark let say "LIST_IN_VAR", also starting the
> > > process; And after doing some work sends the same list to my
> > > program which will
> > use
> > > it to do more things...;
> > > Shark don't really uses the list, at least in this example. It
> > > simply receives and resend it to my program, but the list needs to
> > > enter in
> > shark.
> > >
> > > Problem:
> > > The problem is that I can't used Lists in shark... so what I do
> > > now
is:

> > > LIST_IN_VAR is now defined as a string.
> > > When a request is made, my program converts the list to a string
> > > and
> > sends
> > > it to shark
> > > Shark do is work....And in the end My program receives the "where
> > > to send" and the list as a String Converts the string back to LIST
> > > and sends and continue doing its
> job....
> > >
> > > How can I use the list type from shark?
> > > It's possible to create a variable of type list and define a
> > > initial
> > value??
> > >
> > > Regards and thanks,
> > >    Pedro
> > >
> > >
> > >
> > > --
> > > This message has been scanned for viruses and dangerous content by
> > > MailScanner, and is believed to be clean.
> > >
> > >
> > > --
> > > You receive this message as a subscriber of the shark@...
> > > mailing
> > list.
> > > To unsubscribe: mailto:shark-unsubscribe@... For general help:
> > > mailto:sympa@...?subject=help
> > > OW2 mailing lists service home page: http://www.ow2.org/wws
> >
> >
> >
> >
> > --
> > This message has been scanned for viruses and dangerous content by
> > MailScanner, and is believed to be clean.
> >
> >
> > --
> > You receive this message as a subscriber of the shark@...
> > mailing
> list.
> > To unsubscribe: mailto:shark-unsubscribe@... For general help:
> > mailto:sympa@...?subject=help
> > OW2 mailing lists service home page: http://www.ow2.org/wws
>
>
>
>
>
>
> --
> This message has been scanned for viruses and dangerous content by
> MailScanner, and is believed to be clean.
>
>
> --
> You receive this message as a subscriber of the shark@... mailing
list.
> To unsubscribe: mailto:shark-unsubscribe@... For general help:
> mailto:sympa@...?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws











--
You receive this message as a subscriber of the shark@... mailing list.
To unsubscribe: mailto:shark-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

AW: RE: AW: RE: AW: RE: Shark List Issue again sorry.....

by Manfred Hagenauer-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Pedro,

again the JavaClassToolAgent is the entry point from the engine, this executes your execute method in your Application class.
And no, it is not necessary that your class must extend abstracttoolagent, it is similiar to this:

package com.hico.xprocess;
public class AppCheckIssNumber
{

        public void execute( AppParameter documentName )
        {
.....your code
        }
}
and this class is referenced from your Application-Definition in your workflow, that's all for the application.

Your xpdl should have something like this:
<xpdl:Application Id="Check_Issue_Number" Name="CheckIssueNo">
<xpdl:FormalParameters>
<xpdl:FormalParameter Id="DocName" Mode="IN">
<xpdl:DataType>
<xpdl:ExternalReference location="com.hico.xprocess.DocDeclaration"/>
</xpdl:DataType>
<xpdl:Description>XMLDocument</xpdl:Description>
</xpdl:FormalParameter>
</xpdl:FormalParameters>
<xpdl:ExtendedAttributes>
<xpdl:ExtendedAttribute Name="ToolAgentClass" Value="org.enhydra.shark.toolagent.JavaClassToolAgent"/>
<xpdl:ExtendedAttribute Name="AppName" Value="com.hico.xprocess.AppCheckIssNumber"/>
<xpdl:ExtendedAttribute Name="AppMode"/>
</xpdl:ExtendedAttribute>
</xpdl:ExtendedAttributes>
</xpdl:Application>

And this Application Definition had to be used from your Tool-Definition in the Workflow in the swimlane of a System participant

I'm sorry that I couldn't give you a complete detailed example, it's because our application works in a military environment,
therefore it's not allowed to do this.

Best regards Manfred


-----Ursprüngliche Nachricht-----
Von: PedroUninova [mailto:pd@...]
Gesendet: 2009-02-27 15:21
An: shark@...
Betreff: [shark] RE: AW: RE: AW: RE: Shark List Issue again sorry.....
Wichtigkeit: Hoch

Hello Manfred and thanks,
I have searched for the execute method in the toolagents area but no luck...
this is confusing me... sorry.

Resuming to see if I understand the process:
Done: Define the formal parameter that has an external reference pointing to the class MYLIST;
Done: Create the class MYLIST that will represent my complex type. With the required getters and setters;
Done: Create the class MYLISTInstantiator. This will be used to create an instance of my class; This class must extend the abstracttoolagent?!?!

if I understand what you told me and from the beginning of this issues:
I need to :

not done: create a "systemparticipant" that call for this toolagent; creating the list entity and saving the reference not done: create the rest of the process not done: give the list in an activity that my java code will receive .....

Note: creating a system participant, generates a error when I'm loading process to shark.....invalid xpdl (the problem is really system
participant!)

Regards and thanks,
Pedro
 

-----Mensagem original-----
De: Manfred Hagenauer [mailto:manfred.hagenauer@...]
Enviada: terça-feira, 24 de Fevereiro de 2009 7:02
Para: shark@...
Assunto: [shark] AW: RE: AW: RE: Shark List Issue again sorry.....

 Hello Pedro,

this was only an example, it means

1) in our case we had written our own class named "XMLDocument" for parsing a XMLDocument.
        The AppParameter "documentFileName" supplied from the workflow is given to this Class
        and we pass the Parser object through the Workflow. The Idea behind is that we must parse
        this XML file several times in the workflow and we want to avoid creating a new Object each time.
        So the external Reference "DocDeclaration" has only one function: to be a Data Holder
        for the Parser object "Document" which was created itself with the class "XMLDocument".

2) the execute methods shown in the example are that which are necessary in any case for a Java
        Application called from the Workflow (especially the Toolagent which calls this class)

Hope this clarifies what we had done.

Best regards, Manfred



-----Ursprüngliche Nachricht-----
Von: PedroUninova [mailto:pd@...]
Gesendet: 2009-02-23 16:42
An: shark@...
Betreff: [shark] RE: AW: RE: Shark List Issue again sorry.....

Hello and many thanks Manfred,

I'm following your explanation but i don't understand some things...

Sorry for being so slowly to understand this process :(

 (1)Where did you get the "XMLDocument" object with the method "readDocument" present on this line: "Document xmlDocument = XMLDocument.readDocument( ....."

 (2) the execute method belongs to some interface?

Regards,
        Pedro



-----Mensagem original-----
De: Manfred Hagenauer [mailto:manfred.hagenauer@...]
Enviada: segunda-feira, 16 de Fevereiro de 2009 7:27
Para: shark@...
Assunto: [shark] AW: RE: Shark List Issue again sorry.....

Hello Pedro,

using complex Java Types in Shark is not very complicate.
Look at this example where we use the Parser object of a XML Document.

First you had to define your external Reference in XPDL:
   <xpdl:FormalParameter Id="Document" Mode="INOUT">
        <xpdl:DataType>
             <xpdl:ExternalReference
location="com.hico.xprocess.DocDeclaration"/>
        </xpdl:DataType>
   </xpdl:FormalParameter>
 
Then your Class should look like this:
/**
 * Copyright 2001-2007 HiCo ICS Gesmbh
 * $RCSfile: DocDeclaration,v $ - $Author: manfred.hagenauer $
 * $Source: DocDeclaration.java,v $
 * $Revision: 1.1 $
 *
 * $Log$
 */
package com.hico.xprocess;

import java.io.Serializable;
import org.w3c.dom.Document;

public class DocDeclaration implements Serializable, Cloneable {
        private static final long serialVersionUID = 1L;
        private static Document xmlDocument = null;

        public Object clone()
        {
                try
                {
                        return super.clone();
                }
                catch( Exception ex )
                {
                        return null;
                }
        }

        public DocDeclaration()
        {
        }

        public DocDeclaration( Document document )
        {
                xmlDocument = document;
        }

        public Document getXmlDocument()
        {
                return xmlDocument;
        }

        public void setXmlDocument( Document document )
        {
                xmlDocument = document;
        }
}


Of Course the Parameter must be set in another Class:

public void execute( AppParameter documentFileName,
                AppParameter document)
{
...
        Document xmlDocument = XMLDocument.readDocument( .....
                               
        DocDeclaration doc = new DocDeclaration();
        doc.setXmlDocument(xmlDocument);
....

And in your Applications used in the Workflow you can access your class like
this:

public void execute( AppParameter documentName, AppParameter document ) {
        String strDocumentName = (String) documentName.the_value;
               
        try
        {
                Document doc = ((DocDeclaration)
document.the_value).getXmlDocument();
...


That's all.

You can write your own code and use it like you want (for Lists).
Hope this helps.

Regards Manfred



-----Ursprüngliche Nachricht-----
Von: PedroUninova [mailto:pd@...]
Gesendet: 2009-02-13 17:03
An: shark@...
Betreff: [shark] RE: Shark List Issue again sorry.....

Hello again

Sorry for long absence.... but I have been working on other project....

Geeta
Before the start of this issue I had already build up several process's with simple types....
I'm not sure, but are you saying that I should use simple types as external references to see if I understand the process off instantiate external classes???

After some tries I continue to not understand how an activity will instantiate my custom made class....

Could you, or some one, help me with this long time problem???
Thanks,
        Pedro

-----Mensagem original-----
De: gramani@... [mailto:gramani@...]
Enviada: sábado, 24 de Janeiro de 2009 16:52
Para: shark@...
Assunto: [shark] Re: RE:Shark List Issue

Hi Pedro, the reason you got thsi error ""type not supported"" is because List is not supported as a type for a process variable. Only basic types like String, Integer, Boolean etc are supported. So if you want to start out building a "simple process" then start with one of the basic types.
Once you have that working then move on to more complex Java types. As I mentioned earlier if you want a process variable which is of type List the only way that i know how to do it is to build a Java class which will have the List functionalty and then use it as I described earlier: "

> > you can define any
> > Java object to be a workflow variable (through the use of XPDL
> > ExternalReference data type), and then use it in shark (of course,
> > this class has to be on shark's classpath). "

So go step by step. Make sure you get a Basic type like Integer/String working, then move on to an arbitrary java class.

Regards,
Geeta

"PedroUninova" <pd@...> wrote on 01/23/2009 10:32:21 PM:

> Hello,
> Can any body help me with this subject?
>
> Thanks in advance,
>    Pedro
>
> -----Mensagem original-----
> De: PedroUninova [mailto:pd@...]
> Enviada: terça-feira, 20 de Janeiro de 2009 14:49
> Para: shark@...
> Assunto: [shark] RE: Re: RE: Re: Shark List Issue
>
> Hi Geeta,
>
> I was trying to follow what you said and some problems came...
> - So I started to build a new process called "simple_process" (this
> way I can learn, without destroying things I have already done).
> - create a new workflow variable (list_var) of type LIST(basic type
string);
> - created a workflow participant (sys_participant) of type system;
> - defined a Formal Parameter (list_input) of type LIST(basic type
string);

> - from my previous tests I can't introduce a list to this formal
> parameter.....
>    An error of something like "type not supported" always come up.
>
> How can I use your way to do what I want?! Is this the right way?!
> For sure it's something very simple but I'm not getting it! Sorry :(
>
> Regards,
>             Pedro
>
> -----Mensagem original-----
> De: gramani@... [mailto:gramani@...]
> Enviada: sábado, 17 de Janeiro de 2009 14:04
> Para: shark@...
> Assunto: [shark] Re: RE: Re: Shark List Issue
>
> Hi Pedro:
>
> Here's how i would define my xpdl (again, I apologise if I do not
understand
> your situation correctly):
>
> 1. The xpdl has your custom defined process variable of class
> MyListType, and MyListType is of course in your class path .
> 1. The xpdl has a start activity, which leads to an activity in the
> *System* lane (ie performer is System and the activity is mapped to a
Java
> class, say, MyInstantiater which is also in in your class path). The
> path out of this system activity leads to the rest of the activities
> for your app.
> 2. The above Java class, MyInstantiater, has the logic needed to
instantiate

> your class MyListType as well as populate the custom defined process
> variable.
>
> Why won't this work?
>
> Regards,
> Geeta
>
> "uninova" <pd@...> wrote on 01/15/2009 04:44:01 PM:
>
> > Hello again,
> > I already familiar with that feature, and already tried a classed
> > build
> by
> > me. But I couldn't solve the situation. For sure I'm not doing the
> > things right.
> >
> > The only resolution that come to my mind was (using the example
bellow):

> > (its different from the past one but I think the point is the same)
> > Let's suppose I have a start activity.
> > The transition from this activity loads the values(Static values) to
> > the variable defined using the class build by me, lets say "my list
> type"...
> > A is an instance of "my_list_type"!!! how can I create an instance?!?!
> This
> > is not the right way....
> > a.add(2);
> > a.add(3);
> > a.add(7);
> >
> >
> > The problem now, at least for me, is how do you instantiate the
> class?!you
> > need an instance right?!?! What I need to change?
> >
> > So let's suppose:
> > MY_list_type is defined using the class my_personal_list.java bellow:
> > #########################################
> > private List real_list;
> > My_personal_list()
> > {
> >
> > }
> > Add_value(int value)
> > {
> > Real_list.add(value);
> > }
> > Retrieve_list()
> > {
> > Return real_list;
> > }
> > #####################################
> >
> >
> >
> > Regards,
> >          Pedro
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > -----Mensagem original-----
> > De: gramani@... [mailto:gramani@...]
> > Enviada: quinta-feira, 15 de Janeiro de 2009 14:54
> > Para: shark@...
> > Assunto: [shark] Re: Shark List Issue
> >
> > Hello Pedro,
> >
> > I am not sure if maybe I misunderstand your question, but I hope you
> > know that arbitrary (custome defined) Java classes can be used as
> > process variables..? From the current version docs I see this: "you
> > can define
> any
> > Java object to be a workflow variable (through the use of XPDL
> > ExternalReference data type), and then use it in shark (of course,
> > this class has to be on shark's classpath). "
> >
> > In earlier version's docs, there was more on this topic here:
> >
> > http://shark.objectweb.org/doc/1.1/HowTo/how_to.html#d0e360
> >
> > Again, I apologise if I didn't get your question :) Geeta
> >
> > "uninova" <pd@...> wrote on 01/15/2009 02:33:00 PM:
> >
> > > Hello all,
> > >
> > > Its difficult to explain the situation but lets try....
> > >
> > > I have a problem with lists and shark....
> > > The shark process starts to run when a request from an outside
> > > program is made (my program).
> > >
> > > Situation:
> > > My program first receives a list of arguments to a list variable
> > > type; Sends it to shark let say "LIST_IN_VAR", also starting the
> > > process; And after doing some work sends the same list to my
> > > program which will
> > use
> > > it to do more things...;
> > > Shark don't really uses the list, at least in this example. It
> > > simply receives and resend it to my program, but the list needs to
> > > enter in
> > shark.
> > >
> > > Problem:
> > > The problem is that I can't used Lists in shark... so what I do
> > > now
is:

> > > LIST_IN_VAR is now defined as a string.
> > > When a request is made, my program converts the list to a string
> > > and
> > sends
> > > it to shark
> > > Shark do is work....And in the end My program receives the "where
> > > to send" and the list as a String Converts the string back to LIST
> > > and sends and continue doing its
> job....
> > >
> > > How can I use the list type from shark?
> > > It's possible to create a variable of type list and define a
> > > initial
> > value??
> > >
> > > Regards and thanks,
> > >    Pedro
> > >
> > >
> > >
> > > --
> > > This message has been scanned for viruses and dangerous content by
> > > MailScanner, and is believed to be clean.
> > >
> > >
> > > --
> > > You receive this message as a subscriber of the shark@...
> > > mailing
> > list.
> > > To unsubscribe: mailto:shark-unsubscribe@... For general help:
> > > mailto:sympa@...?subject=help
> > > OW2 mailing lists service home page: http://www.ow2.org/wws
> >
> >
> >
> >
> > --
> > This message has been scanned for viruses and dangerous content by
> > MailScanner, and is believed to be clean.
> >
> >
> > --
> > You receive this message as a subscriber of the shark@...
> > mailing
> list.
> > To unsubscribe: mailto:shark-unsubscribe@... For general help:
> > mailto:sympa@...?subject=help
> > OW2 mailing lists service home page: http://www.ow2.org/wws
>
>
>
>
>
>
> --
> This message has been scanned for viruses and dangerous content by
> MailScanner, and is believed to be clean.
>
>
> --
> You receive this message as a subscriber of the shark@... mailing
list.
> To unsubscribe: mailto:shark-unsubscribe@... For general help:
> mailto:sympa@...?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws












--
You receive this message as a subscriber of the shark@... mailing list.
To unsubscribe: mailto:shark-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

RE: Shark List Issue again sorry..... some good news

by PedroUninova :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hello Manfred,

I think now I'm getting somewhere but some problems arrived…

(now I understand what do you mean by an application. Some misunderstandings from me J)

 

I was able to define a FP using external reference. ( shark starts the process and don’t complains about receiving a external reference formal parameter).

In the process I have two activities

      Routing activity. No problem at all starts and finishes....

      Application activity on the "system lane" starts but after that an error is thrown:

            The executing class does nothing special. It is so simple that even creates the list object. I’m forgetting something?

            It is possible to change the executing method to return something?!

 

2009-03-09 12:34:56,734: Process[key=1201_Complex_load_list,mgrname=Complex#14#load_list] - Activity[Process Id=1201_Complex_load_list, Id=1102_1201_Complex_load_list_expand_list, ba=null, ActDefId=expand_list] is created

2009-03-09 12:34:56,781: Activity[Process Id=1201_Complex_load_list, Id=1102_1201_Complex_load_list_expand_list, ba=null, ActDefId=expand_list] - Executing tool [id=loadlist]

Tool agent map created, maximum number of mappings is 2147483646

Tool agent map created, maximum number of mappings is 2147483646

New mapping added to tool agent map, tool agent map currently has 1 mappings !

2009-03-09 12:34:57,062: JavaClassToolAgent - application list_classes.executing terminated incorrectly: java.lang.NullPointerException

2009-03-09 12:34:57,062: DefaultToolAgent - can't execute tool agent class org.enhydra.shark.toolagent.JavaClassToolAgent - application  terminated incorrectly: org.enhydra.shark.api.internal.toolagent.ToolAgentGeneralException

2009-03-09 12:34:57,062: Activity[Process Id=1201_Complex_load_list, Id=1102_1201_Complex_load_list_expand_list, ba=null, ActDefId=expand_list] - failed to execute tool [id=loadlist]

2009-03-09 12:34:57,062: Process[key=1201_Complex_load_list,mgrname=Complex #14#load_list] - Activity[Process Id=1201_Complex_load_list, Id=1102_1201_Complex_load_list_expand_list, ba=null, ActDefId=expand_list] is terminated.

2009-03-09 12:34:57,062: WfProcessWrapper.start took 453 millis for [key=1201_Complex_load_list],WMSessionHandle[Id=1,vendorData=test]

java.lang.NullPointerException

       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

       at java.lang.reflect.Method.invoke(Method.java:597)

       at org.enhydra.shark.toolagent.JavaClassToolAgent.invokeApplication(JavaClassToolAgent.java:71)

       at org.enhydra.shark.toolagent.DefaultToolAgent.invokeApplication(DefaultToolAgent.java:85)

       at org.enhydra.shark.toolagent.StandardToolAgentManager.invokeToolAgent(StandardToolAgentManager.java:146)

       at org.enhydra.shark.StandardToolActivityHandler$ToolRunner.invokeApplication(StandardToolActivityHandler.java:178)

       at org.enhydra.shark.StandardToolActivityHandler$ToolRunner.run(StandardToolActivityHandler.java:87)

       at org.enhydra.shark.StandardToolActivityHandler.executeActivity(StandardToolActivityHandler.java:45)

       at org.enhydra.shark.WfActivityImpl.runTool(WfActivityImpl.java:1433)

       at org.enhydra.shark.WfActivityImpl.startActivity(WfActivityImpl.java:1365)

       at org.enhydra.shark.WfActivityImpl.activate(WfActivityImpl.java:260)

       at org.enhydra.shark.WfProcessImpl.startActivity(WfProcessImpl.java:917)

       at org.enhydra.shark.WfProcessImpl.queueNext(WfProcessImpl.java:1131)

       at org.enhydra.shark.WfProcessImpl.run(WfProcessImpl.java:750)

       at org.enhydra.shark.WfProcessImpl.start(WfProcessImpl.java:422)

       at org.enhydra.shark.WfProcessWrapper.start(WfProcessWrapper.java:289)

       at shark_inteface.ProcessRes.startprocess(ProcessRes.java:471)

       at shark_inteface.test.main(test.java:343)

org.enhydra.shark.api.internal.toolagent.ToolAgentGeneralException

       at org.enhydra.shark.toolagent.JavaClassToolAgent.invokeApplication(JavaClassToolAgent.java:94)

       at org.enhydra.shark.toolagent.DefaultToolAgent.invokeApplication(DefaultToolAgent.java:85)

       at org.enhydra.shark.toolagent.StandardToolAgentManager.invokeToolAgent(StandardToolAgentManager.java:146)

       at org.enhydra.shark.StandardToolActivityHandler$ToolRunner.invokeApplication(StandardToolActivityHandler.java:178)

       at org.enhydra.shark.StandardToolActivityHandler$ToolRunner.run(StandardToolActivityHandler.java:87)

       at org.enhydra.shark.StandardToolActivityHandler.executeActivity(StandardToolActivityHandler.java:45)

       at org.enhydra.shark.WfActivityImpl.runTool(WfActivityImpl.java:1433)

       at org.enhydra.shark.WfActivityImpl.startActivity(WfActivityImpl.java:1365)

       at org.enhydra.shark.WfActivityImpl.activate(WfActivityImpl.java:260)

       at org.enhydra.shark.WfProcessImpl.startActivity(WfProcessImpl.java:917)

       at org.enhydra.shark.WfProcessImpl.queueNext(WfProcessImpl.java:1131)

       at org.enhydra.shark.WfProcessImpl.run(WfProcessImpl.java:750)

       at org.enhydra.shark.WfProcessImpl.start(WfProcessImpl.java:422)

       at org.enhydra.shark.WfProcessWrapper.start(WfProcessWrapper.java:289)

       at shark_inteface.ProcessRes.startprocess(ProcessRes.java:471)

       at shark_inteface.test.main(test.java:343)

Caused by: java.lang.NullPointerException

       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

       at java.lang.reflect.Method.invoke(Method.java:597)

       at org.enhydra.shark.toolagent.JavaClassToolAgent.invokeApplication(JavaClassToolAgent.java:71)

 

“Executing” class:

 

public class executing implements Serializable{

      /**

       *

       */

      private static final long serialVersionUID = 1825286912541498847L;

 

      public void execute( AppParameter ListEntity){

     

                  List list_original = new ArrayList();

                  list_original.add(2);

                  list_original.add(3);

                  list_original.add(4);

                 

                  //ListDeclaration lista = new ListDeclaration();

                  //lista.setMylist(list_original);  //this will receive the transformed list entity

      }          

}

 

Do you have any clue?

Thanks,

            Pedro

 

 

 

 

-----Mensagem original-----
De: Manfred Hagenauer [mailto:manfred.hagenauer@...]
Enviada: segunda-feira, 2 de Março de 2009 10:14
Para: shark@...
Assunto: [shark] AW: RE: AW: RE: AW: RE: Shark List Issue again sorry.....

 

Hello Pedro,

 

again the JavaClassToolAgent is the entry point from the engine, this executes your execute method in your Application class.

And no, it is not necessary that your class must extend abstracttoolagent, it is similiar to this:

 

package com.hico.xprocess;

public class AppCheckIssNumber

{

 

      public void execute( AppParameter documentName )

      {

.....your code

      }

}

and this class is referenced from your Application-Definition in your workflow, that's all for the application.

 

Your xpdl should have something like this:

<xpdl:Application Id="Check_Issue_Number" Name="CheckIssueNo"> <xpdl:FormalParameters> <xpdl:FormalParameter Id="DocName" Mode="IN"> <xpdl:DataType> <xpdl:ExternalReference location="com.hico.xprocess.DocDeclaration"/>

</xpdl:DataType>

<xpdl:Description>XMLDocument</xpdl:Description>

</xpdl:FormalParameter>

</xpdl:FormalParameters>

<xpdl:ExtendedAttributes>

<xpdl:ExtendedAttribute Name="ToolAgentClass" Value="org.enhydra.shark.toolagent.JavaClassToolAgent"/>

<xpdl:ExtendedAttribute Name="AppName" Value="com.hico.xprocess.AppCheckIssNumber"/>

<xpdl:ExtendedAttribute Name="AppMode"/> </xpdl:ExtendedAttribute> </xpdl:ExtendedAttributes> </xpdl:Application>

 

And this Application Definition had to be used from your Tool-Definition in the Workflow in the swimlane of a System participant

 

I'm sorry that I couldn't give you a complete detailed example, it's because our application works in a military environment, therefore it's not allowed to do this.

 

Best regards Manfred

 

 

-----Ursprüngliche Nachricht-----

Von: PedroUninova [mailto:pd@...]

Gesendet: 2009-02-27 15:21

An: shark@...

Betreff: [shark] RE: AW: RE: AW: RE: Shark List Issue again sorry.....

Wichtigkeit: Hoch

 

Hello Manfred and thanks,

I have searched for the execute method in the toolagents area but no luck...

this is confusing me... sorry.

 

Resuming to see if I understand the process:

Done: Define the formal parameter that has an external reference pointing to the class MYLIST;

Done: Create the class MYLIST that will represent my complex type. With the required getters and setters;

Done: Create the class MYLISTInstantiator. This will be used to create an instance of my class; This class must extend the abstracttoolagent?!?!

 

if I understand what you told me and from the beginning of this issues:

I need to :

 

not done: create a "systemparticipant" that call for this toolagent; creating the list entity and saving the reference not done: create the rest of the process not done: give the list in an activity that my java code will receive .....

 

Note: creating a system participant, generates a error when I'm loading process to shark.....invalid xpdl (the problem is really system

participant!)

 

Regards and thanks,

Pedro

 

 

-----Mensagem original-----

De: Manfred Hagenauer [mailto:manfred.hagenauer@...]

Enviada: terça-feira, 24 de Fevereiro de 2009 7:02

Para: shark@...

Assunto: [shark] AW: RE: AW: RE: Shark List Issue again sorry.....

 

 Hello Pedro,

 

this was only an example, it means

 

1) in our case we had written our own class named "XMLDocument" for parsing a XMLDocument.

      The AppParameter "documentFileName" supplied from the workflow is given to this Class

      and we pass the Parser object through the Workflow. The Idea behind is that we must parse

      this XML file several times in the workflow and we want to avoid creating a new Object each time.

      So the external Reference "DocDeclaration" has only one function: to be a Data Holder

      for the Parser object "Document" which was created itself with the class "XMLDocument".

 

2) the execute methods shown in the example are that which are necessary in any case for a Java

      Application called from the Workflow (especially the Toolagent which calls this class)

 

Hope this clarifies what we had done.

 

Best regards, Manfred

 

 

 

-----Ursprüngliche Nachricht-----

Von: PedroUninova [mailto:pd@...]

Gesendet: 2009-02-23 16:42

An: shark@...

Betreff: [shark] RE: AW: RE: Shark List Issue again sorry.....

 

Hello and many thanks Manfred,

 

I'm following your explanation but i don't understand some things...

 

Sorry for being so slowly to understand this process :(

 

 (1)Where did you get the "XMLDocument" object with the method "readDocument" present on this line: "Document xmlDocument = XMLDocument.readDocument( ....."

 

 (2) the execute method belongs to some interface?

 

Regards,

      Pedro

 

 

 

-----Mensagem original-----

De: Manfred Hagenauer [mailto:manfred.hagenauer@...]

Enviada: segunda-feira, 16 de Fevereiro de 2009 7:27

Para: shark@...

Assunto: [shark] AW: RE: Shark List Issue again sorry.....

 

Hello Pedro,

 

using complex Java Types in Shark is not very complicate.

Look at this example where we use the Parser object of a XML Document.

 

First you had to define your external Reference in XPDL:

   <xpdl:FormalParameter Id="Document" Mode="INOUT">

        <xpdl:DataType>

             <xpdl:ExternalReference

location="com.hico.xprocess.DocDeclaration"/>

        </xpdl:DataType>

   </xpdl:FormalParameter>

 

Then your Class should look like this:

/**

 * Copyright 2001-2007 HiCo ICS Gesmbh

 * $RCSfile: DocDeclaration,v $ - $Author: manfred.hagenauer $

 * $Source: DocDeclaration.java,v $

 * $Revision: 1.1 $

 *

 * $Log$

 */

package com.hico.xprocess;

 

import java.io.Serializable;

import org.w3c.dom.Document;

 

public class DocDeclaration implements Serializable, Cloneable {

      private static final long    serialVersionUID  = 1L;

      private static Document      xmlDocument       = null;

 

      public Object clone()

      {

            try

            {

                  return super.clone();

            }

            catch( Exception ex )

            {

                  return null;

            }

      }

 

      public DocDeclaration()

      {

      }

 

      public DocDeclaration( Document document )

      {

            xmlDocument = document;

      }

 

      public Document getXmlDocument()

      {

            return xmlDocument;

      }

 

      public void setXmlDocument( Document document )

      {

            xmlDocument = document;

      }

}

 

 

Of Course the Parameter must be set in another Class:

 

public void execute( AppParameter documentFileName,

            AppParameter document)

{

...

      Document xmlDocument = XMLDocument.readDocument( .....

                       

      DocDeclaration doc = new DocDeclaration();

      doc.setXmlDocument(xmlDocument);

....

 

And in your Applications used in the Workflow you can access your class like

this:

 

public void execute( AppParameter documentName, AppParameter document ) {

      String strDocumentName = (String) documentName.the_value;

           

      try

      {

            Document doc = ((DocDeclaration)

document.the_value).getXmlDocument();

...

 

 

That's all.

 

You can write your own code and use it like you want (for Lists).

Hope this helps.

 

Regards Manfred

 

 

 

-----Ursprüngliche Nachricht-----

Von: PedroUninova [mailto:pd@...]

Gesendet: 2009-02-13 17:03

An: shark@...

Betreff: [shark] RE: Shark List Issue again sorry.....

 

Hello again

 

Sorry for long absence.... but I have been working on other project....

 

Geeta

Before the start of this issue I had already build up several process's with simple types....

I'm not sure, but are you saying that I should use simple types as external references to see if I understand the process off instantiate external classes???

 

After some tries I continue to not understand how an activity will instantiate my custom made class....

 

Could you, or some one, help me with this long time problem???

Thanks,

      Pedro

 

-----Mensagem original-----

De: gramani@... [mailto:gramani@...]

Enviada: sábado, 24 de Janeiro de 2009 16:52

Para: shark@...

Assunto: [shark] Re: RE:Shark List Issue

 

Hi Pedro, the reason you got thsi error ""type not supported"" is because List is not supported as a type for a process variable. Only basic types like String, Integer, Boolean etc are supported. So if you want to start out building a "simple process" then start with one of the basic types.

Once you have that working then move on to more complex Java types. As I mentioned earlier if you want a process variable which is of type List the only way that i know how to do it is to build a Java class which will have the List functionalty and then use it as I described earlier: "

 

> > you can define any

> > Java object to be a workflow variable (through the use of XPDL

> > ExternalReference data type), and then use it in shark (of course,

> > this class has to be on shark's classpath). "

 

So go step by step. Make sure you get a Basic type like Integer/String working, then move on to an arbitrary java class.

 

Regards,

Geeta

 

"PedroUninova" <pd@...> wrote on 01/23/2009 10:32:21 PM:

 

> Hello,

> Can any body help me with this subject?

> 

> Thanks in advance,

>    Pedro

> 

> -----Mensagem original-----

> De: PedroUninova [mailto:pd@...]

> Enviada: terça-feira, 20 de Janeiro de 2009 14:49

> Para: shark@...

> Assunto: [shark] RE: Re: RE: Re: Shark List Issue

> 

> Hi Geeta,

> 

> I was trying to follow what you said and some problems came...

> - So I started to build a new process called "simple_process" (this

> way I can learn, without destroying things I have already done).

> - create a new workflow variable (list_var) of type LIST(basic type

string);

> - created a workflow participant (sys_participant) of type system;

> - defined a Formal Parameter (list_input) of type LIST(basic type

string);

> - from my previous tests I can't introduce a list to this formal

> parameter.....

>    An error of something like "type not supported" always come up.

> 

> How can I use your way to do what I want?! Is this the right way?!

> For sure it's something very simple but I'm not getting it! Sorry :(

> 

> Regards,

>             Pedro

> 

> -----Mensagem original-----

> De: gramani@... [mailto:gramani@...]

> Enviada: sábado, 17 de Janeiro de 2009 14:04

> Para: shark@...

> Assunto: [shark] Re: RE: Re: Shark List Issue

> 

> Hi Pedro:

> 

> Here's how i would define my xpdl (again, I apologise if I do not

understand

> your situation correctly):

> 

> 1. The xpdl has your custom defined process variable of class

> MyListType, and MyListType is of course in your class path .

> 1. The xpdl has a start activity, which leads to an activity in the

> *System* lane (ie performer is System and the activity is mapped to a

Java

> class, say, MyInstantiater which is also in in your class path). The

> path out of this system activity leads to the rest of the activities

> for your app.

> 2. The above Java class, MyInstantiater, has the logic needed to

instantiate

> your class MyListType as well as populate the custom defined process

> variable.

> 

> Why won't this work?

> 

> Regards,

> Geeta

> 

> "uninova" <pd@...> wrote on 01/15/2009 04:44:01 PM:

> 

> > Hello again,

> > I already familiar with that feature, and already tried a classed

> > build

> by

> > me. But I couldn't solve the situation. For sure I'm not doing the

> > things right.

> >

> > The only resolution that come to my mind was (using the example

bellow):

> > (its different from the past one but I think the point is the same)

> > Let's suppose I have a start activity.

> > The transition from this activity loads the values(Static values) to

> > the variable defined using the class build by me, lets say "my list

> type"...

> > A is an instance of "my_list_type"!!! how can I create an instance?!?!

> This

> > is not the right way....

> > a.add(2);

> > a.add(3);

> > a.add(7);

> >

> >

> > The problem now, at least for me, is how do you instantiate the

> class?!you

> > need an instance right?!?! What I need to change?

> >

> > So let's suppose:

> > MY_list_type is defined using the class my_personal_list.java bellow:

> > #########################################

> > private List real_list;

> > My_personal_list()

> > {

> >

> > }

> > Add_value(int value)

> > {

> > Real_list.add(value);

> > }

> > Retrieve_list()

> > {

> > Return real_list;

> > }

> > #####################################

> >

> >

> >

> > Regards,

> >          Pedro

> >

> >

> >

> >

> >

> >

> >

> >

> >

> > -----Mensagem original-----

> > De: gramani@... [mailto:gramani@...]

> > Enviada: quinta-feira, 15 de Janeiro de 2009 14:54

> > Para: shark@...

> > Assunto: [shark] Re: Shark List Issue

> >

> > Hello Pedro,

> >

> > I am not sure if maybe I misunderstand your question, but I hope you

> > know that arbitrary (custome defined) Java classes can be used as

> > process variables..? From the current version docs I see this: "you

> > can define

> any

> > Java object to be a workflow variable (through the use of XPDL

> > ExternalReference data type), and then use it in shark (of course,

> > this class has to be on shark's classpath). "

> >

> > In earlier version's docs, there was more on this topic here:

> >

> > http://shark.objectweb.org/doc/1.1/HowTo/how_to.html#d0e360

> >

> > Again, I apologise if I didn't get your question :) Geeta

> >

> > "uninova" <pd@...> wrote on 01/15/2009 02:33:00 PM:

> >

> > > Hello all,

> > >

> > > Its difficult to explain the situation but lets try....

> > >

> > > I have a problem with lists and shark....

> > > The shark process starts to run when a request from an outside

> > > program is made (my program).

> > >

> > > Situation:

> > > My program first receives a list of arguments to a list variable

> > > type; Sends it to shark let say "LIST_IN_VAR", also starting the

> > > process; And after doing some work sends the same list to my

> > > program which will

> > use

> > > it to do more things...;

> > > Shark don't really uses the list, at least in this example. It

> > > simply receives and resend it to my program, but the list needs to

> > > enter in

> > shark.

> > >

> > > Problem:

> > > The problem is that I can't used Lists in shark... so what I do

> > > now

is:

> > > LIST_IN_VAR is now defined as a string.

> > > When a request is made, my program converts the list to a string

> > > and

> > sends

> > > it to shark

> > > Shark do is work....And in the end My program receives the "where

> > > to send" and the list as a String Converts the string back to LIST

> > > and sends and continue doing its

> job....

> > >

> > > How can I use the list type from shark?

> > > It's possible to create a variable of type list and define a

> > > initial

> > value??

> > >

> > > Regards and thanks,

> > >    Pedro

> > >

> > >

> > >

> > > --

> > > This message has been scanned for viruses and dangerous content by

> > > MailScanner, and is believed to be clean.

> > >

> > >

> > > --

> > > You receive this message as a subscriber of the shark@...

> > > mailing

> > list.

> > > To unsubscribe: mailto:shark-unsubscribe@... For general help:

> > > mailto:sympa@...?subject=help

> > > OW2 mailing lists service home page: http://www.ow2.org/wws

> >

> >

> >

> >

> > --

> > This message has been scanned for viruses and dangerous content by

> > MailScanner, and is believed to be clean.

> >

> >

> > --

> > You receive this message as a subscriber of the shark@...

> > mailing

> list.

> > To unsubscribe: mailto:shark-unsubscribe@... For general help:

> > mailto:sympa@...?subject=help

> > OW2 mailing lists service home page: http://www.ow2.org/wws

> 

> 

> 

> 

> 

> 

> --

> This message has been scanned for viruses and dangerous content by

> MailScanner, and is believed to be clean.

> 

> 

> --

> You receive this message as a subscriber of the shark@... mailing

list.

> To unsubscribe: mailto:shark-unsubscribe@... For general help:

> mailto:sympa@...?subject=help

> OW2 mailing lists service home page: http://www.ow2.org/wws

 

 

 

 

 

 

 

 

 

 



--
You receive this message as a subscriber of the shark@... mailing list.
To unsubscribe: mailto:shark-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

Re: RE: Shark List Issue again sorry..... some good news

by Francesco Zanitti-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi pedro, I don't know if this is the answer, but when I created a java tool agent i was forced to make a STATIC method execute, like:

public static void execute( AppParameter myParam, ...)

don't know if this is the issue, anyway

fz

On Mar 9, 2009, at 2:05 PM, PedroUninova wrote:

Hello Manfred,
I think now I'm getting somewhere but some problems arrived…
(now I understand what do you mean by an application. Some misunderstandings from me J)
 
I was able to define a FP using external reference. ( shark starts the process and don’t complains about receiving a external reference formal parameter).
In the process I have two activities
      Routing activity. No problem at all starts and finishes....
      Application activity on the "system lane" starts but after that an error is thrown:
            The executing class does nothing special. It is so simple that even creates the list object. I’m forgetting something?
            It is possible to change the executing method to return something?!
 
2009-03-09 12:34:56,734: Process[key=1201_Complex_load_list,mgrname=Complex#14#load_list] - Activity[Process Id=1201_Complex_load_list, Id=1102_1201_Complex_load_list_expand_list, ba=null, ActDefId=expand_list] is created
2009-03-09 12:34:56,781: Activity[Process Id=1201_Complex_load_list, Id=1102_1201_Complex_load_list_expand_list, ba=null, ActDefId=expand_list] - Executing tool [id=loadlist]
Tool agent map created, maximum number of mappings is 2147483646
Tool agent map created, maximum number of mappings is 2147483646
New mapping added to tool agent map, tool agent map currently has 1 mappings !
2009-03-09 12:34:57,062: JavaClassToolAgent - application list_classes.executing terminated incorrectly: java.lang.NullPointerException
2009-03-09 12:34:57,062: DefaultToolAgent - can't execute tool agent class org.enhydra.shark.toolagent.JavaClassToolAgent - application  terminated incorrectly: org.enhydra.shark.api.internal.toolagent.ToolAgentGeneralException
2009-03-09 12:34:57,062: Activity[Process Id=1201_Complex_load_list, Id=1102_1201_Complex_load_list_expand_list, ba=null, ActDefId=expand_list] - failed to execute tool [id=loadlist]
2009-03-09 12:34:57,062: Process[key=1201_Complex_load_list,mgrname=Complex #14#load_list] - Activity[Process Id=1201_Complex_load_list, Id=1102_1201_Complex_load_list_expand_list, ba=null, ActDefId=expand_list] is terminated.
2009-03-09 12:34:57,062: WfProcessWrapper.start took 453 millis for [key=1201_Complex_load_list],WMSessionHandle[Id=1,vendorData=test]
java.lang.NullPointerException
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.enhydra.shark.toolagent.JavaClassToolAgent.invokeApplication(JavaClassToolAgent.java:71)
       at org.enhydra.shark.toolagent.DefaultToolAgent.invokeApplication(DefaultToolAgent.java:85)
       at org.enhydra.shark.toolagent.StandardToolAgentManager.invokeToolAgent(StandardToolAgentManager.java:146)
       at org.enhydra.shark.StandardToolActivityHandler$ToolRunner.invokeApplication(StandardToolActivityHandler.java:178)
       at org.enhydra.shark.StandardToolActivityHandler$ToolRunner.run(StandardToolActivityHandler.java:87)
       at org.enhydra.shark.StandardToolActivityHandler.executeActivity(StandardToolActivityHandler.java:45)
       at org.enhydra.shark.WfActivityImpl.runTool(WfActivityImpl.java:1433)
       at org.enhydra.shark.WfActivityImpl.startActivity(WfActivityImpl.java:1365)
       at org.enhydra.shark.WfActivityImpl.activate(WfActivityImpl.java:260)
       at org.enhydra.shark.WfProcessImpl.startActivity(WfProcessImpl.java:917)
       at org.enhydra.shark.WfProcessImpl.queueNext(WfProcessImpl.java:1131)
       at org.enhydra.shark.WfProcessImpl.run(WfProcessImpl.java:750)
       at org.enhydra.shark.WfProcessImpl.start(WfProcessImpl.java:422)
       at org.enhydra.shark.WfProcessWrapper.start(WfProcessWrapper.java:289)
       at shark_inteface.ProcessRes.startprocess(ProcessRes.java:471)
       at shark_inteface.test.main(test.java:343)
org.enhydra.shark.api.internal.toolagent.ToolAgentGeneralException
       at org.enhydra.shark.toolagent.JavaClassToolAgent.invokeApplication(JavaClassToolAgent.java:94)
       at org.enhydra.shark.toolagent.DefaultToolAgent.invokeApplication(DefaultToolAgent.java:85)
       at org.enhydra.shark.toolagent.StandardToolAgentManager.invokeToolAgent(StandardToolAgentManager.java:146)
       at org.enhydra.shark.StandardToolActivityHandler$ToolRunner.invokeApplication(StandardToolActivityHandler.java:178)
       at org.enhydra.shark.StandardToolActivityHandler$ToolRunner.run(StandardToolActivityHandler.java:87)
       at org.enhydra.shark.StandardToolActivityHandler.executeActivity(StandardToolActivityHandler.java:45)
       at org.enhydra.shark.WfActivityImpl.runTool(WfActivityImpl.java:1433)
       at org.enhydra.shark.WfActivityImpl.startActivity(WfActivityImpl.java:1365)
       at org.enhydra.shark.WfActivityImpl.activate(WfActivityImpl.java:260)
       at org.enhydra.shark.WfProcessImpl.startActivity(WfProcessImpl.java:917)
       at org.enhydra.shark.WfProcessImpl.queueNext(WfProcessImpl.java:1131)
       at org.enhydra.shark.WfProcessImpl.run(WfProcessImpl.java:750)
       at org.enhydra.shark.WfProcessImpl.start(WfProcessImpl.java:422)
       at org.enhydra.shark.WfProcessWrapper.start(WfProcessWrapper.java:289)
       at shark_inteface.ProcessRes.startprocess(ProcessRes.java:471)
       at shark_inteface.test.main(test.java:343)
Caused by: java.lang.NullPointerException
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.enhydra.shark.toolagent.JavaClassToolAgent.invokeApplication(JavaClassToolAgent.java:71)
 
“Executing” class:
 
public class executing implements Serializable{
      /**
       *
       */
      private static final long serialVersionUID = 1825286912541498847L;
 
      public void execute( AppParameter ListEntity){
     
                  List list_original = new ArrayList();
                  list_original.add(2);
                  list_original.add(3);
                  list_original.add(4);
                 
                  //ListDeclaration lista = new ListDeclaration();
                  //lista.setMylist(list_original);  //this will receive the transformed list entity
      }          
}
 
Do you have any clue?
Thanks,
            Pedro
 
 
 
 
-----Mensagem original-----
De: Manfred Hagenauer [manfred.hagenauer@...] 
Enviada: segunda-feira, 2 de Março de 2009 10:14
Para: shark@...
Assunto: [shark] AW: RE: AW: RE: AW: RE: Shark List Issue again sorry.....
 
Hello Pedro,
 
again the JavaClassToolAgent is the entry point from the engine, this executes your execute method in your Application class.
And no, it is not necessary that your class must extend abstracttoolagent, it is similiar to this:
 
package com.hico.xprocess;
public class AppCheckIssNumber
{
 
      public void execute( AppParameter documentName )
      {
.....your code
      }
}
and this class is referenced from your Application-Definition in your workflow, that's all for the application.
 
Your xpdl should have something like this:
<xpdl:Application Id="Check_Issue_Number" Name="CheckIssueNo"> <xpdl:FormalParameters> <xpdl:FormalParameter Id="DocName" Mode="IN"> <xpdl:DataType> <xpdl:ExternalReference location="com.hico.xprocess.DocDeclaration"/>
</xpdl:DataType>
<xpdl:Description>XMLDocument</xpdl:Description>
</xpdl:FormalParameter>
</xpdl:FormalParameters>
<xpdl:ExtendedAttributes>
<xpdl:ExtendedAttribute Name="ToolAgentClass" Value="org.enhydra.shark.toolagent.JavaClassToolAgent"/>
<xpdl:ExtendedAttribute Name="AppName" Value="com.hico.xprocess.AppCheckIssNumber"/>
<xpdl:ExtendedAttribute Name="AppMode"/> </xpdl:ExtendedAttribute> </xpdl:ExtendedAttributes> </xpdl:Application>
 
And this Application Definition had to be used from your Tool-Definition in the Workflow in the swimlane of a System participant
 
I'm sorry that I couldn't give you a complete detailed example, it's because our application works in a military environment, therefore it's not allowed to do this.
 
Best regards Manfred
 
 
-----Ursprüngliche Nachricht-----
Von: PedroUninova [pd@...]
Gesendet: 2009-02-27 15:21
Betreff: [shark] RE: AW: RE: AW: RE: Shark List Issue again sorry.....
Wichtigkeit: Hoch
 
Hello Manfred and thanks,
I have searched for the execute method in the toolagents area but no luck...
this is confusing me... sorry.
 
Resuming to see if I understand the process:
Done: Define the formal parameter that has an external reference pointing to the class MYLIST;
Done: Create the class MYLIST that will represent my complex type. With the required getters and setters;
Done: Create the class MYLISTInstantiator. This will be used to create an instance of my class; This class must extend the abstracttoolagent?!?!
 
if I understand what you told me and from the beginning of this issues:
I need to :
 
not done: create a "systemparticipant" that call for this toolagent; creating the list entity and saving the reference not done: create the rest of the process not done: give the list in an activity that my java code will receive .....
 
Note: creating a system participant, generates a error when I'm loading process to shark.....invalid xpdl (the problem is really system
participant!)
 
Regards and thanks,
Pedro
 
 
-----Mensagem original-----
De: Manfred Hagenauer [manfred.hagenauer@...]
Enviada: terça-feira, 24 de Fevereiro de 2009 7:02
Para: shark@...
Assunto: [shark] AW: RE: AW: RE: Shark List Issue again sorry.....
 
 Hello Pedro,
 
this was only an example, it means
 
1) in our case we had written our own class named "XMLDocument" for parsing a XMLDocument.
      The AppParameter "documentFileName" supplied from the workflow is given to this Class
      and we pass the Parser object through the Workflow. The Idea behind is that we must parse
      this XML file several times in the workflow and we want to avoid creating a new Object each time.
      So the external Reference "DocDeclaration" has only one function: to be a Data Holder
      for the Parser object "Document" which was created itself with the class "XMLDocument".
 
2) the execute methods shown in the example are that which are necessary in any case for a Java
      Application called from the Workflow (especially the Toolagent which calls this class)
 
Hope this clarifies what we had done.
 
Best regards, Manfred
 
 
 
-----Ursprüngliche Nachricht-----
Von: PedroUninova [pd@...]
Gesendet: 2009-02-23 16:42
Betreff: [shark] RE: AW: RE: Shark List Issue again sorry.....
 
Hello and many thanks Manfred,
 
I'm following your explanation but i don't understand some things...
 
Sorry for being so slowly to understand this process :(
 
 (1)Where did you get the "XMLDocument" object with the method "readDocument" present on this line: "Document xmlDocument = XMLDocument.readDocument( ....."
 
 (2) the execute method belongs to some interface?
 
Regards,
      Pedro
 
 
 
-----Mensagem original-----
De: Manfred Hagenauer [manfred.hagenauer@...]
Enviada: segunda-feira, 16 de Fevereiro de 2009 7:27
Para: shark@...
Assunto: [shark] AW: RE: Shark List Issue again sorry.....
 
Hello Pedro,
 
using complex Java Types in Shark is not very complicate.
Look at this example where we use the Parser object of a XML Document.
 
First you had to define your external Reference in XPDL:
   <xpdl:FormalParameter Id="Document" Mode="INOUT">
        <xpdl:DataType>
             <xpdl:ExternalReference
location="com.hico.xprocess.DocDeclaration"/>
        </xpdl:DataType>
   </xpdl:FormalParameter>
 
Then your Class should look like this:
/**
 * Copyright 2001-2007 HiCo ICS Gesmbh
 * $RCSfile: DocDeclaration,v $ - $Author: manfred.hagenauer $
 * $Source: DocDeclaration.java,v $
 * $Revision: 1.1 $
 *
 * $Log$
 */
package com.hico.xprocess;
 
import java.io.Serializable;
import org.w3c.dom.Document;
 
public class DocDeclaration implements Serializable, Cloneable {
      private static final long    serialVersionUID  = 1L;
      private static Document      xmlDocument       = null;
 
      public Object clone()
      {
            try
            {
                  return super.clone();
            }
            catch( Exception ex )
            {
                  return null;
            }
      }
 
      public DocDeclaration()
      {
      }
 
      public DocDeclaration( Document document )
      {
            xmlDocument = document;
      }
 
      public Document getXmlDocument()
      {
            return xmlDocument;
      }
 
      public void setXmlDocument( Document document )
      {
            xmlDocument = document;
      }
}
 
 
Of Course the Parameter must be set in another Class:
 
public void execute( AppParameter documentFileName,
            AppParameter document)
{
...
      Document xmlDocument = XMLDocument.readDocument( .....
                       
      DocDeclaration doc = new DocDeclaration();
      doc.setXmlDocument(xmlDocument);
....
 
And in your Applications used in the Workflow you can access your class like
this:
 
public void execute( AppParameter documentName, AppParameter document ) {
      String strDocumentName = (String) documentName.the_value;
           
      try
      {
            Document doc = ((DocDeclaration)
document.the_value).getXmlDocument();
...
 
 
That's all.
 
You can write your own code and use it like you want (for Lists).
Hope this helps.
 
Regards Manfred
 
 
 
-----Ursprüngliche Nachricht-----
Von: PedroUninova [pd@...]
Gesendet: 2009-02-13 17:03
Betreff: [shark] RE: Shark List Issue again sorry.....
 
Hello again
 
Sorry for long absence.... but I have been working on other project....
 
Geeta
Before the start of this issue I had already build up several process's with simple types....
I'm not sure, but are you saying that I should use simple types as external references to see if I understand the process off instantiate external classes???
 
After some tries I continue to not understand how an activity will instantiate my custom made class....
 
Could you, or some one, help me with this long time problem???
Thanks,
      Pedro
 
-----Mensagem original-----
Enviada: sábado, 24 de Janeiro de 2009 16:52
Para: shark@...
Assunto: [shark] Re: RE:Shark List Issue
 
Hi Pedro, the reason you got thsi error ""type not supported"" is because List is not supported as a type for a process variable. Only basic types like String, Integer, Boolean etc are supported. So if you want to start out building a "simple process" then start with one of the basic types.
Once you have that working then move on to more complex Java types. As I mentioned earlier if you want a process variable which is of type List the only way that i know how to do it is to build a Java class which will have the List functionalty and then use it as I described earlier: "
 
> > you can define any
> > Java object to be a workflow variable (through the use of XPDL
> > ExternalReference data type), and then use it in shark (of course,
> > this class has to be on shark's classpath). "
 
So go step by step. Make sure you get a Basic type like Integer/String working, then move on to an arbitrary java class.
 
Regards,
Geeta
 
"PedroUninova" <pd@...> wrote on 01/23/2009 10:32:21 PM:
 
> Hello,
> Can any body help me with this subject?
> 
> Thanks in advance,
>    Pedro
> 
> -----Mensagem original-----
> De: PedroUninova [pd@...]
> Enviada: terça-feira, 20 de Janeiro de 2009 14:49
> Para: shark@...
> Assunto: [shark] RE: Re: RE: Re: Shark List Issue
> 
> Hi Geeta,
> 
> I was trying to follow what you said and some problems came...
> - So I started to build a new process called "simple_process" (this
> way I can learn, without destroying things I have already done).
> - create a new workflow variable (list_var) of type LIST(basic type
string);
> - created a workflow participant (sys_participant) of type system;
> - defined a Formal Parameter (list_input) of type LIST(basic type
string);
> - from my previous tests I can't introduce a list to this formal
> parameter.....
>    An error of something like "type not supported" always come up.
> 
> How can I use your way to do what I want?! Is this the right way?!
> For sure it's something very simple but I'm not getting it! Sorry :(
> 
> Regards,
>             Pedro
> 
> -----Mensagem original-----
> Enviada: sábado, 17 de Janeiro de 2009 14:04
> Para: shark@...
> Assunto: [shark] Re: RE: Re: Shark List Issue
> 
> Hi Pedro:
> 
> Here's how i would define my xpdl (again, I apologise if I do not
understand
> your situation correctly):
> 
> 1. The xpdl has your custom defined process variable of class
> MyListType, and MyListType is of course in your class path .
> 1. The xpdl has a start activity, which leads to an activity in the
> *System* lane (ie performer is System and the activity is mapped to a
Java
> class, say, MyInstantiater which is also in in your class path). The
> path out of this system activity leads to the rest of the activities
> for your app.
> 2. The above Java class, MyInstantiater, has the logic needed to
instantiate
> your class MyListType as well as populate the custom defined process
> variable.
> 
> Why won't this work?
> 
> Regards,
> Geeta
> 
> "uninova" <pd@...> wrote on 01/15/2009 04:44:01 PM:
> 
> > Hello again,
> > I already familiar with that feature, and already tried a classed
> > build
> by
> > me. But I couldn't solve the situation. For sure I'm not doing the
> > things right.
> >
> > The only resolution that come to my mind was (using the example
bellow):
> > (its different from the past one but I think the point is the same)
> > Let's suppose I have a start activity.
> > The transition from this activity loads the values(Static values) to
> > the variable defined using the class build by me, lets say "my list
> type"...
> > A is an instance of "my_list_type"!!! how can I create an instance?!?!
> This
> > is not the right way....
> > a.add(2);
> > a.add(3);
> > a.add(7);
> >
> >
> > The problem now, at least for me, is how do you instantiate the
> class?!you
> > need an instance right?!?! What I need to change?
> >
> > So let's suppose:
> > MY_list_type is defined using the class my_personal_list.java bellow:
> > #########################################
> > private List real_list;
> > My_personal_list()
> > {
> >
> > }
> > Add_value(int value)
> > {
> > Real_list.add(value);
> > }
> > Retrieve_list()
> > {
> > Return real_list;
> > }
> > #####################################
> >
> >
> >
> > Regards,
> >          Pedro
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > -----Mensagem original-----
> > Enviada: quinta-feira, 15 de Janeiro de 2009 14:54
> > Para: shark@...
> > Assunto: [shark] Re: Shark List Issue
> >
> > Hello Pedro,
> >
> > I am not sure if maybe I misunderstand your question, but I hope you
> > know that arbitrary (custome defined) Java classes can be used as
> > process variables..? From the current version docs I see this: "you
> > can define
> any
> > Java object to be a workflow variable (through the use of XPDL
> > ExternalReference data type), and then use it in shark (of course,
> > this class has to be on shark's classpath). "
> >
> > In earlier version's docs, there was more on this topic here:
> >
> >
> > Again, I apologise if I didn't get your question :) Geeta
> >
> > "uninova" <pd@...> wrote on 01/15/2009 02:33:00 PM:
> >
> > > Hello all,
> > >
> > > Its difficult to explain the situation but lets try....
> > >
> > > I have a problem with lists and shark....
> > > The shark process starts to run when a request from an outside
> > > program is made (my program).
> > >
> > > Situation:
> > > My program first receives a list of arguments to a list variable
> > > type; Sends it to shark let say "LIST_IN_VAR", also starting the
> > > process; And after doing some work sends the same list to my
> > > program which will
> > use
> > > it to do more things...;
> > > Shark don't really uses the list, at least in this example. It
> > > simply receives and resend it to my program, but the list needs to
> > > enter in
> > shark.
> > >
> > > Problem:
> > > The problem is that I can't used Lists in shark... so what I do
> > > now
is:
> > > LIST_IN_VAR is now defined as a string.
> > > When a request is made, my program converts the list to a string
> > > and
> > sends
> > > it to shark
> > > Shark do is work....And in the end My program receives the "where
> > > to send" and the list as a String Converts the string back to LIST
> > > and sends and continue doing its
> job....
> > >
> > > How can I use the list type from shark?
> > > It's possible to create a variable of type list and define a
> > > initial
> > value??
> > >
> > > Regards and thanks,
> > >    Pedro
> > >
> > >
> > >
> > > --
> > > This message has been scanned for viruses and dangerous content by
> > > MailScanner, and is believed to be clean.
> > >
> > >
> > > --
> > > You receive this message as a subscriber of the shark@...
> > > mailing
> > list.
> > > To unsubscribe: shark-unsubscribe@... For general help:
> > > sympa@...
> > > OW2 mailing lists service home page: http://www.ow2.org/wws
> >
> >
> >
> >
> > --
> > This message has been scanned for viruses and dangerous content by
> > MailScanner, and is believed to be clean.
> >
> >
> > --
> > You receive this message as a subscriber of the shark@...
> > mailing
> list.
> > To unsubscribe: shark-unsubscribe@... For general help:
> > OW2 mailing lists service home page: http://www.ow2.org/wws
> 
> 
> 
> 
> 
> 
> --
> This message has been scanned for viruses and dangerous content by
> MailScanner, and is believed to be clean.
> 
> 
> --
> You receive this message as a subscriber of the shark@... mailing
list.
> To unsubscribe: shark-unsubscribe@... For general help:
> OW2 mailing lists service home page: http://www.ow2.org/wws
 
 
 
 
 
 
 
 
 
 

--
You receive this message as a subscriber of the shark@... mailing list.
To unsubscribe: shark-unsubscribe@...
For general help: sympa@...
OW2 mailing lists service home page: http://www.ow2.org/wws



--
You receive this message as a subscriber of the shark@... mailing list.
To unsubscribe: mailto:shark-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

RE: Shark List Issue----> solved

by PedroUninova :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hello,

Thank you all for all the help. I have finally made it. I’m now using list in my application.

A special thanks to Manfred and Francesco.

 

Regards,

Pedro

 

De: Francesco Zanitti [mailto:c43ng.81@...]
Enviada: segunda-feira, 9 de Março de 2009 18:05
Para: shark@...
Assunto: [shark] Re: RE: Shark List Issue again sorry..... some good news

 

Hi pedro, I don't know if this is the answer, but when I created a java tool agent i was forced to make a STATIC method execute, like:

 

public static void execute( AppParameter myParam, ...)

 

don't know if this is the issue, anyway

 

fz

 

On Mar 9, 2009, at 2:05 PM, PedroUninova wrote:



Hello Manfred,

I think now I'm getting somewhere but some problems arrived…

(now I understand what do you mean by an application. Some misunderstandings from me J)

 

I was able to define a FP using external reference. ( shark starts the process and don’t complains about receiving a external reference formal parameter).

In the process I have two activities

      Routing activity. No problem at all starts and finishes....

      Application activity on the "system lane" starts but after that an error is thrown:

            The executing class does nothing special. It is so simple that even creates the list object. I’m forgetting something?

            It is possible to change the executing method to return something?!

 

2009-03-09 12:34:56,734: Process[key=1201_Complex_load_list,mgrname=Complex#14#load_list] - Activity[Process Id=1201_Complex_load_list, Id=1102_1201_Complex_load_list_expand_list, ba=null, ActDefId=expand_list] is created

2009-03-09 12:34:56,781: Activity[Process Id=1201_Complex_load_list, Id=1102_1201_Complex_load_list_expand_list, ba=null, ActDefId=expand_list] - Executing tool [id=loadlist]

Tool agent map created, maximum number of mappings is 2147483646

Tool agent map created, maximum number of mappings is 2147483646

New mapping added to tool agent map, tool agent map currently has 1 mappings !

2009-03-09 12:34:57,062: JavaClassToolAgent - application list_classes.executing terminated incorrectly: java.lang.NullPointerException

2009-03-09 12:34:57,062: DefaultToolAgent - can't execute tool agent class org.enhydra.shark.toolagent.JavaClassToolAgent - application  terminated incorrectly: org.enhydra.shark.api.internal.toolagent.ToolAgentGeneralException

2009-03-09 12:34:57,062: Activity[Process Id=1201_Complex_load_list, Id=1102_1201_Complex_load_list_expand_list, ba=null, ActDefId=expand_list] - failed to execute tool [id=loadlist]

2009-03-09 12:34:57,062: Process[key=1201_Complex_load_list,mgrname=Complex #14#load_list] - Activity[Process Id=1201_Complex_load_list, Id=1102_1201_Complex_load_list_expand_list, ba=null, ActDefId=expand_list] is terminated.

2009-03-09 12:34:57,062: WfProcessWrapper.start took 453 millis for [key=1201_Complex_load_list],WMSessionHandle[Id=1,vendorData=test]

java.lang.NullPointerException

       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

       at java.lang.reflect.Method.invoke(Method.java:597)

       at org.enhydra.shark.toolagent.JavaClassToolAgent.invokeApplication(JavaClassToolAgent.java:71)

       at org.enhydra.shark.toolagent.DefaultToolAgent.invokeApplication(DefaultToolAgent.java:85)

       at org.enhydra.shark.toolagent.StandardToolAgentManager.invokeToolAgent(StandardToolAgentManager.java:146)

       at org.enhydra.shark.StandardToolActivityHandler$ToolRunner.invokeApplication(StandardToolActivityHandler.java:178)

       at org.enhydra.shark.StandardToolActivityHandler$ToolRunner.run(StandardToolActivityHandler.java:87)

       at org.enhydra.shark.StandardToolActivityHandler.executeActivity(StandardToolActivityHandler.java:45)

       at org.enhydra.shark.WfActivityImpl.runTool(WfActivityImpl.java:1433)

       at org.enhydra.shark.WfActivityImpl.startActivity(WfActivityImpl.java:1365)

       at org.enhydra.shark.WfActivityImpl.activate(WfActivityImpl.java:260)

       at org.enhydra.shark.WfProcessImpl.startActivity(WfProcessImpl.java:917)

       at org.enhydra.shark.WfProcessImpl.queueNext(WfProcessImpl.java:1131)

       at org.enhydra.shark.WfProcessImpl.run(WfProcessImpl.java:750)

       at org.enhydra.shark.WfProcessImpl.start(WfProcessImpl.java:422)

       at org.enhydra.shark.WfProcessWrapper.start(WfProcessWrapper.java:289)

       at shark_inteface.ProcessRes.startprocess(ProcessRes.java:471)

       at shark_inteface.test.main(test.java:343)

org.enhydra.shark.api.internal.toolagent.ToolAgentGeneralException

       at org.enhydra.shark.toolagent.JavaClassToolAgent.invokeApplication(JavaClassToolAgent.java:94)

       at org.enhydra.shark.toolagent.DefaultToolAgent.invokeApplication(DefaultToolAgent.java:85)

       at org.enhydra.shark.toolagent.StandardToolAgentManager.invokeToolAgent(StandardToolAgentManager.java:146)

       at org.enhydra.shark.StandardToolActivityHandler$ToolRunner.invokeApplication(StandardToolActivityHandler.java:178)

       at org.enhydra.shark.StandardToolActivityHandler$ToolRunner.run(StandardToolActivityHandler.java:87)

       at org.enhydra.shark.StandardToolActivityHandler.executeActivity(StandardToolActivityHandler.java:45)

       at org.enhydra.shark.WfActivityImpl.runTool(WfActivityImpl.java:1433)

       at org.enhydra.shark.WfActivityImpl.startActivity(WfActivityImpl.java:1365)

       at org.enhydra.shark.WfActivityImpl.activate(WfActivityImpl.java:260)

       at org.enhydra.shark.WfProcessImpl.startActivity(WfProcessImpl.java:917)

       at org.enhydra.shark.WfProcessImpl.queueNext(WfProcessImpl.java:1131)

       at org.enhydra.shark.WfProcessImpl.run(WfProcessImpl.java:750)

       at org.enhydra.shark.WfProcessImpl.start(WfProcessImpl.java:422)

       at org.enhydra.shark.WfProcessWrapper.start(WfProcessWrapper.java:289)

       at shark_inteface.ProcessRes.startprocess(ProcessRes.java:471)

       at shark_inteface.test.main(test.java:343)

Caused by: java.lang.NullPointerException

       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

       at java.lang.reflect.Method.invoke(Method.java:597)

       at org.enhydra.shark.toolagent.JavaClassToolAgent.invokeApplication(JavaClassToolAgent.java:71)

 

“Executing” class:

 

public class executing implements Serializable{

      /**

       *

       */

      private static final long serialVersionUID = 1825286912541498847L;

 

      public void execute( AppParameter ListEntity){

     

                  List list_original = new ArrayList();

                  list_original.add(2);

                  list_original.add(3);

                  list_original.add(4);

                 

                  //ListDeclaration lista = new ListDeclaration();

                  //lista.setMylist(list_original);  //this will receive the transformed list entity

      }          

}

 

Do you have any clue?

Thanks,

            Pedro

 

 

 

 

-----Mensagem original-----
De: Manfred Hagenauer [manfred.hagenauer@...] 
Enviada: segunda-feira, 2 de Março de 2009 10:14
Para: shark@...
Assunto: [shark] AW: RE: AW: RE: AW: RE: Shark List Issue again sorry.....

 

Hello Pedro,

 

again the JavaClassToolAgent is the entry point from the engine, this executes your execute method in your Application class.

And no, it is not necessary that your class must extend abstracttoolagent, it is similiar to this:

 

package com.hico.xprocess;

public class AppCheckIssNumber

{

 

      public void execute( AppParameter documentName )

      {

.....your code

      }

}

and this class is referenced from your Application-Definition in your workflow, that's all for the application.

 

Your xpdl should have something like this:

<xpdl:Application Id="Check_Issue_Number" Name="CheckIssueNo"> <xpdl:FormalParameters> <xpdl:FormalParameter Id="DocName" Mode="IN"> <xpdl:DataType> <xpdl:ExternalReference location="com.hico.xprocess.DocDeclaration"/>

</xpdl:DataType>

<xpdl:Description>XMLDocument</xpdl:Description>

</xpdl:FormalParameter>

</xpdl:FormalParameters>

<xpdl:ExtendedAttributes>

<xpdl:ExtendedAttribute Name="ToolAgentClass" Value="org.enhydra.shark.toolagent.JavaClassToolAgent"/>

<xpdl:ExtendedAttribute Name="AppName" Value="com.hico.xprocess.AppCheckIssNumber"/>

<xpdl:ExtendedAttribute Name="AppMode"/> </xpdl:ExtendedAttribute> </xpdl:ExtendedAttributes> </xpdl:Application>

 

And this Application Definition had to be used from your Tool-Definition in the Workflow in the swimlane of a System participant

 

I'm sorry that I couldn't give you a complete detailed example, it's because our application works in a military environment, therefore it's not allowed to do this.

 

Best regards Manfred

 

 

-----Ursprüngliche Nachricht-----

Von: PedroUninova [pd@...]

Gesendet: 2009-02-27 15:21

An: shark@...

Betreff: [shark] RE: AW: RE: AW: RE: Shark List Issue again sorry.....

Wichtigkeit: Hoch

 

Hello Manfred and thanks,

I have searched for the execute method in the toolagents area but no luck...

this is confusing me... sorry.

 

Resuming to see if I understand the process:

Done: Define the formal parameter that has an external reference pointing to the class MYLIST;

Done: Create the class MYLIST that will represent my complex type. With the required getters and setters;

Done: Create the class MYLISTInstantiator. This will be used to create an instance of my class; This class must extend the abstracttoolagent?!?!

 

if I understand what you told me and from the beginning of this issues:

I need to :

 

not done: create a "systemparticipant" that call for this toolagent; creating the list entity and saving the reference not done: create the rest of the process not done: give the list in an activity that my java code will receive .....

 

Note: creating a system participant, generates a error when I'm loading process to shark.....invalid xpdl (the problem is really system

participant!)

 

Regards and thanks,

Pedro

 

 

-----Mensagem original-----

De: Manfred Hagenauer [manfred.hagenauer@...]

Enviada: terça-feira, 24 de Fevereiro de 2009 7:02

Para: shark@...

Assunto: [shark] AW: RE: AW: RE: Shark List Issue again sorry.....

 

 Hello Pedro,

 

this was only an example, it means

 

1) in our case we had written our own class named "XMLDocument" for parsing a XMLDocument.

      The AppParameter "documentFileName" supplied from the workflow is given to this Class

      and we pass the Parser object through the Workflow. The Idea behind is that we must parse

      this XML file several times in the workflow and we want to avoid creating a new Object each time.

      So the external Reference "DocDeclaration" has only one function: to be a Data Holder

      for the Parser object "Document" which was created itself with the class "XMLDocument".

 

2) the execute methods shown in the example are that which are necessary in any case for a Java

      Application called from the Workflow (especially the Toolagent which calls this class)

 

Hope this clarifies what we had done.

 

Best regards, Manfred

 

 

 

-----Ursprüngliche Nachricht-----

Von: PedroUninova [pd@...]

Gesendet: 2009-02-23 16:42

An: shark@...

Betreff: [shark] RE: AW: RE: Shark List Issue again sorry.....

 

Hello and many thanks Manfred,

 

I'm following your explanation but i don't understand some things...

 

Sorry for being so slowly to understand this process :(

 

 (1)Where did you get the "XMLDocument" object with the method "readDocument" present on this line: "Document xmlDocument = XMLDocument.readDocument( ....."

 

 (2) the execute method belongs to some interface?

 

Regards,

      Pedro

 

 

 

-----Mensagem original-----

De: Manfred Hagenauer [manfred.hagenauer@...]

Enviada: segunda-feira, 16 de Fevereiro de 2009 7:27

Para: shark@...

Assunto: [shark] AW: RE: Shark List Issue again sorry.....

 

Hello Pedro,

 

using complex Java Types in Shark is not very complicate.

Look at this example where we use the Parser object of a XML Document.

 

First you had to define your external Reference in XPDL:

   <xpdl:FormalParameter Id="Document" Mode="INOUT">

        <xpdl:DataType>

             <xpdl:ExternalReference

location="com.hico.xprocess.DocDeclaration"/>

        </xpdl:DataType>

   </xpdl:FormalParameter>

 

Then your Class should look like this:

/**

 * Copyright 2001-2007 HiCo ICS Gesmbh

 * $RCSfile: DocDeclaration,v $ - $Author: manfred.hagenauer $

 * $Source: DocDeclaration.java,v $

 * $Revision: 1.1 $

 *

 * $Log$

 */

package com.hico.xprocess;

 

import java.io.Serializable;

import org.w3c.dom.Document;

 

public class DocDeclaration implements Serializable, Cloneable {

      private static final long    serialVersionUID  = 1L;

      private static Document      xmlDocument       = null;

 

      public Object clone()

      {

            try

            {

                  return super.clone();

            }

            catch( Exception ex )

            {

                  return null;

            }

      }

 

      public DocDeclaration()

      {

      }

 

      public DocDeclaration( Document document )

      {

            xmlDocument = document;

      }

 

      public Document getXmlDocument()

      {

            return xmlDocument;

      }

 

      public void setXmlDocument( Document document )

      {

            xmlDocument = document;

      }

}

 

 

Of Course the Parameter must be set in another Class:

 

public void execute( AppParameter documentFileName,

            AppParameter document)

{

...

      Document xmlDocument = XMLDocument.readDocument( .....

                       

      DocDeclaration doc = new DocDeclaration();

      doc.setXmlDocument(xmlDocument);

....

 

And in your Applications used in the Workflow you can access your class like

this:

 

public void execute( AppParameter documentName, AppParameter document ) {

      String strDocumentName = (String) documentName.the_value;

           

      try

      {

            Document doc = ((DocDeclaration)

document.the_value).getXmlDocument();

...

 

 

That's all.

 

You can write your own code and use it like you want (for Lists).

Hope this helps.

 

Regards Manfred

 

 

 

-----Ursprüngliche Nachricht-----

Von: PedroUninova [pd@...]

Gesendet: 2009-02-13 17:03

An: shark@...

Betreff: [shark] RE: Shark List Issue again sorry.....

 

Hello again

 

Sorry for long absence.... but I have been working on other project....

 

Geeta

Before the start of this issue I had already build up several process's with simple types....

I'm not sure, but are you saying that I should use simple types as external references to see if I understand the process off instantiate external classes???

 

After some tries I continue to not understand how an activity will instantiate my custom made class....

 

Could you, or some one, help me with this long time problem???

Thanks,

      Pedro

 

-----Mensagem original-----

Enviada: sábado, 24 de Janeiro de 2009 16:52

Para: shark@...

Assunto: [shark] Re: RE:Shark List Issue

 

Hi Pedro, the reason you got thsi error ""type not supported"" is because List is not supported as a type for a process variable. Only basic types like String, Integer, Boolean etc are supported. So if you want to start out building a "simple process" then start with one of the basic types.

Once you have that working then move on to more complex Java types. As I mentioned earlier if you want a process variable which is of type List the only way that i know how to do it is to build a Java class which will have the List functionalty and then use it as I described earlier: "

 

> > you can define any

> > Java object to be a workflow variable (through the use of XPDL

> > ExternalReference data type), and then use it in shark (of course,

> > this class has to be on shark's classpath). "

 

So go step by step. Make sure you get a Basic type like Integer/String working, then move on to an arbitrary java class.

 

Regards,

Geeta

 

"PedroUninova" <pd@...> wrote on 01/23/2009 10:32:21 PM:

 

> Hello,

> Can any body help me with this subject?

> Thanks in advance,

>    Pedro

> -----Mensagem original-----

> De: PedroUninova [pd@...]

> Enviada: terça-feira, 20 de Janeiro de 2009 14:49

> Para: shark@...

> Assunto: [shark] RE: Re: RE: Re: Shark List Issue

> Hi Geeta,

> I was trying to follow what you said and some problems came...

> - So I started to build a new process called "simple_process" (this

> way I can learn, without destroying things I have already done).

> - create a new workflow variable (list_var) of type LIST(basic type

string);

> - created a workflow participant (sys_participant) of type system;

> - defined a Formal Parameter (list_input) of type LIST(basic type

string);

> - from my previous tests I can't introduce a list to this formal

> parameter.....

>    An error of something like "type not supported" always come up.

> How can I use your way to do what I want?! Is this the right way?!

> For sure it's something very simple but I'm not getting it! Sorry :(

> Regards,

>             Pedro

> -----Mensagem original-----

> Enviada: sábado, 17 de Janeiro de 2009 14:04

> Para: shark@...

> Assunto: [shark] Re: RE: Re: Shark List Issue

> Hi Pedro:

> Here's how i would define my xpdl (again, I apologise if I do not

understand

> your situation correctly):

> 1. The xpdl has your custom defined process variable of class

> MyListType, and MyListType is of course in your class path .

> 1. The xpdl has a start activity, which leads to an activity in the

> *System* lane (ie performer is System and the activity is mapped to a

Java

> class, say, MyInstantiater which is also in in your class path). The

> path out of this system activity leads to the rest of the activities

> for your app.

> 2. The above Java class, MyInstantiater, has the logic needed to

instantiate

> your class MyListType as well as populate the custom defined process

> variable.

> Why won't this work?

> Regards,

> Geeta

> "uninova" <pd@...> wrote on 01/15/2009 04:44:01 PM:

> > Hello again,

> > I already familiar with that feature, and already tried a classed

> > build

> by

> > me. But I couldn't solve the situation. For sure I'm not doing the

> > things right.

> >

> > The only resolution that come to my mind was (using the example

bellow):

> > (its different from the past one but I think the point is the same)

> > Let's suppose I have a start activity.

> > The transition from this activity loads the values(Static values) to

> > the variable defined using the class build by me, lets say "my list

> type"...

> > A is an instance of "my_list_type"!!! how can I create an instance?!?!

> This

> > is not the right way....

> > a.add(2);

> > a.add(3);

> > a.add(7);

> >

> >

> > The problem now, at least for me, is how do you instantiate the

> class?!you

> > need an instance right?!?! What I need to change?

> >

> > So let's suppose:

> > MY_list_type is defined using the class my_personal_list.java bellow:

> > #########################################

> > private List real_list;

> > My_personal_list()

> > {

> >

> > }

> > Add_value(int value)

> > {

> > Real_list.add(value);

> > }

> > Retrieve_list()

> > {

> > Return real_list;

> > }

> > #####################################

> >

> >

> >

> > Regards,

> >          Pedro

> >

> >

> >

> >

> >

> >

> >

> >

> >

> > -----Mensagem original-----

> > De: gramani@... [gramani@...]

> > Enviada: quinta-feira, 15 de Janeiro de 2009 14:54

> > Para: shark@...

> > Assunto: [shark] Re: Shark List Issue

> >

> > Hello Pedro,

> >

> > I am not sure if maybe I misunderstand your question, but I hope you

> > know that arbitrary (custome defined) Java classes can be used as

> > process variables..? From the current version docs I see this: "you

> > can define

> any

> > Java object to be a workflow variable (through the use of XPDL

> > ExternalReference data type), and then use it in shark (of course,

> > this class has to be on shark's classpath). "

> >

> > In earlier version's docs, there was more on this topic here:

> >

> >

> > Again, I apologise if I didn't get your question :) Geeta

> >

> > "uninova" <pd@...> wrote on 01/15/2009 02:33:00 PM:

> >

> > > Hello all,

> > >

> > > Its difficult to explain the situation but lets try....

> > >

> > > I have a problem with lists and shark....

> > > The shark process starts to run when a request from an outside

> > > program is made (my program).

> > >

> > > Situation:

> > > My program first receives a list of arguments to a list variable

> > > type; Sends it to shark let say "LIST_IN_VAR", also starting the

> > > process; And after doing some work sends the same list to my

> > > program which will

> > use

> > > it to do more things...;

> > > Shark don't really uses the list, at least in this example. It

> > > simply receives and resend it to my program, but the list needs to

> > > enter in

> > shark.

> > >

> > > Problem:

> > > The problem is that I can't used Lists in shark... so what I do

> > > now

is:

> > > LIST_IN_VAR is now defined as a string.

> > > When a request is made, my program converts the list to a string

> > > and

> > sends

> > > it to shark

> > > Shark do is work....And in the end My program receives the "where

> > > to send" and the list as a String Converts the string back to LIST

> > > and sends and continue doing its

> job....

> > >

> > > How can I use the list type from shark?

> > > It's possible to create a variable of type list and define a

> > > initial

> > value??

> > >

> > > Regards and thanks,

> > >    Pedro

> > >

> > >

> > >

> > > --

> > > This message has been scanned for viruses and dangerous content by

> > > MailScanner, and is believed to be clean.

> > >

> > >

> > > --

> > > You receive this message as a subscriber of the shark@...

> > > mailing

> > list.

> > > To unsubscribe: shark-unsubscribe@... For general help:

> > > sympa@...

> > > OW2 mailing lists service home page: http://www.ow2.org/wws

> >

> >

> >

> >

> > --

> > This message has been scanned for viruses and dangerous content by

> > MailScanner, and is believed to be clean.

> >

> >

> > --

> > You receive this message as a subscriber of the shark@...

> > mailing

> list.

> > To unsubscribe: shark-unsubscribe@... For general help:

> > sympa@...

> > OW2 mailing lists service home page: http://www.ow2.org/wws

> --

> This message has been scanned for viruses and dangerous content by

> MailScanner, and is believed to be clean.

> --

> You receive this message as a subscriber of the shark@... mailing

list.

> To unsubscribe: shark-unsubscribe@... For general help:

> OW2 mailing lists service home page: http://www.ow2.org/wws

 

 

 

 

 

 

 

 

 

 


--
You receive this message as a subscriber of the shark@... mailing list.
To unsubscribe: shark-unsubscribe@...
For general help: sympa@...
OW2 mailing lists service home page: http://www.ow2.org/wws

 



--
You receive this message as a subscriber of the shark@... mailing list.
To unsubscribe: mailto:shark-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

how to make several connections to shark

by PedroUninova :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hello again,

 

I’m now facing a different situation.

In the papers that I have read about OMG and WFMC its possible to have several connections to shark.

Currently I can only establish one, with the code transcribed above.

 

What I would like to do:

                Start shark from simple java program that does nothing else. Let’s call it “SERVER”.

After that, one or several, entities of my main program will establish a connection to the “SERVER”.

Can someone help me with this subject?

 

Regards,

                Pedro

 

//--------------------code------------------------

LocalContextFactory.setup("sharkdb");         

ut = (UserTransaction) new InitialContext().lookup("java:comp/UserTransaction");

ut.setTransactionTimeout(50 * 60);

ut.begin();

Shark.configure(confFilePath); //(2)starting shark

ut.commit();

 

ut.begin();

WMConnectInfo wmci = new WMConnectInfo("test","","","");

sharkc = Shark.getInstance().getSharkConnection();

sharkc.connect(wmci);

sh = sharkc.getSessionHandle();

ut.commit();

 

 



--
You receive this message as a subscriber of the shark@... mailing list.
To unsubscribe: mailto:shark-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
< Prev | 1 - 2 | Next >