1 7 8 package javax.sql.rowset.serial; 9 10 import java.sql.*; 11 import java.io.*; 12 import java.util.Map ; 13 import java.net.URL ; 14 15 16 33 public class SerialArray implements Array, Serializable, Cloneable { 34 35 41 private Object [] elements; 42 43 49 private int baseType; 50 51 56 private String baseTypeName; 57 58 64 private int len; 65 66 119 public SerialArray(Array array, Map <String ,Class <?>> map) 120 throws SerialException , SQLException 121 { 122 123 if ((array == null) || (map == null)) { 124 throw new SQLException("Cannot instantiate a SerialArray " + 125 "object with null parameters"); 126 } 127 128 if ((elements = (Object [])array.getArray()) == null) { 129 throw new SQLException("Invalid Array object. Calls to Array.getArray() " + 130 "return null value which cannot be serialized"); 131 } 132 133 elements = (Object [])array.getArray(map); 134 baseType = array.getBaseType(); 135 baseTypeName = array.getBaseTypeName(); 136 len = elements.length; 137 138 switch (baseType) { 139 case java.sql.Types.STRUCT: 140 for (int i = 0; i < len; i++) { 141 elements[i] = new SerialStruct ((Struct)elements[i], map); 142 } 143 break; 144 145 case java.sql.Types.ARRAY: 146 for (int i = 0; i < len; i++) { 147 elements[i] = new SerialArray ((Array)elements[i], map); 148 } 149 break; 150 151 case java.sql.Types.BLOB: 152 for (int i = 0; i < len; i++) { 153 elements[i] = new SerialBlob ((Blob)elements[i]); 154 } 155 break; 156 157 case java.sql.Types.CLOB: 158 for (int i = 0; i < len; i++) { 159 elements[i] = new SerialClob ((Clob)elements[i]); 160 } 161 break; 162 163 case java.sql.Types.DATALINK: 164 for (int i = 0; i < len; i++) { 165 elements[i] = new SerialDatalink ((URL )elements[i]); 166 } 167 break; 168 169 case java.sql.Types.JAVA_OBJECT: 170 for (int i = 0; i < len; i++) { 171 elements[i] = new SerialJavaObject ((Object )elements[i]); 172 } 173 default: 174 ; 175 } 176 } 177 178 179 180 213 public SerialArray(Array array) throws SerialException , SQLException { 214 if (array == null) { 215 throw new SQLException("Cannot instantiate a SerialArray " + 216 "object with a null Array object"); 217 } 218 219 if ((elements = (Object [])array.getArray()) == null) { 220 throw new SQLException("Invalid Array object. Calls to Array.getArray() " + 221 "return null value which cannot be serialized"); 222 } 223 224 baseType = array.getBaseType(); 226 baseTypeName = array.getBaseTypeName(); 227 len = elements.length; 228 229 switch (baseType) { 230 231 case java.sql.Types.BLOB: 232 for (int i = 0; i < len; i++) { 233 elements[i] = new SerialBlob ((Blob)elements[i]); 234 } 235 break; 236 237 case java.sql.Types.CLOB: 238 for (int i = 0; i < len; i++) { 239 elements[i] = new SerialClob ((Clob)elements[i]); 240 } 241 break; 242 243 case java.sql.Types.DATALINK: 244 for (int i = 0; i < len; i++) { 245 elements[i] = new SerialDatalink ((URL )elements[i]); 246 } 247 break; 248 249 case java.sql.Types.JAVA_OBJECT: 250 for (int i = 0; i < len; i++) { 251 elements[i] = new SerialJavaObject ((Object )elements[i]); 252 } 253 254 default: 255 ; 256 } 257 258 259 } 260 261 270 public Object getArray() throws SerialException { 271 Object dst = new Object [len]; 272 System.arraycopy((Object )elements, 0, dst, 0, len); 273 return dst; 274 } 275 276 299 public Object getArray(Map <String , Class <?>> map) throws SerialException { 300 Object dst[] = new Object [len]; 301 System.arraycopy((Object )elements, 0, dst, 0, len); 302 return dst; 303 } 304 305 320 public Object getArray(long index, int count) throws SerialException { 321 Object dst = new Object [count]; 322 System.arraycopy((Object )elements, (int)index, dst, 0, count); 323 return dst; 324 } 325 326 354 public Object getArray(long index, int count, Map <String ,Class <?>> map) 355 throws SerialException 356 { 357 Object dst = new Object [count]; 358 System.arraycopy((Object )elements, (int)index, dst, 0, count); 359 return dst; 360 } 361 362 371 public int getBaseType() throws SerialException { 372 return baseType; 373 } 374 375 383 public String getBaseTypeName() throws SerialException { 384 return baseTypeName; 385 } 386 387 406 public ResultSet getResultSet(long index, int count) throws SerialException { 407 throw new UnsupportedOperationException (); 408 } 409 410 433 public ResultSet getResultSet(Map <String , Class <?>> map) 434 throws SerialException 435 { 436 throw new UnsupportedOperationException (); 437 } 438 439 452 public ResultSet getResultSet() throws SerialException { 453 throw new UnsupportedOperationException (); 454 } 455 456 457 486 public ResultSet getResultSet(long index, int count, 487 Map <String ,Class <?>> map) 488 throws SerialException 489 { 490 throw new UnsupportedOperationException (); 491 } 492 493 499 private class InternalResultSetImpl implements java.sql.ResultSet { 500 501 504 public boolean absolute(int row) throws SQLException { 505 return false; 506 } 507 508 511 public void afterLast() throws SQLException { 512 } 513 514 517 public void beforeFirst() throws SQLException { 518 } 519 522 public void cancelRowUpdates() throws SQLException { 523 } 524 525 528 public void clearWarnings() throws SQLException { 529 } 530 531 534 public void close() throws SQLException { 535 } 536 537 540 public void deleteRow() throws SQLException { 541 } 542 543 546 public int findColumn(String columnName) throws SQLException { 547 return 0; 548 } 549 550 553 public boolean first() throws SQLException { 554 return false; 555 } 556 557 560 public Array getArray(int i) throws SQLException { 561 return null; 562 } 563 564 567 public Array getArray(String colName) throws SQLException { 568 return null; 569 } 570 571 574 public java.io.InputStream getAsciiStream(String columnName) throws SQLException { 575 return null; 576 } 577 578 581 public java.io.InputStream getAsciiStream(int columnIndex) throws SQLException { 582 return null; 583 } 584 585 588 public java.math.BigDecimal getBigDecimal(String columnName) throws SQLException { 589 return null; 590 } 591 592 595 public java.math.BigDecimal getBigDecimal(int columnIndex) throws SQLException { 596 return null; 597 } 598 599 602 public java.math.BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { 603 return null; 604 } 605 606 609 public java.math.BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { 610 return null; 611 } 612 613 616 public java.io.InputStream getBinaryStream(int columnIndex) throws SQLException { 617 return null; 618 } 619 620 623 public java.io.InputStream getBinaryStream(String columnName) throws SQLException { 624 return null; 625 } 626 627 630 public Blob getBlob(int i) throws SQLException { 631 return null; 632 } 633 634 637 public Blob getBlob(String colName) throws SQLException { 638 return null; 639 } 640 641 644 public boolean getBoolean(int columnIndex) throws SQLException { 645 return false; 646 } 647 648 651 public boolean getBoolean(String columnName) throws SQLException { 652 return false; 653 } 654 655 658 public byte getByte(int columnIndex) throws SQLException { 659 return 0; 660 } 661 662 665 public byte getByte(String columnName) throws SQLException { 666 return 0; 667 } 668 669 672 public byte[] getBytes(int columnIndex) throws SQLException { 673 return null; 674 } 675 676 679 public byte[] getBytes(String columnName) throws SQLException { 680 return null; 681 } 682 683 686 public java.io.Reader getCharacterStream(int columnIndex) throws SQLException { 687 return null; 688 } 689 690 693 public java.io.Reader getCharacterStream(String columnName) throws SQLException { 694 return null; 695 } 696 697 700 public Clob getClob(int i) throws SQLException { 701 return null; 702 } 703 704 707 public Clob getClob(String colName) throws SQLException { 708 return null; 709 } 710 711 714 public int getConcurrency() throws SQLException { 715 return 0; 716 } 717 718 721 public String getCursorName() throws SQLException { 722 return null; 723 } 724 725 728 public java.sql.Date getDate(int columnIndex) throws SQLException { 729 return null; 730 } 731 732 735 public java.sql.Date getDate(String columnName) throws SQLException { 736 return null; 737 } 738 739 742 public java.sql.Date getDate(int columnIndex, java.util.Calendar cal) throws SQLException { 743 return null; 744 } 745 746 749 public java.sql.Date getDate(String columnName, java.util.Calendar cal) throws SQLException { 750 return null; 751 } 752 753 756 public double getDouble(int columnIndex) throws SQLException { 757 return 0; 758 } 759 760 763 public double getDouble(String columnName) throws SQLException { 764 return 0; 765 } 766 767 770 public int getFetchDirection() throws SQLException { 771 return 0; 772 } 773 774 777 public int getFetchSize() throws SQLException { 778 return 0; 779 } 780 781 784 public float getFloat(int columnIndex) throws SQLException { 785 return 0; 786 } 787 788 791 public float getFloat(String columnName) throws SQLException { 792 return 0; 793 } 794 795 798 public int getInt(String columnName) throws SQLException { 799 return 0; 800 } 801 802 805 public int getInt(int columnIndex) throws SQLException { 806 return 0; 807 } 808 809 812 public long getLong(int columnIndex) throws SQLException { 813 return 0; 814 } 815 816 819 public long getLong(String columnName) throws SQLException { 820 return 0; 821 } 822 823 826 public ResultSetMetaData getMetaData() throws SQLException { 827 return null; 828 } 829 830 833 public Object getObject(int columnIndex) throws SQLException { 834 return null; 835 } 836 837 840 public Object getObject(String columnName) throws SQLException { 841 return null; 842 } 843 844 847 public Object getObject(int i, java.util.Map <String ,Class <?>> map) 848 throws SQLException 849 { 850 return null; 851 } 852 853 856 public Object getObject(String colName, java.util.Map <String ,Class <?>> map) 857 throws SQLException 858 { 859 return null; 860 } 861 862 865 public Ref getRef(int i) throws SQLException { 866 return null; 867 } 868 869 872 public Ref getRef(String colName) throws SQLException { 873 return null; 874 } 875 876 879 public int getRow() throws SQLException { 880 return 0; 881 } 882 883 886 public short getShort(String columnName) throws SQLException { 887 return 0; 888 } 889 890 893 public short getShort(int columnIndex) throws SQLException { 894 return 0; 895 } 896 897 900 public Statement getStatement() throws SQLException { 901 return null; 902 } 903 904 907 public String getString(String columnName) throws SQLException { 908 return null; 909 } 910 911 914 public String getString(int columnIndex) throws SQLException { 915 return null; 916 } 917 918 921 public java.sql.Time getTime(String columnName) throws SQLException { 922 return null; 923 } 924 925 928 public java.sql.Time getTime(int columnIndex) throws SQLException { 929 return null; 930 } 931 932 935 public java.sql.Time getTime(String columnName, java.util.Calendar cal) throws SQLException { 936 return null; 937 } 938 939 942 public java.sql.Time getTime(int columnIndex, java.util.Calendar cal) throws SQLException { 943 return null; 944 } 945 946 949 public java.sql.Timestamp getTimestamp(String columnName) throws SQLException { 950 return null; 951 } 952 953 956 public java.sql.Timestamp getTimestamp(int columnIndex) throws SQLException { 957 return null; 958 } 959 960 963 public java.sql.Timestamp getTimestamp(String columnName, java.util.Calendar cal) throws SQLException { 964 return null; 965 } 966 967 970 public java.sql.Timestamp getTimestamp(int columnIndex, java.util.Calendar cal) throws SQLException { 971 return null; 972 } 973 974 977 public int getType() throws SQLException { 978 return 0; 979 } 980 981 984 public java.net.URL getURL(int columnIndex) throws SQLException { 985 return null; 986 } 987 988 991 public java.net.URL getURL(String columnName) throws SQLException { 992 return null; 993 } 994 995 998 public java.io.InputStream getUnicodeStream(String columnName) throws SQLException { 999 return null; 1000 } 1001 1002 1005 public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException { 1006 return null; 1007 } 1008 1009 1012 public SQLWarning getWarnings() throws SQLException { 1013 return null; 1014 } 1015 1016 1019 public void insertRow() throws SQLException { 1020 } 1021 1022 1025 public boolean isAfterLast() throws SQLException { 1026 return false; 1027 } 1028 1029 1032 public boolean isBeforeFirst() throws SQLException { 1033 return false; 1034 } 1035 1036 1039 public boolean isFirst() throws SQLException { 1040 return false; 1041 } 1042 1043 1046 public boolean isLast() throws SQLException { 1047 return false; 1048 } 1049 1050 1053 public boolean last() throws SQLException { 1054 return false; 1055 } 1056 1057 1060 public void moveToCurrentRow() throws SQLException { 1061 } 1062 1063 1066 public void moveToInsertRow() throws SQLException { 1067 } 1068 1069 1072 public boolean next() throws SQLException { 1073 return false; 1074 } 1075 1076 1079 public boolean previous() throws SQLException { 1080 return false; 1081 } 1082 1083 1086 public void refreshRow() throws SQLException { 1087 } 1088 1089 1092 public boolean relative(int rows) throws SQLException { 1093 return false; 1094 } 1095 1096 1099 public boolean rowDeleted() throws SQLException { 1100 return false; 1101 } 1102 1103 1106 public boolean rowInserted() throws SQLException { 1107 return false; 1108 } 1109 1110 1113 public boolean rowUpdated() throws SQLException { 1114 return false; 1115 } 1116 1117 1120 public void setFetchDirection(int direction) throws SQLException { 1121 } 1122 1123 1126 public void setFetchSize(int rows) throws SQLException { 1127 } 1128 1129 1132 public void updateArray(String columnName, java.sql.Array x) throws SQLException { 1133 } 1134 1135 1138 public void updateArray(int columnIndex, java.sql.Array x) throws SQLException { 1139 } 1140 1141 1144 public void updateAsciiStream(String columnName, java.io.InputStream x, int length) throws SQLException { 1145 } 1146 1147 1150 public void updateAsciiStream(int columnIndex, java.io.InputStream x, int length) throws SQLException { 1151 } 1152 1153 1156 public void updateBigDecimal(String columnName, java.math.BigDecimal x) throws SQLException { 1157 } 1158 1159 1162 public void updateBigDecimal(int columnIndex, java.math.BigDecimal x) throws SQLException { 1163 } 1164 1165 1168 public void updateBinaryStream(int columnIndex, java.io.InputStream x, int length) throws SQLException { 1169 } 1170 1171 1174 public void updateBinaryStream(String columnName, java.io.InputStream x, int length) throws SQLException { 1175 } 1176 1177 1180 public void updateBlob(int columnIndex, java.sql.Blob x) throws SQLException { 1181 } 1182 1183 1186 public void updateBlob(String columnName, java.sql.Blob x) throws SQLException { 1187 } 1188 1189 1192 public void updateBoolean(int columnIndex, boolean x) throws SQLException { 1193 } 1194 1195 1198 public void updateBoolean(String columnName, boolean x) throws SQLException { 1199 } 1200 1201 1204 public void updateByte(int columnIndex, byte x) throws SQLException { 1205 } 1206 1207 1210 public void updateByte(String columnName, byte x) throws SQLException { 1211 } 1212 1213 1216 public void updateBytes(int columnIndex, byte[] x) throws SQLException { 1217 } 1218 1219 1222 public void updateBytes(String columnName, byte[] x) throws SQLException { 1223 } 1224 1225 1228 public void updateCharacterStream(int columnIndex, java.io.Reader x, int length) throws SQLException { 1229 } 1230 1231 1234 public void updateCharacterStream(String columnName, java.io.Reader reader, int length) throws SQLException { 1235 } 1236 1237 1240 public void updateClob(String columnName, java.sql.Clob x) throws SQLException { 1241 } 1242 1243 1246 public void updateClob(int columnIndex, java.sql.Clob x) throws SQLException { 1247 } 1248 1249 1252 public void updateDate(int columnIndex, java.sql.Date x) throws SQLException { 1253 } 1254 1255 1258 public void updateDate(String columnName, java.sql.Date x) throws SQLException { 1259 } 1260 1261 1264 public void updateDouble(int columnIndex, double x) throws SQLException { 1265 } 1266 1267 1270 public void updateDouble(String columnName, double x) throws SQLException { 1271 } 1272 1273 1276 public void updateFloat(String columnName, float x) throws SQLException { 1277 } 1278 1279 1282 public void updateFloat(int columnIndex, float x) throws SQLException { 1283 } 1284 1285 1288 public void updateInt(String columnName, int x) throws SQLException { 1289 } 1290 1291 1294 public void updateInt(int columnIndex, int x) throws SQLException { 1295 } 1296 1297 1300 public void updateLong(int columnIndex, long x) throws SQLException { 1301 } 1302 1303 1306 public void updateLong(String columnName, long x) throws SQLException { 1307 } 1308 1309 1312 public void updateNull(String columnName) throws SQLException { 1313 } 1314 1315 1318 public void updateNull(int columnIndex) throws SQLException { 1319 } 1320 1321 1324 public void updateObject(String columnName, Object x) throws SQLException { 1325 } 1326 1327 1330 public void updateObject(int columnIndex, Object x) throws SQLException { 1331 } 1332 1333 1336 public void updateObject(int columnIndex, Object x, int scale) throws SQLException { 1337 } 1338 1339 1342 public void updateObject(String columnName, Object x, int scale) throws SQLException { 1343 } 1344 1345 1348 public void updateRef(int columnIndex, java.sql.Ref x) throws SQLException { 1349 } 1350 1351 1354 public void updateRef(String columnName, java.sql.Ref x) throws SQLException { 1355 } 1356 1357 1360 public void updateRow() throws SQLException { 1361 } 1362 1363 1366 public void updateShort(int columnIndex, short x) throws SQLException { 1367 } 1368 1369 1372 public void updateShort(String columnName, short x) throws SQLException { 1373 } 1374 1375 1378 public void updateString(int columnIndex, String x) throws SQLException { 1379 } 1380 1381 public void updateString(String columnName, String x) throws SQLException { 1382 } 1383 1384 1387 public void updateTime(String columnName, java.sql.Time x) throws SQLException { 1388 } 1389 1390 1393 public void updateTime(int columnIndex, java.sql.Time x) throws SQLException { 1394 } 1395 1396 1399 public void updateTimestamp(String columnName, java.sql.Timestamp x) throws SQLException { 1400 } 1401 1402 1405 public void updateTimestamp(int columnIndex, java.sql.Timestamp x) throws SQLException { 1406 } 1407 1408 public boolean wasNull() throws SQLException { 1409 return false; 1410 } 1411 1412 } 1413 1414 1418 static final long serialVersionUID = -8466174297270688520L; 1419} 1420 | Popular Tags |