String role = dependency.getAttribute( "role", null ); // legacy
if( role == null )
{
role = dependency.getAttribute( "key", null );
}
ReferenceDescriptor reference =
buildReferenceDescriptor( dependency );
final boolean optional =
dependency.getAttributeAsBoolean( "optional", false );
final Properties attributes =
buildAttributes( dependency.getChild( "attributes" ) );
//
// default to name of service if role unspecified
//
if( null == role )
{
role = reference.getClassname();
}
return new DependencyDescriptor( role, reference, optional, attributes );
}