if (part == null)
{
if (bError)
{
throw new IntegrationException("err.integration.xml.unsupportedMessage",
new Object[]{sURI, sLocalName});
}
return false;
}
rootMapping = (RootXMLMessagePartMapping)part.getMapping();
assert m_stack.getSize() == 1;
m_stack.setTopMessagePart(part);
m_stack.setTopBaseMessagePart(part);
if (s_logger.isDebugEnabled())
{
s_logger.debug("Identified the XML message as \"" + part.getName() + "\"");
}
((TransferObject)m_stack.getTopObject()).setClassName(part.getName());
m_headerPart = rootMapping.getHeaderPart();
m_bRestart = (rootMapping.getSchemaResourceMap() != null) || (m_headerPart != null);
m_baseRootPart = part;
}
else
{
// Verify root element of message being parsed
rootMapping = (RootXMLMessagePartMapping)part.getMapping();
if (!matches(m_baseRootPart, sURI, sLocalName))
{
if (bError)
{
throw new IntegrationException("err.integration.xml.invalidDocRoot",
new Object[]{sURI, sLocalName});
}
return false;
}
if (m_headerPart != rootMapping.getHeaderPart())
{
m_headerPart = rootMapping.getHeaderPart();
m_bRestart = true;
}
}
TransferObject tobj = (TransferObject)m_stack.getTopObject();
if (!m_bRestart)
{
parseAttributes(tobj, (CompositeMessagePart)part, attributes);
}
Message derivedMessage = getDerivedMessage(attributes, rootMapping, part.getFullPath());
Message primaryMessage = rootMapping.getRootMessage();
tobj.setClassName(primaryMessage.getName());
if (derivedMessage != null)
{
CompositeMessagePart derivedMessageRoot = derivedMessage.getRoot();
RootXMLMessagePartMapping derivedMessageRootMapping = (RootXMLMessagePartMapping)derivedMessageRoot.getMapping();
Message.validatePolymorphism(primaryMessage, derivedMessage, derivedMessageRoot);
m_stack.setTopBaseMessagePart(part);
part = derivedMessageRoot;
m_stack.setTopMessagePart(part);
tobj.setClassName(derivedMessage.getName());
MessagePart headerPart = derivedMessageRootMapping.getHeaderPart();
if (m_headerPart != headerPart)
{
m_headerPart = headerPart;
m_bRestart = true;
}
}
else
{
if (primaryMessage.getDerivation() == Message.DERIVATION_ABSTRACT)
{
throw new IntegrationException("err.integration.abstractMessage",
new Object[]{primaryMessage.getName(), part.getFullPath()});
}
}
m_bProcessRoot = false;