1 2 Previous Next 26 Replies Latest reply on Feb 15, 2013 8:27 AM by Tomohisa igarashi

    Access ODE's User-defined process properties via RiftSaw

    Tomohisa igarashi Master

      Hi RiftSaw guys,

       

      I'm implementing SwitchYard implementation property and now looking at BPEL component part.

       

       

      Bean & Camel component part is here

      https://github.com/igarashitm/components/tree/SWITCHYARD-520

       

      According to this Apache ODE's doc, All I have to do is to connect our SwitchYard property resolver into ODE's User-defined process properties by calling the process management API from RiftsawBPELExchangeHandler.

      http://ode.apache.org/creating-a-process.html#user-defined-process-properties

       

      The question is, how can I access this process management API via RiftSaw? Any pointers would be appreciated!

       

      Thanks,

      Tomo

        • 1. Re: Access ODE's User-defined process properties via RiftSaw
          Gary Brown Master

          Hi Tomo

           

          The BPELEngine interface, available from the RiftsawBPELExchangeHandler, has an untyped getManagementInterface() method that returns an object of type: org.apache.ode.bpel.pmapi.BpelManagementFacade.

           

          This object implements the ProcessManagement API you are looking for.

           

          Regards

          Gary

          • 2. Re: Access ODE's User-defined process properties via RiftSaw
            Tomohisa igarashi Master

            Thanks for the quick reply! I'm now digging into BpelManagementFacade to find a junction point for the property resolver.

            • 3. Re: Access ODE's User-defined process properties via RiftSaw
              Tomohisa igarashi Master

              Hi Gary,

               

              OK, I got a bit from the code - Apparently I need to intercept XPath bpws:process-property(propertyName) and inject SwitchYard implementation property if it exists so that the BPEL process properties could be overridden by SY properties. JaxpFunctionResolver$ProcessProperty seems to be evaluating BPEL process properties, so if I can replace this with extended SwitchYardJaxpFunctionResolver which resolves SY properties, then it should work as expected.

               

              Could you let me know if you know:

              1. is this a right path for my purpose?
              2. how can I replace this JaxpFunctionResolver?

               

              Thanks,

              Tomo

              • 4. Re: Access ODE's User-defined process properties via RiftSaw
                Gary Brown Master

                Hi Tomo

                 

                Sorry I haven't dealt with that part of the code before. Jeff has more experience on the management side, so might know the answer.

                 

                Alternatively it may be worth posting some questions on the Apache ODE user forum?

                 

                Regards

                Gary

                • 5. Re: Access ODE's User-defined process properties via RiftSaw
                  Jeff Yu Master

                  Hi Tomo,

                   

                  I am not sure you need to inject the switchyard property on getting the process property value. Because you've already used the mgmt API to store the correct property value (Injecting the SwitchYard's property value properly), there should be no need to inject them again on retrieving the value.

                   

                  Any reasons you want to inject value on retrieving the value? Is it too late to inject the value on exchangeHandler? If it is too late, then we should do it on the time of deploying a process definition.

                   

                  Regards

                  Jeff

                  • 6. Re: Access ODE's User-defined process properties via RiftSaw
                    Rob Cernich Master

                    Hey Jeff,

                     

                    It's possible the property value could change during the lifecycle of the application.  I anticipate having the ability to change property values from the console.  That said, I don't know how changes to property values are handled by the AS runtime (e.g. system properties).  Depending on how changes are propagated, it might be possible to inject new values in response to notifications.

                     

                    Best,

                    Rob

                    • 7. Re: Access ODE's User-defined process properties via RiftSaw
                      Tomohisa igarashi Master

                      Hi Jeff,

                       

                      We are expecting dynamic property changing as Rob said, not right now though. In addition to that, we need to know which property is requested by process definition so that we can set those are exactly needed. Otherwise, all of system/domain/composite/component properties are needed to be set to process property.

                       

                      Thanks,

                      Tomo

                      • 8. Re: Access ODE's User-defined process properties via RiftSaw
                        Jeff Yu Master

                        Hi Rob and Tomo,

                         

                        Thanks for the clarification. Now it makes perfect sense to me, as I was thinking you had stored already the property, which now I guess were not true.

                         

                        In terms of the evaluating the property, I am thinking that injecting values on the following method might be better :

                         

                        BpelProcess.java

                         

                            public Node getProcessProperty(QName propertyName) {

                                Node value = getEngine()._contexts.customProcessProperties.getProperty(propertyName);

                                if (value != null) {

                                    return value;

                                }

                                Map<QName, Node> properties = _pconf.getProcessProperties();

                                if (properties != null) {

                                    return properties.get(propertyName);

                                }

                                return null;

                            }

                         

                         

                        The JaxpFunctionResolver$ProcessProperty will call the BpelRuntimeContext class, which in turn calls the BpelProcess.java::getProcessProperty method to resolve the properties.

                         

                        As you can see the from the above code, it was looking for the properties in the customProcessProperty first, and then find it in the processConf, which stores the properties from the deploy.xml. I wasn't sure about how to get the properties from the SwitchYard, but if it requires the SwitchYard API, it may best that add an property in the bpel.properties, and then injecting/initialisation the class properly. In this case, the BPEL runtime doesn't need to depend on SwitchYard.

                         

                        Hope this helps.

                        Jeff

                        • 9. Re: Access ODE's User-defined process properties via RiftSaw
                          Jeff Yu Master

                          BTW, I wasn't exactly sure the Management API's setProcessProperty works or not. When I was checking the code, it looks like to me that the ProcessConf only store the properties on the time of deploying ,and then expose them as an unmodified collection. The setProcessProperty was setting the properties directly into the database, but the ProcessConf only reads once on the time of deployment. So better to have a test case to validate it.

                           

                          As to Rob's setting properties value on console, just double check that we just need to use the switchyard's facility to do so, because my above observation, please let me know if my observation was wrong.

                           

                          Regards

                          Jeff

                          • 10. Re: Access ODE's User-defined process properties via RiftSaw
                            Tomohisa igarashi Master

                            Thanks for the infos, Jeff!

                             

                            can I plug-in some class from SwitchYard in order to resolve custom process property? As you are worrying, that's not good idea for us to add something SwitchYard specific into RiftSaw/ODE. And SwitchYard implementation property respects SCA property which should be able to be injected into service implementation from composite/component property definition, so I don't want to ask user to copy those to another file like bpel.properties by hand.

                             

                            This is the bean service which accepts implementation property injection through the @Property annotation.

                            https://github.com/igarashitm/components/commit/7e5cae89725b43b4dd1bc19208949da9e5d0468b#diff-5

                             

                            Thanks for the concern about setProcessProperty as well. I will keep it in my mind and add some tests for it once I reach there

                             

                            Thanks,

                            Tomo

                            • 11. Re: Access ODE's User-defined process properties via RiftSaw
                              Jeff Yu Master

                              Hi Tomo,

                               

                              I think you can use the similar way of the Bean service's implementation.

                               

                              You can define a HashMap in the org.apache.ode.bpel.engine.Context class, and then inject the properties in the BPELComponent/BPELActivator when starts the BpelEngine. In the end, you'll need to update the BpelProcess::getProcessProperty(QName) method to include the logic of accessing the Context properties before acessing the builtin process configuration.

                               

                              PS: When I said add an property entry in the bpel.properties, I meant to say add the SwitchYard context access class's full name, not the properties. :-). Anyway, I think we can use the approach that similars to the Bean Service property access.

                               

                              Regards

                              Jeff

                              • 12. Re: Access ODE's User-defined process properties via RiftSaw
                                Tomohisa igarashi Master

                                Hi Jeff,

                                 

                                Ah, you mean I can change BpelProcess on riftsaw-ode project directly? BpelServerImpl does "new BpelProcess()" so it seems not to be able to be pluggable.

                                 

                                Thanks,

                                Tomo

                                • 13. Re: Access ODE's User-defined process properties via RiftSaw
                                  Gary Brown Master

                                  Hi Tomo

                                   

                                  Just wondering whether an alternative approach to this would be to use the properties in the deploy.xml, and access them using the ode:process-property xpath function.

                                   

                                  I know the aim of you task is to provide the properties from switchyard.xml, but there is a separate thread that will eventually result in the deploy.xml being generated from switchyard.xml. So indirectly your feature request could be satisfied using this generation approach and using the existing ODE supported process-property method?

                                   

                                  Having said that, I just tried this process-property method and it didn't seem to work, so will have to investigate that further.

                                   

                                  Regards

                                  Gary

                                  • 14. Re: Access ODE's User-defined process properties via RiftSaw
                                    Tomohisa igarashi Master

                                    Hi Gary,

                                     

                                    Thanks for the idea - ah, that may be a temporary solution for this property stuff, although we are expecting dynamic property changing in the near future.

                                     

                                    Thanks,

                                    Tomo

                                    1 2 Previous Next