cfg.diff
src/com/goldencode/p2j/cfg/Configuration.java 2020-06-17 15:47:16 +0000 | ||
---|---|---|
2 | 2 |
** Module : Configuration.java |
3 | 3 |
** Abstract : Master configuration object |
4 | 4 |
** |
5 |
** Copyright (c) 2004-2019, Golden Code Development Corporation.
|
|
5 |
** Copyright (c) 2004-2020, Golden Code Development Corporation.
|
|
6 | 6 |
** |
7 | 7 |
** -#- -I- --Date-- --JPRM-- ----------------------------Description----------------------------- |
8 | 8 |
** 001 ECF 20041217 @19157 Created initial version. |
... | ... | |
59 | 59 |
** 021 ECF 20190619 Added configuration for include file reference prefix remapping. |
60 | 60 |
** GES 20190621 Fixed include file prefix processing to allow projects that don't |
61 | 61 |
** have it configured (previous version caused an NPE in every parse). |
62 |
** 022 IAS 20200617 No fatal error if p2j.cfg.xml is not found. |
|
62 | 63 |
*/ |
63 | 64 | |
64 | 65 |
/* |
... | ... | |
118 | 119 | |
119 | 120 |
import java.io.*; |
120 | 121 |
import java.util.*; |
122 | ||
121 | 123 |
import javax.xml.parsers.*; |
124 | ||
122 | 125 |
import org.xml.sax.*; |
123 |
import com.goldencode.util.*; |
|
126 | ||
124 | 127 |
import com.goldencode.p2j.schema.*; |
125 | 128 |
import com.goldencode.p2j.schema.SchemaConfig.*; |
126 | 129 |
import com.goldencode.p2j.schema.SchemaConfig.NsConfig.*; |
130 |
import com.goldencode.util.*; |
|
127 | 131 | |
128 | 132 |
/** |
129 | 133 |
* Master configuration object which loads subsystem configurations. The |
... | ... | |
363 | 367 |
*/ |
364 | 368 |
public static SchemaConfig getSchemaConfig() |
365 | 369 |
{ |
366 |
return (SchemaConfig) getInstance().saxHandler.getGlobalObjects(TAG_SCHEMA).get(0); |
|
370 |
Configuration cfg = getInstance(); |
|
371 |
return cfg.saxHandler == null ? new SchemaConfig() : |
|
372 |
(SchemaConfig) cfg.saxHandler.getGlobalObjects(TAG_SCHEMA).get(0); |
|
367 | 373 |
} |
368 | 374 | |
369 | 375 |
/** |
... | ... | |
773 | 779 |
|
774 | 780 |
if (cfgStream == null) |
775 | 781 |
{ |
776 |
throw new ConfigurationException("Cannot find resource " + path);
|
|
782 |
return config;
|
|
777 | 783 |
} |
778 | 784 |
} |
779 | 785 |
else |
... | ... | |
805 | 811 |
} |
806 | 812 |
catch (Exception exc) |
807 | 813 |
{ |
808 |
throw new RuntimeException(new ConfigurationException( |
|
809 |
"Error loading " + DEF_CFG_FILE + " configuration", exc)); |
|
814 |
// Do nothing |
|
810 | 815 |
} |
811 | 816 |
return config; |
812 | 817 |
} |
src/com/goldencode/p2j/persist/meta/MetadataManager.java 2020-06-17 15:06:49 +0000 | ||
---|---|---|
17 | 17 |
** 009 OM 20181207 Populated DatabaseFeature metadata table. |
18 | 18 |
** 010 IAS 20200518 Populating _File, _Field, _Index, and _Index-Field metadata tables. |
19 | 19 |
** 011 IAS 20200604 Added support for *-SA and CAN-* fields in _File/_Field tables. |
20 |
** 012 IAS 20200617 No fatal error if p2j.cfg.xml is not found; mandatory meta tables support |
|
20 | 21 |
*/ |
21 | 22 |
/* |
22 | 23 |
** This program is free software: you can redistribute it and/or modify |
... | ... | |
84 | 85 |
import java.util.logging.*; |
85 | 86 |
import java.util.stream.*; |
86 | 87 | |
87 |
import org.aspectj.org.eclipse.jdt.internal.formatter.linewrap.*; |
|
88 |
import org.aspectj.weaver.ast.*; |
|
89 |
import org.hibernate.bytecode.instrumentation.internal.javassist.*; |
|
90 | 88 |
import org.hibernate.dialect.*; |
91 | 89 |
import org.w3c.dom.*; |
92 | 90 | |
... | ... | |
216 | 214 |
String basePkg = DMOIndex.getBasePackage(); |
217 | 215 |
baseDir = basePkg.replaceAll("\\.", "/"); |
218 | 216 | |
219 |
Set<String> legacyTables = Configuration.getSchemaConfig().getMetadata().getTables(); |
|
217 |
Set<String> legacyTables = SystemTable.mandatoryTables(); |
|
218 |
legacyTables.addAll(Configuration.getSchemaConfig().getMetadata().getTables()); |
|
220 | 219 |
for (String aTable : legacyTables) |
221 | 220 |
{ |
222 | 221 |
SystemTable systemTable = SystemTable.forName(aTable); |
... | ... | |
408 | 407 |
public static void populateDatabase(Database metaDb, String schema) |
409 | 408 |
throws PersistenceException |
410 | 409 |
{ |
410 |
if (!Configuration.getSchemaConfig().isMetadataActive()) |
|
411 |
{ |
|
412 |
if (log.isLoggable(Level.INFO)) |
|
413 |
{ |
|
414 |
log.log(Level.INFO, "Metadata server was not started; no metadata in use"); |
|
415 |
} |
|
416 |
return; |
|
417 |
} |
|
411 | 418 |
SchemaConfig.Metadata metadata = com.goldencode.p2j.cfg.Configuration. |
412 | 419 |
getSchemaConfig().getMetadata(); |
413 | 420 |
String path = String.format("%s/%s/%s.meta.xml", baseDir, schema, schema); |
... | ... | |
1337 | 1344 |
/** */ |
1338 | 1345 |
_Code_Feature(-16428, "_Code-Feature", Category.VST), |
1339 | 1346 |
/** */ |
1340 |
_Database_Feature(-16427, "_Database-Feature", Category.VST, |
|
1347 |
_Database_Feature(-16427, "_Database-Feature", Category.VST, MANDATORY,
|
|
1341 | 1348 |
MetadataManager::populateDatabaseFeatures), |
1342 | 1349 |
/** Provides detailed information about an OpenEdge Replication agent. */ |
1343 | 1350 |
_Repl_Agent(-16426, "_Repl-Agent", Category.VST), |
... | ... | |
1351 | 1358 |
/** */ |
1352 | 1359 |
_AreaStatus(-16423, "_AreaStatus", Category.VST), |
1353 | 1360 |
/** */ |
1354 |
_MyConnection(-16422, "_MyConnection", Category.VST), |
|
1361 |
_MyConnection(-16422, "_MyConnection", Category.VST , MANDATORY),
|
|
1355 | 1362 |
/** */ |
1356 | 1363 |
_UserStatus(-16421, "_UserStatus", Category.VST), |
1357 | 1364 |
/** */ |
... | ... | |
1409 | 1416 |
/** */ |
1410 | 1417 |
_UserLock(-16394, "_UserLock", Category.VST), |
1411 | 1418 |
/** */ |
1412 |
_Filelist(-16393, "_Filelist", Category.VST), |
|
1419 |
_Filelist(-16393, "_Filelist", Category.VST, MANDATORY),
|
|
1413 | 1420 |
/** */ |
1414 |
_Startup(-16392, "_Startup", Category.VST), |
|
1421 |
_Startup(-16392, "_Startup", Category.VST, MANDATORY),
|
|
1415 | 1422 |
/** */ |
1416 | 1423 |
_Servers(-16391, "_Servers", Category.VST), |
1417 | 1424 |
/** */ |
... | ... | |
1425 | 1432 |
/** */ |
1426 | 1433 |
_MstrBlk(-16386, "_MstrBlk", Category.VST), |
1427 | 1434 |
/** */ |
1428 |
_Connect(-16385, "_Connect", Category.VST), |
|
1435 |
_Connect(-16385, "_Connect", Category.VST, MANDATORY),
|
|
1429 | 1436 |
/** */ |
1430 | 1437 |
_Constraint_Keys(-361, "_Constraint-Keys", Category.DS_SCHEMA), |
1431 | 1438 |
/** */ |
... | ... | |
1545 | 1552 |
/** */ |
1546 | 1553 |
_AreaExtent(-72, "_AreaExtent", Category.PHY_ST), |
1547 | 1554 |
/** */ |
1548 |
_Area(-71, "_Area", Category.PHY_ST), |
|
1555 |
_Area(-71, "_Area", Category.PHY_ST, MANDATORY),
|
|
1549 | 1556 |
/** */ |
1550 | 1557 |
_StorageObject(-70, "_StorageObject", Category.PHY_ST), |
1551 | 1558 |
/** */ |
... | ... | |
1553 | 1560 |
/** */ |
1554 | 1561 |
_Codepage(-68, "_Codepage", Category.SCHEMA), |
1555 | 1562 |
/** */ |
1556 |
_Sequence(-67, "_Sequence", Category.SCHEMA), |
|
1557 |
/** */ |
|
1558 |
_Field_Trig(-66, "_Field-Trig", Category.SCHEMA), |
|
1559 |
/** */ |
|
1560 |
_File_Trig(-65, "_File-Trig", Category.SCHEMA), |
|
1563 |
_Sequence(-67, "_Sequence", Category.SCHEMA, MANDATORY),
|
|
1564 |
/** */ |
|
1565 |
_Field_Trig(-66, "_Field-Trig", Category.SCHEMA, MANDATORY),
|
|
1566 |
/** */ |
|
1567 |
_File_Trig(-65, "_File-Trig", Category.SCHEMA, MANDATORY),
|
|
1561 | 1568 |
/** */ |
1562 | 1569 |
_View_Ref(-32, "_View-Ref", Category.SQL89), |
1563 | 1570 |
/** */ |
... | ... | |
1565 | 1572 |
/** */ |
1566 | 1573 |
_View(-30, "_View", Category.SQL89), |
1567 | 1574 |
/** */ |
1568 |
_Db(-6, "_Db", Category.SCHEMA), |
|
1569 |
/** */ |
|
1570 |
_User(-5, "_User", Category.AUTH, REGULAR), |
|
1571 |
/** */ |
|
1572 |
_Index_Field(-4, "_Index-Field", Category.SCHEMA, IGNORE_META_XML), |
|
1573 |
/** */ |
|
1574 |
_Index(-3, "_Index", Category.SCHEMA, IGNORE_META_XML), |
|
1575 |
/** */ |
|
1576 |
_Field(-2, "_Field", Category.SCHEMA, IGNORE_META_XML), |
|
1577 |
/** */ |
|
1578 |
_File(-1, "_File", Category.SCHEMA, IGNORE_META_XML, MetadataManager::populateFileTable); |
|
1575 |
_Db(-6, "_Db", Category.SCHEMA, MANDATORY),
|
|
1576 |
/** */ |
|
1577 |
_User(-5, "_User", Category.AUTH, REGULAR | MANDATORY),
|
|
1578 |
/** */ |
|
1579 |
_Index_Field(-4, "_Index-Field", Category.SCHEMA, IGNORE_META_XML | MANDATORY),
|
|
1580 |
/** */ |
|
1581 |
_Index(-3, "_Index", Category.SCHEMA, IGNORE_META_XML | MANDATORY),
|
|
1582 |
/** */ |
|
1583 |
_Field(-2, "_Field", Category.SCHEMA, IGNORE_META_XML | MANDATORY),
|
|
1584 |
/** */ |
|
1585 |
_File(-1, "_File", Category.SCHEMA, IGNORE_META_XML | MANDATORY, MetadataManager::populateFileTable);
|
|
1579 | 1586 | |
1580 | 1587 |
/** Table id */ |
1581 | 1588 |
public final int _file_num; |
... | ... | |
1875 | 1882 |
build(); |
1876 | 1883 |
} |
1877 | 1884 |
} |
1878 |
} |
|
1885 |
} |
src/com/goldencode/p2j/schema/SchemaConfig.java 2020-06-17 15:03:59 +0000 | ||
---|---|---|
2 | 2 |
** Module : SchemaConfig.java |
3 | 3 |
** Abstract : Schema configuration information |
4 | 4 |
** |
5 |
** Copyright (c) 2004-2018, Golden Code Development Corporation.
|
|
5 |
** Copyright (c) 2004-2020, Golden Code Development Corporation.
|
|
6 | 6 |
** |
7 | 7 |
** -#- -I- --Date-- --JPRM-- -----------------------------Description----------------------------- |
8 | 8 |
** 001 ECF 20041217 @19174 Created initial version. |
... | ... | |
35 | 35 |
** 014 IAS 20160509 Fixed metadata processing in case of more than one |
36 | 36 |
** default namespace. |
37 | 37 |
** 015 OM 20180118 Removed notion of primary database. |
38 |
** 016 IAS 20200617 Added mandatory meta tables support. |
|
38 | 39 |
*/ |
39 | 40 | |
40 | 41 |
/* |
... | ... | |
95 | 96 |
import java.io.*; |
96 | 97 |
import java.util.*; |
97 | 98 |
import com.goldencode.p2j.cfg.*; |
99 |
import com.goldencode.p2j.persist.meta.MetadataManager.*; |
|
98 | 100 | |
99 | 101 |
/** |
100 | 102 |
* Schema configuration information. This class is instantiated by the master {@link |
... | ... | |
149 | 151 |
*/ |
150 | 152 |
public boolean isMetadataActive() |
151 | 153 |
{ |
152 |
return !metadata.getTables().isEmpty(); |
|
154 |
return metadata != null && |
|
155 |
!metadata.getTables().isEmpty() || !SystemTable.mandatoryTables().isEmpty(); |
|
153 | 156 |
} |
154 | 157 |
|
155 | 158 |
/** |