1 2 Previous Next 26 Replies Latest reply on Mar 31, 2014 2:49 PM by jbride

    SwitchYard Debugger


      Hey all,


      I created a JIRA detailing ideas for debug support in the SwitchYard tools.  It's pretty basic at this point, but hopefully encompasses enough to be useful for a first iteration.  Let me know what you think.




        • 1. Re: SwitchYard Debugger
          • 2. Re: SwitchYard Debugger

            First screenshot detailing service breakpoints.  These come in two forms: PROVIDER and CONSUMER.  Provider aligns with component services and composite references.  Consumer aligns with composite services and component references.


            The breakpoints are implemented as Java method breakpoints with custom conditions.  For example, method org.switchyard.bus.camel.processors.InterceptProcessor.process(Exchange) with the condition:

                    && (org.switchyard.ExchangePhase.IN == ex.getProperty("org.switchyard.bus.camel.phase", org.switchyard.ExchangePhase.class)
                        || org.switchyard.ExchangePhase.OUT == ex.getProperty("org.switchyard.bus.camel.phase", org.switchyard.ExchangePhase.class))
                    && "{urn:com.example.switchyard:switchyard-example2:1.0}ExampleService".equals(ex.getProperty("org.switchyard.bus.camel.provider", org.switchyard.Service.class).getName().toString())


            The screenshot:


            • 3. Re: SwitchYard Debugger

              That's awesome Rob! Great work!

              • 4. Re: SwitchYard Debugger

                Ooooh, this looks very interesting

                • 5. Re: SwitchYard Debugger

                  Very nice, Rob.  How are the breakpoints set?  It would be cool if the user could enable it via the button bar on services and references in the model. :-)

                  • 6. Re: SwitchYard Debugger

                    Hey Keith,


                    Looks like I left that detail out.  Breakpoints can be toggled using a right-click on a service/reference figure.  I'm currently working on adding an indicator onto the figures so the user knows if there's a breakpoint set on the figure or not.



                    • 7. Re: SwitchYard Debugger

                      Breakpoint indicator on a component service:


                      • 8. Re: SwitchYard Debugger

                        In case anybody wants to play, the source is up on github:  https://github.com/rcernich/tools/tree/debug-support

                        • 9. Re: SwitchYard Debugger

                          Nice.  We need to tint those lenses though.

                          • 10. Re: SwitchYard Debugger

                            Added logical structure extensions to make better sense of internal SY objects (e.g. Exchange, Context, Service, etc.).



                            • 11. Re: SwitchYard Debugger

                              Upon further testing, it doesn't look like the "value" column for the child nodes gets refreshed properly.  In order to see the changes, I've been toggling "view logical structures" off and on to get them to refresh.  That said, the contents are correct and the detail pane shows the correct details.

                              • 12. Re: SwitchYard Debugger

                                I've just found better results are obtained by setting "Show variable details ('toString()' value)" to "As the label for all variables" in preferences, Java->Debug->Detail Formatters.  This provides a better "values" in the tree, whereas those strings would normally go in the detail pane.  That said, I'm considering adding some detail formatters for common SwitchYard types (although there is no extension point that supports this, so...).

                                • 13. Re: Re: SwitchYard Debugger

                                  I use the following for a detail formatter when inspecting switchyard values in the debugger.  It would be cool if we could default to (something like) this in switchyard tooling, especially considering how common XML Nodes (and SOAP Messages) are for our content/values:


                                  Object obj = this;

                                  if (obj == null) {

                                      return null;


                                  org.w3c.dom.Node node = null;

                                  if (obj instanceof org.w3c.dom.Node) {

                                      node = (org.w3c.dom.Node)obj;

                                  } else if (obj instanceof javax.xml.soap.SOAPMessage) {

                                      node = ((javax.xml.soap.SOAPMessage)obj).getSOAPPart();


                                  if (node == null) {

                                      return obj.toString();


                                  javax.xml.transform.TransformerFactory tf = javax.xml.transform.TransformerFactory.newInstance();

                                  javax.xml.transform.Transformer transformer = tf.newTransformer();

                                  transformer.setOutputProperty(javax.xml.transform.OutputKeys.ENCODING, "UTF-8");

                                  transformer.setOutputProperty(javax.xml.transform.OutputKeys.INDENT, "yes");

                                  transformer.setOutputProperty(javax.xml.transform.OutputKeys.METHOD, "xml");

                                  transformer.setOutputProperty(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");

                                  transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");

                                  javax.xml.transform.dom.DOMSource source = new javax.xml.transform.dom.DOMSource(node);

                                  java.io.StringWriter os = new java.io.StringWriter();

                                  javax.xml.transform.stream.StreamResult result = new javax.xml.transform.stream.StreamResult(os);

                                  transformer.transform(source, result);

                                  return os.toString();

                                  • 14. Re: Re: SwitchYard Debugger

                                    Hey David,


                                    That would be nice, but Eclipse doesn't currently provide an extension point for registering detail formatters.  Given that, I'm trying to figure out how this might be accomplished.


                                    Thanks for the post.  I'll be adding that to my own environment.



                                    1 2 Previous Next