1 34 package net.myvietnam.mvncore.info; 35 36 import java.awt.image.BufferedImage ; 37 import java.awt.Graphics2D ; 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 ex) {} 67 68 try { 69 Class.forName("javax.sql.DataSource"); 70 supportJavaxSql = true; 71 } catch (ClassNotFoundException ex) {} 72 73 try { 74 Class.forName("javax.activation.DataSource"); 75 supportJAF = true; 76 } catch (ClassNotFoundException ex) {} 77 78 try { 79 Class.forName("javax.mail.Message"); 80 supportMail = true; 81 } catch (ClassNotFoundException ex) {} 82 83 try { 84 Class.forName("org.apache.commons.beanutils.MethodUtils"); 85 supportBeanUtils = true; 86 } catch (ClassNotFoundException ex) {} 87 88 try { 89 Class.forName("org.apache.commons.logging.LogFactory"); 90 supportCommonLogging = true; 91 } catch (ClassNotFoundException ex) {} 92 93 try { 94 Class.forName("org.apache.commons.codec.Decoder"); 95 supportCommonCodec = true; 96 } catch (ClassNotFoundException ex) {} 97 98 try { 99 Class.forName("org.apache.commons.collections.ArrayStack"); 100 supportCommonCollection = true; 101 } catch (ClassNotFoundException ex) {} 102 103 try { 104 Class.forName("org.apache.commons.digester.Digester"); 105 supportCommonDigester = true; 106 } catch (ClassNotFoundException ex) {} 107 108 try { 109 Class.forName("org.apache.commons.lang.SystemUtils"); 110 supportCommonLang = true; 111 } catch (ClassNotFoundException ex) {} 112 113 try { 114 Class.forName("org.apache.regexp.RE"); 115 supportJakartaRegExp = true; 116 } catch (ClassNotFoundException ex) {} 117 118 try { 119 Class.forName("org.apache.lucene.index.IndexWriter"); 120 supportLucene = true; 121 } catch (ClassNotFoundException ex) {} 122 123 try { 124 Class.forName("org.dom4j.Document"); 125 supportDom4j = true; 126 } catch (ClassNotFoundException ex) {} 127 128 try { 129 Class.forName("org.gjt.mm.mysql.Driver"); 130 supportMmMysqlDriver = true; 131 } catch (ClassNotFoundException ex) {} 132 133 try { 134 Class.forName("com.mysql.jdbc.Driver"); 135 supportComMysqlDriver = true; 136 } catch (ClassNotFoundException ex) {} 137 138 try { 139 BufferedImage bufferedImage = new BufferedImage (10, 10, BufferedImage.TYPE_INT_RGB); 140 Graphics2D g = bufferedImage.createGraphics(); 141 g.drawLine(0, 0, 10, 10); 142 g.dispose(); 144 supportImageProcessing = true; 145 } catch (Throwable 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 |