public static RemovableIdentities ofComponent(Cluster cluster, ServiceComponentUninstalledEvent event, KerberosHelper kerberosHelper) throws AmbariException {
    if (cluster.getSecurityType() != SecurityType.KERBEROS) {
      return RemovableIdentities.none();
    }
    KerberosServiceDescriptor serviceDescriptor = kerberosHelper.getKerberosDescriptor(cluster, false).getService(event.getServiceName());
    if (serviceDescriptor == null) {
      return RemovableIdentities.none();
    }
    UsedIdentities usedIdentities = UsedIdentities.populate(
      cluster,
      ServiceExclude.NONE,
      excludeComponent(event.getServiceName(), event.getComponentName(), event.getHostName()),
      kerberosHelper);
    return new RemovableIdentities(
      componentIdentities(singletonList(event.getComponentName()), serviceDescriptor),
      usedIdentities,
      cluster,
      singletonList(event.getComponent()));
  }
Populate the identities with the identities of the removed component
ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/RemovableIdentities.java