01: package org.apache.ojb.broker.accesslayer;
02:
03: /* Copyright 2003-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: import org.apache.ojb.broker.util.factory.ConfigurableFactory;
19: import org.apache.ojb.broker.metadata.ClassDescriptor;
20: import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
21:
22: /**
23: * Factory for {@link org.apache.ojb.broker.accesslayer.StatementsForClassIF}
24: * implementations. Developers may specify the specific implementation returned by
25: * {@link #getStatementsForClass} by implementing the
26: * {@link org.apache.ojb.broker.accesslayer.StatementsForClassIF}
27: * interface and setting the <code>StatementsForClassClass</code> property in
28: * <code>OJB.properties</code>.
29: * <br/>
30: * @see org.apache.ojb.broker.accesslayer.StatementManager
31: * @see org.apache.ojb.broker.accesslayer.StatementsForClassImpl
32: * @author <a href="mailto:rburt3@mchsi.com">Randall Burt</a>
33: * @version $Id: StatementsForClassFactory.java,v 1.5.2.1 2005/12/21 22:22:58 tomdz Exp $
34: */
35:
36: public class StatementsForClassFactory extends ConfigurableFactory {
37: private static StatementsForClassFactory singleton;
38:
39: /**
40: * Get the singleton instance of this class
41: * @return the singleton instance of StatementsForClassFactory
42: */
43: public static synchronized StatementsForClassFactory getInstance() {
44: if (singleton == null) {
45: singleton = new StatementsForClassFactory();
46: }
47: return singleton;
48: }
49:
50: /*
51: * @see org.apache.ojb.broker.util.factory.ConfigurableFactory#getConfigurationKey()
52: */
53: protected String getConfigurationKey() {
54: return "StatementsForClassClass";
55: }
56:
57: /**
58: * Get an instance of {@link org.apache.ojb.broker.accesslayer.StatementsForClassIF}
59: * @param cds our connection descriptor
60: * @param cld the class descriptor of the persistant object
61: * @return an instance of {@link org.apache.ojb.broker.accesslayer.StatementsForClassIF}
62: */
63: public StatementsForClassIF getStatementsForClass(
64: JdbcConnectionDescriptor cds, ClassDescriptor cld) {
65: return (StatementsForClassIF) this .createNewInstance(
66: new Class[] { JdbcConnectionDescriptor.class,
67: ClassDescriptor.class }, new Object[] { cds,
68: cld });
69: }
70: }
|