01: /**
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 1999-2004 Bull S.A.
04: * Contact: jonas-team@objectweb.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: JDBCResource.java 5462 2004-09-20 12:57:34Z danesa $
23: * --------------------------------------------------------------------------
24: */package org.objectweb.jonas.dbm;
25:
26: // Java imports
27: import java.util.ArrayList;
28:
29: import org.objectweb.jonas.management.j2eemanagement.J2EEResource;
30:
31: /**
32: * MBean class for JDBCResource Management
33: *
34: * @author Eric Hardesty JSR 77 (J2EE Management Standard)
35: * @author Adriana Danes improve JDBCDataSource management
36: */
37: public class JDBCResource extends J2EEResource {
38: /**
39: * List of available JDBC data sources given by the list of
40: * OBJECT_NAMEs of the JDBCDataSource MBeans.
41: */
42: private ArrayList jdbcDataSources = new ArrayList();
43:
44: /**
45: * Create q JDBCResource MBean.
46: * @param objectName This MBean's OBJECT_NAME
47: */
48: public JDBCResource(String objectName) {
49: super (objectName);
50: }
51:
52: /**
53: * @return The OBJECT_NAMEs of the JDBCDataSource MBeans.
54: */
55: public String[] getJdbcDataSources() {
56: return ((String[]) jdbcDataSources
57: .toArray(new String[jdbcDataSources.size()]));
58: }
59:
60: /**
61: * @param jdbcDataSourceName Add an OBJECT_NAME to the list of OBJECT_NAMEs
62: * associated to the JDBCResource MBean (means new JDBCDataSource created).
63: */
64: public void addJdbcDataSource(String jdbcDataSourceName) {
65: jdbcDataSources.add(jdbcDataSourceName);
66: }
67:
68: /**
69: * @param jdbcDataSourceName Remove an OBJECT_NAME from the list of OBJECT_NAMEs
70: * associated to the JDBCResource MBean (means JDBCDataSource removed).
71: */
72: public void removeJdbcDataSource(String jdbcDataSourceName) {
73: jdbcDataSources.remove(jdbcDataSourceName);
74: }
75: }
|