ode-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Boisvert <boisv...@intalio.com>
Subject Re: Is there any way how to get bpmn:id?
Date Thu, 09 Jul 2009 22:02:35 GMT
The "pid" is the process identifier after deployment.  You can get it from
the PM API by listing processes.

The "aiid" is the activity identifier based on the BPEL object model (BOM).
For this one, you need to load the compiled BPEL (.cbp), traverse the
activity graph until you find the activity you want, then get its
identifier.

alex


On Thu, Jul 9, 2009 at 7:54 AM, Karel Gardas <karel.gardas@centrum.cz>wrote:

> Alex Boisvert wrote:
> > Did you try rmi://localhost:2099/jcaServer ?
>
> This indeed works! Thanks for your suggestion. The problem now is a
> meaning of `pid' and `aiid' in your code. I've thought `pid' is process
> id. Since this is QName, I tried to use
> `getBpelRuntimeContext().getProcessQName()' inside the activity code,
> but this does not run well, since I got following process not found
> exception:
>
> org.apache.ode.bpel.pmapi.ProcessNotFoundException: The process
> "{http://ode/bpel/unit-test}HelloWorld2<http://ode/bpel/unit-test%7DHelloWorld2>"
> does not exist.
>        at
>
> org.apache.ode.bpel.engine.ProcessAndInstanceManagementImpl.getExtensibilityElements(ProcessAndInstanceManagementImpl.java:522)
>        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.apache.ode.jca.server.rmi.RmiPipeServerImpl.invokeConnectionMethod(RmiPipeServerImpl.java:89)
>
>
> For aiid I've thought I'll use `new Integer[] {_self.hashCode() }' i.e.
> array with just action id inside it. Is this right?
>
> For your information, so far for testing I'm using simple HelloWorld
> process provided by the ODE as an example. So no BPMN generated BPEL yet.
>
> Thanks,
> Karel
>
> >
> > alex
> >
> > On Wed, Jul 8, 2009 at 4:55 PM, Karel Gardas <karel.gardas@centrum.cz
> >wrote:
> >
> >> Alex,
> >>
> >> I'm not sure which URL to use. I've tried simple
> >> http://localhost:8080/ode , various rmi://xxxxx but no way. BTW: is
> this
> >> JCA connector listening on 0.0.0.0:8009 when ODE is running inside
> >> tomcat/axis container?
> >>
> >> Do you have any idea what url to use to set OdeManagedConnectionFactory?
> >>
> >> Thanks,
> >> Karel
> >>
> >> Alex Boisvert wrote:
> >>> The sequence should be roughly as follows,
> >>>
> >>> OdeManagedConnectionFactory mcf = new OdeManagedConnectionFactory();
> >>> mcf.setURL(url);
> >>> OdeConnectionFactory cf = (OdeConnectionFactory)
> >>> mcf.createConnectionFactory();
> >>> ProcessManagementConnection pmc =  cf.getConnection();
> >>>
> >>> alex
> >>>
> >>> On Wed, Jul 8, 2009 at 4:56 AM, Karel Gardas <karel.gardas@centrum.cz
> >>> wrote:
> >>>
> >>>> Hi Alex,
> >>>>
> >>>> it took me some time to figure out needed changes in buildr
> >>>> infrastructure, but it's finally compiling and I'm getting into
> >>>> following issue.
> >>>>
> >>>> Alex Boisvert wrote:
> >>>>> Indeed... BpelManagementFactory is a proprietary class (not in Apache
> >>>> Ode)
> >>>>> which hides the lookup of the ProcessManagement API remote interface.
> >>  I
> >>>>> didn't realize when I cut & pasted the code, sorry.   The class
is
> tied
> >>>> to
> >>>>> other stuff (e.g. loading of configuration, etc.) so I can't share
it
> >>>>> easily.
> >>>>>
> >>>>> Take a look at the following classes for facilities to connect to
the
> >> PM
> >>>> API
> >>>>> via RMI:
> >>>>>
> >>>>> org.apache.ode.bpel.jca.clientapi.ProcessManagementConnection;
> >>>>> org.apache.ode.ra.OdeConnectionFactory;
> >>>>> org.apache.ode.ra.OdeManagedConnectionFactory;
> >>>> both ProcessManagementConnection and OdeConnectionFactory are just
> >>>> interfaces so I started digging into OdeManagedConnectionFactory with
> >>>> the following testing code:
> >>>>
> >>>>        OdeManagedConnectionFactory fact = new
> >>>> OdeManagedConnectionFactory();
> >>>>        try {
> >>>>            OdeConnectionFactory con_fact =
> >>>> (OdeConnectionFactory)fact.createConnectionFactory();
> >>>>            System.err.println(con_fact.getClass().getName());
> >>>>            javax.resource.cci.Connection con =
> con_fact.getConnection();
> >>>>            System.err.println(con.getClass().getName());
> >>>>        }
> >>>>        catch (Exception e) {
> >>>>            e.printStackTrace();
> >>>>        }
> >>>>
> >>>> the intention is "what can I get from it?". The problem is on the
> line:
> >>>>
> >>>>            javax.resource.cci.Connection con =
> con_fact.getConnection();
> >>>>
> >>>> I get following exception:
> >>>>
> >>>> Unable to create connection: Protocol error: unexpected remote object
> >>>> type!; nested exception is:
> >>>>        java.lang.ClassCastException:
> sun.rmi.registry.RegistryImpl_Stub
> >>>> cannot
> >>>> be cast to org.apache.ode.ra.transports.rmi.OdeRemote
> >>>>        at
> >>>>
> >>>>
> >>
> org.apache.ode.ra.OdeManagedConnectionFactory.createManagedConnection(OdeManagedConnectionFactory.java:100)
> >>>>        at
> >>>>
> >>>>
> >>
> org.apache.ode.ra.OdeConnectionManager.allocateConnection(OdeConnectionManager.java:34)
> >>>>        at
> >>>>
> >>>>
> >>
> org.apache.ode.ra.OdeConnectionFactoryImpl.getConnection(OdeConnectionFactoryImpl.java:46)
> >>>>        at org.apache.ode.bpel.runtime.ASSIGN.run(ASSIGN.java:95)
> >>>>        at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source)
> >>>>        at
> >>>>
> >>>>
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >>>>        at java.lang.reflect.Method.invoke(Method.java:597)
> >>>>        at
> >>>>
> org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:451)
> >>>>        at org.apache.ode.jacob.vpu.JacobVPU.execute(JacobVPU.java:139)
> >>>>        at
> >>>>
> >>>>
> >>
> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute(BpelRuntimeContextImpl.java:875)
> >>>>        at
> >>>>
> >>>>
> >>
> org.apache.ode.bpel.engine.PartnerLinkMyRoleImpl.invokeNewInstance(PartnerLinkMyRoleImpl.java:206)
> >>>>        at
> >>>>
> >>
> org.apache.ode.bpel.engine.BpelProcess.invokeProcess(BpelProcess.java:237)
> >>>>        at
> >>>>
> >>>>
> >>
> org.apache.ode.bpel.engine.BpelProcess.handleWorkEvent(BpelProcess.java:408)
> >>>>        at
> >>>>
> >>>>
> >>
> org.apache.ode.bpel.engine.BpelEngineImpl.onScheduledJob(BpelEngineImpl.java:439)
> >>>>        at
> >>>>
> >>>>
> >>
> org.apache.ode.bpel.engine.BpelServerImpl.onScheduledJob(BpelServerImpl.java:441)
> >>>>        at
> >>>>
> >>>>
> >>
> org.apache.ode.scheduler.simple.SimpleScheduler$4$1.call(SimpleScheduler.java:411)
> >>>>        at
> >>>>
> >>>>
> >>
> org.apache.ode.scheduler.simple.SimpleScheduler$4$1.call(SimpleScheduler.java:404)
> >>>>        at
> >>>>
> >>>>
> >>
> org.apache.ode.scheduler.simple.SimpleScheduler.execTransaction(SimpleScheduler.java:218)
> >>>>        at
> >>>>
> >>>>
> >>
> org.apache.ode.scheduler.simple.SimpleScheduler$4.call(SimpleScheduler.java:404)
> >>>>        at
> >>>>
> >>>>
> >>
> org.apache.ode.scheduler.simple.SimpleScheduler$4.call(SimpleScheduler.java:400)
> >>>>        at
> >>>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> >>>>        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> >>>>        at
> >>>>
> >>>>
> >>
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> >>>>        at
> >>>>
> >>>>
> >>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> >>>>        at java.lang.Thread.run(Thread.java:619)
> >>>> Caused by: java.rmi.RemoteException: Protocol error: unexpected remote
> >>>> object type!; nested exception is:
> >>>>        java.lang.ClassCastException:
> sun.rmi.registry.RegistryImpl_Stub
> >>>> cannot
> >>>> be cast to org.apache.ode.ra.transports.rmi.OdeRemote
> >>>>        at
> >>>>
> >>>>
> >>
> org.apache.ode.ra.transports.rmi.RMITransport.createPipe(RMITransport.java:45)
> >>>>        at
> >>>>
> >>>>
> >>
> org.apache.ode.ra.OdeManagedConnectionFactory.createManagedConnection(OdeManagedConnectionFactory.java:98)
> >>>>        ... 24 more
> >>>> Caused by: java.lang.ClassCastException:
> >>>> sun.rmi.registry.RegistryImpl_Stub cannot be cast to
> >>>> org.apache.ode.ra.transports.rmi.OdeRemote
> >>>>        at
> >>>>
> >>>>
> >>
> org.apache.ode.ra.transports.rmi.RMITransport.createPipe(RMITransport.java:39)
> >>>>        ... 25 more
> >>>>
> >>>>
> >>>> Do you have any idea what's going wrong here? Also do you think there
> is
> >>>> any documentation for this part of ODE? I'm asking since relationship
> >>>> between OdeConnectionFactory and connection created by it and
> >>>> ProcessManagementConnection is not yet clear to me.
> >>>>
> >>>> Thanks!
> >>>> Karel
> >>>>> Good luck,
> >>>>> alex
> >>>>>
> >>>>> On Tue, Jul 7, 2009 at 3:08 PM, Karel Gardas <
> karel.gardas@centrum.cz
> >>>>> wrote:
> >>>>>
> >>>>>> Hi Alex,
> >>>>>>
> >>>>>> thanks a lot for your quick help. Unfortunately I do have quite
> >> problem
> >>>>>> to find BpelManagementFactory class. I've tried to find it in
> >> ode-trunk,
> >>>>>> in my ode-1.X source tree and also in ode-1.2 but it's nowhere.
> Could
> >>>>>> you be so kind and kick me into the right direction?
> >>>>>>
> >>>>>> Thanks,
> >>>>>> Karel
> >>>>>>
> >>>>>> Alex Boisvert wrote:
> >>>>>>> Hi Karel,
> >>>>>>>
> >>>>>>> Here's a code fragment that does roughtly what you want:
> >>>>>>>
> >>>>>>>         ProcessManagementConnection conn =
> >>>>>>> BpelManagementFactory.getInstance().createConnection();
> >>>>>>>         try {
> >>>>>>>             ActivityExtInfoListDocument s =
> >>>>>>> conn.getExtensibilityElements(pid, aiid);
> >>>>>>>             TActivitytExtInfoList l = s.getActivityExtInfoList();
> >>>>>>>             List<TActivityExtInfo> ll = l.getActivityExtInfoList();
> >>>>>>>             for (TActivityExtInfo info : ll) {
> >>>>>>>                 NodeList nl = ((Element)
> >>>>>>> info.getDomNode()).getElementsByTagNameNS(BPMN_NS, BPMN_ID);
> >>>>>>>                 for (int i = 0; i < nl.getLength(); i++)
{
> >>>>>>>                     Node n = nl.item(i);
> >>>>>>>                     result.add(n.getFirstChild().getNodeValue());
> >>>>>>>                 }
> >>>>>>>             }
> >>>>>>>         } catch (Exception e) {
> >>>>>>>             ...
> >>>>>>>
> >>>>>>>         }
> >>>>>>>
> >>>>>>> As you can see, you mostly need to use the Process Management
API
> and
> >>>> the
> >>>>>>> BPEL object model.
> >>>>>>>
> >>>>>>> alex
> >>>>>>>
> >>>>>>> On Tue, Jul 7, 2009 at 6:07 AM, Karel Gardas <
> >> karel.gardas@centrum.cz
> >>>>>>> wrote:
> >>>>>>>
> >>>>>>>> Hello,
> >>>>>>>>
> >>>>>>>> I'm trying to find out but so far unsuccessful hence
the question:
> >> is
> >>>>>>>> there any way how to get bpmn:id which is assigned to
some action
> >>>>>>>> directly in action's code? i.e. I do have following
code:
> >>>>>>>>
> >>>>>>>>  <bpel:sequence>
> >>>>>>>>
> >>>>>>>>    <bpel:scope bpmn:label="SubProcess" name="SubProcess"
> >>>>>>>> bpmn:id="_KddAgBq8Ed6g-K1VcIMszw">
> >>>>>>>> ....
> >>>>>>>>
> >>>>>>>> and I would like to get bpmn:id's value, i.e.
> >>>> "_KddAgBq8Ed6g-K1VcIMszw"
> >>>>>>>> somehow in SCOPE.java code. I'm currently using ODE
from 1.X
> branch.
> >>>>>>>>
> >>>>>>>> Thanks,
> >>>>>>>> Karel
> >>>>>>>>
> >>
> >
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message