001 package hep.aida.ref.sql; 002 003 // FreeHEP 004 import org.freehep.util.FreeHEPLookup; 005 import hep.aida.ref.AnalysisFactory; 006 007 // AIDA 008 import hep.aida.ITupleFactory; 009 import hep.aida.ITree; 010 011 // Log4J 012 import org.apache.log4j.Logger; 013 014 /** <code>SQLAnalysisFactory</code> supports {@link AidaSQLStoreFactory} 015 * (with a key <code>sql</code>) and {@link SQLTupleFactory}. 016 * <p><font color="#880088"> 017 * <pre> 018 * $Log: SQLAnalysisFactory.java,v $ 019 * Revision 1.14 2007/05/23 16:38:44 hrivnac 020 * logical connections for Plotter; better UML 021 * 022 * Revision 1.13 2006/11/15 16:16:01 hrivnac 023 * Oracle work fine in CERN, cache enabled 024 * 025 * Revision 1.12 2004/10/08 15:22:33 hrivnac 026 * JAS3 plugin works 027 * 028 * Revision 1.11 2004/05/22 15:12:59 hrivnac 029 * class id reformated 030 * 031 * Revision 1.10 2004/04/14 13:39:46 hrivnac 032 * 1.5 warnings fixed 033 * 034 * Revision 1.9 2004/04/13 15:45:54 hrivnac 035 * AIDA URL introduced 036 * 037 * Revision 1.8 2004/02/12 16:39:40 hrivnac 038 * niceing 039 * 040 * Revision 1.7 2004/02/10 14:50:58 hrivnac 041 * JavaDoc tags completed 042 * 043 * Revision 1.6 2004/02/04 13:30:39 hrivnac 044 * - improvement of Enums internal mapping 045 * - general cleaning 046 * 047 * Revision 1.5 2003/11/24 15:13:22 hrivnac 048 * Logging improved. 049 * 050 * Revision 1.4 2003/11/20 17:36:08 hrivnac 051 * JavaDoc links fixed 052 * 053 * Revision 1.3 2003/11/20 17:21:57 hrivnac 054 * Java 1.5 natively supported, Log4J reporting improved. 055 * 056 * Revision 1.2 2003/11/05 19:46:22 hrivnac 057 * - FreeHEP 1.2.1 058 * - JAIDA 3.2.1 059 * 060 * Revision 1.4 2003/10/21 13:24:52 hrivnac 061 * Constructor from columnString implemented. 062 * 063 * Revision 1.2 2003/10/02 10:00:40 hrivnac 064 * Cleaning. 065 * 066 * Revision 1.3 2003/09/30 14:11:48 hrivnac 067 * Can created SQLTuples. 068 * 069 * Revision 1.2 2003/09/29 14:36:40 hrivnac 070 * Works per attribute. 071 * 072 * </pre> 073 * </font></p> 074 * @opt attributes 075 * @opt operations 076 * @opt types 077 * @opt visibility 078 * @version $Id: SQLAnalysisFactory.java,v 1.14 2007/05/23 16:38:44 hrivnac Exp $ 079 * @author <a href="mailto:Julius.Hrivnac@cern.ch">J.Hrivnac</a> */ 080 public class SQLAnalysisFactory extends AnalysisFactory { 081 082 /** Register {@link AidaSQLStoreFactory} as <code>sql</code>. */ 083 static { 084 FreeHEPLookup.instance().add(new AidaSQLStoreFactory(), "sql"); 085 } 086 087 /** Creates {@link SQLTupleFactory} if {@link ITree} store type 088 * is <code>sql</code>. Otherwise, uses {@link AnalysisFactory}. 089 * @param tree The ITree tu be used for the ITupleFactory. 090 * @return The ITupleFactory associated with he ITree. 091 * @throws IllegalArgumentException if the ITupleFactory can't be created from the ITree. */ 092 public ITupleFactory createTupleFactory(ITree tree) throws IllegalArgumentException { 093 if (tree.storeName() != null && 094 (new AIDAURL(tree.storeName())).storeType().equals("sql")) { 095 try { 096 return new SQLTupleFactory(tree); 097 } 098 catch (SQLTupleException e) { 099 log.error(Util.report("Can't create SQLTupleFactory", e), e); 100 throw new IllegalArgumentException("Couldn't create SQLTupleFactory", e); 101 } 102 } 103 else { 104 return super.createTupleFactory(tree); 105 } 106 } 107 108 /** Logging . */ 109 private static Logger log = Logger.getLogger(Util.class); 110 111 }