1 32 33 package it.businesslogic.ireport; 34 35 import java.util.Map ; 36 37 41 public abstract class IReportConnection { 42 43 private String name=""; 44 48 public boolean isJDBCConnection(){ return false; } 49 50 51 55 public boolean isJRDataSource() { return true; } 56 57 58 public String getDescription(){ return ""; } 59 63 public java.sql.Connection getConnection(){ return null; } 64 65 69 public net.sf.jasperreports.engine.JRDataSource getJRDataSource() { return new net.sf.jasperreports.engine.JREmptyDataSource(); } 70 71 75 public java.lang.String getName() { 76 return name; 77 } 78 79 83 public void setName(java.lang.String name) { 84 this.name = name; 85 } 86 87 public java.util.HashMap getProperties() 88 { 89 return new java.util.HashMap (); 90 } 91 92 96 public void loadProperties(java.util.HashMap map) 97 { 98 } 99 100 103 public void save(java.io.PrintWriter pw) 104 { 105 java.util.HashMap hm = this.getProperties(); 106 pw.println("\t<iReportConnection name=\""+ this.getName() +"\" connectionClass=\"" + this.getClass().getName() +"\">"); 107 java.util.Iterator iterator = hm.keySet().iterator(); 108 109 while (iterator.hasNext()) 110 { 111 String key = (String )iterator.next(); 112 pw.println("\t\t<connectionParameter name=\"" + key + "\"><![CDATA[" + hm.get(key) + "]]></connectionParameter>"); 113 } 114 pw.println("\t</iReportConnection>"); 115 } 116 117 public String toString() 118 { 119 return getName(); 120 } 121 122 126 public Map getSpecialParameters(Map map) throws net.sf.jasperreports.engine.JRException 127 { 128 return map; 129 } 130 131 136 public Map disposeSpecialParameters(Map map) 137 { 138 return map; 139 } 140 141 142 146 public void test() throws Exception {} 147 } 148 | Popular Tags |