/*
  * Contains the default providers used when none are
  * configured in a factory configuration file.
  */
 static List<EntryInfo> getDefaultProviders() {
   WebServicesDelegate delegate = null;
   SecurityServicesUtil svcUtil = SecurityServicesUtil.getInstance();
   if (svcUtil != null) {
     delegate = svcUtil.getHabitat().getComponent(WebServicesDelegate.class);
   }
   if (delegate != null) {
     List<EntryInfo> entries = new ArrayList<EntryInfo>(2);
     entries.add(new EntryInfo(delegate.getDefaultWebServicesProvider(), null));
     entries.add(new EntryInfo(GFServerConfigProvider.class.getName(), null));
     return entries;
   }
   List<EntryInfo> entries = new ArrayList<EntryInfo>(1);
   entries.add(new EntryInfo(GFServerConfigProvider.class.getName(), null));
   return entries;
 }
  // TODO:V3 trying to read system properties here
  protected void handleSupportedCallbacks(Callback[] callbacks)
      throws IOException, UnsupportedCallbackException {

    // this variable is set to true if we have used the older jaas
    // mechanisms to process the callbacks - and we will not need
    // to process further as the inside loop, just takes care
    // of processing all callbacks
    boolean processedSomeAppclientCallbacks = false;

    int i = 0;
    while (i < callbacks.length) {
      if (!processedSomeAppclientCallbacks) {
        if ((callbacks[i] instanceof NameCallback)
            || (callbacks[i] instanceof PasswordCallback)
            || (callbacks[i] instanceof ChoiceCallback)) {

          String loginName = UsernamePasswordStore.getUsername();
          char[] password = UsernamePasswordStore.getPassword();
          boolean doSet = false;
          if (loginName == null) {
            loginName = System.getProperty(LOGIN_NAME);
            doSet = true;
          }
          if (password == null) {
            password = System.getProperty(LOGIN_PASSWORD).toCharArray();
            doSet = true;
          }
          if (doSet) {
            UsernamePasswordStore.set(loginName, password);
          }
          // TODO: V3 CallbackHandler callbackHandler = AppContainer.getCallbackHandler();
          CallbackHandler callbackHandler = SecurityServicesUtil.getInstance().getCallbackHandler();
          if (loginName != null && password != null) {
            // username/password set already
            for (Callback callback : callbacks) {
              if (callback instanceof NameCallback) {
                NameCallback nc = (NameCallback) callback;
                nc.setName(loginName);
              } else if (callback instanceof PasswordCallback) {
                PasswordCallback pc = (PasswordCallback) callback;
                pc.setPassword(password);
              }
            }
          } else {
            // once this is called all callbacks will be handled by
            // callbackHandler and then we dont have to check for
            // NameCallback PasswordCallback and ChoiceCallback
            // again.
            // Let control flow to the callback processors
            callbackHandler.handle(callbacks);
          }
          processedSomeAppclientCallbacks = true;
          break;
        }
      }
      processCallback(callbacks[i]);
      i++;
    }
  }