progressProxy.shiftRange(0.34);
final Lookup importedMessageMap = new HashTab();
m_helper.loadResources(".xsd", "XSD", "xsd", new ResourceNameHandler()
{
public void handleResource(String sName, String sRelativePath)
{
loadXSD(m_helper.getResource(sRelativePath).getURL(), sName, importedMessageMap);
}
}, progress);
m_helper.loadResources(".wsdl", "WSDL", "wsdl", new ResourceNameHandler()
{
public void handleResource(String sName, String sRelativePath)
{
loadXSD(m_helper.getResource(sRelativePath).getURL(), sName, importedMessageMap);
}
}, progress);
m_helper.loadResources(".soaimpl", "SOAImplementation", "soaimpl", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
m_soaLoader.loadImplementation(element, sName, m_metadata.getGlobalEnvironment());
}
}, progress);
contextSaved = ThreadContextHolder.getContext();
try
{
ThreadContextHolder.setContext(m_machine.getContext());
m_soaLoader.initDefinitions(m_machine);
}
finally
{
ThreadContextHolder.setContext(contextSaved);
}
m_helper.loadResources(".message", "Message", "message", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
loadMessage(element, sName);
}
}, progress);
// Explicitly-defined Message metadata shall override Message metadata from imported XSDs and WSDLs
for (Lookup.Iterator itr = importedMessageMap.iterator(); itr.hasNext(); )
{
String sName = (String)itr.next();
if (m_metadata.findMessage(sName) == null)
{
if (s_logger.isDebugEnabled())
{
s_logger.debug("Adding imported message \"" + sName + "\"");
}
m_metadata.addMessage((Message)itr.getValue());
}
else
{
if (s_logger.isDebugEnabled())
{
s_logger.debug("Skipping the overridden imported message \"" + sName + "\"");
}
}
}
// Resolve Inheritance
m_helper.fixup(m_preInheritanceMessageFixupList.iterator());
m_preInheritanceMessageFixupList = null;
List sortedMessageList = new ArrayList(m_metadata.getMessageCount());
Message.resolveInheritance(m_metadata.getMessageIterator(), sortedMessageList);
m_helper.fixup(m_postInheritanceMessageFixupList.iterator());
m_postInheritanceMessageFixupList = null;
Message.resolveReferences(m_metadata.getMessageIterator());
progressProxy.shiftRange(0.36);
m_helper.loadResources(".transformation", "Transformation", "transformation", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
loadTransformation(element, sName);
}
}, progress);
m_helper.fixup(m_transformationFixupList.iterator());
m_transformationFixupList = null;
Transformation.resolveInheritance(m_metadata.getTransformationIterator());
m_helper.fixup(m_postInheritanceTransformationFixupList.iterator());
m_postInheritanceTransformationFixupList = null;
for (Iterator itr = m_metadata.getTransformationIterator(); itr.hasNext(); )
{
Transformation transformation = (Transformation)itr.next();
try
{
transformation.finish(m_machine);
}
catch (UncheckedException ex)
{
m_helper.addException(ex);
}
}
m_helper.checkForError();
progressProxy.shiftRange(0.37);
m_helper.loadResources(".interface", "Interface", "interface", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
loadInterface(element, sName);
}
}, progress);
progressProxy.shiftRange(0.38);
m_helper.loadResources(".service", "Service", "service", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
loadService(element, sName);
}
}, progress);
finishMessagePartMappings(sortedMessageList.iterator());
}
if (progress != null)
{
progressProxy.shiftRange(0.39);
progress.progress("info.meta.resolvingResourceReferences", null, 0);
}
m_helper.fixup(m_persistenceMappingFixupList.iterator());
m_persistenceMappingFixupList = null;
m_helper.fixup(m_persistenceMappingGenerationList.iterator());
m_persistenceMappingGenerationList = null;
m_helper.fixup(m_attributeDependencyList.iterator());
m_attributeDependencyList = null;
Attribute.resolveInverseDependency(m_attributeDependencySet.iterator());
m_attributeDependencySet = null;
if (m_classAspectArray != null)
{
m_helper.fixup(Collections.singleton(new ClassFixup()
{
public void fixup()
{
ClassAspect.resolvePersistence(m_classAspectArray);
}
}).iterator());
}
m_helper.fixup(m_inheritance2ndPassFixupList.iterator());
m_inheritance2ndPassFixupList = null;
m_helper.fixup(m_class2ndPassList.iterator());
m_class2ndPassList = null;
loadLocales();
progressProxy.shiftRange(0.40);
m_helper.loadResources(".comp", "Component", "component", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
loadComponent(element, sName);
}
}, progress);
m_nStage = STAGE_LOADED_COMPONENTS;
progressProxy.progress(null, null, 0);
m_nStage = STAGE_LOAD_ENVIRONMENT_FIXUPS;
progressProxy.shiftRange(0.405);
m_helper.fixup(m_environmentFixupList.iterator());
if (progress != null)
{
progressProxy.shiftRange(0.41);
progress.progress("info.meta.instantiatingComponents", null, 0);
}
m_helper.fixup(m_componentFixupList.iterator());
m_componentFixupList = null;
m_helper.fixup(m_inheritance4thPassFixupList.iterator());
m_inheritance4thPassFixupList = null;
m_helper.fixup(m_singletonFixupList.iterator());
m_singletonFixupList = null;
m_helper.addResources(m_metadata.getDumpResourceMap(), ".dump", "Dump", "dump");
m_helper.addResources(m_metadata.getUnitTestResourceMap(), ".utest", "UnitTest", "unittest");
m_helper.addResources(m_metadata.getUpgradeResourceMap(), ".upgrade", "Upgrade", "upgrade");
loadExtendedMetadata(baseDescElement, rootDescElement);
if (m_bValidatedOnly)
{
progressProxy.setRange(0.42, 0.96);
m_helper.validateResources(m_metadata.getUnitTestResourceMap(), "UnitTest", "unittest", new ResourceNameHandler()
{
public void handleResource(String sName, String sFullName)
{
m_metadata.getUnitTest(sName);
}
}, null);
progressProxy.shiftRange(0.98);
m_helper.validateResources(m_metadata.getUpgradeResourceMap(), "Upgrade", "upgrade", new ResourceNameHandler()
{
public void handleResource(String sName, String sFullName)
{
if (m_helper.findResource(sFullName, XMLMetadataHelper.SEARCH_ROOT_THEN_BASE) != null)
{
m_metadata.getUpgrade(sName).validate(m_metadata, m_helper.getWarnings());
}
}
}, null);
validateExtendedMetadata(progressProxy);
}
try
{
m_metadata.validate(m_metadata, m_helper.getWarnings());
if (!StringUtil.isEmpty(sCompatibleURI))
{
progressProxy.shiftRange(0.988);
progressProxy.progress("info.meta.loadCompatibleModel", null, 0);
Properties compatibleProperties = new Properties(properties);
compatibleProperties.setProperty(BASE_URL_PROPERTY, "");
compatibleProperties.setProperty(COMPATIBLE_URL_PROPERTY, "");
Metadata compatible;
try
{
compatible = new MetadataLoaderDispatcher().load(sCompatibleURI, compatibleProperties, nFlags, null);
}
catch (UncheckedException e)
{
throw new MetadataCompatibilityException("err.meta.compatibleMetadataLoadFailure", null, e);
}
progressProxy.progress("info.meta.verifyModelCompatibility", null, 1);
m_metadata.checkCompatibility(compatible);
}
}
catch (UncheckedException e)
{
m_helper.addException(e);
}
if (m_bValidatedOnly)
{
progressProxy.shiftRange(.989);
m_helper.validateResources(m_metadata.getDumpResourceMap(), "Dump", "dump", new ResourceNameHandler()
{
public void handleResource(String sName, String sFullName)
{
if (m_helper.findResource(sFullName, XMLMetadataHelper.SEARCH_ROOT_THEN_BASE) == null)
{