progressProxy.shiftRange(0.05);
if (!m_bEnvironmentOnly && !bDataSourceOnly)
{
Lookup localeMap = new HashTab();
m_helper.addResources(localeMap, ".locale", "Locale", "locale");
loadStrings(localeMap.iterator());
Lookup stringResMap = new HashTab();
m_helper.addResources(stringResMap, ".strings", "Strings", "strings");
loadStrings(stringResMap.iterator());
if (StringTable.getInstance() == null)
{
StringTable.setInstance(m_metadata.getStringTable(Metadata.DEFAULT_LOCALE));
StringTable.setTimeZone(TZ.UTC);
}
}
progressProxy.shiftRange(0.10);
m_helper.loadEncryptedResourceURL(configURL, "Server", "server", new ResourceHandler()
{
public void handleResource(final Element element, final String sName)
{
if (element.getNodeName().equals("Environment"))
{
String sConnectionsURL = m_properties.getProperty(CONNECTIONS_URL_PROPERTY);
if (StringUtil.isEmpty(sConnectionsURL))
{
m_properties.setProperty(CONNECTIONS_URL_PROPERTY, m_sConfigURL);
}
}
NamedNodeMap attrMap = element.getAttributes();
for (int i = 0; i != attrMap.getLength(); ++i)
{
Node node = attrMap.item(i);
String sOldValue = m_properties.getProperty(node.getNodeName());
if (StringUtil.isEmpty(sOldValue))
{
m_properties.setProperty(node.getNodeName(), node.getNodeValue());
}
}
}
}, m_properties);
m_decryptionDispatcher = new CharacterStreamCipherDispatcher();
m_decryptionDispatcher.init(m_properties);
m_helper.setEncryptionSchemeSet(new HashHolder(4));
loadServer(m_properties);
String sConnectionsURL = m_properties.getProperty(CONNECTIONS_URL_PROPERTY);
URL connectionsURL = null;
if (!StringUtil.isEmpty(sConnectionsURL))
{
connectionsURL = XMLMetadataHelper.getURL(sConnectionsURL, false, handler);
sConnectionsURL = connectionsURL.toString();
if (s_logger.isInfoEnabled())
{
s_logger.info("Connections URL: \"" + sConnectionsURL + "\"");
}
}
m_helper.loadSystemResource("system.dstypes",
"DataSourceTypes", "dataSourceTypes", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
loadDataSourceTypes(element);
}
});
m_helper.loadResources(".dstype", "DataSourceType", "dataSourceType", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
loadDataSourceType(element, sName);
}
}, progress);
m_helper.loadResources(".datasource", "DataSource", "dataSource", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
loadDataSource(element, sName);
}
}, progress);
if (!m_bIntegrationExcluded)
{
m_helper.loadSystemResource("system.chtypes",
"ChannelTypes", "channelTypes", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
loadChannelTypes(element);
}
});
m_helper.loadResources(".chtype", "ChannelType", "channelType", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
loadChannelType(element, sName);
}
}, progress);
// Load the SOA definition XML metadata (which may include definitions of other XML metadata)
m_soaLoader = new XMLSOAMetadataLoader(m_helper);
m_helper.loadResources(".soadef", "SOADefinition", "soadef", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
m_soaLoader.loadDefinition(element, sName);
}
}, progress);
m_soaLoader.resolveReferences();
// dispatcher channel properties loaded from environment.
ChannelType type = m_metadata.getChannelType("ObjectQueue");
m_dispatcherChannel.setType(type);
m_metadata.addChannel(m_dispatcherChannel);
m_helper.loadResources(".channel", "Channel", "channel", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
loadChannel(element, sName);
}
}, progress);
}
final Set componentNameSet = new HashHolder();
m_helper.loadResources(".comp", "Component", "component", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
if (m_bEnvironmentOnly)
{
XMLMetadataHelper.verifyRootElement(element, "Component");
m_metadata.addComponent(new Component(sName));
}
componentNameSet.add(sName);
}
}, progress);
if (componentNameSet.contains("System.ObjectQueueDispatcher") &&
Boolean.parseBoolean(properties.getProperty("queueing.enabled", "true")))
{
// only enable the dispatcher if the metadata supports it.
m_dispatcherChannel.setSendable(true);
m_dispatcherChannel.setReceivable(true);
}
if (connectionsURL != null)
{
boolean bEnvironment = (sConnectionsURL.equals(m_sConfigURL) ||
sConnectionsURL.toLowerCase(Locale.ENGLISH).endsWith(".environment"));
m_helper.loadEncryptedResourceURL(connectionsURL,
(bEnvironment) ? "Environment" : "Connections",
(bEnvironment) ? "environment" : "connections",
new ResourceHandler()
{
public void handleResource(final Element element, final String sName)
{
loadConnections(element, sName);
}
}, m_properties);
}
else
{
loadConnections(null, null);
}
// .server file overrides highest scheme used in the connections file
m_metadata.setEncryptionScheme(m_properties.getProperty("cipher.scheme",
CharacterStreamCipherDispatcher.computeMostSecure(m_helper.getEncryptionSchemeSet())));
if (!bDataSourceOnly)
{
loadUIMetadata(baseDescElement, rootDescElement);
}
progressProxy.shiftRange(0.12);
m_helper.fixup(m_ioFixupList.iterator());
m_ioFixupList = null;
m_helper.loadResources(".extlib", "ExternalLibrary", "externalLibrary", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
loadExternalLibrary(element, sName);
}
}, progress);
m_nStage = STAGE_LOADED_ENVIRONMENT;
progressProxy.progress(null, null, 1.0);
if (m_bEnvironmentOnly || bDataSourceOnly)
{
m_nStage = STAGE_LOAD_ENVIRONMENT_FIXUPS;
m_helper.fixup(m_environmentFixupList.iterator()); // safe to run since no J2EE container
m_nStage = STAGE_FINISHED;
return m_metadata;
}
progressProxy.shiftRange(0.13);
m_helper.loadResources(".security", "SecurityDescriptor", "securityDescriptor", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
loadSecurityDescriptor(element);
}
}, progress);
m_helper.fixup(m_privilegeFixupList.iterator());
m_privilegeFixupList = null;
PrivilegeGroup.resolve(m_metadata);
if (progress != null)
{
progressProxy.shiftRange(0.15);
progress.progress("info.meta.loadingSystemResources", null, 0);
}
Context contextSaved = ThreadContextHolder.getContext();
try
{
ThreadContextHolder.setContext(m_machine.getContext());
m_helper.loadSystemResource("scheme.scm",
"Library", "library", new CharacterStreamHandler()
{
public void handleCharacterStream(Reader reader, String sName) throws IOException
{
loadLibrary(reader, sName, true);
}
});
// Load the Dynamic Object System
m_helper.loadSystemResource("object.scm",
"Library", "library", new CharacterStreamHandler()
{
public void handleCharacterStream(Reader reader, String sName) throws IOException
{
loadLibrary(reader, sName, true);
}
});
// Load the Services Oriented Architecture functionality
m_helper.loadSystemResource("soa.scm",
"Library", "library", new CharacterStreamHandler()
{
public void handleCharacterStream(Reader reader, String sName) throws IOException
{
loadLibrary(reader, sName, true);
}
});
m_helper.loadSystemResource("server.scm",
"Library", "library", new CharacterStreamHandler()
{
public void handleCharacterStream(Reader reader, String sName) throws IOException
{
loadLibrary(reader, sName, true);
}
});
m_helper.loadSystemResource(Metadata.ROOT_CLASS_NAME + ".meta",
"Class", "class", new ResourceHandler()
{
public void handleResource(Element rootElement, String sName)
{
loadClass(rootElement, sName);
}
});
loadExtendedSystemMetadata();
progressProxy.shiftRange(0.16);
m_helper.loadResources(".scm", "Library", "library", new CharacterStreamHandler()
{
public void handleCharacterStream(Reader reader, String sName) throws IOException
{
loadLibrary(reader, sName, false);
}
}, progress);
}
finally
{
ThreadContextHolder.setContext(contextSaved);
}
progressProxy.shiftRange(0.23);
m_helper.loadResources(".meta", "Class", "class", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
String sElement = element.getNodeName();
if (sElement.equals("Class"))
{
loadClass(element, sName);
}
else if (sElement.equals("Aspect"))
{
loadClassAspect(element, sName);
}
else
{
throw new MetadataException("err.meta.metaDocRoot", new Object[]{sElement});
}
}
}, progress);
progressProxy.shiftRange(0.24);
m_helper.loadResources(".enum", "Enumeration", "enum", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
loadEnumeration(element, sName);
}
}, progress);
progressProxy.shiftRange(0.25);
loadUIEventMetadata(baseDescElement, rootDescElement, progress);
if (progress != null)
{
progressProxy.shiftRange(0.26);
progress.progress("info.meta.resolvingResourceReferences", null, 0);
}
m_helper.fixup(m_inheritanceCheckList.iterator());
m_inheritanceCheckList = null;
m_helper.fixup(m_attributeGenerationList.iterator());
m_attributeGenerationList = null;
m_helper.fixup(Collections.singleton(new ClassFixup()
{
public void fixup()
{
m_classAspectArray = ClassAspect.resolveAspects(m_metadata);
}
}).iterator());
m_helper.fixup(m_inheritanceFixupList.iterator());
m_inheritanceFixupList = null;
m_enumerationValueMap = null;
m_helper.fixup(m_attributeFixupList.iterator());
m_attributeFixupList = null;
m_helper.fixup(m_actionFixupList.iterator());
m_actionFixupList = null;
if (m_classAspectArray != null)
{
ClassAspect.resolveMembers(m_classAspectArray);
}
m_helper.fixup(m_persistenceMappingLoadList.iterator());
m_persistenceMappingLoadList = null;
m_helper.fixup(m_attributeResolutionList.iterator());
m_attributeResolutionList = null;
m_helper.fixup(m_inheritance1stPassFixupList.iterator());
m_inheritance1stPassFixupList = null;
progressProxy.shiftRange(0.27);
m_helper.loadResources(".action", "Action", "action", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
loadFlowMacro(element, sName);
}
}, progress);
progressProxy.shiftRange(0.32);
m_helper.loadResources(".workflow", "Workflow", "workflow", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
loadWorkflow(element, sName);
}
}, progress);
progressProxy.shiftRange(0.33);
if (!m_bIntegrationExcluded)
{
m_helper.loadSystemResource("system.formats",
"Formats", "formats", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
loadFormats(element);
}
});
m_helper.loadResources(".format", "Format", "format", new ResourceHandler()
{
public void handleResource(Element element, String sName)
{
loadFormat(element, sName);
}
}, progress);
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)
{