ResolvedConfigurationIdentifier id;
valuesRead++;
switch (type) {
case NEW_DEP:
id = resolvedConfigurationIdentifierSerializer.read(decoder);
allDependencies.put(id, new DefaultResolvedDependency(id.getId(), id.getConfiguration()));
break;
case ROOT:
id = resolvedConfigurationIdentifierSerializer.read(decoder);
results.root = allDependencies.get(id);
if (results.root == null) {
throw new IllegalStateException(String.format("Unexpected root id %s. Seen ids: %s", id, allDependencies.keySet()));
}
//root should be the last
LOG.debug("Loaded resolved configuration results ({}) from {}", clock.getTime(), binaryStore);
return results;
case FIRST_LVL:
id = resolvedConfigurationIdentifierSerializer.read(decoder);
DefaultResolvedDependency dependency = allDependencies.get(id);
if (dependency == null) {
throw new IllegalStateException(String.format("Unexpected first level id %s. Seen ids: %s", id, allDependencies.keySet()));
}
results.firstLevelDependencies.put(mapping.getModuleDependency(id), dependency);
break;
case PARENT_CHILD:
ResolvedConfigurationIdentifier parentId = resolvedConfigurationIdentifierSerializer.read(decoder);
ResolvedConfigurationIdentifier childId = resolvedConfigurationIdentifierSerializer.read(decoder);
DefaultResolvedDependency parent = allDependencies.get(parentId);
DefaultResolvedDependency child = allDependencies.get(childId);
if (parent == null) {
throw new IllegalStateException(String.format("Unexpected parent dependency id %s. Seen ids: %s", parentId, allDependencies.keySet()));
}
if (child == null) {
throw new IllegalStateException(String.format("Unexpected child dependency id %s. Seen ids: %s", childId, allDependencies.keySet()));
}
parent.addChild(child);
break;
case PARENT_ARTIFACT:
ResolvedConfigurationIdentifier artifactParentId = resolvedConfigurationIdentifierSerializer.read(decoder);
ResolvedConfigurationIdentifier artifactChildId = resolvedConfigurationIdentifierSerializer.read(decoder);
DefaultResolvedDependency artifactParent = allDependencies.get(artifactParentId);
DefaultResolvedDependency artifactChild = allDependencies.get(artifactChildId);
if (artifactParent == null) {
throw new IllegalStateException(String.format("Unexpected parent dependency id %s. Seen ids: %s", artifactParentId, allDependencies.keySet()));
}
if (artifactChild == null) {
throw new IllegalStateException(String.format("Unexpected child dependency id %s. Seen ids: %s", artifactChildId, allDependencies.keySet()));