{
Class mechanismClass = CallbackHandlerRegistry.getInstance().getCallbackHandlerClass(mechanism);
try
{
Object instance = mechanismClass.newInstance();
AMQPCallbackHandler cbh = (AMQPCallbackHandler) instance;
cbh.initialise(username,password);
return cbh;
}
catch (Exception e)
{
throw new QpidException("Unable to create callback handler: " + e,ErrorCode.UNDEFINED, e.getCause());