/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* JAAS imports */
/* Java imports */
/**
* <p>
* Prompts and reads from the command line for answers to authentication
* questions.
* This can be used by a JAAS application to instantiate a
* CallbackHandler
* @see javax.security.auth.callback
*/
/**
* <p>Creates a callback handler that prompts and reads from the
* command line for answers to authentication questions.
* This can be used by JAAS applications to instantiate a
* CallbackHandler.
*/
public TextCallbackHandler() { }
/**
* Handles the specified set of callbacks.
*
* @param callbacks the callbacks to handle
* @throws IOException if an input or output error occurs.
* @throws UnsupportedCallbackException if the callback is not an
* instance of NameCallback or PasswordCallback
*/
{
if (callbacks[i] instanceof TextOutputCallback) {
switch (tc.getMessageType()) {
text = "";
break;
case TextOutputCallback.WARNING:
text = "Warning: ";
break;
case TextOutputCallback.ERROR:
text = "Error: ";
break;
default:
throw new UnsupportedCallbackException(
callbacks[i], "Unrecognized message type");
}
}
}
} else if (callbacks[i] instanceof NameCallback) {
} else {
}
}
} else if (callbacks[i] instanceof PasswordCallback) {
} else if (callbacks[i] instanceof ConfirmationCallback) {
} else {
throw new UnsupportedCallbackException(
callbacks[i], "Unrecognized Callback");
}
}
/* Do the confirmation callback last. */
if (confirmation != null) {
}
}
/* Reads a line of input */
throw new IOException("Cannot read from System.in");
}
return result;
}
{
switch (messageType) {
case ConfirmationCallback.WARNING:
prefix = "Warning: ";
break;
case ConfirmationCallback.ERROR:
prefix = "Error: ";
break;
prefix = "";
break;
default:
throw new UnsupportedCallbackException(
}
class OptionInfo {
int value;
}
}
switch (optionType) {
options = new OptionInfo[] {
};
break;
options = new OptionInfo[] {
};
break;
options = new OptionInfo[] {
};
break;
}
break;
default:
throw new UnsupportedCallbackException(
}
prompt = "";
}
}
// defaultOption is an index into the options array
} else {
// defaultOption is an option value
}
}
int result;
try {
}
} catch (NumberFormatException e) {
}
}
}