*/
final ComponentRegistryKey checkComponentName( final Bundle bundle, final String name )
{
// register the name if no registration for that name exists already
final ComponentRegistryKey key = new ComponentRegistryKey( bundle, name );
ComponentHolder existingRegistration = null;
boolean present;
synchronized ( m_componentHoldersByName )
{
present = m_componentHoldersByName.containsKey( key );
if ( !present )
{
m_componentHoldersByName.put( key, null );
}
else
{
existingRegistration = m_componentHoldersByName.get( key );
}
}
// there was a registration already, throw an exception and use the
// existing registration to provide more information if possible
if ( present )
{
String message = "The component name '" + name + "' has already been registered";
if ( existingRegistration != null )
{
Bundle cBundle = existingRegistration.getActivator().getBundleContext().getBundle();
ComponentMetadata cMeta = existingRegistration.getComponentMetadata();
StringBuffer buf = new StringBuffer( message );
buf.append( " by Bundle " ).append( cBundle.getBundleId() );
if ( cBundle.getSymbolicName() != null )
{