001 /** 002 * 003 */ 004 package org.wdssii.core; 005 006 import org.apache.commons.logging.Log; 007 import org.apache.commons.logging.LogFactory; 008 009 /** 010 * @author lakshman 011 * 012 */ 013 public abstract class BuilderFactory { 014 private static Log log = LogFactory.getLog(BuilderFactory.class); 015 016 /** name to Builder */ 017 private static PrototypeFactory<Builder> factory = new PrototypeFactory<Builder>( 018 "java/Builder"); 019 020 public static DataType createDataType(IndexRecord rec) 021 throws DataUnavailableException { 022 String builderName = rec.getParams()[0]; 023 Builder builder = factory.getPrototypeMaster(builderName); 024 if (builder == null) { 025 log.error("ERROR: no such builder: " + builderName); 026 return null; 027 } 028 return builder.createObject(rec); 029 } 030 }