001 package org.apache.ojb.broker.accesslayer;
002
003 /* Copyright 2003-2005 The Apache Software Foundation
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 import org.apache.ojb.broker.util.factory.ConfigurableFactory;
019 import org.apache.ojb.broker.metadata.ClassDescriptor;
020 import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
021
022 /**
023 * Factory for {@link org.apache.ojb.broker.accesslayer.StatementsForClassIF}
024 * implementations. Developers may specify the specific implementation returned by
025 * {@link #getStatementsForClass} by implementing the
026 * {@link org.apache.ojb.broker.accesslayer.StatementsForClassIF}
027 * interface and setting the <code>StatementsForClassClass</code> property in
028 * <code>OJB.properties</code>.
029 * <br/>
030 * @see org.apache.ojb.broker.accesslayer.StatementManager
031 * @see org.apache.ojb.broker.accesslayer.StatementsForClassImpl
032 * @author <a href="mailto:rburt3@mchsi.com">Randall Burt</a>
033 * @version $Id: StatementsForClassFactory.java,v 1.1 2007-08-24 22:17:30 ewestfal Exp $
034 */
035
036 public class StatementsForClassFactory extends ConfigurableFactory
037 {
038 private static StatementsForClassFactory singleton;
039
040
041 /**
042 * Get the singleton instance of this class
043 * @return the singleton instance of StatementsForClassFactory
044 */
045 public static synchronized StatementsForClassFactory getInstance()
046 {
047 if (singleton == null)
048 {
049 singleton = new StatementsForClassFactory();
050 }
051 return singleton;
052 }
053
054 /*
055 * @see org.apache.ojb.broker.util.factory.ConfigurableFactory#getConfigurationKey()
056 */
057 protected String getConfigurationKey()
058 {
059 return "StatementsForClassClass";
060 }
061
062
063 /**
064 * Get an instance of {@link org.apache.ojb.broker.accesslayer.StatementsForClassIF}
065 * @param cds our connection descriptor
066 * @param cld the class descriptor of the persistant object
067 * @return an instance of {@link org.apache.ojb.broker.accesslayer.StatementsForClassIF}
068 */
069 public StatementsForClassIF getStatementsForClass(JdbcConnectionDescriptor cds, ClassDescriptor cld)
070 {
071 return (StatementsForClassIF) this.createNewInstance(new Class[]{JdbcConnectionDescriptor.class, ClassDescriptor.class},
072 new Object[]{cds, cld});
073 }
074 }