| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.DisconnectReason; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | |
| | | import static org.opends.server.loggers.Debug.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugCought; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.server.messages.ExtensionsMessages.*; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | |
| | | public class NullConnectionSecurityProvider |
| | | extends ConnectionSecurityProvider |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.extensions.NullConnectionSecurityProvider"; |
| | | |
| | | |
| | | |
| | |
| | | { |
| | | super(); |
| | | |
| | | assert debugConstructor(CLASS_NAME); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | super(); |
| | | |
| | | assert debugConstructor(CLASS_NAME, String.valueOf(clientConnection)); |
| | | |
| | | this.clientConnection = clientConnection; |
| | | this.socketChannel = socketChannel; |
| | |
| | | public void initializeConnectionSecurityProvider(ConfigEntry configEntry) |
| | | throws ConfigException, InitializationException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "initializeConnectionSecurityProvider", |
| | | String.valueOf(configEntry)); |
| | | |
| | | clearBuffer = null; |
| | | clientConnection = null; |
| | |
| | | */ |
| | | public void finalizeConnectionSecurityProvider() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "finalizeConnectionSecurityProvider"); |
| | | |
| | | // No implementation is required. |
| | | } |
| | |
| | | */ |
| | | public String getSecurityMechanismName() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getSecurityMechanismName"); |
| | | |
| | | return "NULL"; |
| | | } |
| | |
| | | */ |
| | | public boolean isSecure() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "isSecure"); |
| | | |
| | | // This is not a secure provider. |
| | | return false; |
| | |
| | | SocketChannel socketChannel) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "newInstance", |
| | | String.valueOf(clientConnection), |
| | | String.valueOf(socketChannel)); |
| | | |
| | | return new NullConnectionSecurityProvider(clientConnection, |
| | | socketChannel); |
| | |
| | | */ |
| | | public void disconnect(boolean connectionValid) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "disconnect"); |
| | | |
| | | // No implementation is required. |
| | | } |
| | |
| | | */ |
| | | public int getClearBufferSize() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getClearBufferSize"); |
| | | |
| | | return BUFFER_SIZE; |
| | | } |
| | |
| | | */ |
| | | public int getEncodedBufferSize() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getEncodedBufferSize"); |
| | | |
| | | return BUFFER_SIZE; |
| | | } |
| | |
| | | */ |
| | | public boolean readData() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "readData"); |
| | | |
| | | clearBuffer.clear(); |
| | | while (true) |
| | |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | assert debugException(CLASS_NAME, "readData", ioe); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, ioe); |
| | | } |
| | | |
| | | // An error occurred while trying to read data from the client. |
| | | // Disconnect and return. |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "readData", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | // An unexpected error occurred. Disconnect and return. |
| | | clientConnection.disconnect(DisconnectReason.SERVER_ERROR, true, |
| | |
| | | */ |
| | | public boolean writeData(ByteBuffer clearData) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "writeData", "java.nio.ByteBuffer"); |
| | | |
| | | int position = clearData.position(); |
| | | int limit = clearData.limit(); |
| | |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | assert debugException(CLASS_NAME, "writeData", ioe); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, ioe); |
| | | } |
| | | |
| | | // An error occurred while trying to write data to the client. Disconnect |
| | | // and return. |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "writeData", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | // An unexpected error occurred. Disconnect and return. |
| | | clientConnection.disconnect(DisconnectReason.SERVER_ERROR, true, |