1 37 package org.webharvest.runtime.processors; 38 39 import org.webharvest.definition.*; 40 41 public class ProcessorResolver { 42 43 public static BaseProcessor createProcessor(IElementDef elementDef) { 44 if (elementDef instanceof EmptyDef) { 45 return new EmptyProcessor( (EmptyDef)elementDef ); 46 } else if (elementDef instanceof TextDef) { 47 return new TextProcessor( (TextDef)elementDef ); 48 } else if (elementDef instanceof ConstantDef) { 49 return new ConstantProcessor( (ConstantDef)elementDef ); 50 } else if (elementDef instanceof FileDef) { 51 return new FileProcessor( (FileDef)elementDef ); 52 } else if (elementDef instanceof VarDefDef) { 53 return new VarDefProcessor( (VarDefDef)elementDef ); 54 } else if (elementDef instanceof VarDef) { 55 return new VarProcessor( (VarDef)elementDef ); 56 } else if (elementDef instanceof HttpDef) { 57 return new HttpProcessor( (HttpDef)elementDef ); 58 } else if (elementDef instanceof HttpParamDef) { 59 return new HttpParamProcessor( (HttpParamDef)elementDef ); 60 } else if (elementDef instanceof HttpHeaderDef) { 61 return new HttpHeaderProcessor( (HttpHeaderDef)elementDef ); 62 } else if (elementDef instanceof XPathDef) { 63 return new XPathProcessor( (XPathDef)elementDef ); 64 } else if (elementDef instanceof XQueryDef) { 65 return new XQueryProcessor( (XQueryDef)elementDef ); 66 } else if (elementDef instanceof XsltDef) { 67 return new XsltProcessor( (XsltDef)elementDef ); 68 } else if (elementDef instanceof TemplateDef) { 69 return new TemplateProcessor( (TemplateDef)elementDef ); 70 } else if (elementDef instanceof RegexpDef) { 71 return new RegexpProcessor( (RegexpDef)elementDef ); 72 } else if (elementDef instanceof HtmlToXmlDef) { 73 return new HtmlToXmlProcessor( (HtmlToXmlDef)elementDef ); 74 } else if (elementDef instanceof CaseDef) { 75 return new CaseProcessor( (CaseDef)elementDef ); 76 } else if (elementDef instanceof LoopDef) { 77 return new LoopProcessor( (LoopDef)elementDef ); 78 } else if (elementDef instanceof WhileDef) { 79 return new WhileProcessor( (WhileDef)elementDef ); 80 } else if (elementDef instanceof FunctionDef) { 81 return new FunctionProcessor( (FunctionDef)elementDef ); 82 } else if (elementDef instanceof IncludeDef) { 83 return new IncludeProcessor( (IncludeDef)elementDef ); 84 } else if (elementDef instanceof CallDef) { 85 return new CallProcessor( (CallDef)elementDef ); 86 } else if (elementDef instanceof CallParamDef) { 87 return new CallParamProcessor( (CallParamDef)elementDef ); 88 } else if (elementDef instanceof ReturnDef) { 89 return new ReturnProcessor( (ReturnDef)elementDef ); 90 } else if (elementDef instanceof TryDef) { 91 return new TryProcessor( (TryDef)elementDef ); 92 } else if (elementDef instanceof ScriptDef) { 93 return new ScriptProcessor( (ScriptDef)elementDef ); 94 } 95 96 return null; 97 } 98 99 } | Popular Tags |