1 22 package org.jboss.ejb.plugins.cmp.jdbc.metadata; 23 24 import java.lang.reflect.Method ; 25 26 import org.w3c.dom.Element ; 27 import org.jboss.deployment.DeploymentException; 28 import org.jboss.metadata.MetaData; 29 30 36 public final class JDBCJBossQLQueryMetaData implements JDBCQueryMetaData 37 { 38 41 private final Method method; 42 43 46 private final String jbossQL; 47 48 51 private final boolean resultTypeMappingLocal; 52 53 56 private final JDBCReadAheadMetaData readAhead; 57 58 private final Class compiler; 59 60 private final boolean lazyResultSetLoading; 61 62 66 public JDBCJBossQLQueryMetaData(JDBCJBossQLQueryMetaData defaults, 67 JDBCReadAheadMetaData readAhead, 68 Class qlCompiler, 69 boolean lazyResultSetLoading) 70 throws DeploymentException 71 { 72 this.method = defaults.getMethod(); 73 this.readAhead = readAhead; 74 this.jbossQL = defaults.getJBossQL(); 75 this.resultTypeMappingLocal = defaults.isResultTypeMappingLocal(); 76 this.compiler = qlCompiler; 77 this.lazyResultSetLoading = lazyResultSetLoading; 78 } 79 80 84 public JDBCJBossQLQueryMetaData(boolean resultTypeMappingLocal, 85 Element element, 86 Method method, 87 JDBCReadAheadMetaData readAhead, 88 Class compiler, 89 boolean lazyResultSetLoading) 90 throws DeploymentException 91 { 92 this.method = method; 93 this.readAhead = readAhead; 94 jbossQL = MetaData.getElementContent(element); 95 if(jbossQL == null || jbossQL.trim().length() == 0) 96 { 97 throw new DeploymentException("jboss-ql element is empty"); 98 } 99 this.resultTypeMappingLocal = resultTypeMappingLocal; 100 this.compiler = compiler; 101 this.lazyResultSetLoading = lazyResultSetLoading; 102 } 103 104 public Method getMethod() 106 { 107 return method; 108 } 109 110 public Class getQLCompilerClass() 111 { 112 return compiler; 113 } 114 115 120 public String getJBossQL() 121 { 122 return jbossQL; 123 } 124 125 public boolean isResultTypeMappingLocal() 127 { 128 return resultTypeMappingLocal; 129 } 130 131 136 public JDBCReadAheadMetaData getReadAhead() 137 { 138 return readAhead; 139 } 140 141 public boolean isLazyResultSetLoading() 142 { 143 return lazyResultSetLoading; 144 } 145 146 155 public boolean equals(Object o) 156 { 157 if(o instanceof JDBCJBossQLQueryMetaData) 158 { 159 return ((JDBCJBossQLQueryMetaData) o).method.equals(method); 160 } 161 return false; 162 } 163 164 170 public int hashCode() 171 { 172 return method.hashCode(); 173 } 174 175 185 public String toString() 186 { 187 return "[JDBCJBossQLQueryMetaData : method=" + method + "]"; 188 } 189 } 190 | Popular Tags |