Kettle 组件加载 2010 年11 月 廖 佳北京邮电大学计算机学院 TSEG jliao422@gmail.com 1. 根据配置文件加载组件信息 1.1. 方法入口 1.1.1. Spoon 类 main() 调用 initPlugins() 1.1.2. Spoon 类 initPlu gins() //初始化 Step 加载器 try { StepLoader.init(); } catch (KettleException e) { throw new KettleException(Messages.getString ("Spoon.Log.ErrorLoadingAndHaltSystem"), e); } //初始化 JobEntry 加载器 try { JobEntryLoader.init(); } catch (KettleException e) { throw new KettleException ("Error loading job entries & plugins... halting Spoon!", e); } 1.1.3. Steps 加载 1.1.3.1. StepLoader 类init() StepLoader loader = getInstance(pluginDirectory); //加载Kettle中steps loader.readNatives(); loader.readPlugins(); 1.1.3.2. StepLoader 类ReadNativ es () //从BaseStep 类steps 变量获取每个 step 信息并加入 plu ginList(List类型) for (int i = 0; i < BaseStep.steps.length; i++) { StepPluginMeta pluginMeta = BaseStep.steps[i]; String id[] = pluginMeta.getId(); String long_desc = pluginMeta.getLongDesc(); String tooltip = pluginMeta.getTooltipDesc(); String iconfile = pluginMeta.getImageFileName();; String classname = pluginMeta.getClassName().getName(); String directory = null; String jarfiles[] = null; String category = pluginMeta.getCategory(); StepPlugin sp = new StepPlugin(StepPlugin.TYPE_NATIVE, id, long_desc, tooltip, directory, jarfiles, iconfile, classname, category, null); pluginList.add(sp); } 1.1.3.3. BaseStep 类steps 变量 public static StepPluginMeta[] steps = null; //BaseStep 类静态块 static { synchronized (BaseStep.class) { try { //读取src/org/pentaho/di/core/config/kettle-config.xml内容 //annotation相关config ConfigManager> stepsAnntCfg = KettleConfig.getInstance() .getManager("steps-annotation-config"); Collection mainSteps = stepsAnntCfg .loadAs(StepPluginMeta.class);...