KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > jca > ejb > ConnectionFactorySerializationTestSessionBean


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.test.jca.ejb;
23
24 import java.rmi.MarshalledObject JavaDoc;
25 import java.rmi.RemoteException JavaDoc;
26 import java.sql.Connection JavaDoc;
27 import javax.ejb.EJBException JavaDoc;
28 import javax.ejb.SessionBean JavaDoc;
29 import javax.ejb.SessionContext JavaDoc;
30 import javax.naming.InitialContext JavaDoc;
31 import javax.sql.DataSource JavaDoc;
32
33 import org.jboss.logging.Logger;
34
35 /**
36  * ConnectionFactorySerializationTestSessionBean.java
37  *
38  * @author <a HREF="mailto:d_jencks@users.sourceforge.net">David Jencks</a>
39  * @version $Revision: 37406 $
40  *
41  * @ejb:bean name="ConnectionFactorySerializationTestSession"
42  * jndi-name="ConnectionFactorySerializationTestSession"
43  * view-type="remote"
44  * type="Stateless"
45  */

46 public class ConnectionFactorySerializationTestSessionBean
47    implements SessionBean JavaDoc
48 {
49    /** The serialVersionUID */
50    private static final long serialVersionUID = 1L;
51    private final Logger log = Logger.getLogger(getClass());
52
53    /**
54     * Describe <code>testConnectionFactorySerialization</code> method here.
55     *
56     * @exception EJBException if an error occurs
57     * @ejb:interface-method
58     */

59    public void testConnectionFactorySerialization()
60    {
61       try
62       {
63          DataSource JavaDoc ds = (DataSource JavaDoc)new InitialContext JavaDoc().lookup("java:/DefaultDS");
64          Connection JavaDoc c = ds.getConnection();
65          c.close();
66          MarshalledObject JavaDoc mo = new MarshalledObject JavaDoc(ds);
67          ds = (DataSource JavaDoc)mo.get();
68          c = ds.getConnection();
69          c.close();
70       }
71       catch (Exception JavaDoc e)
72       {
73          log.info("Exception: ", e);
74          throw new EJBException JavaDoc("Exception: " + e);
75       } // end of try-catch
76
}
77
78    public void ejbCreate()
79    {
80    }
81
82    public void ejbActivate() throws RemoteException JavaDoc
83    {
84    }
85
86    public void ejbPassivate() throws RemoteException JavaDoc
87    {
88    }
89
90    public void ejbRemove() throws RemoteException JavaDoc
91    {
92    }
93
94    public void setSessionContext(SessionContext JavaDoc ctx) throws RemoteException JavaDoc
95    {
96    }
97
98    public void unsetSessionContext() throws RemoteException JavaDoc
99    {
100    }
101
102 }
103
104
Popular Tags