1 package org.apache.ojb.broker.accesslayer.sql; 2 3 17 18 import org.apache.ojb.broker.util.factory.ConfigurableFactory; 19 import org.apache.ojb.broker.platforms.Platform; 20 21 import java.util.Map ; 22 import java.util.HashMap ; 23 24 29 public class SqlGeneratorFactory extends ConfigurableFactory 30 { 31 private static SqlGeneratorFactory instance = null; 32 33 private Map generatorMap = new HashMap (); 34 35 38 protected String getConfigurationKey() 39 { 40 return "SqlGeneratorClass"; 41 } 42 43 public SqlGenerator createSqlGenerator(Platform pf) 44 { 45 SqlGenerator gen = (SqlGenerator) generatorMap.get(pf.getClass().getName()); 46 if(gen == null) 47 { 48 gen = (SqlGenerator) this.createNewInstance(Platform.class, pf); 49 generatorMap.put(pf.getClass(), gen); 50 } 51 return gen; 52 } 53 54 public static SqlGeneratorFactory getInstance() 55 { 56 if (instance == null) 57 { 58 instance = new SqlGeneratorFactory(); 59 } 60 return instance; 61 } 62 } 63 | Popular Tags |