01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. 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: */package org.apache.geronimo.connector.mock;
17:
18: import javax.naming.NamingException;
19: import javax.naming.Reference;
20: import javax.resource.ResourceException;
21: import javax.resource.cci.Connection;
22: import javax.resource.cci.ConnectionFactory;
23: import javax.resource.cci.ConnectionSpec;
24: import javax.resource.cci.RecordFactory;
25: import javax.resource.cci.ResourceAdapterMetaData;
26: import javax.resource.spi.ConnectionManager;
27:
28: /**
29: *
30: *
31: * @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
32: *
33: * */
34: public class MockConnectionFactory implements
35: ConnectionFactoryExtension {
36:
37: private ConnectionManager connectionManager;
38: private MockManagedConnectionFactory managedConnectionFactory;
39: private Reference reference;
40:
41: public MockConnectionFactory(
42: MockManagedConnectionFactory managedConnectionFactory,
43: ConnectionManager connectionManager) {
44: this .managedConnectionFactory = managedConnectionFactory;
45: this .connectionManager = connectionManager;
46: }
47:
48: public Connection getConnection() throws ResourceException {
49: return getConnection(null);
50: }
51:
52: public Connection getConnection(ConnectionSpec properties)
53: throws ResourceException {
54: return (MockConnection) connectionManager.allocateConnection(
55: managedConnectionFactory,
56: (MockConnectionRequestInfo) properties);
57: }
58:
59: public RecordFactory getRecordFactory() throws ResourceException {
60: return null;
61: }
62:
63: public ResourceAdapterMetaData getMetaData()
64: throws ResourceException {
65: return null;
66: }
67:
68: public void setReference(Reference reference) {
69: this .reference = reference;
70: }
71:
72: public Reference getReference() throws NamingException {
73: return reference;
74: }
75:
76: public String doSomethingElse() {
77: return "SomethingElse";
78: }
79: }
|