1 package org.apache.turbine.pipeline; 2 3 56 57 import org.apache.turbine.Turbine; 58 import org.apache.turbine.RunData; 59 import org.apache.turbine.modules.Module; 60 import org.apache.turbine.TurbineException; 61 import org.apache.commons.logging.LogFactory; 62 import org.apache.commons.logging.Log; 63 69 public class ModuleRunner 70 { 71 private static final Log log = LogFactory.getLog( ModuleRunner.class ); 72 73 public void run(String moduleType, RunData data) 74 throws TurbineException,Exception 75 { 76 String target; 77 String oldTarget = ""; 78 Module module; 79 80 target = getTarget(data); 81 while(! oldTarget.equals(target)) 82 { 83 log.debug("Module to run: " + moduleType + ":" + target); 84 85 module = Turbine.getResolver().getModule(moduleType, target); 86 module.execute(data); 87 88 oldTarget = target; 90 target = getTarget(data); 91 } 92 93 99 } 100 101 private String getTarget(RunData data) 102 throws Exception 103 { 104 String target = data.getTarget(); 105 if (target == null) 106 { 107 target = data.getParameters().getString("template"); 108 data.setTarget(target); 109 } 110 111 target = data.getTarget(); 113 StringBuffer sb = new StringBuffer (); 114 PipelineUtil.parseTemplatePath(target,sb); 115 return sb.toString(); 116 } 117 } 118 | Popular Tags |