muleContext.start();
MuleArtifact artifact = null;
if (embedInFlow)
{
Pipeline pipeline = muleContext.getRegistry().lookupObject(flowName);
if (pipeline.getMessageSource() == null)
{
if (pipeline.getMessageProcessors() != null && pipeline.getMessageProcessors().size() > 0)
{
artifact = new DefaultMuleArtifact(pipeline.getMessageProcessors().get(0));
}
else
{
throw new IllegalArgumentException("artifact is null");
}
}
else
{
artifact = new DefaultMuleArtifact(pipeline.getMessageSource());
}
}
else
{
artifact = new DefaultMuleArtifact(muleContext.getRegistry().lookupObject(element.getAttribute("name")));