Browse files

MODE-1487 Add support in the Teiid sequencer for VDB dependencies spe…

…cified in its "vdb.xml"

Cleaned up debug logging to make it consistent with the rest of ModeShape.
  • Loading branch information...
1 parent 406aaed commit fc37c60dd5890b2d76ec4b9c9cc577e37eb41582 @elvisisking elvisisking committed with rhauch Nov 8, 2012
Showing with 242 additions and 217 deletions.
  1. +70 −60 sequencers/modeshape-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/VdbManifest.java
  2. +1 −1 sequencers/modeshape-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/VdbModel.java
  3. +9 −16 sequencers/modeshape-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/VdbSequencer.java
  4. +1 −0 ...ers/modeshape-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/lexicon/VdbLexicon.java
  5. +13 −26 ...ape-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/model/CoreModelObjectHandler.java
  6. +4 −4 ...ape-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/model/JdbcModelObjectHandler.java
  7. +17 −23 .../modeshape-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/model/ModelNodeWriter.java
  8. +4 −13 ...deshape-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/model/ModelObjectHandler.java
  9. +19 −16 ...cers/modeshape-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/model/ModelReader.java
  10. +12 −19 ...s/modeshape-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/model/ModelSequencer.java
  11. +12 −16 ...odeshape-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/model/ReferenceResolver.java
  12. +3 −3 ...quencer-teiid/src/main/java/org/modeshape/sequencer/teiid/model/RelationalModelObjectHandler.java
  13. +5 −5 ...cer-teiid/src/main/java/org/modeshape/sequencer/teiid/model/TransformationModelObjectHandler.java
  14. +7 −15 sequencers/modeshape-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/xmi/XmiReader.java
  15. +45 −0 ...ncers/modeshape-sequencer-teiid/src/test/java/org/modeshape/sequencer/teiid/VdbSequencerTest.java
  16. +20 −0 sequencers/modeshape-sequencer-teiid/src/test/resources/log4j.properties
  17. BIN sequencers/modeshape-sequencer-teiid/src/test/resources/vdb/BooksOTest.vdb
  18. BIN sequencers/modeshape-sequencer-teiid/src/test/resources/vdb/GatewayVDB.vdb
  19. BIN sequencers/modeshape-sequencer-teiid/src/test/resources/vdb/Portfolio.vdb
  20. BIN sequencers/modeshape-sequencer-teiid/src/test/resources/vdb/PortfolioView.vdb
View
130 ...rs/modeshape-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/VdbManifest.java
@@ -122,7 +122,6 @@
* property (property/0..M)
*/
- private static final boolean DEBUG = false;
static final Logger LOGGER = Logger.getLogger(VdbManifest.class);
public static VdbManifest read( final InputStream stream,
@@ -274,13 +273,6 @@ public String toString() {
}
protected static class Reader {
- private void debug( final String message ) {
- if (DEBUG) {
- System.err.println(message);
- }
- LOGGER.debug(message);
- }
-
private VdbDataRole parseDataRole( final XMLStreamReader streamReader ) throws Exception {
assert VdbLexicon.ManifestIds.DATA_ROLE.equals(streamReader.getLocalName());
@@ -305,20 +297,20 @@ private VdbDataRole parseDataRole( final XMLStreamReader streamReader ) throws E
final String roleName = streamReader.getElementText();
dataRole.getMappedRoleNames().add(roleName);
} else {
- debug("**** unexpected data role element=" + elementName);
+ LOGGER.debug("**** unexpected data role element={0}", elementName);
}
} else if (streamReader.isEndElement() && VdbLexicon.ManifestIds.DATA_ROLE.equals(
streamReader.getLocalName())) {
break;
} else {
if (streamReader.isCharacters()) {
if (!StringUtil.isBlank(streamReader.getText())) {
- debug("**** unhandled data role event type CHARACTERS=" + streamReader.getText());
+ LOGGER.debug("**** unhandled data role event type CHARACTERS={0}", streamReader.getText());
}
} else if (streamReader.isEndElement()) {
- debug("**** unhandled data role event type END_ELEMENT=" + streamReader.getLocalName());
+ LOGGER.debug("**** unhandled data role event type END_ELEMENT={0}", streamReader.getLocalName());
} else {
- debug("**** unhandled data role event type=" + eventType);
+ LOGGER.debug("**** unhandled data role event type={0}", eventType);
}
}
}
@@ -348,19 +340,19 @@ private VdbEntry parseEntry( final XMLStreamReader streamReader ) throws Excepti
assert (property != null) : "entry property is null";
entry.getProperties().put(property.getKey(), property.getValue());
} else {
- debug("**** unexpected entry element=" + elementName);
+ LOGGER.debug("**** unexpected entry element={0}", elementName);
}
} else if (streamReader.isEndElement() && VdbLexicon.ManifestIds.ENTRY.equals(streamReader.getLocalName())) {
break;
} else {
if (streamReader.isCharacters()) {
if (!StringUtil.isBlank(streamReader.getText())) {
- debug("**** unhandled entry event type CHARACTERS=" + streamReader.getText());
+ LOGGER.debug("**** unhandled entry event type CHARACTERS={0}", streamReader.getText());
}
} else if (streamReader.isEndElement()) {
- debug("**** unhandled entry event type END_ELEMENT=" + streamReader.getLocalName());
+ LOGGER.debug("**** unhandled entry event type END_ELEMENT={0}", streamReader.getLocalName());
} else {
- debug("**** unhandled entry event type=" + eventType);
+ LOGGER.debug("**** unhandled entry event type={0}", eventType);
}
}
}
@@ -408,23 +400,23 @@ private VdbModel parseModel( final XMLStreamReader streamReader ) throws Excepti
final String metadata = streamReader.getElementText().trim();
model.setModelDefinition(metadata.replaceAll("\\s{2,}", " ")); // collapse whitespace
} else {
- debug("**** unexpected model element=" + elementName);
+ LOGGER.debug("**** unexpected model element={0}", elementName);
}
} else if (streamReader.isEndElement()) {
if (VdbLexicon.ManifestIds.SOURCE.equals(streamReader.getLocalName())) {
continue;
} else if (VdbLexicon.ManifestIds.MODEL.equals(streamReader.getLocalName())) {
break;
} else {
- debug("**** unhandled model event type END_ELEMENT=" + streamReader.getLocalName());
+ LOGGER.debug("**** unhandled model event type END_ELEMENT={0}", streamReader.getLocalName());
}
} else {
if (streamReader.isCharacters()) {
if (!StringUtil.isBlank(streamReader.getText())) {
- debug("**** unhandled model event type CHARACTERS=" + streamReader.getText());
+ LOGGER.debug("**** unhandled model event type CHARACTERS={0}", streamReader.getText());
}
} else {
- debug("**** unhandled model event type=" + eventType);
+ LOGGER.debug("**** unhandled model event type={0}", eventType);
}
}
}
@@ -438,10 +430,12 @@ private Permission parsePermission( final XMLStreamReader streamReader,
assert (dataRole != null) : "data role is null";
// should not have any attributes
- for (int i = 0, size = streamReader.getAttributeCount(); i < size; ++i) {
- final QName name = streamReader.getAttributeName(i);
- final String value = streamReader.getAttributeValue(i);
- debug("**** unexpected data role permission attribute name=" + name.getLocalPart() + ", value=" + value);
+ if (LOGGER.isDebugEnabled()) {
+ for (int i = 0, size = streamReader.getAttributeCount(); i < size; ++i) {
+ final QName name = streamReader.getAttributeName(i);
+ final String value = streamReader.getAttributeValue(i);
+ LOGGER.debug("**** unexpected data role permission attribute name={0}, value={1}", name.getLocalPart(), value);
+ }
}
Permission permission = null;
@@ -474,7 +468,7 @@ private Permission parsePermission( final XMLStreamReader streamReader,
} else if (VdbLexicon.ManifestIds.ALLOW_UPDATE.equals(elementName)) {
update = Boolean.parseBoolean(streamReader.getElementText());
} else {
- debug("**** unexpected data role permission element=" + elementName);
+ LOGGER.debug("**** unexpected data role permission element={0}", elementName);
}
} else if (streamReader.isEndElement() && VdbLexicon.ManifestIds.PERMISSION.equals(
streamReader.getLocalName())) {
@@ -494,12 +488,12 @@ private Permission parsePermission( final XMLStreamReader streamReader,
} else {
if (streamReader.isCharacters()) {
if (!StringUtil.isBlank(streamReader.getText())) {
- debug("**** unhandled data role permission event type CHARACTERS=" + streamReader.getText());
+ LOGGER.debug("**** unhandled data role permission event type CHARACTERS={0}", streamReader.getText());
}
} else if (streamReader.isEndElement()) {
- debug("**** unhandled data role permission event type END_ELEMENT=" + streamReader.getLocalName());
+ LOGGER.debug("**** unhandled data role permission event type END_ELEMENT={0}", streamReader.getLocalName());
} else {
- debug("**** unhandled data role permission event type=" + eventType);
+ LOGGER.debug("**** unhandled data role permission event type={0}", eventType);
}
}
}
@@ -525,20 +519,20 @@ private VdbTranslator parseTranslator( final XMLStreamReader streamReader ) thro
assert (property != null) : "translator property is null";
translator.getProperties().put(property.getKey(), property.getValue());
} else {
- debug("**** unexpected data role element=" + elementName);
+ LOGGER.debug("**** unexpected data role element={0}", elementName);
}
} else if (streamReader.isEndElement() && VdbLexicon.ManifestIds.TRANSLATOR.equals(
streamReader.getLocalName())) {
break;
} else {
if (streamReader.isCharacters()) {
if (!StringUtil.isBlank(streamReader.getText())) {
- debug("**** unhandled translator event type CHARACTERS=" + streamReader.getText());
+ LOGGER.debug("**** unhandled translator event type CHARACTERS={0}", streamReader.getText());
}
} else if (streamReader.isEndElement()) {
- debug("**** unhandled translator event type END_ELEMENT=" + streamReader.getLocalName());
+ LOGGER.debug("**** unhandled translator event type END_ELEMENT={0}", streamReader.getLocalName());
} else {
- debug("**** unhandled translator event type=" + eventType);
+ LOGGER.debug("**** unhandled translator event type={0}", eventType);
}
}
}
@@ -587,7 +581,7 @@ private VdbManifest parseVdb( final XMLStreamReader streamReader ) throws Except
assert (importVdb != null) : "importVdb is null";
manifest.getImportVdbs().add(importVdb);
} else {
- debug("**** unexpected VDB element=" + elementName);
+ LOGGER.debug("**** unexpected VDB element={0}", elementName);
}
} else if (streamReader.isEndElement() && VdbLexicon.ManifestIds.VDB.equals(streamReader.getLocalName())) {
break;
@@ -606,7 +600,7 @@ private VdbDataRole processDataRoleAttributes( final XMLStreamReader streamReade
final QName name = streamReader.getAttributeName(i);
final String value = streamReader.getAttributeValue(i);
attributes.put(name.getLocalPart(), value);
- debug("data-role attribute name=" + name.getLocalPart() + ", value=" + value);
+ LOGGER.debug("data-role attribute name={0}, value={1}", name.getLocalPart(), value);
}
// make sure there is a name
@@ -638,8 +632,10 @@ private VdbDataRole processDataRoleAttributes( final XMLStreamReader streamReade
}
// look for unhandled attributes
- for (final Map.Entry<String, String> entry : attributes.entrySet()) {
- debug("**** unexpected data role attribute:name=" + entry.getKey());
+ if (LOGGER.isDebugEnabled()) {
+ for (final Map.Entry<String, String> entry : attributes.entrySet()) {
+ LOGGER.debug("**** unexpected data role attribute:name={0}", entry.getKey());
+ }
}
return dataRole;
@@ -654,7 +650,7 @@ private VdbEntry processEntryAttributes( final XMLStreamReader streamReader ) th
final QName name = streamReader.getAttributeName(i);
final String value = streamReader.getAttributeValue(i);
attributes.put(name.getLocalPart(), value);
- debug("entry attribute name=" + name.getLocalPart() + ", value=" + value);
+ LOGGER.debug("entry attribute name={0}, value={1}", name.getLocalPart(), value);
}
// make sure there is a path
@@ -668,8 +664,10 @@ private VdbEntry processEntryAttributes( final XMLStreamReader streamReader ) th
attributes.remove(VdbLexicon.ManifestIds.PATH);
// look for unhandled attributes
- for (final Map.Entry<String, String> attrib : attributes.entrySet()) {
- debug("**** unexpected entry attribute:name=" + attrib.getKey());
+ if (LOGGER.isDebugEnabled()) {
+ for (final Map.Entry<String, String> attrib : attributes.entrySet()) {
+ LOGGER.debug("**** unexpected entry attribute:name={0}", attrib.getKey());
+ }
}
return entry;
@@ -684,7 +682,7 @@ private ImportVdb processImportVdbAttributes( final XMLStreamReader streamReader
final QName name = streamReader.getAttributeName(i);
final String value = streamReader.getAttributeValue(i);
attributes.put(name.getLocalPart(), value);
- debug("import VDB attribute name=" + name.getLocalPart() + ", value=" + value);
+ LOGGER.debug("import VDB attribute name={0}, value={1}", name.getLocalPart(), value);
}
// make sure there is a name and version
@@ -711,8 +709,10 @@ private ImportVdb processImportVdbAttributes( final XMLStreamReader streamReader
}
// look for unhandled attributes
- for (final Map.Entry<String, String> entry : attributes.entrySet()) {
- debug("**** unexpected import VDB attribute:name=" + entry.getKey());
+ if (LOGGER.isDebugEnabled()) {
+ for (final Map.Entry<String, String> entry : attributes.entrySet()) {
+ LOGGER.debug("**** unexpected import VDB attribute:name={0}", entry.getKey());
+ }
}
return importVdb;
@@ -727,7 +727,7 @@ private VdbModel processModelAttributes( final XMLStreamReader streamReader ) th
final QName name = streamReader.getAttributeName(i);
final String value = streamReader.getAttributeValue(i);
attributes.put(name.getLocalPart(), value);
- debug("model attribute name=" + name.getLocalPart() + ", value=" + value);
+ LOGGER.debug("model attribute name={0}, value={1}", name.getLocalPart(), value);
}
// make sure there is a model name, type, and path
@@ -755,9 +755,12 @@ private VdbModel processModelAttributes( final XMLStreamReader streamReader ) th
}
// look for unhandled attributes
- for (final Map.Entry<String, String> entry : attributes.entrySet()) {
- debug("**** unexpected model attribute:name=" + entry.getKey());
+ if (LOGGER.isDebugEnabled()) {
+ for (final Map.Entry<String, String> entry : attributes.entrySet()) {
+ LOGGER.debug("**** unexpected model attribute:name={0}", entry.getKey());
+ }
}
+
return model;
}
@@ -771,7 +774,7 @@ private void processModelSourceAttributes( final XMLStreamReader streamReader,
final QName name = streamReader.getAttributeName(i);
final String value = streamReader.getAttributeValue(i);
attributes.put(name.getLocalPart(), value);
- debug("model source attribute name=" + name.getLocalPart() + ", value=" + value);
+ LOGGER.debug("model source attribute name={0}, value={1}", name.getLocalPart(), value);
}
{ // set model source name
@@ -802,8 +805,10 @@ private void processModelSourceAttributes( final XMLStreamReader streamReader,
}
// look for unhandled attributes
- for (final Map.Entry<String, String> entry : attributes.entrySet()) {
- debug("**** unexpected model source attribute:name=" + entry.getKey());
+ if (LOGGER.isDebugEnabled()) {
+ for (final Map.Entry<String, String> entry : attributes.entrySet()) {
+ LOGGER.debug("**** unexpected model source attribute:name={0}", entry.getKey());
+ }
}
assert (((streamReader.next() == XMLStreamConstants.END_ELEMENT) && VdbLexicon.ManifestIds.SOURCE.equals(
@@ -841,7 +846,7 @@ private void processModelSourceAttributes( final XMLStreamReader streamReader,
if (StringUtil.isBlank(propName) || StringUtil.isBlank(propValue)) {
throw new Exception(TeiidI18n.missingPropertyNameOrValue.text());
}
- debug("adding property name=" + propName + ", value=" + propValue);
+ LOGGER.debug("adding property name={0}, value={1}", propName, propValue);
final int eventType = streamReader.next();
assert (eventType == XMLStreamConstants.END_ELEMENT) : "**** unexpected PROPERTY END_ELEMENT of " + eventType;
@@ -862,7 +867,7 @@ private VdbTranslator processTranslatorAttributes( final XMLStreamReader streamR
final QName name = streamReader.getAttributeName(i);
final String value = streamReader.getAttributeValue(i);
attributes.put(name.getLocalPart(), value);
- debug("translator attribute name=" + name.getLocalPart() + ", value=" + value);
+ LOGGER.debug("translator attribute name={0}, value={1}", name.getLocalPart(), value);
}
// make sure there is a name and type
@@ -886,8 +891,10 @@ private VdbTranslator processTranslatorAttributes( final XMLStreamReader streamR
}
}
// look for unhandled attributes
- for (final Map.Entry<String, String> entry : attributes.entrySet()) {
- debug("**** unexpected translator attribute:name=" + entry.getKey());
+ if (LOGGER.isDebugEnabled()) {
+ for (final Map.Entry<String, String> entry : attributes.entrySet()) {
+ LOGGER.debug("**** unexpected translator attribute:name={0}", entry.getKey());
+ }
}
return translator;
@@ -903,7 +910,7 @@ private void processValidationErrorAttributes( final XMLStreamReader streamReade
final QName name = streamReader.getAttributeName(i);
final String value = streamReader.getAttributeValue(i);
attributes.put(name.getLocalPart(), value);
- debug("model validation error attribute name=" + name.getLocalPart() + ", value=" + value);
+ LOGGER.debug("model validation error attribute name={0}, value={1}", name.getLocalPart(), value);
}
{ // create model problem
@@ -918,8 +925,10 @@ private void processValidationErrorAttributes( final XMLStreamReader streamReade
model.addProblem(severity, path, message);
}
// look for unhandled attributes
- for (final Map.Entry<String, String> entry : attributes.entrySet()) {
- debug("**** unexpected model validation error attribute:name=" + entry.getKey());
+ if (LOGGER.isDebugEnabled()) {
+ for (final Map.Entry<String, String> entry : attributes.entrySet()) {
+ LOGGER.debug("**** unexpected model validation error attribute:name={0}", entry.getKey());
+ }
}
}
@@ -932,8 +941,7 @@ private VdbManifest processVdbAttributes( final XMLStreamReader streamReader ) t
final QName name = streamReader.getAttributeName(i);
final String value = streamReader.getAttributeValue(i);
attributes.put(name.getLocalPart(), value);
-
- debug("VDB attribute name=" + name.getLocalPart() + ", value=" + value);
+ LOGGER.debug("VDB attribute name={0}, value={1}", name.getLocalPart(), value);
}
// set VDB name
@@ -961,8 +969,10 @@ private VdbManifest processVdbAttributes( final XMLStreamReader streamReader ) t
}
// look for unexpected attributes
- for (final Map.Entry<String, String> entry : attributes.entrySet()) {
- debug("**** unexpected VDB attribute:name=" + entry.getKey());
+ if (LOGGER.isDebugEnabled()) {
+ for (final Map.Entry<String, String> entry : attributes.entrySet()) {
+ LOGGER.debug("**** unexpected VDB attribute:name={0}", entry.getKey());
+ }
}
return manifest;
@@ -982,7 +992,7 @@ public VdbManifest read( final InputStream stream,
manifest = parseVdb(streamReader);
assert (manifest != null) : "manifest is null";
} else {
- debug("**** unhandled vdb read element ****");
+ LOGGER.debug("**** unhandled vdb read element ****");
}
}
}
View
2 ...ncers/modeshape-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/VdbModel.java
@@ -171,7 +171,7 @@ public boolean isBuiltIn() {
* @return <code>true</code> if model definition is declared in the VDB manifest and not by an XMI file
*/
public boolean isDeclarative() {
- return !getProperties().containsKey(VdbLexicon.Model.INDEX_NAME);
+ return !getProperties().containsKey(VdbLexicon.ManifestIds.INDEX_NAME);
}
/**
View
25 ...s/modeshape-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/VdbSequencer.java
@@ -55,19 +55,9 @@
public class VdbSequencer extends Sequencer {
private static final Logger LOGGER = Logger.getLogger(VdbSequencer.class);
-
- private static final boolean DEBUG = false;
private static final String MANIFEST_FILE = "META-INF/vdb.xml";
private static final Pattern VERSION_REGEX = Pattern.compile("(.*)[.]\\s*[+-]?([0-9]+)\\s*$");
- private void debug( final String message ) {
- if (DEBUG) {
- System.err.println(message);
- }
-
- LOGGER.debug(message);
- }
-
/**
* Utility method to extract the version information from a VDB filename.
*
@@ -101,7 +91,7 @@ public static String extractVersionInfomation( String fileNameWithoutExtension,
public boolean execute( final Property inputProperty,
final Node outputNode,
final Context context ) throws Exception {
- debug("VdbSequencer.execute called:outputNode name=" + outputNode.getName() + ", path=" + outputNode.getPath());
+ LOGGER.debug("VdbSequencer.execute called:outputNode name='{0}', path='{1}'", outputNode.getName(), outputNode.getPath());
final Binary binaryValue = inputProperty.getBinary();
CheckArg.isNotNull(binaryValue, "binary");
@@ -116,7 +106,7 @@ public boolean execute( final Property inputProperty,
String entryName = entry.getName();
if (entryName.endsWith(MANIFEST_FILE)) {
- debug("----before reading vdb.xml");
+ LOGGER.debug("----before reading vdb.xml");
manifest = VdbManifest.read(vdbStream, context);
assert (manifest != null) : "manifest is null";
@@ -148,9 +138,9 @@ public boolean execute( final Property inputProperty,
// create child nodes for declarative models
sequenceDeclarativeModels(manifest, outputNode);
- debug(">>>>done reading vdb.xml\n\n");
+ LOGGER.debug(">>>>done reading vdb.xml\n\n");
} else if (!entry.isDirectory() && this.modelSequencer.hasModelFileExtension(entryName)) {
- debug("----before reading model " + entryName);
+ LOGGER.debug("----before reading model '{0}'", entryName);
// vdb.xml file should be read first in stream so manifest model should be available
if (manifest == null) {
@@ -175,11 +165,12 @@ public boolean execute( final Property inputProperty,
if (!sequenced) {
modelNode.remove();
+ LOGGER.debug(">>>>model NOT sequenced '{0}'\n\n", entryName);
} else {
- debug(">>>>done sequencing model " + entryName + "\n\n");
+ LOGGER.debug(">>>>done sequencing model '{0}'\n\n", entryName);
}
} else {
- debug("----ignoring resource " + entryName);
+ LOGGER.debug("----ignoring resource '{0}'", entryName);
}
}
@@ -282,6 +273,8 @@ private void sequenceDeclarativeModels( final VdbManifest manifest,
for (final VdbModel model : manifest.getModels()) {
// if there is metadata then there is no xmi file
if (model.isDeclarative()) {
+ LOGGER.debug(">>>>writing declarative model '{0}'", model.getName());
+
final Node modelNode = outputNode.addNode(model.getName(), VdbLexicon.Vdb.DECLARATIVE_MODEL);
// set vdb:abstractModel properties
View
1 ...shape-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/lexicon/VdbLexicon.java
@@ -101,6 +101,7 @@
String IMPORTS = "imports";
String IMPORT_DATA_POLICIES = "import-data-policies";
String IMPORT_VDB = "import-vdb";
+ String INDEX_NAME = "indexName";
String JNDI_NAME = "connection-jndi-name";
String MAPPED_ROLE_NAME = "mapped-role-name";
String METADATA = "metadata";
View
39 ...encer-teiid/src/main/java/org/modeshape/sequencer/teiid/model/CoreModelObjectHandler.java
@@ -80,9 +80,7 @@ protected void process( final XmiElement element,
CheckArg.isNotNull(modelNode, "node");
CheckArg.isEquals(element.getNamespaceUri(), "namespace URI", URI, "relational URI");
- if (DEBUG) {
- debug("==== CoreModelObjectHandler:process:element=" + element.getName());
- }
+ LOGGER.debug("==== CoreModelObjectHandler:process:element={0}", element.getName());
final String type = element.getName();
if (CoreLexicon.ModelId.MODEL_ANNOTATION.equals(type)) {
@@ -133,10 +131,9 @@ protected void process( final XmiElement element,
setProperty(markerNode, VdbLexicon.Model.Marker.MESSAGE, marker.getMessage());
setProperty(markerNode, VdbLexicon.Model.Marker.SEVERITY, marker.getSeverity().toString());
- if (DEBUG) {
- debug("added validation marker at path " + marker.getPath() + " and with severity of "
- + marker.getSeverity());
- }
+ LOGGER.debug("added validation marker at path {0} and with severity of {1}",
+ marker.getPath(),
+ marker.getSeverity());
}
}
}
@@ -163,9 +160,7 @@ protected void process( final XmiElement element,
}
}
- if (DEBUG) {
- debug("[end writing model annotation]");
- }
+ LOGGER.debug("[end writing model annotation]");
} else if (CoreLexicon.ModelId.ANNOTATION_CONTAINER.equals(type)) {
for (final XmiElement annotation : element.getChildren()) {
if (CoreLexicon.ModelId.ANNOTATION.equals(annotation.getName())) {
@@ -185,10 +180,7 @@ protected void process( final XmiElement element,
uuid = getResolver().resolveInternalReference(uuid);
if (StringUtil.isBlank(uuid)) {
- if (DEBUG) {
- debug("annotated object UUID is blank");
- }
-
+ LOGGER.debug("annotated object UUID is blank");
continue;
}
@@ -276,33 +268,28 @@ protected void process( final XmiElement element,
} else if (unresolved != null) {
unresolved.addProperty(key, value, false);
}
- } else if (DEBUG) {
+ } else {
if (node != null) {
- debug("tag " + key + " not added as property of node " + node.getName());
+ LOGGER.debug("tag '{0}' not added as property of node '{1}'", key, node.getName());
} else if (unresolved != null) {
- debug("tag " + key + " not added as property of node " + unresolved.getUuid());
+ LOGGER.debug("tag '{0}' not added as property of node '{1}'", key, unresolved.getUuid());
}
}
- } else if (DEBUG) {
- debug("Unexpected element processing an annotation: " + child.getName());
+ } else {
+ LOGGER.debug("Unexpected element processing an annotation: {0}", child.getName());
}
}
}
}
} else {
- if (DEBUG) {
- debug("**** core type of " + type + " was not processed");
- }
+ LOGGER.debug("**** core type of '{0}' was not processed", type);
}
}
private void registerMed( final String medPrefix ) {
assert (medPrefix != null);
this.meds.add(medPrefix);
-
- if (DEBUG) {
- debug("registered MED " + medPrefix);
- }
+ LOGGER.debug("registered MED '{0}'", medPrefix);
}
}
View
8 ...encer-teiid/src/main/java/org/modeshape/sequencer/teiid/model/JdbcModelObjectHandler.java
@@ -56,7 +56,7 @@ protected void process( final XmiElement element,
CheckArg.isNotNull(parentNode, "outputNode");
CheckArg.isEquals(element.getNamespaceUri(), "namespace URI", URI, "JDBC URI");
- debug("==== JdbcModelObjectHandler:process:element=" + element.getName());
+ LOGGER.debug("==== JdbcModelObjectHandler:process:element={0}", element.getName());
final String type = element.getName();
if (ModelId.SOURCE.equals(type)) {
@@ -71,7 +71,7 @@ protected void process( final XmiElement element,
break; // only one
}
- debug("**** JDBC Source child element type of " + childElement.getName() + " was not processed");
+ LOGGER.debug("**** JDBC Source child element type of '{0}' was not processed", childElement.getName());
}
} else if (ModelId.IMPORT_SETTINGS.equals(type)) {
final Node importSettingNode = addNode(parentNode, element, URI, JcrId.IMPORTED);
@@ -94,11 +94,11 @@ protected void process( final XmiElement element,
// - jdbcs:includedTableTypes (string) multiple
addPropertyValue(importSettingNode, JcrId.INCLUDED_TABLE_TYPES, childElement.getValue());
} else {
- debug("**** JDBC Import Settings child element type of " + childElement.getName() + " was not processed");
+ LOGGER.debug("**** JDBC Import Settings child element type of '{0}' was not processed", childElement.getName());
}
}
} else {
- debug("**** JDBC type of " + type + " was not processed");
+ LOGGER.debug("**** JDBC type of '{0}' was not processed", type);
}
}
View
40 ...pe-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/model/ModelNodeWriter.java
@@ -56,15 +56,6 @@
private static final Logger LOGGER = Logger.getLogger(ModelNodeWriter.class);
- private static final boolean DEBUG = false;
-
- private void debug( final String message ) {
- if (DEBUG) {
- System.err.println(message);
- }
- LOGGER.debug(message);
- }
-
private final Context context;
private final Map<String, ModelObjectHandler> handlers = new HashMap<String, ModelObjectHandler>();
private final Node outputNode;
@@ -156,32 +147,32 @@ public boolean write() throws Exception {
}
}
- debug("\n\nmodel write time=" + (System.currentTimeMillis() - startTime));
+ LOGGER.debug("model write time={0}\n\n", (System.currentTimeMillis() - startTime));
return result;
}
private boolean writeModelObjects() throws Exception {
- debug("\n\n[begin writeModelObjects()]");
+ LOGGER.debug("[begin writeModelObjects()]");
for (final XmiElement element : this.reader.getElements()) {
final String nsUri = element.getNamespaceUri();
final ModelObjectHandler handler = getHandler(nsUri);
if (handler == null) {
- debug("ModelObjectHandler for namespace " + nsUri + " cannot be found");
+ LOGGER.debug("ModelObjectHandler for namespace {0} cannot be found", nsUri);
continue;
}
handler.process(element, this.outputNode);
}
- debug("[end writeModelObjects()]\n\n");
+ LOGGER.debug("[end writeModelObjects()]\n\n");
return true;
}
public boolean writeUnresolvedReferences() throws Exception {
- debug("\n\n[begin writeUnresolvedReferences()]");
+ LOGGER.debug("[begin writeUnresolvedReferences()]");
// keep track of the unresolved references that have been resolved so that they can be marked as resolved later
List<UnresolvedReference> resolvedReferences = new ArrayList<ReferenceResolver.UnresolvedReference>();
@@ -190,7 +181,7 @@ public boolean writeUnresolvedReferences() throws Exception {
final Node resolved = this.resolver.getNode(entry.getKey());
if (resolved == null) {
- debug("**** uuid " + entry.getKey() + " is still unresolved during last phase of writing model");
+ LOGGER.debug("**** uuid {0} is still unresolved during last phase of writing model", entry.getKey());
continue;
}
@@ -200,7 +191,7 @@ public boolean writeUnresolvedReferences() throws Exception {
// add mixins
for (final String mixin : unresolved.getMixins()) {
resolved.addMixin(mixin);
- debug("adding mixin " + mixin + " to resolved node " + resolved.getName());
+ LOGGER.debug("adding mixin {0} to resolved node {1}", mixin, resolved.getName());
}
{ // add properties
@@ -220,8 +211,10 @@ public boolean writeUnresolvedReferences() throws Exception {
} else {
// single valued
resolved.setProperty(propName, property.getValue());
- debug("setting property '" + propName + "' with value '" + property.getValue()
- + "' to resolved node " + resolved.getName());
+ LOGGER.debug("setting property '{0}' with value '{1}' to resolved node {2}",
+ propName,
+ property.getValue(),
+ resolved.getName());
}
}
}
@@ -259,8 +252,10 @@ public boolean writeUnresolvedReferences() throws Exception {
resolved.setProperty(propertyName, refs.iterator().next());
}
} else {
- debug("**** resolved property does not have property '" + propertyName + "'."
- + " The value has " + refs.size() + " reference(s) and first reference is '" + refs.iterator().next());
+ LOGGER.debug("**** resolved property does not have property '{0}'. The value has {1} reference(s) and first reference is '{2}'",
+ propertyName,
+ refs.size(),
+ refs.iterator().next());
}
}
}
@@ -320,7 +315,7 @@ public boolean writeUnresolvedReferences() throws Exception {
referencer.setProperty(propertyName, weakRef);
}
} else {
- debug("**** weak reference property could be multi-value here");
+ LOGGER.debug("**** weak reference property could be multi-value here");
}
}
}
@@ -335,8 +330,7 @@ public boolean writeUnresolvedReferences() throws Exception {
}
}
- debug("number unresolved at end=" + this.resolver.getUnresolved().size());
- debug("[end writeUnresolvedReferences()]\n\n");
+ LOGGER.debug("number unresolved at end={0}\n[end writeUnresolvedReferences()]\n\n", this.resolver.getUnresolved().size());
return true;
}
View
17 ...sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/model/ModelObjectHandler.java
@@ -43,16 +43,7 @@
*/
public abstract class ModelObjectHandler {
- protected Logger logger = Logger.getLogger(getClass());
-
- protected static final boolean DEBUG = false;
-
- protected void debug( final String message ) {
- if (DEBUG) {
- System.err.println(message);
- }
- logger.debug(message);
- }
+ protected static final Logger LOGGER = Logger.getLogger(ModelObjectHandler.class);
private Context context; // set by handler framework and is never null
private ModelReader reader; // set by handler framework and is never null
@@ -89,7 +80,7 @@ protected Node addNode( final Node parentNode,
setProperty(newNode, XmiLexicon.JcrId.UUID, element.getUuid());
this.resolver.record(element.getUuid(), newNode);
- debug("adding node " + newNode.getName() + " to parent " + parentNode.getName());
+ LOGGER.debug("adding node {0} to parent {1}", newNode.getName(), parentNode.getName());
return newNode;
}
@@ -130,7 +121,7 @@ protected void addPropertyValue( final Node node,
node.setProperty(propertyName, new Value[] {newValue});
}
- debug("added a value of " + newValue + " to multi-valued property " + propertyName + " in node " + node.getName());
+ LOGGER.debug("added a value of '{0}' to multi-valued property '{1}' in node '{2}'", newValue, propertyName, node.getName());
}
/**
@@ -241,7 +232,7 @@ protected void setProperty( final Node node,
}
} else {
node.setProperty(propertyName, propertyValue);
- debug(node.getName() + ":setting " + propertyName + " = " + propertyValue);
+ LOGGER.debug("{0}:setting {1} = {2}", node.getName(), propertyName, propertyValue);
}
}
}
View
35 ...eshape-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/model/ModelReader.java
@@ -392,23 +392,26 @@ public void readModel( final InputStream stream ) throws Exception {
final long startTime = System.currentTimeMillis();
final List<XmiElement> elements = super.read(stream);
- for (final XmiElement element : elements) {
- debug("====root model element=" + element.getName());
- }
-
- debug("");
-
- for (final Entry<String, XmiElement> uuidMapping : this.resolver.getUuidMappings().entrySet()) {
- debug(uuidMapping.getKey() + '=' + uuidMapping.getValue());
- }
-
- debug("");
-
- for (String uuid : this.resolver.getUnresolved().keySet()) {
- debug("**** unresolved " + uuid);
+ if (LOGGER.isDebugEnabled()) {
+ for (final XmiElement element : elements) {
+ LOGGER.debug("====root model element='{0}'", element.getName());
+ }
+
+ LOGGER.debug("");
+
+ for (final Entry<String, XmiElement> uuidMapping : this.resolver.getUuidMappings().entrySet()) {
+ LOGGER.debug("{0}={1}", uuidMapping.getKey(), uuidMapping.getValue());
+ }
+
+ LOGGER.debug("");
+
+ for (String uuid : this.resolver.getUnresolved().keySet()) {
+ LOGGER.debug("**** unresolved '{0}'", uuid);
+ }
+
+ LOGGER.debug("\n\n");
+ LOGGER.debug("model read time={0}", (System.currentTimeMillis() - startTime));
}
-
- debug("\n\nmodel read time=" + (System.currentTimeMillis() - startTime));
}
/**
View
31 ...ape-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/model/ModelSequencer.java
@@ -47,18 +47,9 @@
*/
public class ModelSequencer extends Sequencer {
- private static final boolean DEBUG = false;
-
private static final String[] MODEL_FILE_EXTENSIONS = { ".xmi" };
private static final Logger LOGGER = Logger.getLogger(ModelSequencer.class);
- private void debug( final String message ) {
- if (DEBUG) {
- System.err.println(message);
- }
- LOGGER.debug(message);
- }
-
/**
* @param modelReader the reader who processed the model file (cannot be <code>null</code>)
* @return <code>true</code> if the model process by the reader should be sequenced
@@ -125,29 +116,29 @@ public boolean hasModelFileExtension( final String resourceName ) {
@Override
public void initialize( final NamespaceRegistry registry,
final NodeTypeManager nodeTypeManager ) throws RepositoryException, IOException {
- debug("enter initialize");
+ LOGGER.debug("enter initialize");
super.registerNodeTypes("../xmi.cnd", nodeTypeManager, true);
- debug("xmi.cnd loaded");
+ LOGGER.debug("xmi.cnd loaded");
super.registerNodeTypes("../mmcore.cnd", nodeTypeManager, true);
- debug("mmcore.cnd loaded");
+ LOGGER.debug("mmcore.cnd loaded");
super.registerNodeTypes("../jdbc.cnd", nodeTypeManager, true);
- debug("jdbc.cnd loaded");
+ LOGGER.debug("jdbc.cnd loaded");
super.registerNodeTypes("../relational.cnd", nodeTypeManager, true);
- debug("relational.cnd loaded");
+ LOGGER.debug("relational.cnd loaded");
super.registerNodeTypes("../transformation.cnd", nodeTypeManager, true);
- debug("transformation.cnd loaded");
+ LOGGER.debug("transformation.cnd loaded");
// Register some of the namespaces we'll need ...
registerNamespace(DiagramLexicon.Namespace.PREFIX, DiagramLexicon.Namespace.URI, registry);
registerNamespace(ModelExtensionDefinitionLexicon.Namespace.PREFIX, // TODO may not need this if MED CND is made
ModelExtensionDefinitionLexicon.Namespace.URI,
registry);
- debug("exit initialize");
+ LOGGER.debug("exit initialize");
}
/**
@@ -171,8 +162,10 @@ private boolean sequenceModel( final InputStream modelStream,
assert (context != null);
assert (modelOutputNode.isNodeType(CoreLexicon.JcrId.MODEL));
- debug("sequenceModel:model node path=" + modelOutputNode.getPath() + ", model path=" + modelPath + ", vdb model="
- + vdbModel);
+ LOGGER.debug("sequenceModel:model node path='{0}', model path='{1}', vdb model='{2}'",
+ modelOutputNode.getPath(),
+ modelPath,
+ vdbModel);
final NamespaceRegistry registry = modelOutputNode.getSession().getWorkspace().getNamespaceRegistry();
final ModelReader modelReader = new ModelReader(modelPath, this.resolver, registry);
@@ -185,7 +178,7 @@ private boolean sequenceModel( final InputStream modelStream,
}
// stream was not sequenced
- debug("sequenceModel:model not sequenced at path '" + modelPath + "'");
+ LOGGER.debug("sequenceModel:model not sequenced at path '{0}'", modelPath);
return false;
}
View
28 ...-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/model/ReferenceResolver.java
@@ -47,8 +47,7 @@
*/
public class ReferenceResolver {
- private static final boolean DEBUG = false;
- private static final Logger LOGGER = Logger.getLogger(ReferenceResolver.class);
+ static final Logger LOGGER = Logger.getLogger(ReferenceResolver.class);
public static final Map<String, String> STANDARD_DATA_TYPE_URLS_BY_UUID;
public static final Map<String, String> STANDARD_DATA_TYPE_URLS_TO_NAMES;
@@ -142,13 +141,6 @@
STANDARD_DATA_TYPE_UUIDS_BY_NAMES = Collections.unmodifiableMap(dataTypeUuidsByName);
}
- void debug( final String message ) {
- if (DEBUG) {
- System.err.println(message);
- }
- LOGGER.debug(message);
- }
-
// key = uuid, value = UnresolvedReference
private final Map<String, UnresolvedReference> unresolved = new ConcurrentHashMap<String, ReferenceResolver.UnresolvedReference>();
@@ -179,7 +171,7 @@ public UnresolvedReference addUnresolvedReference( String xmiUuid ) throws Excep
if (unresolved == null) {
unresolved = new UnresolvedReference(xmiUuid);
this.unresolved.put(xmiUuid, unresolved);
- debug("added " + xmiUuid + " to the list of unresolved references");
+ LOGGER.debug("added '{0}' to the list of unresolved references", xmiUuid);
}
return unresolved;
@@ -285,7 +277,7 @@ public void resolved( final UnresolvedReference unresolved ) {
CheckArg.isNotNull(unresolved, "unresolved");
final UnresolvedReference resolved = this.unresolved.remove(unresolved.getUuid());
assert (unresolved == resolved);
- debug("UUID " + unresolved.getUuid() + " has been resolved");
+ LOGGER.debug("UUID '{0}' has been resolved", unresolved.getUuid());
}
/**
@@ -420,7 +412,7 @@ public boolean addMixin( final String newMixin ) {
final boolean added = this.mixins.add(newMixin);
if (added) {
- debug("added mixin '" + newMixin + "' to the unresolved reference " + this.uuid);
+ LOGGER.debug("added mixin '{0}' to the unresolved reference '{1}'", newMixin, this.uuid);
}
return added;
@@ -445,12 +437,16 @@ public void addProperty( final String propertyName,
} else {
unresolvedProperty.addValue(propertyValue);
}
- debug("added multi-valued property '" + propertyName + "' with value '" + propertyValue
- + "' to the unresolved reference " + this.uuid);
+ LOGGER.debug("added multi-valued property '{0}' with value '{1}' to the unresolved reference '{2}'",
+ propertyName,
+ propertyValue,
+ this.uuid);
} else {
this.properties.put(propertyName, new UnresolvedProperty(propertyName, propertyValue, false));
- debug("added property '" + propertyName + "' with value '" + propertyValue
- + "' to the unresolved reference " + this.uuid);
+ LOGGER.debug("added property '{0}' with value '{1}' to the unresolved reference '{2}'",
+ propertyName,
+ propertyValue,
+ this.uuid);
}
}
}
View
6 ...teiid/src/main/java/org/modeshape/sequencer/teiid/model/RelationalModelObjectHandler.java
@@ -58,7 +58,7 @@ protected void process( final XmiElement element,
CheckArg.isNotNull(parentNode, "node");
CheckArg.isEquals(element.getNamespaceUri(), "namespace URI", URI, "relational URI");
- debug("==== RelationalModelObjectHandler:process:element=" + element.getName());
+ LOGGER.debug("==== RelationalModelObjectHandler:process:element={0}", element.getName());
final String type = element.getName();
if (ModelId.BASE_TABLE.equals(type)) {
@@ -106,7 +106,7 @@ protected void process( final XmiElement element,
tableNode = addNode(parentNode, element, URI, JcrId.VIEW);
processTable(element, tableNode);
} else {
- debug("**** relational '" + ModelId.TABLES + "' type + of '" + xsiType + "' was not processed");
+ LOGGER.debug("**** relational '{0}' type + of '{1}' was not processed", ModelId.TABLES, xsiType);
}
} else if (ModelId.TYPE.equals(type)) {
processType(element, parentNode);
@@ -117,7 +117,7 @@ protected void process( final XmiElement element,
final Node viewNode = addNode(parentNode, element, URI, JcrId.VIEW);
processTable(element, viewNode);
} else {
- debug("**** relational type of " + type + " was not processed");
+ LOGGER.debug("**** relational type of '{0}' was not processed", type);
}
}
View
10 ...d/src/main/java/org/modeshape/sequencer/teiid/model/TransformationModelObjectHandler.java
@@ -53,19 +53,19 @@ protected void process( final XmiElement element,
CheckArg.isNotNull(parentNode, "node");
CheckArg.isEquals(element.getNamespaceUri(), "namespace URI", URI, "relational URI");
- debug("==== TransformationModelObjectHandler:process:element=" + element.getName());
+ LOGGER.debug("==== TransformationModelObjectHandler:process:element={0}", element.getName());
if (ModelId.TRANSFORMATION_CONTAINER.equals(element.getName())) {
// just process children
for (final XmiElement kid : element.getChildren()) {
if (ModelId.TRANSFORMATION_MAPPINGS.equals(kid.getName())) {
processMappings(kid);
} else {
- debug("**** transformation container child of '" + kid.getName() + "' was not processed");
+ LOGGER.debug("**** transformation container child of '{0}' was not processed", kid.getName());
}
}
} else {
- debug("**** transformation type of '" + element.getName() + "' was not processed");
+ LOGGER.debug("**** transformation type of '{0}' was not processed", element.getName());
}
}
@@ -136,7 +136,7 @@ private void processMappings( final XmiElement mappings ) throws Exception {
assert (mappings != null);
assert (ModelId.TRANSFORMATION_MAPPINGS.equals(mappings.getName()));
- debug("=========" + mappings.getName());
+ LOGGER.debug("=========mappings='{0}'", mappings.getName());
final ReferenceResolver resolver = getResolver();
final String targetUuid = mappings.getAttributeValue(ModelId.TARGET, URI);
final String uuid = resolver.resolveInternalReference(targetUuid);
@@ -178,7 +178,7 @@ private void processMappings( final XmiElement mappings ) throws Exception {
} else if (ModelId.NESTED.equals(kid.getName())) {
processNested(kid);
} else {
- debug("**** transformation mapping child type of " + kid + " was not processed");
+ LOGGER.debug("**** transformation mapping child type of '{0}' was not processed", kid);
}
}
}
View
22 .../modeshape-sequencer-teiid/src/main/java/org/modeshape/sequencer/teiid/xmi/XmiReader.java
@@ -42,15 +42,7 @@
*/
public class XmiReader {
- protected Logger logger = Logger.getLogger(getClass());
- protected static final boolean DEBUG = false;
-
- protected void debug( final String message ) {
- if (DEBUG) {
- System.err.println(message);
- }
- logger.debug(message);
- }
+ static final Logger LOGGER = Logger.getLogger(XmiReader.class);
private static String getIndent( final int stackSize ) {
final StringBuilder indent = new StringBuilder();
@@ -126,7 +118,7 @@ protected void createAttributes( final XMLStreamReader streamReader,
newAttribute.setValue(streamReader.getAttributeValue(i));
addAttribute(element, newAttribute);
- debug(getIndent(this.stack.size()) + " added attribute: " + newAttribute);
+ LOGGER.debug("{0} added attribute: '{1}'", getIndent(this.stack.size()), newAttribute);
}
}
@@ -202,7 +194,7 @@ protected void handleCharacters( final XMLStreamReader streamReader ) {
if (!StringUtil.isBlank(value) && !this.stack.isEmpty()) {
this.stack.peek().setValue(value);
} else if (!StringUtil.isBlank(value)) {
- debug("**** unhandled XmiReader CHARACTERS event type. Character=" + streamReader.getText());
+ LOGGER.debug("**** unhandled XmiReader CHARACTERS event type. Character={0}", streamReader.getText());
}
}
@@ -216,7 +208,7 @@ protected XmiElement handleEndElement( final XMLStreamReader streamReader ) {
CheckArg.isNotNull(streamReader, "streamReader");
final XmiElement popped = pop(streamReader);
- debug(getIndent(this.stack.size() + 1) + "end:elementName=" + streamReader.getLocalName() + ", popped=" + popped);
+ LOGGER.debug("{0}end:elementName={1}, popped={2}", getIndent(this.stack.size() + 1), streamReader.getLocalName(), popped);
return popped;
}
@@ -227,7 +219,7 @@ protected XmiElement handleEndElement( final XMLStreamReader streamReader ) {
*/
protected void handleOtherEvents( final XMLStreamReader streamReader ) {
CheckArg.isNotNull(streamReader, "streamReader");
- debug("**** unhandled XmiReader event of type " + streamReader.getEventType());
+ LOGGER.debug("**** unhandled XmiReader event of type {0}", streamReader.getEventType());
}
/**
@@ -250,7 +242,7 @@ protected XmiElement handleStartElement( final XMLStreamReader streamReader ) th
push(element);
- debug(getIndent(this.stack.size()) + "startElement: " + element);
+ LOGGER.debug("{0}startElement: {1}", getIndent(this.stack.size()), element);
// create attributes
createAttributes(streamReader, element);
@@ -261,7 +253,7 @@ protected XmiElement handleStartElement( final XMLStreamReader streamReader ) th
final String nsUri = streamReader.getNamespaceURI(i);
this.namespaces.put(nsPrefix, nsUri);
- debug("registered namespace " + nsPrefix + '=' + nsUri + " to model");
+ LOGGER.debug("registered namespace {0}={1} to model", nsPrefix, nsUri);
}
}
View
45 ...deshape-sequencer-teiid/src/test/java/org/modeshape/sequencer/teiid/VdbSequencerTest.java
@@ -457,11 +457,56 @@ public void shouldSequenceVdbPartsVdb() throws Exception {
}
@Test
+ public void shouldSequenceVdbPortfolioViewVdb() throws Exception {
+ // Portfolio.vdb is a 7.4 VDB
+ createNodeWithContentFromFile("vdb/PortfolioView.vdb", "vdb/PortfolioView.vdb");
+ Node outputNode = getOutputNode(this.rootNode, "vdbs/PortfolioView.vdb");
+ assertNotNull(outputNode);
+ assertThat(outputNode.getPrimaryNodeType().getName(), is(VdbLexicon.Vdb.VIRTUAL_DATABASE));
+ }
+
+ @Test
+ public void shouldSequenceVdbPortfolioVdb() throws Exception {
+ // Portfolio.vdb is a 7.4 VDB
+ createNodeWithContentFromFile("vdb/Portfolio.vdb", "vdb/Portfolio.vdb");
+ Node outputNode = getOutputNode(this.rootNode, "vdbs/Portfolio.vdb");
+ assertNotNull(outputNode);
+ assertThat(outputNode.getPrimaryNodeType().getName(), is(VdbLexicon.Vdb.VIRTUAL_DATABASE));
+ assertThat(outputNode.getNodes().getSize(), is(4L));
+ }
+
+ @Test
+ public void shouldSequenceVdbGatewayVDBVdb() throws Exception {
+ // GatewayVDB.vdb is a 7.7 VDB
+ createNodeWithContentFromFile("vdb/GatewayVDB.vdb", "vdb/GatewayVDB.vdb");
+ Node outputNode = getOutputNode(this.rootNode, "vdbs/GatewayVDB.vdb");
+ assertNotNull(outputNode);
+ assertThat(outputNode.getPrimaryNodeType().getName(), is(VdbLexicon.Vdb.VIRTUAL_DATABASE));
+ assertThat(outputNode.getNodes().getSize(), is(1L));
+ }
+
+ @Test
+ public void shouldSequenceVdbBooksOTestVdb() throws Exception {
+ // BooksOTest.vdb is a 7.7 VDB
+ createNodeWithContentFromFile("vdb/BooksOTest.vdb", "vdb/BooksOTest.vdb");
+ Node outputNode = getOutputNode(this.rootNode, "vdbs/BooksOTest.vdb");
+ assertNotNull(outputNode);
+ assertThat(outputNode.getPrimaryNodeType().getName(), is(VdbLexicon.Vdb.VIRTUAL_DATABASE));
+ assertThat(outputNode.getNodes().getSize(), is(1L));
+ }
+
+ @Test
public void shouldSequenceVdbFinancialsLinuxVdb() throws Exception {
createNodeWithContentFromFile("vdb/Financials_Linux.vdb", "vdb/Financials_Linux.vdb");
Node outputNode = getOutputNode(this.rootNode, "vdbs/Financials_Linux.vdb");
assertNotNull(outputNode);
assertThat(outputNode.getPrimaryNodeType().getName(), is(VdbLexicon.Vdb.VIRTUAL_DATABASE));
+ assertThat(outputNode.getNodes().getSize(), is(5L));
+
+ Node modelNode = outputNode.getNode("US_CustomerAccounts_VBL.xmi");
+ assertNotNull(modelNode);
+ assertThat(modelNode.getPrimaryNodeType().getName(), is(VdbLexicon.Vdb.MODEL));
+ assertThat(modelNode.getProperty(VdbLexicon.Model.PATH_IN_VDB).getString(), is("Financials/VirtualBaseLayer/US_CustomerAccounts_VBL.xmi"));
}
@Test
View
20 sequencers/modeshape-sequencer-teiid/src/test/resources/log4j.properties
@@ -0,0 +1,20 @@
+# Direct log messages to stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %m%n
+
+# Root logger option
+log4j.rootLogger=INFO, stdout
+
+# Set up the default logging to be INFO level, then override specific units
+log4j.logger.org.modeshape=INFO
+
+# Uncomment to turn debug logging on
+#log4j.logger.org.modeshape.sequencer.teiid.VdbManifest=DEBUG
+#log4j.logger.org.modeshape.sequencer.teiid.model.ModelNodeWriter=DEBUG
+#log4j.logger.org.modeshape.sequencer.teiid.model.ModelObjectHandler=DEBUG
+#log4j.logger.org.modeshape.sequencer.teiid.model.ReferenceResolver=DEBUG
+#log4j.logger.org.modeshape.sequencer.teiid.model.ModelSequencer=DEBUG
+#log4j.logger.org.modeshape.sequencer.teiid.VdbSequencer=DEBUG
+#log4j.logger.org.modeshape.sequencer.teiid.xmi.XmiReader=DEBUG
View
BIN sequencers/modeshape-sequencer-teiid/src/test/resources/vdb/BooksOTest.vdb
Binary file not shown.
View
BIN sequencers/modeshape-sequencer-teiid/src/test/resources/vdb/GatewayVDB.vdb
Binary file not shown.
View
BIN sequencers/modeshape-sequencer-teiid/src/test/resources/vdb/Portfolio.vdb
Binary file not shown.
View
BIN sequencers/modeshape-sequencer-teiid/src/test/resources/vdb/PortfolioView.vdb
Binary file not shown.

0 comments on commit fc37c60

Please sign in to comment.