Java 类javax.security.auth.callback.LanguageCallback 实例源码

项目:javify    文件:AbstractCallbackHandler.java   
public void handle(Callback[] callbacks)
  throws IOException, UnsupportedCallbackException
{
  if (callbacks == null)
    throw new NullPointerException();
  for (int i = 0; i < callbacks.length; i++)
    {
      if (callbacks[i] == null)
        continue;
      if (callbacks[i] instanceof ChoiceCallback)
        handleChoice((ChoiceCallback) callbacks[i]);
      else if (callbacks[i] instanceof ConfirmationCallback)
        handleConfirmation((ConfirmationCallback) callbacks[i]);
      else if (callbacks[i] instanceof LanguageCallback)
        handleLanguage((LanguageCallback) callbacks[i]);
      else if (callbacks[i] instanceof NameCallback)
        handleName((NameCallback) callbacks[i]);
      else if (callbacks[i] instanceof PasswordCallback)
        handlePassword((PasswordCallback) callbacks[i]);
      else if (callbacks[i] instanceof TextInputCallback)
        handleTextInput((TextInputCallback) callbacks[i]);
      else if (callbacks[i] instanceof TextOutputCallback)
        handleTextOutput((TextOutputCallback) callbacks[i]);
      else
        handleOther(callbacks[i]);
    }
}
项目:javify    文件:ConsoleCallbackHandler.java   
protected void handleLanguage(LanguageCallback c) throws IOException
{
  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
  out.print(messages.getString("callback.language"));
  String reply = null;
  reply = in.readLine();
  if (reply == null)
    {
      c.setLocale(Locale.getDefault());
    }
  else
    {
      c.setLocale(new Locale(reply.trim()));
    }
}
项目:jvm-stm    文件:AbstractCallbackHandler.java   
public void handle(Callback[] callbacks)
  throws IOException, UnsupportedCallbackException
{
  if (callbacks == null)
    throw new NullPointerException();
  for (int i = 0; i < callbacks.length; i++)
    {
      if (callbacks[i] == null)
        continue;
      if (callbacks[i] instanceof ChoiceCallback)
        handleChoice((ChoiceCallback) callbacks[i]);
      else if (callbacks[i] instanceof ConfirmationCallback)
        handleConfirmation((ConfirmationCallback) callbacks[i]);
      else if (callbacks[i] instanceof LanguageCallback)
        handleLanguage((LanguageCallback) callbacks[i]);
      else if (callbacks[i] instanceof NameCallback)
        handleName((NameCallback) callbacks[i]);
      else if (callbacks[i] instanceof PasswordCallback)
        handlePassword((PasswordCallback) callbacks[i]);
      else if (callbacks[i] instanceof TextInputCallback)
        handleTextInput((TextInputCallback) callbacks[i]);
      else if (callbacks[i] instanceof TextOutputCallback)
        handleTextOutput((TextOutputCallback) callbacks[i]);
      else
        handleOther(callbacks[i]);
    }
}
项目:jvm-stm    文件:ConsoleCallbackHandler.java   
protected void handleLanguage(LanguageCallback c) throws IOException
{
  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
  out.print(messages.getString("callback.language"));
  String reply = null;
  reply = in.readLine();
  if (reply == null)
    {
      c.setLocale(Locale.getDefault());
    }
  else
    {
      c.setLocale(new Locale(reply.trim()));
    }
}
项目:cn1    文件:LanguageCallbackTest.java   
/**
 * test of Ctor, method set/getLocale() 
 */
public final void testLanguageCallback_01() {
    lc = new LanguageCallback();
    Locale locale = Locale.US;
    lc.setLocale(locale);
    assertEquals("US", lc.getLocale().getCountry());
}
项目:cn1    文件:LanguageCallbackTest.java   
/**
 * locale is null 
 */
public final void testLanguageCallback_02() {
    lc = new LanguageCallback();
    assertNull(lc.getLocale());
    try {
    lc.setLocale(null);
    } catch (NullPointerException e ){}
}
项目:JamVM-PH    文件:AbstractCallbackHandler.java   
public void handle(Callback[] callbacks)
  throws IOException, UnsupportedCallbackException
{
  if (callbacks == null)
    throw new NullPointerException();
  for (int i = 0; i < callbacks.length; i++)
    {
      if (callbacks[i] == null)
        continue;
      if (callbacks[i] instanceof ChoiceCallback)
        handleChoice((ChoiceCallback) callbacks[i]);
      else if (callbacks[i] instanceof ConfirmationCallback)
        handleConfirmation((ConfirmationCallback) callbacks[i]);
      else if (callbacks[i] instanceof LanguageCallback)
        handleLanguage((LanguageCallback) callbacks[i]);
      else if (callbacks[i] instanceof NameCallback)
        handleName((NameCallback) callbacks[i]);
      else if (callbacks[i] instanceof PasswordCallback)
        handlePassword((PasswordCallback) callbacks[i]);
      else if (callbacks[i] instanceof TextInputCallback)
        handleTextInput((TextInputCallback) callbacks[i]);
      else if (callbacks[i] instanceof TextOutputCallback)
        handleTextOutput((TextOutputCallback) callbacks[i]);
      else
        handleOther(callbacks[i]);
    }
}
项目:JamVM-PH    文件:ConsoleCallbackHandler.java   
protected void handleLanguage(LanguageCallback c) throws IOException
{
  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
  out.print(messages.getString("callback.language"));
  String reply = null;
  reply = in.readLine();
  if (reply == null)
    {
      c.setLocale(Locale.getDefault());
    }
  else
    {
      c.setLocale(new Locale(reply.trim()));
    }
}
项目:roboconf-platform    文件:AuthenticationManagerTest.java   
@Test( expected = UnsupportedCallbackException.class )
public void testRoboconfCallbackHandler_failure() throws Exception {

    RoboconfCallbackHandler handler = new RoboconfCallbackHandler( "user", "password" );
    handler.handle( new Callback[] {
            new NameCallback( "Username: " ),
            new PasswordCallback( "Password: ", false ),
            new LanguageCallback()
    });
}
项目:classpath    文件:AbstractCallbackHandler.java   
public void handle(Callback[] callbacks)
  throws IOException, UnsupportedCallbackException
{
  if (callbacks == null)
    throw new NullPointerException();
  for (int i = 0; i < callbacks.length; i++)
    {
      if (callbacks[i] == null)
        continue;
      if (callbacks[i] instanceof ChoiceCallback)
        handleChoice((ChoiceCallback) callbacks[i]);
      else if (callbacks[i] instanceof ConfirmationCallback)
        handleConfirmation((ConfirmationCallback) callbacks[i]);
      else if (callbacks[i] instanceof LanguageCallback)
        handleLanguage((LanguageCallback) callbacks[i]);
      else if (callbacks[i] instanceof NameCallback)
        handleName((NameCallback) callbacks[i]);
      else if (callbacks[i] instanceof PasswordCallback)
        handlePassword((PasswordCallback) callbacks[i]);
      else if (callbacks[i] instanceof TextInputCallback)
        handleTextInput((TextInputCallback) callbacks[i]);
      else if (callbacks[i] instanceof TextOutputCallback)
        handleTextOutput((TextOutputCallback) callbacks[i]);
      else
        handleOther(callbacks[i]);
    }
}
项目:classpath    文件:ConsoleCallbackHandler.java   
protected void handleLanguage(LanguageCallback c) throws IOException
{
  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
  out.print(messages.getString("callback.language"));
  String reply = null;
  reply = in.readLine();
  if (reply == null)
    {
      c.setLocale(Locale.getDefault());
    }
  else
    {
      c.setLocale(new Locale(reply.trim()));
    }
}
项目:freeVM    文件:LanguageCallbackTest.java   
/**
 * test of Ctor, method set/getLocale() 
 */
public final void testLanguageCallback_01() {
    lc = new LanguageCallback();
    Locale locale = Locale.US;
    lc.setLocale(locale);
    assertEquals("US", lc.getLocale().getCountry());
}
项目:freeVM    文件:LanguageCallbackTest.java   
/**
 * locale is null 
 */
public final void testLanguageCallback_02() {
    lc = new LanguageCallback();
    assertNull(lc.getLocale());
    try {
    lc.setLocale(null);
    } catch (NullPointerException e ){}
}
项目:freeVM    文件:LanguageCallbackTest.java   
/**
 * test of Ctor, method set/getLocale() 
 */
public final void testLanguageCallback_01() {
    lc = new LanguageCallback();
    Locale locale = Locale.US;
    lc.setLocale(locale);
    assertEquals("US", lc.getLocale().getCountry());
}
项目:freeVM    文件:LanguageCallbackTest.java   
/**
 * locale is null 
 */
public final void testLanguageCallback_02() {
    lc = new LanguageCallback();
    assertNull(lc.getLocale());
    try {
    lc.setLocale(null);
    } catch (NullPointerException e ){}
}
项目:javify    文件:AWTCallbackHandler.java   
protected synchronized void handleLanguage(LanguageCallback c)
{
  Locale[] locales = Locale.getAvailableLocales();
  String[] languages = new String[locales.length];
  Locale def = Locale.getDefault();
  int defind = 0;
  for (int i = 0; i < locales.length; i++)
    {
      CPStringBuilder lang =
        new CPStringBuilder(locales[i].getDisplayLanguage(locales[i]));
      String country = locales[i].getDisplayCountry(locales[i]);
      String variant = locales[i].getDisplayVariant(locales[i]);
      if (country.length() > 0 && variant.length() > 0)
        {
          lang.append(" (");
          lang.append(country);
          lang.append(", ");
          lang.append(variant);
          lang.append(")");
        }
      else if (country.length() > 0)
        {
          lang.append(" (");
          lang.append(country);
          lang.append(")");
        }
      else if (variant.length() > 0)
        {
          lang.append(" (");
          lang.append(variant);
          lang.append(")");
        }
      languages[i] = lang.toString();
      if (locales[i].equals(def))
        defind = i;
    }
  ChoiceCallback c2 =
    new ChoiceCallback(messages.getString("callback.language"), languages,
                       defind, false);
  handleChoice(c2);
  c.setLocale(def);
  if (c2.getSelectedIndexes() != null && c2.getSelectedIndexes().length > 0)
    {
      int index = c2.getSelectedIndexes()[0];
      if (index >= 0 && index < locales.length)
        c.setLocale(locales[index]);
    }
}
项目:javify    文件:DefaultCallbackHandler.java   
protected void handleLanguage(LanguageCallback c)
{
  c.setLocale(Locale.getDefault());
}
项目:jvm-stm    文件:AWTCallbackHandler.java   
protected synchronized void handleLanguage(LanguageCallback c)
{
  Locale[] locales = Locale.getAvailableLocales();
  String[] languages = new String[locales.length];
  Locale def = Locale.getDefault();
  int defind = 0;
  for (int i = 0; i < locales.length; i++)
    {
      CPStringBuilder lang =
        new CPStringBuilder(locales[i].getDisplayLanguage(locales[i]));
      String country = locales[i].getDisplayCountry(locales[i]);
      String variant = locales[i].getDisplayVariant(locales[i]);
      if (country.length() > 0 && variant.length() > 0)
        {
          lang.append(" (");
          lang.append(country);
          lang.append(", ");
          lang.append(variant);
          lang.append(")");
        }
      else if (country.length() > 0)
        {
          lang.append(" (");
          lang.append(country);
          lang.append(")");
        }
      else if (variant.length() > 0)
        {
          lang.append(" (");
          lang.append(variant);
          lang.append(")");
        }
      languages[i] = lang.toString();
      if (locales[i].equals(def))
        defind = i;
    }
  ChoiceCallback c2 =
    new ChoiceCallback(messages.getString("callback.language"), languages,
                       defind, false);
  handleChoice(c2);
  c.setLocale(def);
  if (c2.getSelectedIndexes() != null && c2.getSelectedIndexes().length > 0)
    {
      int index = c2.getSelectedIndexes()[0];
      if (index >= 0 && index < locales.length)
        c.setLocale(locales[index]);
    }
}
项目:jvm-stm    文件:DefaultCallbackHandler.java   
protected void handleLanguage(LanguageCallback c)
{
  c.setLocale(Locale.getDefault());
}
项目:cn1    文件:LanguageCallbackTest.java   
@Override
protected Object[] getData() {
    LanguageCallback lc = new LanguageCallback();
    lc.setLocale(Locale.UK);
    return new Object[] { lc };
}
项目:cn1    文件:LanguageCallbackTest.java   
public void assertDeserialized(Serializable golden, Serializable test) {
    assertTrue(test instanceof LanguageCallback);
    assertEquals(((LanguageCallback) golden).getLocale(),
            ((LanguageCallback) test).getLocale());
}
项目:JamVM-PH    文件:AWTCallbackHandler.java   
protected synchronized void handleLanguage(LanguageCallback c)
{
  Locale[] locales = Locale.getAvailableLocales();
  String[] languages = new String[locales.length];
  Locale def = Locale.getDefault();
  int defind = 0;
  for (int i = 0; i < locales.length; i++)
    {
      CPStringBuilder lang =
        new CPStringBuilder(locales[i].getDisplayLanguage(locales[i]));
      String country = locales[i].getDisplayCountry(locales[i]);
      String variant = locales[i].getDisplayVariant(locales[i]);
      if (country.length() > 0 && variant.length() > 0)
        {
          lang.append(" (");
          lang.append(country);
          lang.append(", ");
          lang.append(variant);
          lang.append(")");
        }
      else if (country.length() > 0)
        {
          lang.append(" (");
          lang.append(country);
          lang.append(")");
        }
      else if (variant.length() > 0)
        {
          lang.append(" (");
          lang.append(variant);
          lang.append(")");
        }
      languages[i] = lang.toString();
      if (locales[i].equals(def))
        defind = i;
    }
  ChoiceCallback c2 =
    new ChoiceCallback(messages.getString("callback.language"), languages,
                       defind, false);
  handleChoice(c2);
  c.setLocale(def);
  if (c2.getSelectedIndexes() != null && c2.getSelectedIndexes().length > 0)
    {
      int index = c2.getSelectedIndexes()[0];
      if (index >= 0 && index < locales.length)
        c.setLocale(locales[index]);
    }
}
项目:JamVM-PH    文件:DefaultCallbackHandler.java   
protected void handleLanguage(LanguageCallback c)
{
  c.setLocale(Locale.getDefault());
}
项目:classpath    文件:AWTCallbackHandler.java   
protected synchronized void handleLanguage(LanguageCallback c)
{
  Locale[] locales = Locale.getAvailableLocales();
  String[] languages = new String[locales.length];
  Locale def = Locale.getDefault();
  int defind = 0;
  for (int i = 0; i < locales.length; i++)
    {
      CPStringBuilder lang =
        new CPStringBuilder(locales[i].getDisplayLanguage(locales[i]));
      String country = locales[i].getDisplayCountry(locales[i]);
      String variant = locales[i].getDisplayVariant(locales[i]);
      if (country.length() > 0 && variant.length() > 0)
        {
          lang.append(" (");
          lang.append(country);
          lang.append(", ");
          lang.append(variant);
          lang.append(")");
        }
      else if (country.length() > 0)
        {
          lang.append(" (");
          lang.append(country);
          lang.append(")");
        }
      else if (variant.length() > 0)
        {
          lang.append(" (");
          lang.append(variant);
          lang.append(")");
        }
      languages[i] = lang.toString();
      if (locales[i].equals(def))
        defind = i;
    }
  ChoiceCallback c2 =
    new ChoiceCallback(messages.getString("callback.language"), languages,
                       defind, false);
  handleChoice(c2);
  c.setLocale(def);
  if (c2.getSelectedIndexes() != null && c2.getSelectedIndexes().length > 0)
    {
      int index = c2.getSelectedIndexes()[0];
      if (index >= 0 && index < locales.length)
        c.setLocale(locales[index]);
    }
}
项目:classpath    文件:DefaultCallbackHandler.java   
protected void handleLanguage(LanguageCallback c)
{
  c.setLocale(Locale.getDefault());
}
项目:freeVM    文件:LanguageCallbackTest.java   
@Override
protected Object[] getData() {
    LanguageCallback lc = new LanguageCallback();
    lc.setLocale(Locale.UK);
    return new Object[] { lc };
}
项目:freeVM    文件:LanguageCallbackTest.java   
public void assertDeserialized(Serializable golden, Serializable test) {
    assertTrue(test instanceof LanguageCallback);
    assertEquals(((LanguageCallback) golden).getLocale(),
            ((LanguageCallback) test).getLocale());
}
项目:freeVM    文件:LanguageCallbackTest.java   
@Override
protected Object[] getData() {
    LanguageCallback lc = new LanguageCallback();
    lc.setLocale(Locale.UK);
    return new Object[] { lc };
}
项目:freeVM    文件:LanguageCallbackTest.java   
public void assertDeserialized(Serializable golden, Serializable test) {
    assertTrue(test instanceof LanguageCallback);
    assertEquals(((LanguageCallback) golden).getLocale(),
            ((LanguageCallback) test).getLocale());
}
项目:javify    文件:AbstractCallbackHandler.java   
/**
 * Handles a {@link LanguageCallback}.
 *
 * @param callback The language callback.
 * @throws IOException If an I/O error occurs.
 */
protected abstract void handleLanguage(LanguageCallback callback)
  throws IOException;
项目:jvm-stm    文件:AbstractCallbackHandler.java   
/**
 * Handles a {@link LanguageCallback}.
 *
 * @param callback The language callback.
 * @throws IOException If an I/O error occurs.
 */
protected abstract void handleLanguage(LanguageCallback callback)
  throws IOException;
项目:JamVM-PH    文件:AbstractCallbackHandler.java   
/**
 * Handles a {@link LanguageCallback}.
 *
 * @param callback The language callback.
 * @throws IOException If an I/O error occurs.
 */
protected abstract void handleLanguage(LanguageCallback callback)
  throws IOException;
项目:classpath    文件:AbstractCallbackHandler.java   
/**
 * Handles a {@link LanguageCallback}.
 *
 * @param callback The language callback.
 * @throws IOException If an I/O error occurs.
 */
protected abstract void handleLanguage(LanguageCallback callback)
  throws IOException;