// Every webMethods Integration Server service has exactly one input // argument: the pipeline. // // The pipeline is like a java.util.Map object that gets passed to each // service that gets called. (It's actually a com.wm.data.IData object, // which unfortunately doesn't implement java.util.Map.) // // Because objects are passed by reference, every service called can alter // the keys and values in the pipeline. // // This is an example of how the webMethods Integration Server pipeline // would work if it was implemented in Java using java.util.Map objects. // // $ javac Pipeline.java // $ java Pipeline import java.util.*; public class Pipeline { public static void greet(Map pipeline) { // convert the name input argument to uppercase: this litters the // pipeline with "instring" and "outstring" variables pipeline.put("instring", pipeline.get("name")); upcase(pipeline); pipeline.put("name", pipeline.get("outstring")); // get honorific for the gender: this litters the pipeline with the // variable "honorific" honorific(pipeline); // add greeting variable to pipeline: this is an output argument for the method pipeline.put("greeting", "Hello " + pipeline.get("honorific") + " " + pipeline.get("name")); } public static void upcase(Map pipeline) { String instring = (String)pipeline.get("instring"); String outstring = instring.toUpperCase(); pipeline.put("outstring", outstring); } public static void honorific(Map pipeline) { String gender = (String)pipeline.get("gender"); String honorific = ""; if (gender.equals("male")) { honorific = "Mr"; } else if (gender.equals("female")) { honorific = "Ms"; } pipeline.put("honorific", honorific); } public static void main(String[] args) { // create a new pipeline, and populate it with some variables Map pipeline = new HashMap(); pipeline.put("name", "John Doe"); pipeline.put("gender", "male"); pipeline.put("email", "john.doe@example.com"); pipeline.put("address", "123 Sycamore Street"); // call greet service, passing the pipeline // greet then calls upcase and honorific, both of which // litter the pipeline with their arguments greet(pipeline); System.out.println("greeting = " + pipeline.get("greeting")); System.out.println("pipeline = " + pipeline); } }