try
{
if (InternalUtils.isBlank(componentClassName))
{
throw new TapestryException(
PageloadMessages.missingComponentType(), location, null);
}
EmbeddedComponentAssemblerImpl embedded = new EmbeddedComponentAssemblerImpl(assemblerSource,
instantiatorSource, componentClassResolver, componentClassName, getSelector(), embeddedModel,
mixins, location);
if (embeddedIdToAssembler == null)
embeddedIdToAssembler = CollectionFactory.newMap();
embeddedIdToAssembler.put(embeddedId, embedded);
if (embeddedModel != null)
{
for (String publishedParameterName : embeddedModel.getPublishedParameters())
{
if (publishedParameterToEmbeddedId == null)
publishedParameterToEmbeddedId = CollectionFactory.newCaseInsensitiveMap();
String existingEmbeddedId = publishedParameterToEmbeddedId.get(publishedParameterName);
if (existingEmbeddedId != null)
{
throw new TapestryException(
PageloadMessages.parameterAlreadyPublished(publishedParameterName, embeddedId, instantiator
.getModel().getComponentClassName(), existingEmbeddedId), location, null);
}
publishedParameterToEmbeddedId.put(publishedParameterName, embeddedId);
}
}
return embedded;
} catch (Exception ex)
{
throw new TapestryException(PageloadMessages.failureCreatingEmbeddedComponent(embeddedId, instantiator
.getModel().getComponentClassName(), InternalUtils.toMessage(ex)), location, ex);
}
}