static Map trustedProviderSetToProtocolMap(Set providerSet,String realm){
  if ((providerSet == null) || providerSet.isEmpty()) {
    return Collections.EMPTY_MAP;
  }
  Map map=new HashMap();
  Set wsfedSet=new HashSet();
  Set saml2Set=new HashSet();
  Set idffSet=new HashSet();
  Iterator it=providerSet.iterator();
  while (it.hasNext()) {
    String val=(String)it.next();
    if (debug.messageEnabled()) {
      debug.message("COTUtils.setToPrototolMap: check " + val);
    }
    if (val.endsWith(SAML2_DELIM)) {
      saml2Set.add(val.substring(0,val.length() - SAML2_DELIM.length()));
    }
 else     if (val.endsWith(IDFF_DELIM)) {
      idffSet.add(val.substring(0,val.length() - IDFF_DELIM.length()));
    }
 else     if (val.endsWith(WSFED_DELIM)) {
      wsfedSet.add(val.substring(0,val.length() - WSFED_DELIM.length()));
    }
 else {
      Set protocolSet=findProtocolsForEntity(val,realm);
      if ((protocolSet != null) && !protocolSet.isEmpty()) {
        Iterator pIt=protocolSet.iterator();
        while (pIt.hasNext()) {
          String proto=(String)pIt.next();
          if (proto.equals(COTConstants.SAML2)) {
            saml2Set.add(val);
          }
 else           if (proto.equals(COTConstants.IDFF)) {
            idffSet.add(val);
          }
 else           if (proto.equals(COTConstants.WS_FED)) {
            wsfedSet.add(val);
          }
        }
      }
    }
  }
  map.put(COTConstants.SAML2,saml2Set);
  map.put(COTConstants.IDFF,idffSet);
  map.put(COTConstants.WS_FED,wsfedSet);
  if (debug.messageEnabled()) {
    debug.message("COTUtils.setToProtocolMap: return " + map);
  }
  return map;
}

static Map trustedProviderSetToProtocolMap ( Set providerSet , String realm ) { if ( ( providerSet == null ) || providerSet . isEmpty ( ) ) { return Collections . EMPTY_MAP ; } Map map = new HashMap ( ) ; Set wsfedSet = new HashSet ( ) ; Set saml2Set = new HashSet ( ) ; Set idffSet = new HashSet ( ) ; Iterator it = providerSet . iterator ( ) ; while ( it . hasNext ( ) ) { String val = ( String ) it . next ( ) ; if ( debug . messageEnabled ( ) ) { debug . message ( "COTUtils.setToPrototolMap: check " + val ) ; } if ( val . endsWith ( SAML2_DELIM ) ) { saml2Set . add ( val . substring ( 0 , val . length ( ) - SAML2_DELIM . length ( ) ) ) ; } else if ( val . endsWith ( IDFF_DELIM ) ) { idffSet . add ( val . substring ( 0 , val . length ( ) - IDFF_DELIM . length ( ) ) ) ; } else if ( val . endsWith ( WSFED_DELIM ) ) { wsfedSet . add ( val . substring ( 0 , val . length ( ) - WSFED_DELIM . length ( ) ) ) ; } else { Set protocolSet = findProtocolsForEntity ( val , realm ) ; if ( ( protocolSet != null ) && ! protocolSet . isEmpty ( ) ) { Iterator pIt = protocolSet . iterator ( ) ; while ( pIt . hasNext ( ) ) { String proto = ( String ) pIt . next ( ) ; if ( proto . equals ( COTConstants . SAML2 ) ) { saml2Set . add ( val ) ; } else if ( proto . equals ( COTConstants . IDFF ) ) { idffSet . add ( val ) ; } else if ( proto . equals ( COTConstants . WS_FED ) ) { wsfedSet . add ( val ) ; } } } } } map . put ( COTConstants . SAML2 , saml2Set ) ; map . put ( COTConstants . IDFF , idffSet ) ; map . put ( COTConstants . WS_FED , wsfedSet ) ; if ( debug . messageEnabled ( ) ) { debug . message ( "COTUtils.setToProtocolMap: return " + map ) ; } return map ; }
converts set of cot trusted providers to map . key of the map is protocol name , value is a set of entity ids which speaks the protocol . protocl name is one of cotconstants . ws_fed , cotconstants . saml2 or cotconstants . idff .
