1 package org.drools.jsr94.jca.spi;
2
3 /*
4 $Id: RuleConnectionFactory.java,v 1.5 2003/06/19 09:28:35 tdiesler Exp $
5
6 Copyright 2002 (C) The Werken Company. All Rights Reserved.
7
8 Redistribution and use of this software and associated documentation
9 ("Software"), with or without modification, are permitted provided
10 that the following conditions are met:
11
12 1. Redistributions of source code must retain copyright
13 statements and notices. Redistributions must also contain a
14 copy of this document.
15
16 2. Redistributions in binary form must reproduce the
17 above copyright notice, this list of conditions and the
18 following disclaimer in the documentation and/or other
19 materials provided with the distribution.
20
21 3. The name "drools" must not be used to endorse or promote
22 products derived from this Software without prior written
23 permission of The Werken Company. For written permission,
24 please contact bob@werken.com.
25
26 4. Products derived from this Software may not be called "drools"
27 nor may "drools" appear in their names without prior written
28 permission of The Werken Company. "drools" is a registered
29 trademark of The Werken Company.
30
31 5. Due credit should be given to The Werken Company.
32 (http://drools.werken.com/).
33
34 THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS
35 ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
36 NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
37 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
38 THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
39 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
40 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
41 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
42 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
43 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
44 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
45 OF THE POSSIBILITY OF SUCH DAMAGE.
46
47 */
48
49 import org.drools.jsr94.rules.RuleServiceProviderImpl;
50
51 import javax.naming.NamingException;
52 import javax.naming.Reference;
53 import javax.resource.Referenceable;
54 import javax.resource.ResourceException;
55 import javax.resource.cci.*;
56 import javax.resource.spi.ConnectionManager;
57 import javax.resource.spi.ManagedConnectionFactory;
58 import java.io.PrintWriter;
59 import java.io.Serializable;
60
61 /***
62 * ConnectionFactory provides an interface for getting connection to an EIS instance.
63 * An implementation of ConnectionFactory interface is provided by a resource adapter.
64 * <p>
65 * Application code looks up a ConnectionFactory instance from JNDI namespace and uses it to get EIS connections.
66 * <p>
67 * An implementation class for ConnectionFactory is required to implement java.io.Serializable and
68 * javax.resource.Referenceableinterfaces to support JNDI registration.
69 * <p>
70 * @author <a href="mailto:thomas.diesler@softcon-itec.de">thomas diesler</a>
71 */
72 public class RuleConnectionFactory extends RuleServiceProviderImpl implements ConnectionFactory, Serializable, Referenceable
73 {
74
75 private String desc;
76 private ManagedConnectionFactory mcf;
77 private ConnectionManager cm;
78 private Reference reference;
79 private PrintWriter logWriter;
80
81 public RuleConnectionFactory( ManagedConnectionFactory mcf, ConnectionManager cm ) throws ResourceException
82 {
83 this.mcf = mcf;
84 this.cm = cm;
85 this.logWriter = mcf.getLogWriter();
86 logWriter.println( "RuleConnectionFactory" );
87 }
88
89 /***
90 * ConnectionFactory provides an interface for getting connection to an EIS instance.
91 * An implementation of ConnectionFactory interface is provided by a resource adapter.
92 * <p>
93 * Application code looks up a ConnectionFactory instance from JNDI namespace and uses it to get EIS connections.
94 * <p>
95 * An implementation class for ConnectionFactory is required to implement java.io.Serializable and
96 * javax.resource.Referenceableinterfaces to support JNDI registration.
97 */
98 public Connection getConnection() throws ResourceException
99 {
100 logWriter.println( "RuleConnectionFactory.getConnection,1" );
101 return null;
102 }
103
104 /***
105 * Gets a connection to an EIS instance. A component should use the getConnection variant with
106 * javax.resource.cci.ConnectionSpec parameter, if it needs to pass any resource adapter specific security
107 * information and connection parameters. the component- managed sign-on case, an application component passes
108 * security information (example: username, password) through the ConnectionSpec instance.
109 * <p>
110 * It is important to note that the properties passed through the getConnection method should be client-specific
111 * (example: username, password, language) and not related to the configuration of a target EIS instance
112 * (example: port number, server name). The ManagedConnectionFactory instance is configured with complete set of
113 * properties required for the creation of a connection to an EIS instance.
114 */
115 public Connection getConnection( ConnectionSpec connectionSpec ) throws ResourceException
116 {
117 logWriter.println( "RuleConnectionFactory.getConnection,2" );
118 return null;
119 }
120
121 /***
122 * Gets a RecordFactory instance. The RecordFactory is used for the creation of generic Record instances.
123 */
124 public RecordFactory getRecordFactory() throws ResourceException
125 {
126 logWriter.println( "RuleConnectionFactory.getRecordFactory" );
127 return null;
128 }
129
130 /***
131 * Gets metadata for the Resource Adapter. Note that the metadata information is about the ResourceAdapter
132 * and not the EIS instance. An invocation of this method does not require that an active connection to an EIS
133 * instance should have been established.
134 */
135 public ResourceAdapterMetaData getMetaData() throws ResourceException
136 {
137 logWriter.println( "RuleConnectionFactory.getMetaData" );
138 return null;
139 }
140
141 /***
142 * Sets the Reference instance. This method is called by the deployment code to set the Reference that can be
143 * later returned by the getReference method (as defined in the javax.naming.Referenceable interface).
144 */
145 public void setReference( Reference reference )
146 {
147 logWriter.println( "RuleConnectionFactory.setReference" );
148 this.reference = reference;
149 }
150
151 /***
152 * Retrieves the Reference of this object.
153 */
154 public Reference getReference() throws NamingException
155 {
156 logWriter.println( "RuleConnectionFactory.getReference" );
157 return reference;
158 }
159
160 }
This page was automatically generated by Maven