1 32 33 package com.knowgate.dataobjs; 34 35 39 40 import com.knowgate.dataobjs.DBBind; 41 42 import java.awt.Image ; 43 44 import java.lang.ClassNotFoundException ; 45 import java.lang.NoSuchMethodException ; 46 47 import java.beans.SimpleBeanInfo ; 48 import java.beans.BeanDescriptor ; 49 import java.beans.MethodDescriptor ; 50 51 public class DBBindBeanInfo extends SimpleBeanInfo { 52 53 public DBBindBeanInfo() { 54 } 55 56 public BeanDescriptor getBeanDescriptor() { 57 return new BeanDescriptor (beanClass); 58 } 59 60 public Image getIcon(int iconKind) { 61 switch(iconKind) { 62 case SimpleBeanInfo.ICON_MONO_16x16: 63 return loadImage("dbbind16m.gif"); 64 case SimpleBeanInfo.ICON_COLOR_16x16: 65 return loadImage("dbbind16c.gif"); 66 case SimpleBeanInfo.ICON_MONO_32x32: 67 return loadImage("dbbind32m.gif"); 68 case SimpleBeanInfo.ICON_COLOR_32x32: 69 return loadImage("dbbind32c.gif"); 70 } 71 return null; 72 } 73 74 public MethodDescriptor [] getMethodDescriptors() { 75 try { 76 Class voidParams[] = { }; 77 Class nextValParams[] = { Class.forName("java.sql.Connection"), Class.forName("String") }; 78 Class getTableParams[] = { Class.forName("String") }; 79 Class getConnectionParams[] = { Class.forName("String") }; 80 Class escapeParams[] = { Class.forName("java.util.Date"), Class.forName("String") }; 81 Class existsParams[] = { Class.forName("com.knowgate.jdc.JDCConnection"), Class.forName("String"), Class.forName("String") }; 82 Class getDataModelParams[] = { Class.forName("com.knowgate.jdc.JDCConnection") }; 83 84 MethodDescriptor closeBind = 85 new MethodDescriptor (DBBind.class.getMethod("close", voidParams)); 86 MethodDescriptor nextVal = 87 new MethodDescriptor (DBBind.class.getMethod("nextVal", nextValParams)); 88 MethodDescriptor getTable = 89 new MethodDescriptor (DBBind.class.getMethod("getTable", getTableParams)); 90 MethodDescriptor getConnection = 91 new MethodDescriptor (DBBind.class.getMethod("getConnection", getConnectionParams)); 92 MethodDescriptor getDataModelVersion = 93 new MethodDescriptor (DBBind.class.getMethod("getDatabaseProductName", getDataModelParams)); 94 MethodDescriptor getDataModelVersionNumber = 95 new MethodDescriptor (DBBind.class.getMethod("getDatabaseProductName", getDataModelParams)); 96 MethodDescriptor getDatabaseProductName = 97 new MethodDescriptor (DBBind.class.getMethod("getDatabaseProductName", voidParams)); 98 MethodDescriptor getTime = 99 new MethodDescriptor (DBBind.class.getMethod("getTime", voidParams)); 100 MethodDescriptor connectionPool = 101 new MethodDescriptor (DBBind.class.getMethod("connectionPool", voidParams)); 102 MethodDescriptor escape = 103 new MethodDescriptor (DBBind.class.getMethod("escape", escapeParams)); 104 MethodDescriptor exists = 105 new MethodDescriptor (DBBind.class.getMethod("exists", voidParams)); 106 107 MethodDescriptor rv[] = { closeBind, nextVal, getTable, getConnection, 108 getDataModelVersion, getDataModelVersionNumber, getDatabaseProductName, 109 getTime, connectionPool, escape, exists }; 110 return rv; 111 } catch (ClassNotFoundException e) { 112 throw new Error (e.toString()); 113 } catch (NoSuchMethodException e) { 114 throw new Error (e.toString()); 115 } 116 } 117 118 private final static Class beanClass = DBBind.class; 119 } 120
| Popular Tags
|