// Get the domain composite items
Entry<String, Item>[] domainEntries = domainCompositeCollection.getAll();
// Populate the domain composite
Workspace workspace = workspaceFactory.createWorkspace();
workspace.setModelResolver(new ExtensibleModelResolver(workspace, extensionPoints));
Map<String, Contribution> contributionMap = new HashMap<String, Contribution>();
for (Entry<String, Item> domainEntry: domainEntries) {
// Load the required contributions
String contributionURI = contributionURI(domainEntry.getKey());
Contribution contribution = contributionMap.get(contributionURI);
if (contribution == null) {
// The contribution has not been loaded yet, load it with all its dependencies
Entry<String, Item>[] entries = contributionCollection.query("alldependencies=" + contributionURI);
for (Entry<String, Item> entry: entries) {
Item dependencyItem = entry.getData();
String dependencyURI = entry.getKey();
if (!contributionMap.containsKey(dependencyURI)) {
// Read the contribution
Contribution dependency;
try {
String dependencyLocation = dependencyItem.getAlternate();
dependency = contribution(workspace, dependencyURI, dependencyLocation);
} catch (Exception e) {
if (contributionURI.equals(dependencyURI)) {
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, getDescription(e));
return;
} else {
continue;
}
}
workspace.getContributions().add(dependency);
contributionMap.put(dependencyURI, dependency);
if (contributionURI.equals(entry.getKey())) {
contribution = dependency;
}