KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jaspersoft > jasperserver > api > metadata > jasperreports > domain > impl > datasource > RepoJdbcDataSource


1 /*
2  * Copyright (C) 2006 JasperSoft http://www.jaspersoft.com
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed WITHOUT ANY WARRANTY; and without the
10  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  * See the GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
15  * or write to:
16  *
17  * Free Software Foundation, Inc.,
18  * 59 Temple Place - Suite 330,
19  * Boston, MA USA 02111-1307
20  */

21
22 package com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.impl.datasource;
23
24 import com.jaspersoft.jasperserver.api.metadata.common.domain.Resource;
25 import com.jaspersoft.jasperserver.api.metadata.common.service.ResourceFactory;
26 import com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.ReferenceResolver;
27 import com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.JdbcReportDataSource;
28
29 /**
30  * @author Lucian Chirita (lucianc@users.sourceforge.net)
31  * @version $Id: RepoJdbcDataSource.java 2995 2006-04-07 14:05:32Z tdanciu $
32  *
33  * @hibernate.joined-subclass table="JdbcDatasource"
34  * @hibernate.joined-subclass-key column="id"
35  */

36 public class RepoJdbcDataSource extends RepoReportDataSource {
37     
38     private String JavaDoc driverClass;
39     private String JavaDoc connectionUrl;
40     private String JavaDoc username;
41     private String JavaDoc password;
42
43     public RepoJdbcDataSource() {
44     }
45
46     /**
47      * @hibernate.property column="driver" type="string" length="100" not-null="true"
48      */

49     public String JavaDoc getDriverClass() {
50         return driverClass;
51     }
52
53     public void setDriverClass(String JavaDoc driverClass) {
54         this.driverClass = driverClass;
55     }
56
57     /**
58      * @hibernate.property column="password" type="string" length="100"
59      */

60     public String JavaDoc getPassword() {
61         return password;
62     }
63
64     public void setPassword(String JavaDoc password) {
65         this.password = password;
66     }
67
68     /**
69      * @hibernate.property column="connectionUrl" type="string" length="100"
70      */

71     public String JavaDoc getConnectionUrl() {
72         return connectionUrl;
73     }
74
75     public void setConnectionUrl(String JavaDoc url) {
76         this.connectionUrl = url;
77     }
78
79     /**
80      * @hibernate.property column="username" type="string" length="100"
81      */

82     public String JavaDoc getUsername() {
83         return username;
84     }
85
86     public void setUsername(String JavaDoc username) {
87         this.username = username;
88     }
89
90     protected Class JavaDoc getClientItf() {
91         return JdbcReportDataSource.class;
92     }
93
94     protected void copyTo(Resource clientRes, ResourceFactory resourceFactory) {
95         super.copyTo(clientRes, resourceFactory);
96         
97         JdbcReportDataSource ds = (JdbcReportDataSource) clientRes;
98         ds.setDriverClass(getDriverClass());
99         ds.setConnectionUrl(getConnectionUrl());
100         ds.setUsername(getUsername());
101         ds.setPassword(getPassword());
102     }
103
104     protected void copyFrom(Resource clientRes,
105             ReferenceResolver referenceResolver) {
106         super.copyFrom(clientRes, referenceResolver);
107         JdbcReportDataSource ds = (JdbcReportDataSource) clientRes;
108         setDriverClass(ds.getDriverClass());
109         setConnectionUrl(ds.getConnectionUrl());
110         setUsername(ds.getUsername());
111         setPassword(ds.getPassword());
112     }
113 }
114
Popular Tags