if (type == null)
{
if (expectedConfiguredObjectClass == null)
{
throw new IllegalConfigurationException("Type attribute is not provided for configuration entry " + parent);
}
else
{
type = expectedConfiguredObjectClass.getSimpleName();
}
}
String name = null;
if (attributes != null)
{
name = (String) attributes.get(ATTRIBUTE_NAME);
}
if ((name == null || "".equals(name)))
{
if (expectedConfiguredObjectClass == Broker.class)
{
name = DEFAULT_BROKER_NAME;
}
else
{
throw new IllegalConfigurationException("Name attribute is not provided for configuration entry " + parent);
}
}
UUID id = null;
if (idAsString == null)
{
id = UUIDGenerator.generateRandomUUID();
_generatedObjectIdDuringLoad = true;
}
else
{
try
{
id = UUID.fromString(idAsString);
}
catch (Exception e)
{
throw new IllegalConfigurationException(
"ID attribute value does not conform to UUID format for configuration entry " + parent);
}
}
ConfigurationEntry entry = new ConfigurationEntry(id, type, attributes, childrenIds, this);
if (entries.containsKey(id))
{
throw new IllegalConfigurationException("Duplicate id is found: " + id
+ "! The following configuration entries have the same id: " + entries.get(id) + ", " + entry);
}
entries.put(id, entry);
return entry;
}