KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > myvietnam > mvncore > info > LibInfo


1 /*
2  * $Header: /cvsroot/mvnforum/myvietnam/src/net/myvietnam/mvncore/info/LibInfo.java,v 1.10 2006/04/15 02:59:19 minhnn Exp $
3  * $Author: minhnn $
4  * $Revision: 1.10 $
5  * $Date: 2006/04/15 02:59:19 $
6  *
7  * ====================================================================
8  *
9  * Copyright (C) 2002-2006 by MyVietnam.net
10  *
11  * All copyright notices regarding MyVietnam and MyVietnam CoreLib
12  * MUST remain intact in the scripts and source code.
13  *
14  * This library is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU Lesser General Public
16  * License as published by the Free Software Foundation; either
17  * version 2.1 of the License, or (at your option) any later version.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22  * Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public
25  * License along with this library; if not, write to the Free Software
26  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27  *
28  * Correspondence and Marketing Questions can be sent to:
29  * info at MyVietnam net
30  *
31  * @author: Minh Nguyen
32  * @author: Mai Nguyen
33  */

34 package net.myvietnam.mvncore.info;
35
36 import java.awt.image.BufferedImage JavaDoc;
37 import java.awt.Graphics2D JavaDoc;
38
39 public class LibInfo {
40
41     boolean supportJNDI = false;
42     boolean supportJavaxSql = false;
43     boolean supportJAF = false;
44     boolean supportMail = false;
45
46     boolean supportBeanUtils = false;
47     boolean supportCommonLogging = false;
48     boolean supportCommonCodec = false;
49     boolean supportCommonCollection = false;
50     boolean supportCommonDigester = false;
51     boolean supportCommonLang = false;
52     boolean supportJakartaRegExp = false;
53     boolean supportLucene = false;
54
55     boolean supportDom4j = false;
56
57     boolean supportMmMysqlDriver = false;
58     boolean supportComMysqlDriver = false;
59
60     boolean supportImageProcessing = false;
61
62     public LibInfo() {
63         try {
64             Class.forName("javax.naming.Name");
65             supportJNDI = true;
66         } catch (ClassNotFoundException JavaDoc ex) {}
67
68         try {
69             Class.forName("javax.sql.DataSource");
70             supportJavaxSql = true;
71         } catch (ClassNotFoundException JavaDoc ex) {}
72
73         try {
74             Class.forName("javax.activation.DataSource");
75             supportJAF = true;
76         } catch (ClassNotFoundException JavaDoc ex) {}
77
78         try {
79             Class.forName("javax.mail.Message");
80             supportMail = true;
81         } catch (ClassNotFoundException JavaDoc ex) {}
82
83         try {
84             Class.forName("org.apache.commons.beanutils.MethodUtils");
85             supportBeanUtils = true;
86         } catch (ClassNotFoundException JavaDoc ex) {}
87
88         try {
89             Class.forName("org.apache.commons.logging.LogFactory");
90             supportCommonLogging = true;
91         } catch (ClassNotFoundException JavaDoc ex) {}
92
93         try {
94             Class.forName("org.apache.commons.codec.Decoder");
95             supportCommonCodec = true;
96         } catch (ClassNotFoundException JavaDoc ex) {}
97
98         try {
99             Class.forName("org.apache.commons.collections.ArrayStack");
100             supportCommonCollection = true;
101         } catch (ClassNotFoundException JavaDoc ex) {}
102
103         try {
104             Class.forName("org.apache.commons.digester.Digester");
105             supportCommonDigester = true;
106         } catch (ClassNotFoundException JavaDoc ex) {}
107
108         try {
109             Class.forName("org.apache.commons.lang.SystemUtils");
110             supportCommonLang = true;
111         } catch (ClassNotFoundException JavaDoc ex) {}
112
113         try {
114             Class.forName("org.apache.regexp.RE");
115             supportJakartaRegExp = true;
116         } catch (ClassNotFoundException JavaDoc ex) {}
117
118         try {
119             Class.forName("org.apache.lucene.index.IndexWriter");
120             supportLucene = true;
121         } catch (ClassNotFoundException JavaDoc ex) {}
122
123         try {
124             Class.forName("org.dom4j.Document");
125             supportDom4j = true;
126         } catch (ClassNotFoundException JavaDoc ex) {}
127
128         try {
129             Class.forName("org.gjt.mm.mysql.Driver");
130             supportMmMysqlDriver = true;
131         } catch (ClassNotFoundException JavaDoc ex) {}
132
133         try {
134             Class.forName("com.mysql.jdbc.Driver");
135             supportComMysqlDriver = true;
136         } catch (ClassNotFoundException JavaDoc ex) {}
137
138         try {
139             BufferedImage JavaDoc bufferedImage = new BufferedImage JavaDoc(10, 10, BufferedImage.TYPE_INT_RGB);
140             Graphics2D JavaDoc g = bufferedImage.createGraphics();
141             g.drawLine(0, 0, 10, 10);
142             g.dispose();// free resource
143

144             supportImageProcessing = true;
145         } catch (Throwable JavaDoc ex) {}
146
147     }
148
149     public boolean isSupportJAF() {
150         return supportJAF;
151     }
152
153     public boolean isSupportJavaxSql() {
154         return supportJavaxSql;
155     }
156
157     public boolean isSupportJNDI() {
158         return supportJNDI;
159     }
160
161     public boolean isSupportMail() {
162         return supportMail;
163     }
164
165     public boolean isSupportBeanUtils() {
166         return supportBeanUtils;
167     }
168
169     public boolean isSupportCommonLogging() {
170         return supportCommonLogging;
171     }
172
173     public boolean isSupportCommonCodec() {
174         return supportCommonCodec;
175     }
176
177     public boolean isSupportCommonCollection() {
178         return supportCommonCollection;
179     }
180
181     public boolean isSupportCommonDigester() {
182         return supportCommonDigester;
183     }
184
185     public boolean isSupportCommonLang() {
186         return supportCommonLang;
187     }
188
189     public boolean isSupportJakartaRegExp() {
190         return supportJakartaRegExp;
191     }
192
193     public boolean isSupportLucene() {
194         return supportLucene;
195     }
196
197     public boolean isSupportDom4j() {
198         return supportDom4j;
199     }
200
201     public boolean isSupportMmMysqlDriver() {
202         return supportMmMysqlDriver;
203     }
204
205     public boolean isSupportComMysqlDriver() {
206         return supportComMysqlDriver;
207     }
208
209     public boolean isSupportImageProcessing() {
210         return supportImageProcessing;
211     }
212
213 }
214
Popular Tags