01: /**
02: * EasyBeans
03: * Copyright (C) 2006 Bull S.A.S.
04: * Contact: easybeans@ow2.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19: * USA
20: *
21: * --------------------------------------------------------------------------
22: * $Id: SLSBDatabaseManager.java 1970 2007-10-16 11:49:25Z benoitf $
23: * --------------------------------------------------------------------------
24: */package org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged;
25:
26: import java.sql.SQLException;
27:
28: import javax.ejb.Remote;
29: import javax.ejb.Stateless;
30: import javax.naming.NamingException;
31:
32: import org.ow2.easybeans.tests.common.db.TableManager;
33:
34: /**
35: * Manages the database in the server side.
36: * @author Gisele Pinheiro Souza
37: * @author Eduardo Studzinski Estima de Castro
38: */
39: @Stateless(name="SLSBDatabaseManager")
40: @Remote(ItfDatabaseManager.class)
41: public class SLSBDatabaseManager implements ItfDatabaseManager {
42:
43: /**
44: * @see org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.ItfDatabaseManager#deleteTable(java.lang.String,
45: * java.lang.String)
46: * @param dbName name in the registry.
47: * @param tableName name in the database.
48: * @throws NamingException if a lookup error occurs.
49: * @throws SQLException if a database error occurs.
50: */
51: public void deleteTable(final String dbName, final String tableName)
52: throws NamingException, SQLException {
53: // deletes the table
54: TableManager tableManager = new TableManager(dbName);
55: tableManager.deleteTable(tableName);
56: }
57:
58: /**
59: * @see org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.ItfDatabaseManager#verifyTable(java.lang.String,
60: * java.lang.String)
61: * @param dbName name in the registry.
62: * @param tableName name in the database.
63: * @throws NamingException if a lookup error occurs.
64: * @throws SQLException if a database error occurs.
65: */
66: public void verifyTable(final String dbName, final String tableName)
67: throws NamingException, SQLException {
68: // verifies the table
69: TableManager tableManager = new TableManager(dbName);
70: tableManager.verifyTable(tableName);
71: }
72:
73: /**
74: * @see org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.ItfDatabaseManager#insertTable(java.lang.String,
75: * java.lang.String)
76: * @param dbName name in the registry.
77: * @param tableName name in the database.
78: * @throws NamingException if a lookup error occurs.
79: * @throws SQLException if a database error occurs.
80: */
81: public void insertTable(final String dbName, final String tableName)
82: throws NamingException, SQLException {
83: TableManager tableManager = new TableManager(dbName);
84: tableManager.insertTable(tableName);
85: }
86:
87: }
|