1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
|
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package com.sun.star.filter.config.tools.utils;
//_______________________________________________
import java.lang.*;
import java.util.*;
import java.io.*;
//_______________________________________________
/**
* It implements a container for all possible entries which are part of the type
* and filter mechanism of an office - means all items of the configuration file
* "TypeDetection". How these entries will be readed or written can be switch
* in different modes. That would make it possible to edit an xml directly or
* to contact a running office instance.
*
*
*/
public class Cache
{
/** identifies a file type item of this cache. */
public static final int E_TYPE = 0;
/** identifies a filter item of this cache. */
public static final int E_FILTER = 1;
/** identifies a detect service item of this cache. */
public static final int E_DETECTSERVICE = 2;
/** identifies a frame loader item of this cache. */
public static final int E_FRAMELOADER = 3;
/** identifies a content handler item of this cache. */
public static final int E_CONTENTHANDLER = 4;
/** indicates an unsupported xml format => error! */
public static final int FORMAT_UNSUPPORTED = -1;
/** identify the configuration format of an office 6.0.
* The own formated data string is used. */
public static final int FORMAT_60 = 0;
/** identify the configuration format of an office 6.y.
* Properties are realy xml tags again. */
public static final int FORMAT_6Y = 1;
/** identify the configuration format which is used inside
* this tooling project. */
public static final int FORMAT_INTERNAL = 2;
/** right value for a command line parameter to define a 6.0 version. */
public static final java.lang.String CMDVAL_FORMAT_60 = "6.0";
/** right value for a command line parameter to define a 6.Y version. */
public static final java.lang.String CMDVAL_FORMAT_6Y = "6.Y";
/** right value for a command line parameter to define an internal xml version! */
public static final java.lang.String CMDVAL_FORMAT_INTERNAL = "internal";
// general
public static final java.lang.String PROPNAME_DATA = "Data";
public static final java.lang.String PROPNAME_NAME = "Name";
public static final java.lang.String PROPNAME_UINAME = "UIName";
public static final java.lang.String PROPNAME_UINAMES = "UINames";
// type 6.0 ...
public static final java.lang.String PROPNAME_MEDIATYPE = "MediaType";
public static final java.lang.String PROPNAME_PREFERRED = "Preferred";
public static final java.lang.String PROPNAME_CLIPBOARDFORMAT = "ClipboardFormat";
public static final java.lang.String PROPNAME_DOCUMENTICONID = "DocumentIconID";
public static final java.lang.String PROPNAME_URLPATTERN = "URLPattern";
public static final java.lang.String PROPNAME_EXTENSIONS = "Extensions";
// ... +6.y
public static final java.lang.String PROPNAME_UIORDER = "UIOrder";
public static final java.lang.String PROPNAME_PREFERREDFILTER = "PreferredFilter";
public static final java.lang.String PROPNAME_DETECTSERVICE = "DetectService";
public static final java.lang.String PROPNAME_FRAMELOADER = "FrameLoader";
public static final java.lang.String PROPNAME_CONTENTHANDLER = "ContentHandler";
// filter
public static final java.lang.String PROPNAME_DOCUMENTSERVICE = "DocumentService";
public static final java.lang.String PROPNAME_FILEFORMATVERSION = "FileFormatVersion";
public static final java.lang.String PROPNAME_FILTERSERVICE = "FilterService";
public static final java.lang.String PROPNAME_FLAGS = "Flags";
public static final java.lang.String PROPNAME_ORDER = "Order"; // -6.y
public static final java.lang.String PROPNAME_TEMPLATENAME = "TemplateName";
public static final java.lang.String PROPNAME_TYPE = "Type";
public static final java.lang.String PROPNAME_UICOMPONENT = "UIComponent";
public static final java.lang.String PROPNAME_USERDATA = "UserData";
// frame loader / detect services / content handler
public static final java.lang.String PROPNAME_TYPES = "Types";
//___________________________________________
// private const
private static final java.lang.String FILTERSERVICE_NATIVEWARPPER = "com.sun.star.filter.NativeFilterWrapper";
private static final java.lang.String GENERIC_DETECTSERVICE = "com.sun.star.comp.office.FrameLoader";
/** its the name of the cfg set, which contains all types. */
private static final java.lang.String CFGNODE_TYPES = "Types";
/** its the name of the cfg set, which contains all filters. */
private static final java.lang.String CFGNODE_FILTERS = "Filters";
/** its the name of the cfg set, which contains all detect services. */
private static final java.lang.String CFGNODE_DETECTSERVICES = "DetectServices";
/** its the name of the cfg set, which contains all frame loaders. */
private static final java.lang.String CFGNODE_FRAMELOADERS = "FrameLoaders";
/** its the name of the cfg set, which contains all content handlers. */
private static final java.lang.String CFGNODE_CONTENTHANDLERS = "ContentHandlers";
// names for filter flags
private static final java.lang.String FLAGNAME_3RDPARTYFILTER = "3RDPARTYFILTER";
private static final java.lang.String FLAGNAME_ALIEN = "ALIEN";
private static final java.lang.String FLAGNAME_ASYNCHRON = "ASYNCHRON";
private static final java.lang.String FLAGNAME_BROWSERPREFERRED = "BROWSERPREFERRED";
private static final java.lang.String FLAGNAME_CONSULTSERVICE = "CONSULTSERVICE";
private static final java.lang.String FLAGNAME_DEFAULT = "DEFAULT";
private static final java.lang.String FLAGNAME_EXPORT = "EXPORT";
private static final java.lang.String FLAGNAME_IMPORT = "IMPORT";
private static final java.lang.String FLAGNAME_INTERNAL = "INTERNAL";
private static final java.lang.String FLAGNAME_NOTINCHOOSER = "NOTINCHOOSER";
private static final java.lang.String FLAGNAME_NOTINFILEDIALOG = "NOTINFILEDIALOG";
private static final java.lang.String FLAGNAME_NOTINSTALLED = "NOTINSTALLED";
private static final java.lang.String FLAGNAME_OWN = "OWN";
private static final java.lang.String FLAGNAME_PACKED = "PACKED";
private static final java.lang.String FLAGNAME_PREFERRED = "PREFERRED";
private static final java.lang.String FLAGNAME_READONLY = "READONLY";
private static final java.lang.String FLAGNAME_TEMPLATE = "TEMPLATE";
private static final java.lang.String FLAGNAME_TEMPLATEPATH = "TEMPLATEPATH";
private static final java.lang.String FLAGNAME_USESOPTIONS = "USESOPTIONS";
private static final java.lang.String FLAGNAME_COMBINED = "COMBINED";
private static final java.lang.String FLAGNAME_SUPPORTSSELECTION= "SUPPORTSSELECTION";
// values for filter flags
private static final int FLAGVAL_3RDPARTYFILTER = 0x00080000; // 524288
private static final int FLAGVAL_ALIEN = 0x00000040; // 64
private static final int FLAGVAL_ALL = 0xffffffff; // 4294967295
private static final int FLAGVAL_ASYNCHRON = 0x00004000; // 16384
private static final int FLAGVAL_BROWSERPREFERRED = 0x00400000; // 4194304
private static final int FLAGVAL_CONSULTSERVICE = 0x00040000; // 262144
private static final int FLAGVAL_DEFAULT = 0x00000100; // 256
private static final int FLAGVAL_EXPORT = 0x00000002; // 2
private static final int FLAGVAL_IMPORT = 0x00000001; // 1
private static final int FLAGVAL_INTERNAL = 0x00000008; // 8
private static final int FLAGVAL_NOTINCHOOSER = 0x00002000; // 8192
private static final int FLAGVAL_NOTINFILEDIALOG = 0x00001000; // 4096
private static final int FLAGVAL_NOTINSTALLED = 0x00020000; // 131072
private static final int FLAGVAL_OWN = 0x00000020; // 32
private static final int FLAGVAL_PACKED = 0x00100000; // 1048576
private static final int FLAGVAL_PREFERRED = 0x10000000; // 268435456
private static final int FLAGVAL_READONLY = 0x00010000; // 65536
private static final int FLAGVAL_TEMPLATE = 0x00000004; // 4
private static final int FLAGVAL_TEMPLATEPATH = 0x00000010; // 16
private static final int FLAGVAL_USESOPTIONS = 0x00000080; // 128
private static final int FLAGVAL_COMBINED = 0x00800000; // ...
private static final int FLAGVAL_SUPPORTSSELECTION = 0x00000400; // 1024
//___________________________________________
// member
/** list of all located types.
* Format: [string,HashMap]
*/
private java.util.HashMap m_lTypes;
/** list of all located filters.
* Format: [string,HashMap]
*/
private java.util.HashMap m_lFilters;
/** list of all located detect services.
* Format: [string,HashMap]
*/
private java.util.HashMap m_lDetectServices;
/** list of all located frame loader.
* Format: [string,HashMap]
*/
private java.util.HashMap m_lFrameLoaders;
/** list of all located content handler.
* Format: [string,HashMap]
*/
private java.util.HashMap m_lContentHandlers;
/** contains all analyzed relations between
* filters and types. The key is an internal
* type name (can be used as reference into the
* list m_lTypes) and the value is a Vector of all
* internal filter names, which are registered for
* this type.
* Format: [string, Vector]
*/
private java.util.HashMap m_lFilterToTypeRegistrations;
private int m_nDoubleRegisteredFilters;
private int m_nTypesForFilters;
private int m_nTypesForDetectServices;
private int m_nTypesForFrameLoaders;
private int m_nTypesForContentHandlers;
/** can be used to log different informations. */
private Logger m_aDebug;
//___________________________________________
// interface
/** standard ctor.
*
* Initialize an empty cache instance. You have to use
* on of the fromXXX() methods to fill it from different
* sources with content.
*/
public Cache(Logger aDebug)
{
reset();
m_aDebug = aDebug;
}
//___________________________________________
/** free memory and set default values on all members.
*/
public synchronized void reset()
{
m_lTypes = new java.util.HashMap();
m_lFilters = new java.util.HashMap();
m_lFrameLoaders = new java.util.HashMap();
m_lDetectServices = new java.util.HashMap();
m_lContentHandlers = new java.util.HashMap();
m_lFilterToTypeRegistrations = new java.util.HashMap();
m_aDebug = new Logger();
m_nDoubleRegisteredFilters = 0;
m_nTypesForFilters = 0;
m_nTypesForDetectServices = 0;
m_nTypesForFrameLoaders = 0;
m_nTypesForContentHandlers = 0;
}
//___________________________________________
/** converts a string representation of an xml format
* to its int value, which must be used at some interface
* methods of this cache.
*
* If the given string does not match to any well known format,
* the return value will be FORMAT_UNSUPPORTED. The calli have to
* check that. Otherwhise a called interface method at this cache
* instance will be rejected by an exception!
*
* @param sFormat
* the string representation
* Must be one of our public const values from type CMDVAL_FORMAT_xxx.
*
* @return [int]
* the int representation.
* Will be one of our public const values from type FORMAT_xxx.
*/
public static int mapFormatString2Format(java.lang.String sFormat)
{
int nFormat = FORMAT_UNSUPPORTED;
if (sFormat.equalsIgnoreCase(CMDVAL_FORMAT_60))
nFormat = FORMAT_60;
else
if (sFormat.equalsIgnoreCase(CMDVAL_FORMAT_6Y))
nFormat = FORMAT_6Y;
else
if (sFormat.equalsIgnoreCase(CMDVAL_FORMAT_INTERNAL))
nFormat = FORMAT_INTERNAL;
return nFormat;
}
//___________________________________________
/** return some statistic values.
*
* Such values can be: - count of container items,
* - ...
*
* @return [java.lang.String]
* a formated string, which contains al statistic data.
*/
public synchronized java.lang.String getStatistics()
{
java.lang.StringBuffer sBuffer = new java.lang.StringBuffer(256);
sBuffer.append("types = "+m_lTypes.size() +"\n");
sBuffer.append("filters = "+m_lFilters.size() +"\n");
sBuffer.append("detect services = "+m_lDetectServices.size() +"\n");
sBuffer.append("frame loaders = "+m_lFrameLoaders.size() +"\n");
sBuffer.append("content handler = "+m_lContentHandlers.size() +"\n");
sBuffer.append("double registered filters = "+m_nDoubleRegisteredFilters+"\n");
sBuffer.append("types used by filters = "+m_nTypesForFilters +"\n");
sBuffer.append("types used by detect services = "+m_nTypesForDetectServices +"\n");
sBuffer.append("types used by frame loaders = "+m_nTypesForFrameLoaders +"\n");
sBuffer.append("types used by content handlers = "+m_nTypesForContentHandlers+"\n");
return sBuffer.toString();
}
//___________________________________________
/** reset this cache and fill it with new values using the given XML file.
*
* @param aXML
* must be a system file of a suitable XML file, which
* include all neccessary type/filter items.
*
* @param nFormat
* identifies the format of the specified xml file,
* which must be interpreted.
*/
public synchronized void fromXML(java.io.File aXML ,
int nFormat)
throws java.lang.Exception
{
// clear this cache
reset();
// parse it
javax.xml.parsers.DocumentBuilderFactory aFactory = javax.xml.parsers.DocumentBuilderFactory.newInstance();
/* Attention:
* This call is important. It force right handling of entities during parsing and(!)
* writing. It let all possible signs for entities or it's quoted representations
* untouched. So this class don't change the original signs of the original file.
* Means:
* <ul>
* <li>(') => (')</li>
* <li>(") => (")</li>
* <li>(>) => (>)</li>
* <li>(<) => (<)</li>
* <li>(>) => (>)</li>
* <li>(&) => (&)</li>
* <li>...</li>
* </ul>
*/
System.out.println("TODO: must be adapted to java 1.3 :-(");
System.exit(-1);
//TODO_JAVA aFactory.setExpandEntityReferences(false);
javax.xml.parsers.DocumentBuilder aBuilder = aFactory.newDocumentBuilder();
org.w3c.dom.Document aDOM = aBuilder.parse(aXML);
org.w3c.dom.Element aRoot = aDOM.getDocumentElement();
// step over all sets
java.util.Vector lSetNodes = XMLHelper.extractChildNodesByTagName(aRoot, XMLHelper.XMLTAG_NODE);
java.util.Enumeration it1 = lSetNodes.elements();
while (it1.hasMoreElements())
{
// try to find out, which set should be read
org.w3c.dom.Node aSetNode = (org.w3c.dom.Node)it1.nextElement();
java.lang.String sSetName = XMLHelper.extractNodeAttribByName(aSetNode, XMLHelper.XMLATTRIB_OOR_NAME);
if (sSetName == null)
throw new java.io.IOException("unsupported format: could not extract set name on node ...\n"+aSetNode);
// map some generic interfaces to the right members!
int eType = -1 ;
java.util.HashMap rMap = null;
if (sSetName.equals(CFGNODE_TYPES))
{
eType = E_TYPE;
rMap = m_lTypes;
}
else
if (sSetName.equals(CFGNODE_FILTERS))
{
eType = E_FILTER;
rMap = m_lFilters;
}
else
if (sSetName.equals(CFGNODE_FRAMELOADERS))
{
eType = E_FRAMELOADER;
rMap = m_lFrameLoaders;
}
else
if (sSetName.equals(CFGNODE_DETECTSERVICES))
{
eType = E_DETECTSERVICE;
rMap = m_lDetectServices;
}
else
if (sSetName.equals(CFGNODE_CONTENTHANDLERS))
{
eType = E_CONTENTHANDLER;
rMap = m_lContentHandlers;
}
else
throw new java.io.IOException("unsupported format: unknown set name [\""+sSetName+"\"] detected on node ...\n"+aSetNode);
// load all set entries
java.util.Vector lChildNodes = XMLHelper.extractChildNodesByTagName(aSetNode, XMLHelper.XMLTAG_NODE);
java.util.Enumeration it2 = lChildNodes.elements();
while (it2.hasMoreElements())
{
org.w3c.dom.Node aChildNode = (org.w3c.dom.Node)it2.nextElement();
java.lang.String sChildName = XMLHelper.extractNodeAttribByName(aChildNode, XMLHelper.XMLATTRIB_OOR_NAME);
if (sChildName == null)
throw new java.io.IOException("unsupported format: could not extract child node name on node ...\n"+aChildNode);
java.util.HashMap aPropSet = null;
// Note: Our internal format is different from the source format!
java.util.HashMap aTempSet = XMLHelper.convertNodeToPropSet(aChildNode);
switch(eType)
{
case E_TYPE :
{
aPropSet = Cache.convertTypePropsToInternal(aTempSet, nFormat);
m_aDebug.setDetailedInfo("type [\""+sChildName+"\"] converted to internal format");
}
break;
case E_FILTER :
{
aPropSet = Cache.convertFilterPropsToInternal(aTempSet, nFormat);
m_aDebug.setDetailedInfo("filter [\""+sChildName+"\"] converted to internal format");
}
break;
case E_DETECTSERVICE :
{
aPropSet = Cache.convertDetectServicePropsToInternal(aTempSet, nFormat);
m_aDebug.setDetailedInfo("detect service [\""+sChildName+"\"] converted to internal format");
}
break;
case E_FRAMELOADER :
{
aPropSet = Cache.convertFrameLoaderPropsToInternal(aTempSet, nFormat);
m_aDebug.setDetailedInfo("frame loader [\""+sChildName+"\"] converted to internal format");
}
break;
case E_CONTENTHANDLER :
{
aPropSet = Cache.convertContentHandlerPropsToInternal(aTempSet, nFormat);
m_aDebug.setDetailedInfo("content handler [\""+sChildName+"\"] converted to internal format");
}
break;
}
m_aDebug.setDetailedInfo("props = "+aTempSet);
rMap.put(sChildName, aPropSet);
}
}
}
//___________________________________________
/** create some hml views of the current content of this cache.
*
* The given directory is used to create different html files
* there. Every of them show another aspect of this cache.
* E.g.: - all type/filter properties
* - relation ships between types/filters/loaders etc.
*
* @param aDirectory
* points to a system directory, which
* can be used completely(!) to generate
* the results there.
*
* @param nFormat
* specify in which context the cache items should be
* interpreted.
*/
public synchronized void toHTML(java.io.File aDirectory,
int nFormat ,
java.lang.String sEncoding )
throws java.lang.Exception
{
if (nFormat != FORMAT_6Y)
throw new java.lang.Exception("HTML views are supported for the new 6.y format only yet.");
java.lang.StringBuffer sRelationView = new java.lang.StringBuffer(1000);
sRelationView.append("<html><header><title>Relation View</title></header><body>");
sRelationView.append("<table border=1>");
sRelationView.append("<tr><td><b>type</b></td><td><b>detect service</b></td><td><b>preferred filter</b></td><td><b>frame loader</b></td><td><b>content handler</b></td></tr>");
java.util.Iterator aIt = m_lTypes.keySet().iterator();
while (aIt.hasNext())
{
java.lang.String sType = (java.lang.String)aIt.next();
java.util.HashMap aType = (java.util.HashMap)m_lTypes.get(sType);
sRelationView.append("<tr>");
sRelationView.append("<td>"+sType+"</td>");
java.lang.String sVal = (java.lang.String)aType.get(PROPNAME_DETECTSERVICE);
if (sVal == null || sVal.length()<1)
sRelationView.append("<td> - </td>");
else
sRelationView.append("<td>"+sVal+"</td>");
sVal = (java.lang.String)aType.get(PROPNAME_PREFERREDFILTER);
if (sVal == null || sVal.length()<1)
sRelationView.append("<td> - </td>");
else
sRelationView.append("<td>"+sVal+"</td>");
sVal = (java.lang.String)aType.get(PROPNAME_FRAMELOADER);
if (sVal == null || sVal.length()<1)
sRelationView.append("<td> - </td>");
else
sRelationView.append("<td>"+sVal+"</td>");
sVal = (java.lang.String)aType.get(PROPNAME_CONTENTHANDLER);
if (sVal == null || sVal.length()<1)
sRelationView.append("<td> - </td>");
else
sRelationView.append("<td>"+sVal+"</td>");
sRelationView.append("</tr>");
}
sRelationView.append("</table>");
sRelationView.append("</body>");
FileHelper.writeEncodedBufferToFile(new java.io.File(aDirectory, "relation_view.html"), sEncoding, false, sRelationView);
java.util.HashMap lFilters2TypeRegistration = new java.util.HashMap();
aIt = m_lFilters.keySet().iterator();
while (aIt.hasNext())
{
java.lang.String sFilter = (java.lang.String)aIt.next();
java.util.HashMap aFilter = (java.util.HashMap)m_lFilters.get(sFilter);
java.lang.String sType = (java.lang.String)aFilter.get(PROPNAME_TYPE);
java.util.Vector lFilters = (java.util.Vector)lFilters2TypeRegistration.get(sType);
if (lFilters == null)
lFilters = new java.util.Vector();
lFilters.add(sFilter);
lFilters2TypeRegistration.put(sType, lFilters);
}
java.lang.StringBuffer sType2FiltersView = new java.lang.StringBuffer(1000);
sType2FiltersView.append("<html><header><title>Type2Filters View</title></header><body>");
sType2FiltersView.append("<table border=1>");
sType2FiltersView.append("<tr><td><b>type</b></td><td><b>filters</b></td></tr>");
aIt = lFilters2TypeRegistration.keySet().iterator();
while (aIt.hasNext())
{
java.lang.String sType = (java.lang.String)aIt.next();
java.util.Vector lFilters = (java.util.Vector)lFilters2TypeRegistration.get(sType);
sType2FiltersView.append("<tr><td>"+sType+"</td><td>");
java.util.Enumeration aEn = lFilters.elements();
while(aEn.hasMoreElements())
sType2FiltersView.append(aEn.nextElement()+"<br>");
sType2FiltersView.append("</td></tr>");
}
sType2FiltersView.append("</table>");
sType2FiltersView.append("</body>");
FileHelper.writeEncodedBufferToFile(new java.io.File(aDirectory, "type2filters_view.html"), sEncoding, false, sType2FiltersView);
}
//___________________________________________
/** converts all items of this cache to its xml representation
* and write it to the given file.
*
* @param aXML
* the target file for output.
*
* @param nFormat
* the requested xml format.
* see const values FORMAT_xxx too.
*
* @param sEncoding
* specify the file encoding for the generated xml file.
*
* @throws [java.lang.Exception]
* if something fail during convertion.
*/
public synchronized void toXML(java.io.File aXML ,
int nFormat ,
java.lang.String sEncoding)
throws java.lang.Exception
{
java.lang.StringBuffer sXML = new java.lang.StringBuffer(500000);
for (int i=0; i<5; ++i)
{
// define right sub container
java.lang.String sSetName = null;
java.util.HashMap rMap = null;
int eType = -1;
switch(i)
{
case 0 :
{
sSetName = CFGNODE_TYPES;
rMap = m_lTypes;
eType = E_TYPE;
}
break;
case 1 :
{
sSetName = CFGNODE_FILTERS;
rMap = m_lFilters;
eType = E_FILTER;
}
break;
case 2 :
{
sSetName = CFGNODE_DETECTSERVICES;
rMap = m_lDetectServices;
eType = E_DETECTSERVICE;
}
break;
case 3 :
{
sSetName = CFGNODE_FRAMELOADERS;
rMap = m_lFrameLoaders;
eType = E_FRAMELOADER;
}
break;
case 4 :
{
sSetName = CFGNODE_CONTENTHANDLERS;
rMap = m_lContentHandlers;
eType = E_CONTENTHANDLER;
}
break;
}
// generate set
sXML.append("<node oor:name=\""+sSetName+"\" oor:op=\"replace\">\n");
java.util.Iterator it = rMap.keySet().iterator();
while(it.hasNext())
{
java.lang.String sItem = (java.lang.String)it.next();
sXML.append("<node oor:name=\""+sItem+"\" oor:op=\"replace\">\n");
sXML.append(getItemAsXML(eType, sItem, nFormat));
sXML.append("</node>\n");
}
sXML.append("</node>\n");
}
java.io.FileOutputStream aStream = new java.io.FileOutputStream(aXML.getAbsolutePath(), false);
java.io.OutputStreamWriter aWriter = new java.io.OutputStreamWriter(aStream, sEncoding);
java.lang.String sOut = sXML.toString();
aWriter.write(sOut, 0, sOut.length());
aWriter.flush();
aWriter.close();
}
//___________________________________________
/** converts a type property set from internal format
* to an external one.
*
* @param aMap
* points to the item, which should be converted.
*
* @param nFormat
* specify the requested output format.
*
* @return [java.util.HashMap]
* contains the properties in the requested format.
*
* @throws [java.lang.Exception
* if something fail during convertion.
*/
private static java.util.HashMap convertTypePropsToExternal(java.util.HashMap aMap ,
int nFormat)
throws java.lang.Exception
{
java.util.HashMap aResultMap = new java.util.HashMap();
// copy Name property ... if it exists!
if (aMap.containsKey(PROPNAME_NAME))
aResultMap.put(PROPNAME_NAME, aMap.get(PROPNAME_NAME));
switch(nFormat)
{
//-----------------------------------
case FORMAT_60 :
{
// copy UIName property unchanged
aResultMap.put(PROPNAME_UINAME, aMap.get(PROPNAME_UINAME));
// ignore properties "UIOrder", "PreferredFilter", "DetectService"
// They are not supported for 6.0 types.
// pack all other properties to one "Data" string value
java.lang.StringBuffer sData = new java.lang.StringBuffer(256);
sData.append(aMap.get(PROPNAME_PREFERRED));
sData.append(",");
sData.append(aMap.get(PROPNAME_MEDIATYPE));
sData.append(",");
sData.append(aMap.get(PROPNAME_CLIPBOARDFORMAT));
sData.append(",");
java.util.Vector lList = (java.util.Vector)aMap.get(PROPNAME_URLPATTERN);
int c = lList.size();
int i = 0;
for (i=0; i<c; ++i)
{
sData.append(lList.elementAt(i));
if (i<(c-1))
sData.append(";");
}
lList = (java.util.Vector)aMap.get(PROPNAME_EXTENSIONS);
c = lList.size();
for (i=0; i<c; ++i)
{
sData.append(lList.elementAt(i));
if (i<(c-1))
sData.append(";");
}
sData.append(",");
sData.append(aMap.get(PROPNAME_DOCUMENTICONID));
sData.append(",");
aResultMap.put(PROPNAME_DATA, sData.toString());
}
break;
//-----------------------------------
case FORMAT_6Y :
{
// copy all supported properties directly
aResultMap.put(PROPNAME_PREFERRED , aMap.get(PROPNAME_PREFERRED ));
aResultMap.put(PROPNAME_MEDIATYPE , aMap.get(PROPNAME_MEDIATYPE ));
aResultMap.put(PROPNAME_URLPATTERN , aMap.get(PROPNAME_URLPATTERN ));
aResultMap.put(PROPNAME_EXTENSIONS , aMap.get(PROPNAME_EXTENSIONS ));
aResultMap.put(PROPNAME_UINAME , aMap.get(PROPNAME_UINAME ));
aResultMap.put(PROPNAME_PREFERREDFILTER, aMap.get(PROPNAME_PREFERREDFILTER));
aResultMap.put(PROPNAME_DETECTSERVICE , aMap.get(PROPNAME_DETECTSERVICE ));
aResultMap.put(PROPNAME_CLIPBOARDFORMAT, aMap.get(PROPNAME_CLIPBOARDFORMAT));
aResultMap.put(PROPNAME_UIORDER , aMap.get(PROPNAME_UIORDER ));
/* REMOVED!
aResultMap.put(PROPNAME_DOCUMENTICONID , aMap.get(PROPNAME_DOCUMENTICONID ));
*/
}
break;
//-----------------------------------
default :
throw new java.lang.Exception("unknown format");
}
return aResultMap;
}
//___________________________________________
/** converts a filter property set from internal format
* to an external one.
*
* @param aMap
* points to the item, which should be converted.
*
* @param nFormat
* specify the requested output format.
*
* @return [java.util.HashMap]
* contains the properties in the requested format.
*
* @throws [java.lang.Exception
* if something fail during convertion.
*/
private static java.util.HashMap convertFilterPropsToExternal(java.util.HashMap aMap ,
int nFormat)
throws java.lang.Exception
{
java.util.HashMap aResultMap = new java.util.HashMap();
// copy Name property ... if it exists!
if (aMap.containsKey(PROPNAME_NAME))
aResultMap.put(PROPNAME_NAME, aMap.get(PROPNAME_NAME));
switch(nFormat)
{
//-----------------------------------
case FORMAT_60 :
{
// copy UIName property unchanged!
aResultMap.put(PROPNAME_UINAME, aMap.get(PROPNAME_UINAME));
// but pack all other properties
java.lang.StringBuffer sData = new java.lang.StringBuffer(256);
sData.append(aMap.get(PROPNAME_ORDER));
sData.append(",");
sData.append(aMap.get(PROPNAME_TYPE));
sData.append(",");
sData.append(aMap.get(PROPNAME_DOCUMENTSERVICE));
sData.append(",");
sData.append(aMap.get(PROPNAME_FILTERSERVICE));
sData.append(",");
sData.append(aMap.get(PROPNAME_FLAGS));
sData.append(",");
java.util.Vector lList = (java.util.Vector)aMap.get(PROPNAME_USERDATA);
int c = lList.size();
int i = 0;
for (i=0; i<c; ++i)
{
sData.append(lList.elementAt(i));
if (i<(c-1))
sData.append(";");
}
sData.append(",");
sData.append(aMap.get(PROPNAME_FILEFORMATVERSION));
sData.append(",");
sData.append(aMap.get(PROPNAME_TEMPLATENAME));
sData.append(",");
sData.append(aMap.get(PROPNAME_UICOMPONENT));
sData.append(",");
aResultMap.put(PROPNAME_DATA, sData.toString());
}
break;
//-----------------------------------
case FORMAT_6Y :
{
// supress "Order" property.
// Will be moved to type entries in 6.y version!
// supress "UIName" property.
// Only type entries will be localized in 6.y version!
/* TODO make it configurable :-) */
aResultMap.put(PROPNAME_UINAME , aMap.get(PROPNAME_UINAME ));
// copy all supported properties directly
aResultMap.put(PROPNAME_TYPE , aMap.get(PROPNAME_TYPE ));
aResultMap.put(PROPNAME_DOCUMENTSERVICE , aMap.get(PROPNAME_DOCUMENTSERVICE ));
aResultMap.put(PROPNAME_FILTERSERVICE , aMap.get(PROPNAME_FILTERSERVICE ));
aResultMap.put(PROPNAME_USERDATA , aMap.get(PROPNAME_USERDATA ));
aResultMap.put(PROPNAME_FILEFORMATVERSION, aMap.get(PROPNAME_FILEFORMATVERSION));
aResultMap.put(PROPNAME_TEMPLATENAME , aMap.get(PROPNAME_TEMPLATENAME ));
aResultMap.put(PROPNAME_UICOMPONENT , aMap.get(PROPNAME_UICOMPONENT ));
// "Flags" will be converted from internal format [int] to
// the 6.y format [string-list]!
java.lang.Integer nFlags = (java.lang.Integer)aMap.get(PROPNAME_FLAGS);
java.util.Vector lFlags = Cache.convertFilterFlagValues2Names(nFlags);
aResultMap.put(PROPNAME_FLAGS, lFlags);
}
break;
//-----------------------------------
default :
throw new java.lang.Exception("unknown format");
}
return aResultMap;
}
//___________________________________________
/** converts a detect service property set from internal format
* to an external one.
*
* @param aMap
* points to the item, which should be converted.
*
* @param nFormat
* specify the requested output format.
*
* @return [java.util.HashMap]
* contains the properties in the requested format.
*
* @throws [java.lang.Exception
* if something fail during convertion.
*/
private static java.util.HashMap convertDetectServicePropsToExternal(java.util.HashMap aMap ,
int nFormat)
throws java.lang.Exception
{
java.util.HashMap aResultMap = null;
switch(nFormat)
{
//-----------------------------------
case FORMAT_60 :
{
// no changes!
aResultMap = aMap;
}
break;
//-----------------------------------
case FORMAT_6Y :
{
// remove localized name
aResultMap = aMap;
aResultMap.remove(PROPNAME_UINAME);
}
break;
//-----------------------------------
default :
throw new java.lang.Exception("unknown format");
}
return aResultMap;
}
private static java.util.HashMap convertFrameLoaderPropsToExternal(java.util.HashMap aMap ,
int nFormat)
throws java.lang.Exception
{
java.util.HashMap aResultMap = null;
switch(nFormat)
{
//-----------------------------------
case FORMAT_60 :
{
// no changes!
aResultMap = aMap;
}
break;
//-----------------------------------
case FORMAT_6Y :
{
// remove localized name
aResultMap = aMap;
aResultMap.remove(PROPNAME_UINAME);
}
break;
//-----------------------------------
default :
throw new java.lang.Exception("unknown format");
}
return aResultMap;
}
private static java.util.HashMap convertContentHandlerPropsToExternal(java.util.HashMap aMap ,
int nFormat)
throws java.lang.Exception
{
java.util.HashMap aResultMap = null;
switch(nFormat)
{
//-----------------------------------
case FORMAT_60 :
{
// no changes!
aResultMap = aMap;
}
break;
//-----------------------------------
case FORMAT_6Y :
{
// remove localized name
aResultMap = aMap;
aResultMap.remove(PROPNAME_UINAME);
}
break;
//-----------------------------------
default :
throw new java.lang.Exception("unknown format");
}
return aResultMap;
}
//___________________________________________
/** converts a type property set (using an external format) to
* our internal cache format.
*
* Especialy the data format string will be expanded
* to its real properties.
*
* Schema:
* aMap["UIName"] => aExpandedMap["UIName"]
* aMap["Data" ] => aExpandedMap["Preferred" ], aExpandedMap["MediaType"] etc. ...
*
* @param aMap
* points to the item, which should be converted.
* @param nFormat
* specify the external format.
*
* @return [java.util.HashMap]
* The new map in internal format.
*/
private static java.util.HashMap convertTypePropsToInternal(java.util.HashMap aMap ,
int nFormat)
throws java.lang.Exception
{
java.util.HashMap aResultMap = new java.util.HashMap();
// copy Name property ... if it exists!
if (aMap.containsKey(PROPNAME_NAME))
aResultMap.put(PROPNAME_NAME, aMap.get(PROPNAME_NAME));
switch(nFormat)
{
//-----------------------------------
case FORMAT_60 :
{
// copy UIName property unchanged!
aResultMap.put(PROPNAME_UINAME, aMap.get(PROPNAME_UINAME));
// generate new property "UIOrder"
// Its the moved property "Order" of filters for versions >= 6.y!
aResultMap.put(PROPNAME_UIORDER, new java.lang.Integer(0));
// generate new property "PreferredFilter"
// Its a the moved filter flag "Preferred" for versions >= 6.y!
aResultMap.put(PROPNAME_PREFERREDFILTER, new java.lang.String());
// generate new property "DetectService"
// Every type know its detector diretcly from now. No search
// will be neccessary any longer.
aResultMap.put(PROPNAME_DETECTSERVICE, new java.lang.String());
// analyze the Data property of the original map
// and copy its results (means all expanded properties)
// to the result map.
java.lang.String sDataVal = (java.lang.String)aMap.get(PROPNAME_DATA);
java.util.Vector lTokens = Cache.splitTokenString(sDataVal, ",");
int t = 0;
java.util.Enumeration it = lTokens.elements();
while (it.hasMoreElements())
{
java.lang.String sToken = (java.lang.String)it.nextElement();
switch(t)
{
case 0 :
aResultMap.put(PROPNAME_PREFERRED, new java.lang.Boolean(sToken));
break;
case 1 :
aResultMap.put(PROPNAME_MEDIATYPE, sToken);
break;
case 2 :
{
/*HACK ersetze %20 mit " " ...*/
int ni = sToken.indexOf("%20");
if (ni!=-1)
{
java.lang.String sPatch = sToken.substring(0,ni) + " " + sToken.substring(ni+3);
sToken = sPatch;
}
aResultMap.put(PROPNAME_CLIPBOARDFORMAT, sToken);
}
break;
case 3 :
aResultMap.put(PROPNAME_URLPATTERN, Cache.splitTokenString(sToken, ";"));
break;
case 4 :
aResultMap.put(PROPNAME_EXTENSIONS, Cache.splitTokenString(sToken, ";"));
break;
case 5 :
aResultMap.put(PROPNAME_DOCUMENTICONID, new java.lang.Integer(sToken));
break;
default :
throw new java.lang.Exception("unsupported format for data value of a type \""+aMap.get(PROPNAME_NAME)+"\" detected.");
}
++t;
}
}
break;
//-----------------------------------
case FORMAT_6Y :
{
// copy all supported properties directly
aResultMap.put(PROPNAME_PREFERRED , aMap.get(PROPNAME_PREFERRED ));
aResultMap.put(PROPNAME_MEDIATYPE , aMap.get(PROPNAME_MEDIATYPE ));
aResultMap.put(PROPNAME_CLIPBOARDFORMAT, aMap.get(PROPNAME_CLIPBOARDFORMAT));
aResultMap.put(PROPNAME_URLPATTERN , aMap.get(PROPNAME_URLPATTERN ));
aResultMap.put(PROPNAME_EXTENSIONS , aMap.get(PROPNAME_EXTENSIONS ));
aResultMap.put(PROPNAME_DOCUMENTICONID , aMap.get(PROPNAME_DOCUMENTICONID ));
aResultMap.put(PROPNAME_UINAME , aMap.get(PROPNAME_UINAME ));
aResultMap.put(PROPNAME_UIORDER , aMap.get(PROPNAME_UIORDER ));
aResultMap.put(PROPNAME_PREFERREDFILTER, aMap.get(PROPNAME_PREFERREDFILTER));
aResultMap.put(PROPNAME_DETECTSERVICE , aMap.get(PROPNAME_DETECTSERVICE ));
}
break;
//-----------------------------------
default :
throw new java.lang.Exception("unknown format");
}
return aResultMap;
}
//___________________________________________
/** converts a filter property set (using an external format) to
* our internal cache format.
*
* Especialy the data format string will be expanded
* to its real properties.
*
* Schema:
* aMap["UIName"] => aExpandedMap["UIName"]
* aMap["Data" ] => aExpandedMap["Order" ], aExpandedMap["Flags"] etc. ...
*
* @param aMap
* points to the item, which should be converted.
*
* @param nFormat
* specify the external format.
*
* @return [java.util.HashMap]
* The new map in internal format.
*/
private static java.util.HashMap convertFilterPropsToInternal(java.util.HashMap aMap ,
int nFormat)
throws java.lang.Exception
{
java.util.HashMap aResultMap = new java.util.HashMap();
// copy Name property ... if it exists!
if (aMap.containsKey(PROPNAME_NAME))
aResultMap.put(PROPNAME_NAME, aMap.get(PROPNAME_NAME));
switch(nFormat)
{
//-----------------------------------
case FORMAT_60 :
{
// copy UIName property
aResultMap.put(PROPNAME_UINAME, aMap.get(PROPNAME_UINAME));
// analyze the Data property of the original map
// and copy its results (means all expanded properties)
// to the result map.
java.lang.String sDataVal = (java.lang.String)aMap.get(PROPNAME_DATA);
java.util.Vector lTokens = Cache.splitTokenString(sDataVal, ",");
int t = 0;
java.util.Enumeration it = lTokens.elements();
while (it.hasMoreElements())
{
java.lang.String sToken = (java.lang.String)it.nextElement();
switch(t)
{
case 0 :
aResultMap.put(PROPNAME_ORDER, new java.lang.Integer(sToken));
break;
case 1 :
aResultMap.put(PROPNAME_TYPE, sToken);
break;
case 2 :
aResultMap.put(PROPNAME_DOCUMENTSERVICE, sToken);
break;
case 3 :
aResultMap.put(PROPNAME_FILTERSERVICE, sToken);
break;
case 4 :
aResultMap.put(PROPNAME_FLAGS, new java.lang.Integer(sToken));
break;
case 5 :
aResultMap.put(PROPNAME_USERDATA, Cache.splitTokenString(sToken, ";"));
break;
case 6 :
aResultMap.put(PROPNAME_FILEFORMATVERSION, new java.lang.Integer(sToken));
break;
case 7 :
aResultMap.put(PROPNAME_TEMPLATENAME, sToken);
break;
case 8 :
aResultMap.put(PROPNAME_UICOMPONENT, sToken);
break;
default :
throw new java.lang.Exception("unsupported format for data value of a filter detected.");
}
++t;
}
// its an optional property :-)
if (!aResultMap.containsKey(PROPNAME_TEMPLATENAME))
aResultMap.put(PROPNAME_TEMPLATENAME, new java.lang.String(""));
// its an optional property :-)
if (!aResultMap.containsKey(PROPNAME_UICOMPONENT))
aResultMap.put(PROPNAME_UICOMPONENT, new java.lang.String(""));
}
break;
//-----------------------------------
case FORMAT_6Y :
{
// "Order" does not exist for 6.y versions! Use default.
aResultMap.put(PROPNAME_ORDER, new java.lang.Integer(0));
// "UIName" property does not exist for 6.y versions! use default.
/* TODO make it configurable :-) */
aResultMap.put(PROPNAME_UINAME, aMap.get(PROPNAME_UINAME));
//aResultMap.put(PROPNAME_UINAME, new java.util.HashMap());
// "Flags" must be converted from names to its values
java.util.Vector lFlags = (java.util.Vector)aMap.get(PROPNAME_FLAGS);
java.lang.Integer nFlags = Cache.convertFilterFlagNames2Values(lFlags);
aResultMap.put(PROPNAME_FLAGS, nFlags);
// copy all direct supported properties
aResultMap.put(PROPNAME_TYPE , aMap.get(PROPNAME_TYPE ));
aResultMap.put(PROPNAME_DOCUMENTSERVICE , aMap.get(PROPNAME_DOCUMENTSERVICE ));
aResultMap.put(PROPNAME_FILTERSERVICE , aMap.get(PROPNAME_ORDER ));
aResultMap.put(PROPNAME_USERDATA , aMap.get(PROPNAME_USERDATA ));
aResultMap.put(PROPNAME_FILEFORMATVERSION, aMap.get(PROPNAME_FILEFORMATVERSION));
aResultMap.put(PROPNAME_TEMPLATENAME , aMap.get(PROPNAME_TEMPLATENAME ));
aResultMap.put(PROPNAME_UICOMPONENT , aMap.get(PROPNAME_UICOMPONENT ));
}
break;
//-----------------------------------
default :
throw new java.lang.Exception("unknown format");
}
return aResultMap;
}
private static java.util.HashMap convertDetectServicePropsToInternal(java.util.HashMap aMap ,
int nFormat)
throws java.lang.Exception
{
/*FIXME*/
java.util.HashMap aResultMap = aMap;
return aResultMap;
}
private static java.util.HashMap convertFrameLoaderPropsToInternal(java.util.HashMap aMap ,
int nFormat)
throws java.lang.Exception
{
/*FIXME*/
java.util.HashMap aResultMap = aMap;
return aResultMap;
}
private static java.util.HashMap convertContentHandlerPropsToInternal(java.util.HashMap aMap ,
int nFormat)
throws java.lang.Exception
{
/*FIXME*/
java.util.HashMap aResultMap = aMap;
return aResultMap;
}
//___________________________________________
/** converts filter flag names to its int representation.
*
* @param lFlags
* a list of flag names.
*
* @return [java.lang.Integer]
* an integer field of all set flags.
*
* @throws [java.lang.Exception]
* for unsupported flags or empty flag fields!
*/
private static java.lang.Integer convertFilterFlagNames2Values(java.util.Vector lFlags)
throws java.lang.Exception
{
int nFlags = 0;
java.util.Enumeration it = lFlags.elements();
while(it.hasMoreElements())
{
java.lang.String sFlagName = (java.lang.String)it.nextElement();
if (sFlagName.equals(FLAGNAME_3RDPARTYFILTER))
nFlags |= FLAGVAL_3RDPARTYFILTER;
else
if (sFlagName.equals(FLAGNAME_ALIEN))
nFlags |= FLAGVAL_ALIEN;
else
if (sFlagName.equals(FLAGNAME_ASYNCHRON))
nFlags |= FLAGVAL_ASYNCHRON;
else
if (sFlagName.equals(FLAGNAME_BROWSERPREFERRED))
nFlags |= FLAGVAL_BROWSERPREFERRED;
else
if (sFlagName.equals(FLAGNAME_CONSULTSERVICE))
nFlags |= FLAGVAL_CONSULTSERVICE;
else
if (sFlagName.equals(FLAGNAME_DEFAULT))
nFlags |= FLAGVAL_DEFAULT;
else
if (sFlagName.equals(FLAGNAME_EXPORT))
nFlags |= FLAGVAL_EXPORT;
else
if (sFlagName.equals(FLAGNAME_IMPORT))
nFlags |= FLAGVAL_IMPORT;
else
if (sFlagName.equals(FLAGNAME_INTERNAL))
nFlags |= FLAGVAL_INTERNAL;
else
if (sFlagName.equals(FLAGNAME_NOTINCHOOSER))
nFlags |= FLAGVAL_NOTINCHOOSER;
else
if (sFlagName.equals(FLAGNAME_NOTINFILEDIALOG))
nFlags |= FLAGVAL_NOTINFILEDIALOG;
else
if (sFlagName.equals(FLAGNAME_NOTINSTALLED))
nFlags |= FLAGVAL_NOTINSTALLED;
else
if (sFlagName.equals(FLAGNAME_OWN))
nFlags |= FLAGVAL_OWN;
else
if (sFlagName.equals(FLAGNAME_PACKED))
nFlags |= FLAGVAL_PACKED;
else
if (sFlagName.equals(FLAGNAME_PREFERRED))
nFlags |= FLAGVAL_PREFERRED;
else
if (sFlagName.equals(FLAGNAME_READONLY))
nFlags |= FLAGVAL_READONLY;
else
if (sFlagName.equals(FLAGNAME_TEMPLATE))
nFlags |= FLAGVAL_TEMPLATE;
else
if (sFlagName.equals(FLAGNAME_TEMPLATEPATH))
nFlags |= FLAGVAL_TEMPLATEPATH;
else
if (sFlagName.equals(FLAGNAME_USESOPTIONS))
nFlags |= FLAGVAL_USESOPTIONS;
else
if (sFlagName.equals(FLAGNAME_COMBINED))
nFlags |= FLAGVAL_COMBINED;
else
throw new java.lang.Exception("unsupported filter flag detected: \""+sFlagName+"\"");
}
if (nFlags == 0)
throw new java.lang.Exception("no filter flags?");
return new java.lang.Integer(nFlags);
}
//___________________________________________
/** converts filter flag values to its string representation.
*
* @param nFlags
* the flag field as int value.
*
* @return [java.util.Vector]
* a list of flag names.
*
* @throws [java.lang.Exception]
* for unsupported flags or empty flag fields!
*/
private static java.util.Vector convertFilterFlagValues2Names(java.lang.Integer nFlags)
throws java.lang.Exception
{
java.util.Vector lFlags = new java.util.Vector();
int field = nFlags.intValue();
if (field == 0)
throw new java.lang.Exception("no filter flags?");
if((field & FLAGVAL_IMPORT) == FLAGVAL_IMPORT)
lFlags.add(FLAGNAME_IMPORT);
if((field & FLAGVAL_EXPORT) == FLAGVAL_EXPORT)
lFlags.add(FLAGNAME_EXPORT);
if((field & FLAGVAL_TEMPLATE) == FLAGVAL_TEMPLATE)
lFlags.add(FLAGNAME_TEMPLATE);
if((field & FLAGVAL_INTERNAL) == FLAGVAL_INTERNAL)
lFlags.add(FLAGNAME_INTERNAL);
if((field & FLAGVAL_TEMPLATEPATH) == FLAGVAL_TEMPLATEPATH)
lFlags.add(FLAGNAME_TEMPLATEPATH);
if((field & FLAGVAL_OWN) == FLAGVAL_OWN)
lFlags.add(FLAGNAME_OWN);
if((field & FLAGVAL_ALIEN) == FLAGVAL_ALIEN)
lFlags.add(FLAGNAME_ALIEN);
if((field & FLAGVAL_USESOPTIONS) == FLAGVAL_USESOPTIONS)
lFlags.add(FLAGNAME_USESOPTIONS);
if((field & FLAGVAL_DEFAULT) == FLAGVAL_DEFAULT)
lFlags.add(FLAGNAME_DEFAULT);
if((field & FLAGVAL_NOTINFILEDIALOG) == FLAGVAL_NOTINFILEDIALOG)
lFlags.add(FLAGNAME_NOTINFILEDIALOG);
if((field & FLAGVAL_NOTINCHOOSER) == FLAGVAL_NOTINCHOOSER)
lFlags.add(FLAGNAME_NOTINCHOOSER);
if((field & FLAGVAL_ASYNCHRON) == FLAGVAL_ASYNCHRON)
lFlags.add(FLAGNAME_ASYNCHRON);
if((field & FLAGVAL_READONLY) == FLAGVAL_READONLY)
lFlags.add(FLAGNAME_READONLY);
if((field & FLAGVAL_NOTINSTALLED) == FLAGVAL_NOTINSTALLED)
lFlags.add(FLAGNAME_NOTINSTALLED);
if((field & FLAGVAL_CONSULTSERVICE) == FLAGVAL_CONSULTSERVICE)
lFlags.add(FLAGNAME_CONSULTSERVICE);
if((field & FLAGVAL_3RDPARTYFILTER) == FLAGVAL_3RDPARTYFILTER)
lFlags.add(FLAGNAME_3RDPARTYFILTER);
if((field & FLAGVAL_PACKED) == FLAGVAL_PACKED)
lFlags.add(FLAGNAME_PACKED);
if((field & FLAGVAL_BROWSERPREFERRED) == FLAGVAL_BROWSERPREFERRED)
lFlags.add(FLAGNAME_BROWSERPREFERRED);
if((field & FLAGVAL_PREFERRED) == FLAGVAL_PREFERRED)
lFlags.add(FLAGNAME_PREFERRED);
if((field & FLAGVAL_COMBINED) == FLAGVAL_COMBINED)
lFlags.add(FLAGNAME_COMBINED);
if((field & FLAGVAL_COMBINED) == FLAGVAL_SUPPORTSSELECTION)
lFlags.add(FLAGNAME_SUPPORTSSELECTION);
return lFlags;
}
//___________________________________________
/** return a reference to one of our member
* lists for types/filters etc ...
*
* @param eItemType
* specify, which item map is required.
*
* @return [java.util.HashMap]
* a reference(!) to the right member.
*
* @throws [java.lang.Exception]
* if the specified map does not exist.
*/
private java.util.HashMap getItemMap(int eItemType)
throws java.lang.Exception
{
java.util.HashMap rMap = null;
switch(eItemType)
{
case E_TYPE :
rMap = m_lTypes;
break;
case E_FILTER :
rMap = m_lFilters;
break;
case E_DETECTSERVICE :
rMap = m_lDetectServices;
break;
case E_FRAMELOADER :
rMap = m_lFrameLoaders;
break;
case E_CONTENTHANDLER :
rMap = m_lContentHandlers;
break;
default:
throw new java.lang.Exception("Invalid item map specified.");
}
return rMap;
}
//___________________________________________
/** return the count of items inside a sub container
* of this cache.
*
* @param eItemType
* specify, which item map is required.
*
* @throws [java.lang.Exception]
* if the specified map does not exist.
*/
public synchronized int getItemCount(int eItemType)
throws java.lang.Exception
{
java.util.HashMap rMap = getItemMap(eItemType);
return rMap.size();
}
//___________________________________________
/** get a list of all item names of the specified
* sub container.
*
* @param eItemType
* specify, which item map is required.
*
* @throws [java.lang.Exception]
* if the specified map does not exist.
*/
public synchronized java.util.Vector getItemNames(int eItemType)
throws java.lang.Exception
{
java.util.Vector lNames = new java.util.Vector();
java.util.HashMap rMap = getItemMap(eItemType);
java.util.Iterator it = rMap.keySet().iterator();
while(it.hasNext())
lNames.add(it.next());
return lNames;
}
//___________________________________________
/** get a list of all item names of the specified
* sub coontainer, where items match to given property set.
*
* Note: The given property set must exist at all
* returned items as minimum and every checked property
* value must be equals! Using of reg expressions or
* similar mechanism will not be supported here.
*
* @param eItemType
* specify, which item map is required.
*
* @param aPropSet
* the set of properties, which must
* exist at the returned item as minimum.
*
* @throws [java.lang.Exception]
* if the specified map does not exist.
*/
public synchronized java.util.Vector getMatchedItemNames(int eItemType,
java.util.HashMap aPropSet )
throws java.lang.Exception
{
java.util.Vector lNames = new java.util.Vector();
java.util.HashMap rMap = getItemMap(eItemType);
java.util.Iterator it = rMap.keySet().iterator();
while(it.hasNext())
{
java.lang.String sItemName = (java.lang.String)it.next();
java.util.HashMap rItemProps = (java.util.HashMap)rMap.get(sItemName);
boolean bMatch = Cache.matchPropSet(rItemProps, aPropSet);
if (bMatch)
lNames.add(sItemName);
else
{
java.lang.StringBuffer sBuffer = new java.lang.StringBuffer(1000);
sBuffer.append("entry ["+eItemType+"] \""+sItemName+"\" does not match.\n");
sBuffer.append("\torg items = {"+rItemProps+"}\n");
sBuffer.append("\treq items = {"+aPropSet+"}\n");
m_aDebug.setDetailedInfo(sBuffer.toString());
}
}
return lNames;
}
//___________________________________________
/** check if two property sets are equals in its
* shared properties.
*
* Note: Only set properties of the match set will be searched
* inside the original set. And its values must be equals.
* Using of reg expressions or similar mechanism will not
* be supported here.
*
* @param rOrgProps
* the original property set, which should be checked.
*
* @param rMatchProps
* contains the properties, which must be searched
* inside rOrgProps.
*
* @return TRUE if all properties of rMatchProps could be located
* inside rOrgProps.
*/
private static boolean matchPropSet(java.util.HashMap rOrgProps ,
java.util.HashMap rMatchProps)
{
java.util.Iterator it = rMatchProps.keySet().iterator();
while(it.hasNext())
{
java.lang.String sMatchName = (java.lang.String)it.next();
java.lang.Object aMatchValue = rMatchProps.get(sMatchName);
if (
(!rOrgProps.containsKey(sMatchName) ) ||
(!rOrgProps.get(sMatchName).equals(aMatchValue))
)
{
return false;
}
}
return true;
}
//___________________________________________
/** return a property set for the queried container item.
*
* @param eItemType
* specify, which item map is required.
*
* @param sItemName
* must be a valid item name of the specified item map.
*
* @return [java.util.HashMap]
* the property set of the queried item.
* Always different from null!
*
* @throws [java.lang.Exception]
* if the specified item does not exists or
* seems to be invalid in general (means null!).
*/
public synchronized java.util.HashMap getItem(int eItemType,
java.lang.String sItemName)
throws java.lang.Exception
{
java.util.HashMap rMap = getItemMap(eItemType);
java.util.HashMap rItem = (java.util.HashMap)rMap.get(sItemName);
if (rItem == null)
throw new java.lang.Exception("Queried item \""+sItemName+"\" does not exist inside this cache.");
return rItem;
}
//___________________________________________
/** return a requested item in XML format.
*
* @param eItemType
* identify the right sub set of this cache
* inside which the requested item should exist.
* e.g. E_TYPE, E_FILTER, ...
*
* @param sItemName
* the name of the request item
*
* @param nXMLFormat
* means the format of the generated xml source.
*
* @return [java.lang.String]
* a xml formated string, which contains all properties
* for this container item.
*/
public synchronized java.lang.String getItemAsXML(int eItemType ,
java.lang.String sItemName ,
int nXMLFormat)
throws java.lang.Exception
{
// Note: Our internal format must be converted to the target format!
java.util.HashMap rItem = getItem(eItemType, sItemName);
java.util.HashMap rFormatedItem = null;
switch(eItemType)
{
case E_TYPE :
{
rFormatedItem = Cache.convertTypePropsToExternal(rItem, nXMLFormat);
m_aDebug.setGlobalInfo("type to external \""+sItemName+"\"");
}
break;
case E_FILTER :
{
rFormatedItem = Cache.convertFilterPropsToExternal(rItem, nXMLFormat);
m_aDebug.setGlobalInfo("filter to external \""+sItemName+"\"");
}
break;
case E_DETECTSERVICE :
{
rFormatedItem = Cache.convertDetectServicePropsToExternal(rItem, nXMLFormat);
m_aDebug.setGlobalInfo("detect service to external \""+sItemName+"\"");
}
break;
case E_FRAMELOADER :
{
rFormatedItem = Cache.convertFrameLoaderPropsToExternal(rItem, nXMLFormat);
m_aDebug.setGlobalInfo("frame loader to external \""+sItemName+"\"");
}
break;
case E_CONTENTHANDLER :
{
rFormatedItem = Cache.convertContentHandlerPropsToExternal(rItem, nXMLFormat);
m_aDebug.setGlobalInfo("content handler to external \""+sItemName+"\"");
}
break;
}
java.lang.StringBuffer sXML = new java.lang.StringBuffer(1000);
int nPrettyTabs = 1;
for (int t=0; t<nPrettyTabs; ++t)
sXML.append("\t");
sXML.append("<"+XMLHelper.XMLTAG_NODE+" "+XMLHelper.XMLATTRIB_OOR_NAME+"=\""+XMLHelper.encodeHTMLSigns(sItemName)+"\" "+XMLHelper.XMLATTRIB_OOR_OP+"=\""+XMLHelper.XMLATTRIB_OP_REPLACE+"\">\n");
sXML.append(XMLHelper.convertPropSetToXML(rFormatedItem, nPrettyTabs+1));
for (int t=0; t<nPrettyTabs; ++t)
sXML.append("\t");
sXML.append("</"+XMLHelper.XMLTAG_NODE+">\n");
return sXML.toString();
}
//___________________________________________
/** split the given string (using the specified delimiter)
* and return alist of found string tokens.
*
* Note: Against the normal behaviour of the StringTokenizer class
* this method returns empty tokens too.
* E.g: "0,,1" will return "0" - "" - "1"
*
* @param sTokenString
* the string value, which should be analyzed.
*
* @param sDelim
* the delimiter, which will be used to differe between tokens.
*
* @return [java.util.Vector]
* a list of string tokens. Can be empty - but not null!
*/
private static java.util.Vector splitTokenString(java.lang.String sTokenString,
java.lang.String sDelim )
{
java.util.Vector lTokens = new java.util.Vector();
java.util.StringTokenizer aTokenizer = new java.util.StringTokenizer(sTokenString, sDelim, true);
boolean bLastWasDelim = false;
while (aTokenizer.hasMoreTokens())
{
java.lang.String sToken = aTokenizer.nextToken();
if (sToken.equals(sDelim))
{
if (bLastWasDelim)
{
// last token was a delimiter - new one too
// => an empty token must be placed between these
// two delimiters! Add this empty value to the return list.
lTokens.add("");
}
else
{
// last token was not a delimiter - new one is such delim
// => ignore this delimiter - but save the information, that
// it occurred
bLastWasDelim = true;
}
}
else
{
// new token is no delim
// => Add it to the return list.
lTokens.add(sToken);
// Dont forget to reset this information - so next loop
// will do the right things!
bLastWasDelim = false;
}
}
return lTokens;
}
//___________________________________________
/**
*/
public synchronized void analyze()
{
m_nDoubleRegisteredFilters = 0;
m_nTypesForFilters = 0;
m_nTypesForDetectServices = 0;
m_nTypesForFrameLoaders = 0;
m_nTypesForContentHandlers = 0;
// create table of types and all registered filters for such types
// By the way: count all double registrations, where a filter
// uses the same type then another filter.
m_lFilterToTypeRegistrations = new java.util.HashMap();
java.util.Iterator aIt1 = m_lFilters.keySet().iterator();
while (aIt1.hasNext())
{
java.lang.String sFilter = (java.lang.String)aIt1.next();
java.util.HashMap aFilter = (java.util.HashMap)m_lFilters.get(sFilter);
java.lang.String sType = (java.lang.String)aFilter.get(PROPNAME_TYPE);
java.util.Vector lFilters = (java.util.Vector)m_lFilterToTypeRegistrations.get(sType);
if (lFilters == null)
lFilters = new java.util.Vector();
else
++m_nDoubleRegisteredFilters;
lFilters.add(sFilter);
m_lFilterToTypeRegistrations.put(sType, lFilters);
}
// count, how many types are used by filters, frame loaders or content handlers
aIt1 = m_lTypes.keySet().iterator();
while (aIt1.hasNext())
{
java.lang.String sType = (java.lang.String)aIt1.next();
java.util.Iterator aIt2 = m_lFilters.keySet().iterator();
while (aIt2.hasNext())
{
java.lang.String sItem = (java.lang.String)aIt2.next();
java.util.HashMap aItem = (java.util.HashMap)m_lFilters.get(sItem);
java.lang.String sTypeReg = (java.lang.String)aItem.get(PROPNAME_TYPE);
if (sTypeReg.equals(sType))
{
++m_nTypesForFilters;
break;
}
}
aIt2 = m_lDetectServices.keySet().iterator();
while (aIt2.hasNext())
{
java.lang.String sItem = (java.lang.String)aIt2.next();
java.util.HashMap aItem = (java.util.HashMap)m_lDetectServices.get(sItem);
java.util.Vector lTypeReg = (java.util.Vector)aItem.get(PROPNAME_TYPES);
if (lTypeReg.contains(sType))
{
++m_nTypesForDetectServices;
break;
}
}
aIt2 = m_lFrameLoaders.keySet().iterator();
while (aIt2.hasNext())
{
java.lang.String sItem = (java.lang.String)aIt2.next();
java.util.HashMap aItem = (java.util.HashMap)m_lFrameLoaders.get(sItem);
java.util.Vector lTypeReg = (java.util.Vector)aItem.get(PROPNAME_TYPES);
if (lTypeReg.contains(sType))
{
++m_nTypesForFrameLoaders;
break;
}
}
aIt2 = m_lContentHandlers.keySet().iterator();
while (aIt2.hasNext())
{
java.lang.String sItem = (java.lang.String)aIt2.next();
java.util.HashMap aItem = (java.util.HashMap)m_lContentHandlers.get(sItem);
java.util.Vector lTypeReg = (java.util.Vector)aItem.get(PROPNAME_TYPES);
if (lTypeReg.contains(sType))
{
++m_nTypesForContentHandlers;
break;
}
}
}
}
//___________________________________________
/** validate all cache entries.
*
* It checks if all made registrations are valid;
* try to repair some simple problems;
* create missing informations on demand ...
*
* @param nFormat
* specify, which configuration format
* must be checked.
*
* @throws [java.lang.Exception]
* if an unrecoverable problem occure.
*/
public synchronized void validate(int nFormat)
throws java.lang.Exception
{
validateTypes(nFormat);
validateFilters(nFormat);
}
//___________________________________________
/** validate all type entries of this cache.
*
* @param nFormat
* specify, which configuration format
* must be checked.
*
* @throws [java.lang.Exception]
* if an unrecoverable problem occure.
*/
private void validateTypes(int nFormat)
throws java.lang.Exception
{
java.util.Iterator aIt1 = m_lTypes.keySet().iterator();
while(aIt1.hasNext())
{
java.lang.String sType = (java.lang.String)aIt1.next();
java.util.HashMap aType = (java.util.HashMap)m_lTypes.get(sType);
if (aType == null)
throw new java.lang.Exception("type ["+sType+"] dos not exist realy?!");
if (
(!aType.containsKey(PROPNAME_MEDIATYPE )) ||
(!aType.containsKey(PROPNAME_PREFERRED )) ||
(!aType.containsKey(PROPNAME_CLIPBOARDFORMAT)) ||
(!aType.containsKey(PROPNAME_DOCUMENTICONID )) ||
(!aType.containsKey(PROPNAME_URLPATTERN )) ||
(!aType.containsKey(PROPNAME_EXTENSIONS )) ||
(!aType.containsKey(PROPNAME_UINAME ))
)
{
throw new java.lang.Exception("Type \""+sType+"\" does not contain all neccessary properties for a 6.0/6.Y format.");
}
if (
(((java.util.Vector)aType.get(PROPNAME_EXTENSIONS)).isEmpty()) &&
(((java.util.Vector)aType.get(PROPNAME_URLPATTERN)).isEmpty())
)
{
throw new java.lang.Exception("Type \""+sType+"\" does not contain any extension nor an url pattern.");
}
if (((java.util.HashMap)aType.get(PROPNAME_UINAME)).isEmpty())
throw new java.lang.Exception("Type \""+sType+"\" is not localized.");
if (nFormat == FORMAT_6Y)
{
if (
(!aType.containsKey(PROPNAME_UIORDER )) ||
(!aType.containsKey(PROPNAME_PREFERREDFILTER)) ||
(!aType.containsKey(PROPNAME_DETECTSERVICE ))
)
{
throw new java.lang.Exception("Type \""+sType+"\" does not contain all neccessary properties for a 6.Y format.");
}
if (((java.lang.Integer)aType.get(PROPNAME_UIORDER)).intValue() < 0)
throw new java.lang.Exception("Type \""+sType+"\" has invalid value for prop UIOrder.");
if (((java.lang.String)aType.get(PROPNAME_DETECTSERVICE)).length() < 1)
m_aDebug.setWarning("Type \""+sType+"\" has no detect service registered.");
java.lang.String sPreferredReg = (java.lang.String)aType.get(PROPNAME_PREFERREDFILTER);
if (
(sPreferredReg == null) ||
(sPreferredReg.length() < 1 )
)
{
m_aDebug.setWarning("Type \""+sType+"\" has no preferred filter ...");
/*FIXME
* OK - not every type has a filter registered .. but the
* a frame loader MUST(!) exist! Check it.
*/
}
else
{
if (!m_lFilters.containsKey(sPreferredReg))
throw new java.lang.Exception("Type \""+sType+"\" has no valid preferred filter registration [\""+sPreferredReg+"\"].");
}
}
}
}
//___________________________________________
/** validate all filter entries of this cache.
*
* @param nFormat
* specify, which configuration format
* must be checked.
*
* @throws [java.lang.Exception]
* if an unrecoverable problem occure.
*/
public synchronized void validateFilters(int nFormat)
throws java.lang.Exception
{
java.util.Iterator aIt1 = m_lFilters.keySet().iterator();
while(aIt1.hasNext())
{
java.lang.String sFilter = (java.lang.String)aIt1.next();
java.util.HashMap aFilter = (java.util.HashMap)m_lFilters.get(sFilter);
if (aFilter == null)
throw new java.lang.Exception("filter ["+sFilter+"] dos not exist realy?!");
if (
(!aFilter.containsKey(PROPNAME_DOCUMENTSERVICE )) ||
(!aFilter.containsKey(PROPNAME_FILEFORMATVERSION)) ||
(!aFilter.containsKey(PROPNAME_FILTERSERVICE )) ||
(!aFilter.containsKey(PROPNAME_FLAGS )) ||
(!aFilter.containsKey(PROPNAME_TEMPLATENAME )) ||
(!aFilter.containsKey(PROPNAME_TYPE )) ||
(!aFilter.containsKey(PROPNAME_UICOMPONENT )) ||
(!aFilter.containsKey(PROPNAME_USERDATA ))
)
{
throw new java.lang.Exception("Filter \""+sFilter+"\" does not contain all neccessary properties for a 6.0/6.Y format.");
}
if (((java.lang.Integer)aFilter.get(PROPNAME_FLAGS)).intValue() < 1)
throw new java.lang.Exception("Filter \""+sFilter+"\" does not have a valid flag field.");
if (!m_lTypes.containsKey(aFilter.get(PROPNAME_TYPE)))
throw new java.lang.Exception("Filter \""+sFilter+"\" is not registered for a well known type.");
if (nFormat == FORMAT_60)
{
if (
(!aFilter.containsKey(PROPNAME_ORDER )) ||
(!aFilter.containsKey(PROPNAME_UINAME))
)
{
throw new java.lang.Exception("Filter \""+sFilter+"\" does not contain all neccessary properties for a 6.0 format.");
}
if (((java.lang.Integer)aFilter.get(PROPNAME_ORDER)).intValue() < 0)
throw new java.lang.Exception("Filter \""+sFilter+"\" does not have a valid Order value.");
if (((java.util.HashMap)aFilter.get(PROPNAME_UINAME)).isEmpty())
throw new java.lang.Exception("Filter \""+sFilter+"\" is not localized.");
}
/*TODO
depends from the configuration item "remove_filter_flag_preferred" ...
if (nFormat == FORMAT_6Y)
{
int flags = ((java.lang.Integer)aFilter.get(PROPNAME_FLAGS)).intValue();
if ((flags & FLAGVAL_PREFERRED) == FLAGVAL_PREFERRED)
throw new java.lang.Exception("Filter \""+sFilter+"\" has superflous Preferred flag set. Please remove this flag. ["+flags+"]");
}
*/
}
}
/*TODO
* - remove graphic filters!
* - move detect services to types
*/
public synchronized void transform60to6Y(boolean bCreateCombineFilterFlag ,
boolean bRemoveFilterFlagBrowserPreferred,
boolean bRemoveFilterFlagPreferred ,
boolean bRemoveFilterFlag3rdparty ,
boolean bRemoveFilterUINames ,
boolean bRemoveGraphicFilters ,
boolean bSetDefaultDetector )
throws java.lang.Exception
{
// remove some superflous cache entries ...
// everything related to "load macros"
// Macros should be dispatched instead of loaded!
if (m_lTypes.containsKey("macro"))
{
m_lTypes.remove("macro");
m_aDebug.setDetailedInfo("superflous type \"macro\" was removed");
}
if (m_lFrameLoaders.containsKey("com.sun.star.comp.sfx2.SfxMacroLoader"))
{
m_lFrameLoaders.remove("com.sun.star.comp.sfx2.SfxMacroLoader");
m_aDebug.setDetailedInfo("superflous frame loader \"com.sun.star.comp.sfx2.SfxMacroLoader\" was removed");
}
// step over all filters and check her properties and references
java.util.Vector lPreferredFilters = new java.util.Vector();
java.util.Vector lNoRealFilters = new java.util.Vector();
java.util.Iterator aIt1 = m_lFilters.keySet().iterator();
while(aIt1.hasNext())
{
java.lang.String sFilter = (java.lang.String)aIt1.next();
java.util.HashMap aFilter = (java.util.HashMap)m_lFilters.get(sFilter);
// remove the "graphic helper filters" used by draw and impress
// They dont have any valid document service name set and cant be handled
// by our generic FrameLoader!
// They must be moved to her own configuration ...
if (
(bRemoveGraphicFilters ) &&
(((java.lang.String)aFilter.get(PROPNAME_DOCUMENTSERVICE)).length() < 1)
)
{
lNoRealFilters.add(sFilter);
continue;
}
java.lang.String sTypeReg = (java.lang.String)aFilter.get(PROPNAME_TYPE);
java.util.HashMap aType = (java.util.HashMap)m_lTypes.get(sTypeReg);
// move UINames of filters to types
java.util.HashMap lFilterUINames = (java.util.HashMap)aFilter.get(PROPNAME_UINAME);
java.util.HashMap lTypeUINames = (java.util.HashMap)aType.get(PROPNAME_UINAME);
java.util.HashMap lPatchUINames = new java.util.HashMap();
java.util.Iterator pUINames = lTypeUINames.keySet().iterator();
while(pUINames.hasNext())
{
java.lang.String sLocale = (java.lang.String)pUINames.next();
java.lang.String sValue = (java.lang.String)lTypeUINames.get(sLocale);
lPatchUINames.put(sLocale, sValue);
}
pUINames = lFilterUINames.keySet().iterator();
while(pUINames.hasNext())
{
java.lang.String sLocale = (java.lang.String)pUINames.next();
java.lang.String sValue = (java.lang.String)lFilterUINames.get(sLocale);
lPatchUINames.put(sFilter+":"+sLocale, sValue);
}
aType.put(PROPNAME_UINAME, lPatchUINames);
// set generic filter service wrapper for our own native filters!
// By the way: The format types of such filters can be detected by our
// generic detector too.
if (
(bSetDefaultDetector ) &&
(((java.lang.String)aFilter.get(PROPNAME_FILTERSERVICE)).length() < 1)
)
{
/*ME_THINKING aFilter.put(PROPNAME_FILTERSERVICE, FILTERSERVICE_NATIVEWARPPER);*/
aType.put(PROPNAME_DETECTSERVICE, GENERIC_DETECTSERVICE);
}
// move the preferred filter information to any type
// Set the filter name to the type for which the filter is registered.
// If this type already have a set PreferredFilter value, check if the current filter
// has the preferred flag set. If not ignore it - otherwhise overwrite the
// current information at the type. But look for multiple preferred filter relations ...
// means: look if more the one filter has set the preferred flag for the same type!
/* Attention!
*
* Dont remove the preferred flag from any filter! ... not here.
* Otherwhise next loop can't detect ambigous preferred registrations!
* Add filter to a temp. list, which can be used later to remove the preferred
* flag ...
*/
int flags1 = ((java.lang.Integer)aFilter.get(PROPNAME_FLAGS)).intValue();
java.lang.String sDocSrv = (java.lang.String)aFilter.get(PROPNAME_DOCUMENTSERVICE);
if (sDocSrv.length()>0)// without a doc service its not a real filter - its a graphic filter!
{
boolean preferred1 = ((flags1 & FLAGVAL_PREFERRED) == FLAGVAL_PREFERRED);
if (preferred1)
lPreferredFilters.add(aFilter);
java.lang.String sAlreadyRegisteredFilter = (java.lang.String)aType.get(PROPNAME_PREFERREDFILTER);
// no registration => set this filter as "any possible one"!
if (sAlreadyRegisteredFilter.length() < 1)
aType.put(PROPNAME_PREFERREDFILTER, sFilter);
else
{
java.util.HashMap aAlreadyRegisteredFilter = (java.util.HashMap)m_lFilters.get(sAlreadyRegisteredFilter);
int flags2 = ((java.lang.Integer)aAlreadyRegisteredFilter.get(PROPNAME_FLAGS)).intValue();
boolean preferred2 = ((flags2 & FLAGVAL_PREFERRED) == FLAGVAL_PREFERRED);
// two preferred filters for the same type! => error
if (preferred1 && preferred2)
{
java.lang.StringBuffer sMsg = new java.lang.StringBuffer(256);
sMsg.append("More the one preferred filter detected for the same type.\n");
sMsg.append("\ttype = \""+sTypeReg+"\"\n");
sMsg.append("\tfilter[1] = \""+sAlreadyRegisteredFilter+"\"\n");
sMsg.append("\tfilter[2] = \""+sFilter+"\"\n");
throw new java.lang.Exception(sMsg.toString());
}
else
// overwrite the "any possible" filter with a real preferred one
if (preferred1 && !preferred2)
aType.put(PROPNAME_PREFERREDFILTER, sFilter);
}
}
// create the new combined filter flag if required
if (bCreateCombineFilterFlag)
{
if (
((flags1 & FLAGVAL_IMPORT) == FLAGVAL_IMPORT) &&
((flags1 & FLAGVAL_EXPORT) == FLAGVAL_EXPORT)
)
{
flags1 |= FLAGVAL_COMBINED;
flags1 &= ~FLAGVAL_IMPORT ;
flags1 &= ~FLAGVAL_EXPORT ;
aFilter.put(PROPNAME_FLAGS, new java.lang.Integer(flags1));
}
}
// remove some obsolete filter flags
if (bRemoveFilterFlagBrowserPreferred)
{
flags1 &= ~FLAGVAL_BROWSERPREFERRED;
aFilter.put(PROPNAME_FLAGS, new java.lang.Integer(flags1));
}
if (bRemoveFilterFlag3rdparty)
{
flags1 &= ~FLAGVAL_3RDPARTYFILTER;
aFilter.put(PROPNAME_FLAGS, new java.lang.Integer(flags1));
}
// if its a filter with an UI order ...
// move this information to the registered type.
// Note: Because more then one filter can be registered for the same type.
// Handle it as an error ... till we find a better transformation!
java.lang.Integer nOrder = (java.lang.Integer)aFilter.get(PROPNAME_ORDER);
java.lang.Integer nUIOrder = (java.lang.Integer)aType.get(PROPNAME_UIORDER);
int order = nOrder.intValue();
int uiorder = nUIOrder.intValue();
if (order > 0)
{
if (
(uiorder < 1 ) ||
(uiorder > order)
)
{
aType.put(PROPNAME_UIORDER, nOrder);
m_aDebug.setDetailedInfo("moved order value "+nOrder+" from filter \""+sFilter+"\" to type \""+sTypeReg+"\"");
}
else
m_aDebug.setDetailedInfo("ignore order value [order="+nOrder+",uiorder="+nUIOrder+"] for filter \""+sFilter+"\" and type \""+sTypeReg+"\"");
}
}
// NOW ... remove the preferred flags from every filter, which it has set.
java.util.Enumeration aIt2 = null;
if (bRemoveFilterFlagPreferred)
{
aIt2 = lPreferredFilters.elements();
while (aIt2.hasMoreElements())
{
java.util.HashMap aFilter = (java.util.HashMap)aIt2.nextElement();
int flags = ((java.lang.Integer)aFilter.get(PROPNAME_FLAGS)).intValue();
flags &= ~FLAGVAL_PREFERRED;
aFilter.put(PROPNAME_FLAGS, new java.lang.Integer(flags));
}
}
// NOW ... remove all "no real filters" like the graphich helper filters of
// draw and impress!
aIt2 = lNoRealFilters.elements();
while (aIt2.hasMoreElements())
m_lFilters.remove(aIt2.nextElement());
// step over all detect services and move this information directly to
// the corresponding types
// Overwrite possibel default registrations with a real existing one!
aIt1 = m_lDetectServices.keySet().iterator();
while(aIt1.hasNext())
{
java.lang.String sDetector = (java.lang.String)aIt1.next();
java.util.HashMap aDetector = (java.util.HashMap)m_lDetectServices.get(sDetector);
java.util.Vector lTypeReg = (java.util.Vector)aDetector.get(PROPNAME_TYPES);
aIt2 = lTypeReg.elements();
while(aIt2.hasMoreElements())
{
java.lang.String sTypeReg = (java.lang.String)aIt2.nextElement();
java.util.HashMap aType = (java.util.HashMap)m_lTypes.get(sTypeReg);
if (aType == null)
{
m_aDebug.setWarning("Detector \""+sDetector+"\" seem to be registered for unknown type \""+sTypeReg+"\"");
continue;
}
java.lang.Object aAlreadyRegisteredDetector = aType.get(PROPNAME_DETECTSERVICE);
if (aAlreadyRegisteredDetector != null && ((java.lang.String)aAlreadyRegisteredDetector).length() > 0)
{
java.lang.StringBuffer sMsg = new java.lang.StringBuffer(256);
sMsg.append("type \""+sTypeReg+"\" has ambigous registrations of a detect service\n");
sMsg.append("\tdetect service[1] = \""+(java.lang.String)aAlreadyRegisteredDetector+"\"\n");
sMsg.append("\tdetect service[2] = \""+sDetector+"\"\n");
m_aDebug.setWarning(sMsg.toString());
}
aType.put(PROPNAME_DETECTSERVICE, sDetector);
m_aDebug.setGlobalInfo("move detector \""+sDetector+"\" to type \""+sTypeReg+"\"");
}
}
// because all detect service was registered as type properties directly ...
// remove all detect service objects of this cache!
m_lDetectServices.clear();
// step over all frame loader and move this information directly to
// the corresponding types
// Overwrite possibel default registrations with a real existing one!
aIt1 = m_lFrameLoaders.keySet().iterator();
while(aIt1.hasNext())
{
java.lang.String sLoader = (java.lang.String)aIt1.next();
java.util.HashMap aLoader = (java.util.HashMap)m_lFrameLoaders.get(sLoader);
java.util.Vector lTypeReg = (java.util.Vector)aLoader.get(PROPNAME_TYPES);
aIt2 = lTypeReg.elements();
while(aIt2.hasMoreElements())
{
java.lang.String sTypeReg = (java.lang.String)aIt2.nextElement();
java.util.HashMap aType = (java.util.HashMap)m_lTypes.get(sTypeReg);
java.lang.String sAlreadyRegisteredLoader = (java.lang.String)aType.get(PROPNAME_FRAMELOADER);
if (sAlreadyRegisteredLoader != null && sAlreadyRegisteredLoader.length() > 0)
{
java.lang.StringBuffer sMsg = new java.lang.StringBuffer(256);
sMsg.append("type \""+sTypeReg+"\" has ambigous registrations of a frame loader\n");
sMsg.append("\tframe loader[1] = \""+sAlreadyRegisteredLoader+"\"\n");
sMsg.append("\tframe loader[2] = \""+sLoader+"\"\n");
m_aDebug.setWarning(sMsg.toString());
}
aType.put(PROPNAME_FRAMELOADER, sLoader);
System.out.println("move loader \""+sLoader+"\" to type \""+sTypeReg+"\"");
}
}
m_lFrameLoaders.clear();
// step over all content handler and move this information directly to
// the corresponding types
// Overwrite possibel default registrations with a real existing one!
aIt1 = m_lContentHandlers.keySet().iterator();
while(aIt1.hasNext())
{
java.lang.String sHandler = (java.lang.String)aIt1.next();
java.util.HashMap aHandler = (java.util.HashMap)m_lContentHandlers.get(sHandler);
java.util.Vector lTypeReg = (java.util.Vector)aHandler.get(PROPNAME_TYPES);
aIt2 = lTypeReg.elements();
while(aIt2.hasMoreElements())
{
java.lang.String sTypeReg = (java.lang.String)aIt2.nextElement();
java.util.HashMap aType = (java.util.HashMap)m_lTypes.get(sTypeReg);
java.lang.String sAlreadyRegisteredHandler = (java.lang.String)aType.get(PROPNAME_CONTENTHANDLER);
if (sAlreadyRegisteredHandler != null && sAlreadyRegisteredHandler.length() > 0)
{
java.lang.StringBuffer sMsg = new java.lang.StringBuffer(256);
sMsg.append("type \""+sTypeReg+"\" has ambigous registrations of a content handler\n");
sMsg.append("\tcontent handler[1] = \""+sAlreadyRegisteredHandler+"\"\n");
sMsg.append("\tcontent handler[2] = \""+sHandler+"\"\n");
m_aDebug.setWarning(sMsg.toString());
}
aType.put(PROPNAME_CONTENTHANDLER, sHandler);
System.out.println("move handler \""+sHandler+"\" to type \""+sTypeReg+"\"");
}
}
m_lContentHandlers.clear();
/*
int c = m_lTypes.size();
java.lang.String[] lT1 = new java.lang.String[c];
java.lang.String[] lT2 = new java.lang.String[c];
long nUPS = 0;
int i = 0;
aIt1 = m_lTypes.keySet().iterator();
while(aIt1.hasNext())
{
lT1[i] = (java.lang.String)aIt1.next();
lT2[i] = lT1[i];
++i;
}
for (int i1=0; i1<c; ++i1)
{
java.lang.String sT1 = lT1[i1];
java.util.HashMap aT1 = (java.util.HashMap)m_lTypes.get(sT1);
for (int i2=i1; i2<c; ++i2)
{
java.lang.String sT2 = lT1[i2];
java.util.HashMap aT2 = (java.util.HashMap)m_lTypes.get(sT2);
if (!sT1.equals(sT2))
{
if (
aT1.get(PROPNAME_MEDIATYPE).equals(aT2.get(PROPNAME_MEDIATYPE)) &&
aT1.get(PROPNAME_CLIPBOARDFORMAT).equals(aT2.get(PROPNAME_CLIPBOARDFORMAT)) &&
aT1.get(PROPNAME_URLPATTERN).equals(aT2.get(PROPNAME_URLPATTERN)) &&
aT1.get(PROPNAME_EXTENSIONS).equals(aT2.get(PROPNAME_EXTENSIONS))
)
{
System.err.println("UUPPSS----------------------------------------------------------------------------");
System.err.println("[1]\""+sT1+"\" equals [2]\""+sT2+"\"");
System.err.println("\tprops 1: "+aT1);
System.err.println("\tprops 2: "+aT2);
System.err.println("----------------------------------------------------------------------------------\n");
++nUPS;
// throw new java.lang.Exception("UUPPS :-)");
}
}
}
}
System.err.println("count of UPS = "+nUPS);
*/
}
}
|