You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2008/05/12 13:49:46 UTC
svn commit: r655480 [4/11] - in /directory:
apacheds/trunk/apacheds-jdbm/src/examples/
apacheds/trunk/apacheds-jdbm/src/main/java/jdbm/btree/
apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/
apached...
Modified: directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/IntOption.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/IntOption.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/IntOption.java (original)
+++ directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/IntOption.java Mon May 12 04:49:35 2008
@@ -31,33 +31,33 @@
* @version $Rev: 551805 $, $Date: 2007-06-29 00:57:04 -0500 (Fr, 29 Jun 2007) $
*/
public abstract class IntOption extends DhcpOption {
- /**
- * The int value (represented as a long because of the unsignedness).
- */
- private long intValue;
+ /**
+ * The int value (represented as a long because of the unsignedness).
+ */
+ private long intValue;
- /*
- * @see org.apache.directory.server.dhcp.options.DhcpOption#setData(byte[])
- */
- public void setData(byte[] data) {
- intValue = (data[0] & 0xff) << 24 | (data[1] & 0xff) << 16
- | (data[2] & 0xff) << 8 | (data[3] & 0xff);
- }
+ /*
+ * @see org.apache.directory.server.dhcp.options.DhcpOption#setData(byte[])
+ */
+ public void setData(byte[] data) {
+ intValue = (data[0] & 0xff) << 24 | (data[1] & 0xff) << 16
+ | (data[2] & 0xff) << 8 | (data[3] & 0xff);
+ }
- /*
- * @see org.apache.directory.server.dhcp.options.DhcpOption#getData()
- */
- public byte[] getData() {
- return new byte[]{(byte) (intValue >> 24 & 0xff),
- (byte) (intValue >> 16 & 0xff), (byte) (intValue >> 8 & 0xff),
- (byte) (intValue & 0xff)};
- }
+ /*
+ * @see org.apache.directory.server.dhcp.options.DhcpOption#getData()
+ */
+ public byte[] getData() {
+ return new byte[]{(byte) (intValue >> 24 & 0xff),
+ (byte) (intValue >> 16 & 0xff), (byte) (intValue >> 8 & 0xff),
+ (byte) (intValue & 0xff)};
+ }
- public long getIntValue() {
- return intValue;
- }
+ public long getIntValue() {
+ return intValue;
+ }
- public void setIntValue(long intValue) {
- this.intValue = intValue;
- }
+ public void setIntValue(long intValue) {
+ this.intValue = intValue;
+ }
}
Modified: directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/ShortOption.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/ShortOption.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/ShortOption.java (original)
+++ directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/ShortOption.java Mon May 12 04:49:35 2008
@@ -34,31 +34,31 @@
* @version $Rev: 551805 $, $Date: 2007-06-29 00:57:04 -0500 (Fr, 29 Jun 2007) $
*/
public abstract class ShortOption extends DhcpOption {
- /**
- * The short value (represented as an int because of the unsignedness).
- */
- private int shortValue;
+ /**
+ * The short value (represented as an int because of the unsignedness).
+ */
+ private int shortValue;
- /*
- * @see org.apache.directory.server.dhcp.options.DhcpOption#setData(byte[])
- */
- public void setData(byte[] data) {
- shortValue = (data[0] & 0xff) << 8 | (data[1] & 0xff);
- }
+ /*
+ * @see org.apache.directory.server.dhcp.options.DhcpOption#setData(byte[])
+ */
+ public void setData(byte[] data) {
+ shortValue = (data[0] & 0xff) << 8 | (data[1] & 0xff);
+ }
- /*
- * @see org.apache.directory.server.dhcp.options.DhcpOption#getData()
- */
- public byte[] getData() {
- return new byte[]{(byte) (shortValue >> 8 & 0xff),
- (byte) (shortValue & 0xff)};
- }
+ /*
+ * @see org.apache.directory.server.dhcp.options.DhcpOption#getData()
+ */
+ public byte[] getData() {
+ return new byte[]{(byte) (shortValue >> 8 & 0xff),
+ (byte) (shortValue & 0xff)};
+ }
- public int getShortValue() {
- return shortValue;
- }
+ public int getShortValue() {
+ return shortValue;
+ }
- public void setShortValue(int shortValue) {
- this.shortValue = shortValue;
- }
+ public void setShortValue(int shortValue) {
+ this.shortValue = shortValue;
+ }
}
Modified: directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/dhcp/UnrecognizedOption.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/dhcp/UnrecognizedOption.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/dhcp/UnrecognizedOption.java (original)
+++ directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/dhcp/UnrecognizedOption.java Mon May 12 04:49:35 2008
@@ -30,20 +30,20 @@
* @version $Rev: 552077 $, $Date: 2007-06-29 21:23:39 -0500 (Fr, 29 Jun 2007) $
*/
public class UnrecognizedOption extends DhcpOption {
- private final byte tag;
+ private final byte tag;
- public UnrecognizedOption() {
- tag = -1;
- }
+ public UnrecognizedOption() {
+ tag = -1;
+ }
- /*
- * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
- */
- public byte getTag() {
- return tag;
- }
+ /*
+ * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag()
+ */
+ public byte getTag() {
+ return tag;
+ }
- public UnrecognizedOption(byte tag) {
- this.tag = tag;
- }
+ public UnrecognizedOption(byte tag) {
+ this.tag = tag;
+ }
}
Modified: directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolHandler.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolHandler.java (original)
+++ directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolHandler.java Mon May 12 04:49:35 2008
@@ -43,132 +43,132 @@
* @version $Rev$, $Date$
*/
public class DhcpProtocolHandler implements IoHandler {
- private static final Logger logger = LoggerFactory
- .getLogger(DhcpProtocolHandler.class);
+ private static final Logger logger = LoggerFactory
+ .getLogger(DhcpProtocolHandler.class);
- /**
- * Default DHCP client port
- */
- public static final int CLIENT_PORT = 68;
-
- /**
- * Default DHCP server port
- */
- public static final int SERVER_PORT = 67;
-
- /**
- * The DHCP service implementation. The implementation is supposed to be
- * thread-safe.
- */
- private final DhcpService dhcpService;
-
- /**
- *
- */
- public DhcpProtocolHandler(DhcpService service) {
- this.dhcpService = service;
- }
-
- public void sessionCreated(IoSession session) throws Exception {
- logger.debug("{} CREATED", session.getLocalAddress());
- session.getFilterChain().addFirst("codec",
- new ProtocolCodecFilter(new DhcpProtocolCodecFactory()));
- }
-
- public void sessionOpened(IoSession session) {
- logger.debug("{} -> {} OPENED", session.getRemoteAddress(), session
- .getLocalAddress());
- }
-
- public void sessionClosed(IoSession session) {
- logger.debug("{} -> {} CLOSED", session.getRemoteAddress(), session
- .getLocalAddress());
- }
-
- public void sessionIdle(IoSession session, IdleStatus status) {
- // ignore
- }
-
- public void exceptionCaught(IoSession session, Throwable cause) {
- logger.error("EXCEPTION CAUGHT ", cause);
- cause.printStackTrace(System.out);
-
- session.close();
- }
-
- public void messageReceived(IoSession session, Object message)
- throws Exception {
- if (logger.isDebugEnabled())
- logger.debug("{} -> {} RCVD: {} " + message, session.getRemoteAddress(),
- session.getLocalAddress());
-
- final DhcpMessage request = (DhcpMessage) message;
-
- final DhcpMessage reply = dhcpService.getReplyFor(
- (InetSocketAddress) session.getServiceAddress(),
- (InetSocketAddress) session.getRemoteAddress(), request);
-
- if (null != reply) {
- final InetSocketAddress isa = determineMessageDestination(request, reply);
- ((BroadcastIoSession) session).write(reply, isa);
- }
- }
-
- /**
- * Determine where to send the message: <br>
- * If the 'giaddr' field in a DHCP message from a client is non-zero, the
- * server sends any return messages to the 'DHCP server' port on the BOOTP
- * relay agent whose address appears in 'giaddr'. If the 'giaddr' field is
- * zero and the 'ciaddr' field is nonzero, then the server unicasts DHCPOFFER
- * and DHCPACK messages to the address in 'ciaddr'. If 'giaddr' is zero and
- * 'ciaddr' is zero, and the broadcast bit is set, then the server broadcasts
- * DHCPOFFER and DHCPACK messages to 0xffffffff. If the broadcast bit is not
- * set and 'giaddr' is zero and 'ciaddr' is zero, then the server unicasts
- * DHCPOFFER and DHCPACK messages to the client's hardware address and
- * 'yiaddr' address. In all cases, when 'giaddr' is zero, the server
- * broadcasts any DHCPNAK messages to 0xffffffff.
- *
- * @param request
- * @param reply
- * @return
- */
- private InetSocketAddress determineMessageDestination(DhcpMessage request,
- DhcpMessage reply) {
-
- final MessageType mt = reply.getMessageType();
- if (!isNullAddress(request.getRelayAgentAddress()))
- // send to agent, if received via agent.
- return new InetSocketAddress(request.getRelayAgentAddress(), SERVER_PORT);
- else if (null != mt && mt == MessageType.DHCPNAK)
- // force broadcast for DHCPNAKs
- return new InetSocketAddress("255.255.255.255", 68);
- else // not a NAK...
- if (!isNullAddress(request.getCurrentClientAddress()))
- // have a current address? unicast to it.
- return new InetSocketAddress(request.getCurrentClientAddress(),
- CLIENT_PORT);
- else
- return new InetSocketAddress("255.255.255.255", 68);
- }
-
- /**
- * Determine, whether the given address ist actually the null address
- * "0.0.0.0".
- *
- * @param relayAgentAddress
- * @return
- */
- private boolean isNullAddress(InetAddress addr) {
- final byte a[] = addr.getAddress();
- for (int i = 0; i < a.length; i++)
- if (a[i] != 0)
- return false;
- return true;
- }
-
- public void messageSent(IoSession session, Object message) {
- if (logger.isDebugEnabled())
- logger.debug("{} -> {} SENT: " + message, session.getRemoteAddress(),
- session.getLocalAddress());
- }
+ /**
+ * Default DHCP client port
+ */
+ public static final int CLIENT_PORT = 68;
+
+ /**
+ * Default DHCP server port
+ */
+ public static final int SERVER_PORT = 67;
+
+ /**
+ * The DHCP service implementation. The implementation is supposed to be
+ * thread-safe.
+ */
+ private final DhcpService dhcpService;
+
+ /**
+ *
+ */
+ public DhcpProtocolHandler(DhcpService service) {
+ this.dhcpService = service;
+ }
+
+ public void sessionCreated(IoSession session) throws Exception {
+ logger.debug("{} CREATED", session.getLocalAddress());
+ session.getFilterChain().addFirst("codec",
+ new ProtocolCodecFilter(new DhcpProtocolCodecFactory()));
+ }
+
+ public void sessionOpened(IoSession session) {
+ logger.debug("{} -> {} OPENED", session.getRemoteAddress(), session
+ .getLocalAddress());
+ }
+
+ public void sessionClosed(IoSession session) {
+ logger.debug("{} -> {} CLOSED", session.getRemoteAddress(), session
+ .getLocalAddress());
+ }
+
+ public void sessionIdle(IoSession session, IdleStatus status) {
+ // ignore
+ }
+
+ public void exceptionCaught(IoSession session, Throwable cause) {
+ logger.error("EXCEPTION CAUGHT ", cause);
+ cause.printStackTrace(System.out);
+
+ session.close();
+ }
+
+ public void messageReceived(IoSession session, Object message)
+ throws Exception {
+ if (logger.isDebugEnabled())
+ logger.debug("{} -> {} RCVD: {} " + message, session.getRemoteAddress(),
+ session.getLocalAddress());
+
+ final DhcpMessage request = (DhcpMessage) message;
+
+ final DhcpMessage reply = dhcpService.getReplyFor(
+ (InetSocketAddress) session.getServiceAddress(),
+ (InetSocketAddress) session.getRemoteAddress(), request);
+
+ if (null != reply) {
+ final InetSocketAddress isa = determineMessageDestination(request, reply);
+ ((BroadcastIoSession) session).write(reply, isa);
+ }
+ }
+
+ /**
+ * Determine where to send the message: <br>
+ * If the 'giaddr' field in a DHCP message from a client is non-zero, the
+ * server sends any return messages to the 'DHCP server' port on the BOOTP
+ * relay agent whose address appears in 'giaddr'. If the 'giaddr' field is
+ * zero and the 'ciaddr' field is nonzero, then the server unicasts DHCPOFFER
+ * and DHCPACK messages to the address in 'ciaddr'. If 'giaddr' is zero and
+ * 'ciaddr' is zero, and the broadcast bit is set, then the server broadcasts
+ * DHCPOFFER and DHCPACK messages to 0xffffffff. If the broadcast bit is not
+ * set and 'giaddr' is zero and 'ciaddr' is zero, then the server unicasts
+ * DHCPOFFER and DHCPACK messages to the client's hardware address and
+ * 'yiaddr' address. In all cases, when 'giaddr' is zero, the server
+ * broadcasts any DHCPNAK messages to 0xffffffff.
+ *
+ * @param request
+ * @param reply
+ * @return
+ */
+ private InetSocketAddress determineMessageDestination(DhcpMessage request,
+ DhcpMessage reply) {
+
+ final MessageType mt = reply.getMessageType();
+ if (!isNullAddress(request.getRelayAgentAddress()))
+ // send to agent, if received via agent.
+ return new InetSocketAddress(request.getRelayAgentAddress(), SERVER_PORT);
+ else if (null != mt && mt == MessageType.DHCPNAK)
+ // force broadcast for DHCPNAKs
+ return new InetSocketAddress("255.255.255.255", 68);
+ else // not a NAK...
+ if (!isNullAddress(request.getCurrentClientAddress()))
+ // have a current address? unicast to it.
+ return new InetSocketAddress(request.getCurrentClientAddress(),
+ CLIENT_PORT);
+ else
+ return new InetSocketAddress("255.255.255.255", 68);
+ }
+
+ /**
+ * Determine, whether the given address ist actually the null address
+ * "0.0.0.0".
+ *
+ * @param relayAgentAddress
+ * @return
+ */
+ private boolean isNullAddress(InetAddress addr) {
+ final byte a[] = addr.getAddress();
+ for (int i = 0; i < a.length; i++)
+ if (a[i] != 0)
+ return false;
+ return true;
+ }
+
+ public void messageSent(IoSession session, Object message) {
+ if (logger.isDebugEnabled())
+ logger.debug("{} -> {} SENT: " + message, session.getRemoteAddress(),
+ session.getLocalAddress());
+ }
}
Modified: directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/AbstractDhcpService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/AbstractDhcpService.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/AbstractDhcpService.java (original)
+++ directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/service/AbstractDhcpService.java Mon May 12 04:49:35 2008
@@ -44,253 +44,253 @@
*
*/
public abstract class AbstractDhcpService implements DhcpService {
- private static final Logger logger = LoggerFactory
- .getLogger(AbstractDhcpService.class);
+ private static final Logger logger = LoggerFactory
+ .getLogger(AbstractDhcpService.class);
- /*
- * @see org.apache.directory.server.dhcp.DhcpService#getReplyFor(org.apache.directory.server.dhcp.messages.DhcpMessage)
- */
- public final DhcpMessage getReplyFor(InetSocketAddress localAddress,
- InetSocketAddress clientAddress, DhcpMessage request)
- throws DhcpException {
- // ignore messages with an op != REQUEST/REPLY
- if (request.getOp() != DhcpMessage.OP_BOOTREQUEST
- && request.getOp() != DhcpMessage.OP_BOOTREPLY)
- return null;
-
- // message type option MUST be set - we don't support plain BOOTP.
- if (null == request.getMessageType()) {
- logger.warn("Missing message type option - plain BOOTP not supported.");
- return null;
- }
-
- // dispatch based on the message type
- switch (request.getMessageType().getCode()){
- // client-to-server messages
- case MessageType.CODE_DHCPDISCOVER :
- return handleDISCOVER(localAddress, clientAddress, request);
- case MessageType.CODE_DHCPREQUEST :
- return handleREQUEST(localAddress, clientAddress, request);
- case MessageType.CODE_DHCPRELEASE :
- return handleRELEASE(localAddress, clientAddress, request);
- case MessageType.CODE_DHCPINFORM :
- return handleINFORM(localAddress, clientAddress, request);
-
- case MessageType.CODE_DHCPOFFER :
- return handleOFFER(localAddress, clientAddress, request);
-
- // server-to-client messages
- case MessageType.CODE_DHCPDECLINE :
- case MessageType.CODE_DHCPACK :
- case MessageType.CODE_DHCPNAK :
- return null; // just ignore them
-
- default :
- return handleUnknownMessage(clientAddress, request);
- }
- }
-
- /**
- * Handle unknown DHCP message. The default implementation just logs and
- * ignores it.
- *
- * @param clientAddress
- * @param request the request message
- * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
- * it.
- */
- protected DhcpMessage handleUnknownMessage(InetSocketAddress clientAddress,
- DhcpMessage request) {
- if (logger.isWarnEnabled())
- logger.warn("Got unknkown DHCP message: " + request + " from: "
- + clientAddress);
- return null;
- }
-
- /**
- * Handle DHCPINFORM message. The default implementation just ignores it.
- *
- * @param localAddress
- * @param clientAddress
- * @param request the request message
- * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
- * it.
- */
- protected DhcpMessage handleINFORM(InetSocketAddress localAddress,
- InetSocketAddress clientAddress, DhcpMessage request)
- throws DhcpException {
- if (logger.isDebugEnabled())
- logger.debug("Got INFORM message: " + request + " from: "
- + clientAddress);
- return null;
- }
-
- /**
- * Handle DHCPRELEASE message. The default implementation just ignores it.
- *
- * @param localAddress
- * @param clientAddress
- * @param request the request message
- * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
- * it.
- */
- protected DhcpMessage handleRELEASE(InetSocketAddress localAddress,
- InetSocketAddress clientAddress, DhcpMessage request)
- throws DhcpException {
- if (logger.isDebugEnabled())
- logger.debug("Got RELEASE message: " + request + " from: "
- + clientAddress);
- return null;
- }
-
- /**
- * Handle DHCPREQUEST message. The default implementation just ignores it.
- *
- * @param localAddress
- * @param clientAddress
- * @param request the request message
- * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
- * it.
- */
- protected DhcpMessage handleREQUEST(InetSocketAddress localAddress,
- InetSocketAddress clientAddress, DhcpMessage request)
- throws DhcpException {
- if (logger.isDebugEnabled())
- logger.debug("Got REQUEST message: " + request + " from: "
- + clientAddress);
- return null;
- }
-
- /**
- * Handle DHCPDISCOVER message. The default implementation just ignores it.
- *
- * @param localAddress
- * @param clientAddress
- * @param request the request message
- * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
- * it.
- * @throws DhcpException
- */
- protected DhcpMessage handleDISCOVER(InetSocketAddress localAddress,
- InetSocketAddress clientAddress, DhcpMessage request)
- throws DhcpException {
- if (logger.isDebugEnabled())
- logger.debug("Got DISCOVER message: " + request + " from: "
- + clientAddress);
- return null;
- }
-
- /**
- * Handle DHCPOFFER message. The default implementation just ignores it.
- *
- * @param localAddress
- * @param clientAddress
- * @param request the request message
- * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
- * it.
- * @throws DhcpException
- */
- protected DhcpMessage handleOFFER(InetSocketAddress localAddress,
- InetSocketAddress clientAddress, DhcpMessage request)
- throws DhcpException {
- if (logger.isDebugEnabled())
- logger
- .debug("Got OFFER message: " + request + " from: " + clientAddress);
- return null;
- }
-
- /**
- * Initialize a general DHCP reply message. Sets:
- * <ul>
- * <li>op=BOOTREPLY
- * <li>htype, hlen, xid, flags, giaddr, chaddr like in request message
- * <li>hops, secs to 0.
- * <li>server hostname to the hostname appropriate for the interface the
- * request was received on
- * <li>the server identifier set to the address of the interface the request
- * was received on
- * </ul>
- *
- * @param localAddress
- * @param request
- * @return DhcpMessage
- */
- protected final DhcpMessage initGeneralReply(InetSocketAddress localAddress,
- DhcpMessage request) {
- final DhcpMessage reply = new DhcpMessage();
-
- reply.setOp(DhcpMessage.OP_BOOTREPLY);
-
- reply.setHardwareAddress(request.getHardwareAddress());
- reply.setTransactionId(request.getTransactionId());
- reply.setFlags(request.getFlags());
- reply.setRelayAgentAddress(request.getRelayAgentAddress());
-
- // set server hostname
- reply.setServerHostname(localAddress.getHostName());
-
- // set server identifier based on the IF on which we received the packet
- reply.getOptions().add(new ServerIdentifier(localAddress.getAddress()));
-
- return reply;
- }
-
- /**
- * Check if an address is the zero-address
- *
- * @param addr
- * @return boolean
- */
- private boolean isZeroAddress(byte[] addr) {
- for (int i = 0; i < addr.length; i++)
- if (addr[i] != 0)
- return false;
- return true;
- }
-
- /**
- * Determine address on which to base selection. If the relay agent address is
- * set, we use the relay agent's address, otherwise we use the address we
- * received the request from.
- *
- * @param clientAddress
- * @param request
- * @return InetAddress
- */
- protected final InetAddress determineSelectionBase(
- InetSocketAddress clientAddress, DhcpMessage request) {
- // FIXME: do we know
- // a) the interface address over which we received a message (!)
- // b) the client address (if specified)
- // c) the relay agent address?
-
- // if the relay agent address is set, we use it as the selection base
- if (!isZeroAddress(request.getRelayAgentAddress().getAddress()))
- return request.getRelayAgentAddress();
-
- return clientAddress.getAddress();
- }
-
- /**
- * Strip options that the client doesn't want, if the ParameterRequestList
- * option is present.
- *
- * @param request
- * @param options
- */
- protected final void stripUnwantedOptions(DhcpMessage request,
- OptionsField options) {
- final ParameterRequestList prl = (ParameterRequestList) request
- .getOptions().get(ParameterRequestList.class);
- if (null != prl) {
- final byte[] list = prl.getData();
- for (final Iterator i = options.iterator(); i.hasNext();) {
- final DhcpOption o = (DhcpOption) i.next();
- for (int j = 0; j < list.length; j++)
- if (list[j] == o.getTag())
- continue;
- i.remove();
- }
- }
- }
+ /*
+ * @see org.apache.directory.server.dhcp.DhcpService#getReplyFor(org.apache.directory.server.dhcp.messages.DhcpMessage)
+ */
+ public final DhcpMessage getReplyFor(InetSocketAddress localAddress,
+ InetSocketAddress clientAddress, DhcpMessage request)
+ throws DhcpException {
+ // ignore messages with an op != REQUEST/REPLY
+ if (request.getOp() != DhcpMessage.OP_BOOTREQUEST
+ && request.getOp() != DhcpMessage.OP_BOOTREPLY)
+ return null;
+
+ // message type option MUST be set - we don't support plain BOOTP.
+ if (null == request.getMessageType()) {
+ logger.warn("Missing message type option - plain BOOTP not supported.");
+ return null;
+ }
+
+ // dispatch based on the message type
+ switch (request.getMessageType().getCode()){
+ // client-to-server messages
+ case MessageType.CODE_DHCPDISCOVER :
+ return handleDISCOVER(localAddress, clientAddress, request);
+ case MessageType.CODE_DHCPREQUEST :
+ return handleREQUEST(localAddress, clientAddress, request);
+ case MessageType.CODE_DHCPRELEASE :
+ return handleRELEASE(localAddress, clientAddress, request);
+ case MessageType.CODE_DHCPINFORM :
+ return handleINFORM(localAddress, clientAddress, request);
+
+ case MessageType.CODE_DHCPOFFER :
+ return handleOFFER(localAddress, clientAddress, request);
+
+ // server-to-client messages
+ case MessageType.CODE_DHCPDECLINE :
+ case MessageType.CODE_DHCPACK :
+ case MessageType.CODE_DHCPNAK :
+ return null; // just ignore them
+
+ default :
+ return handleUnknownMessage(clientAddress, request);
+ }
+ }
+
+ /**
+ * Handle unknown DHCP message. The default implementation just logs and
+ * ignores it.
+ *
+ * @param clientAddress
+ * @param request the request message
+ * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
+ * it.
+ */
+ protected DhcpMessage handleUnknownMessage(InetSocketAddress clientAddress,
+ DhcpMessage request) {
+ if (logger.isWarnEnabled())
+ logger.warn("Got unknkown DHCP message: " + request + " from: "
+ + clientAddress);
+ return null;
+ }
+
+ /**
+ * Handle DHCPINFORM message. The default implementation just ignores it.
+ *
+ * @param localAddress
+ * @param clientAddress
+ * @param request the request message
+ * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
+ * it.
+ */
+ protected DhcpMessage handleINFORM(InetSocketAddress localAddress,
+ InetSocketAddress clientAddress, DhcpMessage request)
+ throws DhcpException {
+ if (logger.isDebugEnabled())
+ logger.debug("Got INFORM message: " + request + " from: "
+ + clientAddress);
+ return null;
+ }
+
+ /**
+ * Handle DHCPRELEASE message. The default implementation just ignores it.
+ *
+ * @param localAddress
+ * @param clientAddress
+ * @param request the request message
+ * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
+ * it.
+ */
+ protected DhcpMessage handleRELEASE(InetSocketAddress localAddress,
+ InetSocketAddress clientAddress, DhcpMessage request)
+ throws DhcpException {
+ if (logger.isDebugEnabled())
+ logger.debug("Got RELEASE message: " + request + " from: "
+ + clientAddress);
+ return null;
+ }
+
+ /**
+ * Handle DHCPREQUEST message. The default implementation just ignores it.
+ *
+ * @param localAddress
+ * @param clientAddress
+ * @param request the request message
+ * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
+ * it.
+ */
+ protected DhcpMessage handleREQUEST(InetSocketAddress localAddress,
+ InetSocketAddress clientAddress, DhcpMessage request)
+ throws DhcpException {
+ if (logger.isDebugEnabled())
+ logger.debug("Got REQUEST message: " + request + " from: "
+ + clientAddress);
+ return null;
+ }
+
+ /**
+ * Handle DHCPDISCOVER message. The default implementation just ignores it.
+ *
+ * @param localAddress
+ * @param clientAddress
+ * @param request the request message
+ * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
+ * it.
+ * @throws DhcpException
+ */
+ protected DhcpMessage handleDISCOVER(InetSocketAddress localAddress,
+ InetSocketAddress clientAddress, DhcpMessage request)
+ throws DhcpException {
+ if (logger.isDebugEnabled())
+ logger.debug("Got DISCOVER message: " + request + " from: "
+ + clientAddress);
+ return null;
+ }
+
+ /**
+ * Handle DHCPOFFER message. The default implementation just ignores it.
+ *
+ * @param localAddress
+ * @param clientAddress
+ * @param request the request message
+ * @return DhcpMessage response message or <code>null</code> to ignore (don't reply to)
+ * it.
+ * @throws DhcpException
+ */
+ protected DhcpMessage handleOFFER(InetSocketAddress localAddress,
+ InetSocketAddress clientAddress, DhcpMessage request)
+ throws DhcpException {
+ if (logger.isDebugEnabled())
+ logger
+ .debug("Got OFFER message: " + request + " from: " + clientAddress);
+ return null;
+ }
+
+ /**
+ * Initialize a general DHCP reply message. Sets:
+ * <ul>
+ * <li>op=BOOTREPLY
+ * <li>htype, hlen, xid, flags, giaddr, chaddr like in request message
+ * <li>hops, secs to 0.
+ * <li>server hostname to the hostname appropriate for the interface the
+ * request was received on
+ * <li>the server identifier set to the address of the interface the request
+ * was received on
+ * </ul>
+ *
+ * @param localAddress
+ * @param request
+ * @return DhcpMessage
+ */
+ protected final DhcpMessage initGeneralReply(InetSocketAddress localAddress,
+ DhcpMessage request) {
+ final DhcpMessage reply = new DhcpMessage();
+
+ reply.setOp(DhcpMessage.OP_BOOTREPLY);
+
+ reply.setHardwareAddress(request.getHardwareAddress());
+ reply.setTransactionId(request.getTransactionId());
+ reply.setFlags(request.getFlags());
+ reply.setRelayAgentAddress(request.getRelayAgentAddress());
+
+ // set server hostname
+ reply.setServerHostname(localAddress.getHostName());
+
+ // set server identifier based on the IF on which we received the packet
+ reply.getOptions().add(new ServerIdentifier(localAddress.getAddress()));
+
+ return reply;
+ }
+
+ /**
+ * Check if an address is the zero-address
+ *
+ * @param addr
+ * @return boolean
+ */
+ private boolean isZeroAddress(byte[] addr) {
+ for (int i = 0; i < addr.length; i++)
+ if (addr[i] != 0)
+ return false;
+ return true;
+ }
+
+ /**
+ * Determine address on which to base selection. If the relay agent address is
+ * set, we use the relay agent's address, otherwise we use the address we
+ * received the request from.
+ *
+ * @param clientAddress
+ * @param request
+ * @return InetAddress
+ */
+ protected final InetAddress determineSelectionBase(
+ InetSocketAddress clientAddress, DhcpMessage request) {
+ // FIXME: do we know
+ // a) the interface address over which we received a message (!)
+ // b) the client address (if specified)
+ // c) the relay agent address?
+
+ // if the relay agent address is set, we use it as the selection base
+ if (!isZeroAddress(request.getRelayAgentAddress().getAddress()))
+ return request.getRelayAgentAddress();
+
+ return clientAddress.getAddress();
+ }
+
+ /**
+ * Strip options that the client doesn't want, if the ParameterRequestList
+ * option is present.
+ *
+ * @param request
+ * @param options
+ */
+ protected final void stripUnwantedOptions(DhcpMessage request,
+ OptionsField options) {
+ final ParameterRequestList prl = (ParameterRequestList) request
+ .getOptions().get(ParameterRequestList.class);
+ if (null != prl) {
+ final byte[] list = prl.getData();
+ for (final Iterator i = options.iterator(); i.hasNext();) {
+ final DhcpOption o = (DhcpOption) i.next();
+ for (int j = 0; j < list.length; j++)
+ if (list[j] == o.getTag())
+ continue;
+ i.remove();
+ }
+ }
+ }
}
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/gui/OutstandingRequestsDialog.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/gui/OutstandingRequestsDialog.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/gui/OutstandingRequestsDialog.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/gui/OutstandingRequestsDialog.java Mon May 12 04:49:35 2008
@@ -110,9 +110,9 @@
/**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
+ * This method initializes jPanel
+ *
+ * @return javax.swing.JPanel
*/
private JPanel getJPanel()
{
@@ -129,9 +129,9 @@
/**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
+ * This method initializes jScrollPane
+ *
+ * @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane()
{
@@ -145,9 +145,9 @@
/**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
+ * This method initializes jTable
+ *
+ * @return javax.swing.JTable
*/
private JTable getJTable()
{
@@ -203,9 +203,9 @@
/**
- * This method initializes jPanel1
- *
- * @return javax.swing.JPanel
+ * This method initializes jPanel1
+ *
+ * @return javax.swing.JPanel
*/
private JPanel getJPanel1()
{
@@ -220,9 +220,9 @@
/**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
+ * This method initializes jButton
+ *
+ * @return javax.swing.JButton
*/
private JButton getJButton()
{
@@ -244,9 +244,9 @@
/**
- * This method initializes jPanel2
- *
- * @return javax.swing.JPanel
+ * This method initializes jPanel2
+ *
+ * @return javax.swing.JPanel
*/
private JPanel getJPanel2()
{
@@ -265,9 +265,9 @@
/**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
+ * This method initializes jTextArea
+ *
+ * @return javax.swing.JTextArea
*/
private JTextArea getJTextArea()
{
@@ -283,9 +283,9 @@
/**
- * This method initializes jButton1
- *
- * @return javax.swing.JButton
+ * This method initializes jButton1
+ *
+ * @return javax.swing.JButton
*/
private JButton getJButton1()
{
@@ -309,9 +309,9 @@
/**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
+ * This method initializes jButton2
+ *
+ * @return javax.swing.JButton
*/
private JButton getJButton2()
{
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/gui/SessionsFrame.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/gui/SessionsFrame.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/gui/SessionsFrame.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/gui/SessionsFrame.java Mon May 12 04:49:35 2008
@@ -144,9 +144,9 @@
/**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
+ * This method initializes jPanel
+ *
+ * @return javax.swing.JPanel
*/
private JPanel getMainPanel()
{
@@ -163,9 +163,9 @@
/**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
+ * This method initializes jScrollPane
+ *
+ * @return javax.swing.JScrollPane
*/
private JScrollPane getSessionsPane()
{
@@ -180,9 +180,9 @@
/**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
+ * This method initializes jTable
+ *
+ * @return javax.swing.JTable
*/
private JTable getSessionsTable()
{
@@ -215,9 +215,9 @@
/**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
+ * This method initializes jPanel
+ *
+ * @return javax.swing.JPanel
*/
private JPanel getFilterPanel()
{
@@ -235,9 +235,9 @@
/**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
+ * This method initializes jButton
+ *
+ * @return javax.swing.JButton
*/
private JButton getFilterButton()
{
@@ -251,9 +251,9 @@
/**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
+ * This method initializes jTextField
+ *
+ * @return javax.swing.JTextField
*/
private JTextField getFilterText()
{
@@ -266,9 +266,9 @@
/**
- * This method initializes jJMenuBar
- *
- * @return javax.swing.JMenuBar
+ * This method initializes jJMenuBar
+ *
+ * @return javax.swing.JMenuBar
*/
private JMenuBar getMainMenuBar()
{
@@ -283,9 +283,9 @@
/**
- * This method initializes jMenu
- *
- * @return javax.swing.JMenu
+ * This method initializes jMenu
+ *
+ * @return javax.swing.JMenu
*/
private JMenu getMenuFile()
{
@@ -300,9 +300,9 @@
/**
- * This method initializes jMenuItem
- *
- * @return javax.swing.JMenuItem
+ * This method initializes jMenuItem
+ *
+ * @return javax.swing.JMenuItem
*/
private JMenuItem getExitItem()
{
@@ -324,9 +324,9 @@
/**
- * This method initializes jMenu
- *
- * @return javax.swing.JMenu
+ * This method initializes jMenu
+ *
+ * @return javax.swing.JMenu
*/
private JMenu getMenuSession()
{
@@ -348,9 +348,9 @@
/**
- * This method initializes jMenuItem
- *
- * @return javax.swing.JMenuItem
+ * This method initializes jMenuItem
+ *
+ * @return javax.swing.JMenuItem
*/
private JMenuItem getCloseItem()
{
@@ -380,9 +380,9 @@
/**
- * This method initializes jMenu
- *
- * @return javax.swing.JMenu
+ * This method initializes jMenu
+ *
+ * @return javax.swing.JMenu
*/
private JMenu getMenuSendNoD()
{
@@ -399,9 +399,9 @@
/**
- * This method initializes jMenuItem
- *
- * @return javax.swing.JMenuItem
+ * This method initializes jMenuItem
+ *
+ * @return javax.swing.JMenuItem
*/
private JMenuItem getUnavailableItem()
{
@@ -431,9 +431,9 @@
/**
- * This method initializes jMenuItem
- *
- * @return javax.swing.JMenuItem
+ * This method initializes jMenuItem
+ *
+ * @return javax.swing.JMenuItem
*/
private JMenuItem getProtocolErrorItem()
{
@@ -463,9 +463,9 @@
/**
- * This method initializes jMenuItem
- *
- * @return javax.swing.JMenuItem
+ * This method initializes jMenuItem
+ *
+ * @return javax.swing.JMenuItem
*/
private JMenuItem getStrongAuthRequiredItem()
{
@@ -497,9 +497,9 @@
// /**
- // * This method initializes jPopupMenu
- // *
- // * @return javax.swing.JPopupMenu
+ // * This method initializes jPopupMenu
+ // *
+ // * @return javax.swing.JPopupMenu
// */
// private JPopupMenu getSessionsPopupMenu()
// {
@@ -514,9 +514,9 @@
// }
/**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
+ * This method initializes jPanel
+ *
+ * @return javax.swing.JPanel
*/
private JPanel getSouthPanel()
{
@@ -532,9 +532,9 @@
/**
- * This method initializes jMenuItem
- *
- * @return javax.swing.JMenuItem
+ * This method initializes jMenuItem
+ *
+ * @return javax.swing.JMenuItem
*/
private JMenuItem getShowRequests()
{
@@ -564,9 +564,9 @@
// /**
- // * This method initializes jMenuItem
- // *
- // * @return javax.swing.JMenuItem
+ // * This method initializes jMenuItem
+ // *
+ // * @return javax.swing.JMenuItem
// */
// private JMenuItem getJMenuItem()
// {
@@ -580,9 +580,9 @@
//
//
// /**
- // * This method initializes jMenu
- // *
- // * @return javax.swing.JMenu
+ // * This method initializes jMenu
+ // *
+ // * @return javax.swing.JMenu
// */
// private JMenu getJMenu()
// {
@@ -599,9 +599,9 @@
//
//
// /**
- // * This method initializes jMenuItem1
- // *
- // * @return javax.swing.JMenuItem
+ // * This method initializes jMenuItem1
+ // *
+ // * @return javax.swing.JMenuItem
// */
// private JMenuItem getJMenuItem1()
// {
@@ -615,9 +615,9 @@
//
//
// /**
- // * This method initializes jMenuItem2
- // *
- // * @return javax.swing.JMenuItem
+ // * This method initializes jMenuItem2
+ // *
+ // * @return javax.swing.JMenuItem
// */
// private JMenuItem getJMenuItem2()
// {
@@ -631,9 +631,9 @@
//
//
// /**
- // * This method initializes jMenuItem3
- // *
- // * @return javax.swing.JMenuItem
+ // * This method initializes jMenuItem3
+ // *
+ // * @return javax.swing.JMenuItem
// */
// private JMenuItem getJMenuItem3()
// {
@@ -647,9 +647,9 @@
//
//
// /**
- // * This method initializes jMenuItem4
- // *
- // * @return javax.swing.JMenuItem
+ // * This method initializes jMenuItem4
+ // *
+ // * @return javax.swing.JMenuItem
// */
// private JMenuItem getJMenuItem4()
// {
@@ -662,9 +662,9 @@
// }
/**
- * This method initializes jButton2
- *
- * @return javax.swing.JButton
+ * This method initializes jButton2
+ *
+ * @return javax.swing.JButton
*/
private JButton getRefreshButton()
{
@@ -704,9 +704,9 @@
}
/**
- * This method initializes jMenuItem
- *
- * @return javax.swing.JMenuItem
+ * This method initializes jMenuItem
+ *
+ * @return javax.swing.JMenuItem
*/
private JMenuItem getUnbindItem()
{
@@ -808,9 +808,9 @@
/**
- * This method initializes jMenuItem
- *
- * @return javax.swing.JMenuItem
+ * This method initializes jMenuItem
+ *
+ * @return javax.swing.JMenuItem
*/
private JMenuItem getBindItem()
{
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/gui/ShutdownDialog.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/gui/ShutdownDialog.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/gui/ShutdownDialog.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/gui/ShutdownDialog.java Mon May 12 04:49:35 2008
@@ -115,9 +115,9 @@
/**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
+ * This method initializes jPanel
+ *
+ * @return javax.swing.JPanel
*/
private JPanel getJPanel()
{
@@ -135,9 +135,9 @@
/**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
+ * This method initializes jPanel
+ *
+ * @return javax.swing.JPanel
*/
private JPanel getJPanel2()
{
@@ -152,9 +152,9 @@
/**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
+ * This method initializes jButton
+ *
+ * @return javax.swing.JButton
*/
private JButton getJButton()
{
@@ -215,9 +215,9 @@
/**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
+ * This method initializes jButton
+ *
+ * @return javax.swing.JButton
*/
private JButton getJButton2()
{
@@ -242,9 +242,9 @@
/**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
+ * This method initializes jPanel
+ *
+ * @return javax.swing.JPanel
*/
private JPanel getJPanel3()
{
@@ -263,9 +263,9 @@
/**
- * This method initializes jPanel1
- *
- * @return javax.swing.JPanel
+ * This method initializes jPanel1
+ *
+ * @return javax.swing.JPanel
*/
private JPanel getJPanel1()
{
@@ -284,9 +284,9 @@
/**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
+ * This method initializes jTextField
+ *
+ * @return javax.swing.JTextField
*/
private JTextField getJTextField()
{
@@ -299,9 +299,9 @@
/**
- * This method initializes jTextField1
- *
- * @return javax.swing.JTextField
+ * This method initializes jTextField1
+ *
+ * @return javax.swing.JTextField
*/
private JTextField getJTextField1()
{
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/gui/ShutdownProgress.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/gui/ShutdownProgress.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/gui/ShutdownProgress.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/gui/ShutdownProgress.java Mon May 12 04:49:35 2008
@@ -119,9 +119,9 @@
/**
- * This method initializes jPanel
- *
- * @return javax.swing.JPanel
+ * This method initializes jPanel
+ *
+ * @return javax.swing.JPanel
*/
private JPanel getJPanel()
{
@@ -135,9 +135,9 @@
/**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
+ * This method initializes jButton
+ *
+ * @return javax.swing.JButton
*/
private JButton getJButton()
{
@@ -159,9 +159,9 @@
/**
- * This method initializes jProgressBar
- *
- * @return javax.swing.JProgressBar
+ * This method initializes jProgressBar
+ *
+ * @return javax.swing.JProgressBar
*/
private JProgressBar getJProgressBar()
{
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/AbstractLdapHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/AbstractLdapHandler.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/AbstractLdapHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/AbstractLdapHandler.java Mon May 12 04:49:35 2008
@@ -60,24 +60,24 @@
/**
- * Return an array containing the controls for this message.
- *
- * @param context The context in which we will store teh found controls
- * @param message The message for which we want to extract the controls
- */
- protected void setRequestControls( LdapContext context, Message message ) throws NamingException
- {
- MutableControl[] controls = null;
-
- if ( message.getControls() != null )
- {
- int nbControls = message.getControls().size();
-
- if ( nbControls != 0 )
- {
- controls = new MutableControl[ nbControls ];
- context.setRequestControls( message.getControls().values().toArray( controls ) );
- }
- }
- }
+ * Return an array containing the controls for this message.
+ *
+ * @param context The context in which we will store teh found controls
+ * @param message The message for which we want to extract the controls
+ */
+ protected void setRequestControls( LdapContext context, Message message ) throws NamingException
+ {
+ MutableControl[] controls = null;
+
+ if ( message.getControls() != null )
+ {
+ int nbControls = message.getControls().size();
+
+ if ( nbControls != 0 )
+ {
+ controls = new MutableControl[ nbControls ];
+ context.setRequestControls( message.getControls().values().toArray( controls ) );
+ }
+ }
+ }
}
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultBindHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultBindHandler.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultBindHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultBindHandler.java Mon May 12 04:49:35 2008
@@ -677,7 +677,7 @@
{
if ( LOG.isDebugEnabled() )
{
- LOG.debug( "User {} is binding", bindRequest.getName() );
+ LOG.debug( "User {} is binding", bindRequest.getName() );
if ( bindRequest.isSimple() )
{
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultModifyHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultModifyHandler.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultModifyHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultModifyHandler.java Mon May 12 04:49:35 2008
@@ -74,22 +74,22 @@
// Process the modifications
if ( req.getModificationItems() != null )
{
- int nbItems = req.getModificationItems().size();
+ int nbItems = req.getModificationItems().size();
- if ( nbItems != 0 )
- {
- ModificationItemImpl[] mods = new ModificationItemImpl[nbItems];
+ if ( nbItems != 0 )
+ {
+ ModificationItemImpl[] mods = new ModificationItemImpl[nbItems];
//noinspection SuspiciousToArrayCall
ctx.modifyAttributes( req.getName(), req.getModificationItems().toArray( mods ) );
- }
- else
- {
- // What should we do if we don't have any modification ???
- }
+ }
+ else
+ {
+ // What should we do if we don't have any modification ???
+ }
}
else
{
- // What should we do if we don't have any modification ???
+ // What should we do if we don't have any modification ???
}
result.setResultCode( ResultCodeEnum.SUCCESS );
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultSearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultSearchHandler.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultSearchHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/DefaultSearchHandler.java Mon May 12 04:49:35 2008
@@ -221,12 +221,12 @@
LdapServer ldapServer = ( LdapServer )
session.getAttribute( LdapServer.class.toString() );
- if ( IS_DEBUG )
- {
- LOG.debug( "Message received: {}", req.toString() );
- }
+ if ( IS_DEBUG )
+ {
+ LOG.debug( "Message received: {}", req.toString() );
+ }
- ServerLdapContext ctx;
+ ServerLdapContext ctx;
NamingEnumeration<SearchResult> list = null;
String[] ids = null;
Collection<String> retAttrs = new HashSet<String>();
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java Mon May 12 04:49:35 2008
@@ -175,7 +175,7 @@
}
- public void setLdapProvider( LdapServer provider)
+ public void setLdapProvider( LdapServer provider)
{
- }
+ }
}
Modified: directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/AbstractBootstrapProducer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/AbstractBootstrapProducer.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/AbstractBootstrapProducer.java (original)
+++ directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/AbstractBootstrapProducer.java Mon May 12 04:49:35 2008
@@ -301,17 +301,17 @@
*/
public MatchingRule getEquality() throws NamingException
{
- if ( equalityMR == null )
- {
- if ( equalityId != null )
- {
- equalityMR = this.matchingRuleRegistry.lookup( equalityId );
- }
- else if ( superiorId != null )
- {
- equalityMR = getSuperior().getEquality();
- }
- }
+ if ( equalityMR == null )
+ {
+ if ( equalityId != null )
+ {
+ equalityMR = this.matchingRuleRegistry.lookup( equalityId );
+ }
+ else if ( superiorId != null )
+ {
+ equalityMR = getSuperior().getEquality();
+ }
+ }
return equalityMR;
}
@@ -397,19 +397,19 @@
*/
public Syntax getSyntax() throws NamingException
{
- if ( syntax == null )
- {
- if ( syntaxId != null )
- {
- syntax = syntaxRegistry.lookup( syntaxId );
- }
- else if ( superiorId != null )
- {
- syntax = getSuperior().getSyntax();
- }
- }
+ if ( syntax == null )
+ {
+ if ( syntaxId != null )
+ {
+ syntax = syntaxRegistry.lookup( syntaxId );
+ }
+ else if ( superiorId != null )
+ {
+ syntax = getSuperior().getSyntax();
+ }
+ }
- return syntax;
+ return syntax;
}
@@ -524,17 +524,17 @@
public boolean isStructural()
{
- return type == ObjectClassTypeEnum.STRUCTURAL;
+ return type == ObjectClassTypeEnum.STRUCTURAL;
}
public boolean isAbstract()
{
- return type == ObjectClassTypeEnum.ABSTRACT;
+ return type == ObjectClassTypeEnum.ABSTRACT;
}
public boolean isAuxiliary()
{
- return type == ObjectClassTypeEnum.AUXILIARY;
+ return type == ObjectClassTypeEnum.AUXILIARY;
}
public void setSchema( String schema )
Modified: directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/DnComparator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/DnComparator.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/DnComparator.java (original)
+++ directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/DnComparator.java Mon May 12 04:49:35 2008
@@ -72,7 +72,7 @@
catch ( NamingException e )
{
// -- what do we do here ?
- return -1;
+ return -1;
}
return dn0.compareTo( dn1 );
Modified: directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/NameAndOptionalUIDComparator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/NameAndOptionalUIDComparator.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/NameAndOptionalUIDComparator.java (original)
+++ directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/NameAndOptionalUIDComparator.java Mon May 12 04:49:35 2008
@@ -71,26 +71,26 @@
if ( ( obj0 instanceof String ) && ( obj1 instanceof String) )
{
- dnstr0 = (String)obj0;
- dnstr1 = (String)obj1;
-
- int dash0 = dnstr0.lastIndexOf( '#' );
- int dash1 = dnstr1.lastIndexOf( '#' );
-
- if ( ( dash0 == -1 ) && ( dash1 == -1 ) )
- {
- // no UID part
- try
- {
- return getDn( dnstr0 ).compareTo( getDn ( dnstr1 ) );
- }
- catch ( NamingException ne )
- {
- return -1;
- }
- }
- else
- {
+ dnstr0 = (String)obj0;
+ dnstr1 = (String)obj1;
+
+ int dash0 = dnstr0.lastIndexOf( '#' );
+ int dash1 = dnstr1.lastIndexOf( '#' );
+
+ if ( ( dash0 == -1 ) && ( dash1 == -1 ) )
+ {
+ // no UID part
+ try
+ {
+ return getDn( dnstr0 ).compareTo( getDn ( dnstr1 ) );
+ }
+ catch ( NamingException ne )
+ {
+ return -1;
+ }
+ }
+ else
+ {
// Now, check that we don't have another '#'
if ( dnstr0.indexOf( '#' ) != dash0 )
{
@@ -98,7 +98,7 @@
// escaped.
return -1;
}
-
+
if ( dnstr1.indexOf( '#' ) != dash0 )
{
// Yes, we have one : this is not allowed, it should have been
@@ -116,14 +116,14 @@
if ( dash0 > 0 )
{
- try
- {
- dn0 = new LdapDN( dnstr0.substring( 0, dash0 ) );
- }
- catch ( NamingException ne )
- {
- return -1;
- }
+ try
+ {
+ dn0 = new LdapDN( dnstr0.substring( 0, dash0 ) );
+ }
+ catch ( NamingException ne )
+ {
+ return -1;
+ }
}
else
{
@@ -137,14 +137,14 @@
if ( dash1 > 0 )
{
- try
+ try
+ {
+ dn1 = new LdapDN( dnstr0.substring( 0, dash1 ) );
+ }
+ catch ( NamingException ne )
{
- dn1 = new LdapDN( dnstr0.substring( 0, dash1 ) );
- }
- catch ( NamingException ne )
- {
- return 1;
- }
+ return 1;
+ }
}
else
{
@@ -155,15 +155,15 @@
if ( dnComp != 0 )
{
- return dnComp;
+ return dnComp;
}
return uid0.compareTo( uid1 );
- }
+ }
}
else
{
- return -1;
+ return -1;
}
}
Modified: directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultOidRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultOidRegistry.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultOidRegistry.java (original)
+++ directory/apacheds/trunk/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultOidRegistry.java Mon May 12 04:49:35 2008
@@ -123,13 +123,13 @@
*/
public boolean hasOid( String name )
{
- if ( StringTools.isEmpty( name ) )
- {
- return false;
- }
-
- String normalized = name.trim().toLowerCase();
-
+ if ( StringTools.isEmpty( name ) )
+ {
+ return false;
+ }
+
+ String normalized = name.trim().toLowerCase();
+
return byName.containsKey( normalized );
}
@@ -216,17 +216,17 @@
{
if ( !OID.isOID( oid ) )
{
- String message = "Swap the parameter order: the oid " +
- "does not start with a digit, or is not an OID!";
-
- LOG.debug( message );
+ String message = "Swap the parameter order: the oid " +
+ "does not start with a digit, or is not an OID!";
+
+ LOG.debug( message );
throw new NamingException( message );
}
if ( StringTools.isEmpty( name ) )
{
- String message = "The name is empty";
- LOG.error( message );
+ String message = "The name is empty";
+ LOG.error( message );
throw new NamingException( message );
}
@@ -263,11 +263,11 @@
if ( value.contains( lowerCase ) )
{
- return;
+ return;
}
else
{
- value.add( lowerCase );
+ value.add( lowerCase );
}
}
@@ -282,16 +282,16 @@
public void unregister( String numericOid ) throws NamingException
{
- // First, remove the <OID, names> from the byOID map
+ // First, remove the <OID, names> from the byOID map
List<String> names = byOid.remove( numericOid );
// Then remove all the <name, OID> from the byName map
if ( names != null )
{
- for ( String name:names )
- {
- byName.remove( name );
- }
+ for ( String name:names )
+ {
+ byName.remove( name );
+ }
}
// Last, remove the <OID, OID> from the byName map
Modified: directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java (original)
+++ directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java Mon May 12 04:49:35 2008
@@ -98,9 +98,9 @@
{
this.directoryService = new DefaultDirectoryService();
}
- else
- {
- this.directoryService = directoryService;
+ else
+ {
+ this.directoryService = directoryService;
}
this.ldapServer = ldapServer;
Modified: directory/apacheds/trunk/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java (original)
+++ directory/apacheds/trunk/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java Mon May 12 04:49:35 2008
@@ -20,40 +20,53 @@
package org.apache.directory.server.unit;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.naming.Context;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.ldap.InitialLdapContext;
+import javax.naming.ldap.LdapContext;
+
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
+
import org.apache.commons.io.FileUtils;
import org.apache.directory.server.constants.ServerDNConstants;
import org.apache.directory.server.core.DefaultDirectoryService;
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.jndi.CoreContextFactory;
import org.apache.directory.server.ldap.LdapServer;
+import org.apache.directory.server.ldap.handlers.bind.CramMd5MechanismHandler;
+import org.apache.directory.server.ldap.handlers.bind.DigestMd5MechanismHandler;
+import org.apache.directory.server.ldap.handlers.bind.GssapiMechanismHandler;
+import org.apache.directory.server.ldap.handlers.bind.MechanismHandler;
+import org.apache.directory.server.ldap.handlers.bind.SimpleMechanismHandler;
+import org.apache.directory.server.ldap.handlers.bind.ntlm.NtlmMechanismHandler;
import org.apache.directory.server.ldap.handlers.extended.StartTlsHandler;
import org.apache.directory.server.ldap.handlers.extended.StoredProcedureExtendedOperationHandler;
-import org.apache.directory.server.ldap.handlers.bind.*;
-import org.apache.directory.server.ldap.handlers.bind.ntlm.NtlmMechanismHandler;
import org.apache.directory.server.protocol.shared.SocketAcceptor;
+import org.apache.directory.shared.ldap.constants.SupportedSaslMechanisms;
import org.apache.directory.shared.ldap.exception.LdapConfigurationException;
import org.apache.directory.shared.ldap.ldif.LdifEntry;
import org.apache.directory.shared.ldap.ldif.LdifReader;
import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.constants.SupportedSaslMechanisms;
import org.apache.mina.util.AvailablePortFinder;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.ldap.InitialLdapContext;
-import javax.naming.ldap.LdapContext;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.*;
-
/**
* A simple testcase for testing JNDI provider functionality.
@@ -172,7 +185,7 @@
if ( ! readAttribute.contains( origAttribute.get( ii ) ) )
{
LOG.error( "Failed to verify entry addition of {}. {} attribute in original " +
- "entry missing from read entry.", entry.getDn(), id );
+ "entry missing from read entry.", entry.getDn(), id );
throw new AssertionFailedError( "Failed to verify entry addition of " + entry.getDn() );
}
}
Modified: directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DITUtilitiesSP.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DITUtilitiesSP.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DITUtilitiesSP.java (original)
+++ directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DITUtilitiesSP.java Mon May 12 04:49:35 2008
@@ -33,9 +33,9 @@
public class DITUtilitiesSP
{
- private static final Logger log = LoggerFactory.getLogger( DITUtilitiesSP.class );
-
- /**
+ private static final Logger log = LoggerFactory.getLogger( DITUtilitiesSP.class );
+
+ /**
* Recursively deletes a subtree including the apex given.
*
* If you do not want to wait for the developers to implement the
Modified: directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DeleteIllegalDNITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DeleteIllegalDNITest.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DeleteIllegalDNITest.java (original)
+++ directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/DeleteIllegalDNITest.java Mon May 12 04:49:35 2008
@@ -60,11 +60,11 @@
}
catch ( NamingException ne )
{
- fail();
+ fail();
}
catch( Exception e )
{
- fail();
+ fail();
}
try
@@ -73,18 +73,18 @@
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
controls.setTimeLimit( 10 );
- NamingEnumeration<SearchResult> result = ctx.search( "ou=system", "(objectClass=*)", controls );
+ NamingEnumeration<SearchResult> result = ctx.search( "ou=system", "(objectClass=*)", controls );
assertTrue( result.hasMore() );
}
catch ( InvalidNameException ine )
{
- fail();
+ fail();
// Expected.
}
catch ( NamingException ne )
{
- fail();
+ fail();
}
}
}
Modified: directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/PersistentSearchTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/PersistentSearchTest.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/PersistentSearchTest.java (original)
+++ directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/PersistentSearchTest.java Mon May 12 04:49:35 2008
@@ -48,6 +48,11 @@
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.message.PersistentSearchControl;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -86,6 +91,7 @@
/**
* Create context and a person entry.
*/
+ @Before
public void setUp() throws Exception
{
super.setUp();
@@ -110,6 +116,7 @@
/**
* Remove person entry and close context.
*/
+ @After
public void tearDown() throws Exception
{
try
@@ -128,6 +135,7 @@
/**
* Shows correct notifications for modify(4) changes.
*/
+ @Test
public void testPsearchModify() throws Exception
{
PSearchListener listener = new PSearchListener();
@@ -162,6 +170,7 @@
/**
* Shows correct notifications for moddn(8) changes.
*/
+ @Test
public void testPsearchModifyDn() throws Exception
{
PSearchListener listener = new PSearchListener();
@@ -194,6 +203,7 @@
/**
* Shows correct notifications for delete(2) changes.
*/
+ @Test
public void testPsearchDelete() throws Exception
{
PSearchListener listener = new PSearchListener();
@@ -226,6 +236,7 @@
/**
* Shows correct notifications for add(1) changes.
*/
+ @Test
public void testPsearchAdd() throws Exception
{
PSearchListener listener = new PSearchListener();
@@ -259,6 +270,7 @@
* Shows correct notifications for modify(4) changes with returned
* EntryChangeControl.
*/
+ @Test
public void testPsearchModifyWithEC() throws Exception
{
PersistentSearchControl control = new PersistentSearchControl();
@@ -295,6 +307,7 @@
* Shows correct notifications for moddn(8) changes with returned
* EntryChangeControl.
*/
+ @Test
public void testPsearchModifyDnWithEC() throws Exception
{
PersistentSearchControl control = new PersistentSearchControl();
@@ -332,6 +345,7 @@
* Shows correct notifications for delete(2) changes with returned
* EntryChangeControl.
*/
+ @Test
public void testPsearchDeleteWithEC() throws Exception
{
PersistentSearchControl control = new PersistentSearchControl();
@@ -368,6 +382,7 @@
* Shows correct notifications for add(1) changes with returned
* EntryChangeControl.
*/
+ @Test
public void testPsearchAddWithEC() throws Exception
{
PersistentSearchControl control = new PersistentSearchControl();
@@ -404,6 +419,7 @@
* Shows correct notifications for only add(1) and modify(4) registered changes with returned
* EntryChangeControl.
*/
+ @Test
public void testPsearchAddModifyEnabledWithEC() throws Exception
{
PersistentSearchControl control = new PersistentSearchControl();
@@ -516,6 +532,7 @@
* Shows notifications functioning with the JNDI notification API of the SUN
* provider.
*/
+ @Test
public void testPsearchUsingJndiNotifications() throws Exception
{
Hashtable<String, Object> env = new Hashtable<String, Object>();
@@ -555,6 +572,7 @@
* Shows notifications functioning with the JNDI notification API of the SUN
* provider.
*/
+ @Test
public void testPsearchAbandon() throws Exception
{
PersistentSearchControl control = new PersistentSearchControl();
@@ -584,7 +602,9 @@
assertNotNull( listener.result );
assertEquals( "cn=Jack Black", listener.result.getName() );
assertEquals( listener.result.control.getChangeType(), ChangeType.ADD );
- listener.result = null;
+
+ listener = new PSearchListener( control );
+
t = new Thread( listener );
t.start();
@@ -602,6 +622,10 @@
// there seems to be a race condition here
// assertNull( listener.result );
+ assertNotNull( listener.result );
+ assertEquals( "cn=Jack Black", listener.result.getName() );
+ assertEquals( ChangeType.DELETE, listener.result.control.getChangeType() );
+ listener.result = null;
// thread is still waiting for notifications try a modify
ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, new AttributesImpl( "description", PERSON_DESCRIPTION,
@@ -616,9 +640,9 @@
}
}
- assertNotNull( listener.result );
- assertEquals( RDN, listener.result.getName() );
- assertEquals( listener.result.control.getChangeType(), ChangeType.MODIFY );
+ assertNull( listener.result );
+ //assertEquals( RDN, listener.result.getName() );
+ //assertEquals( listener.result.control.getChangeType(), ChangeType.MODIFY );
}
class JndiNotificationListener implements NamespaceChangeListener, ObjectChangeListener
Modified: directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SearchITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SearchITest.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SearchITest.java (original)
+++ directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SearchITest.java Mon May 12 04:49:35 2008
@@ -187,7 +187,7 @@
{
ctx.unbind( RDN );
ctx.close();
-
+
ctx = null;
super.tearDown();
}
@@ -1036,7 +1036,7 @@
}
catch ( NamingException ne )
{
- assertTrue( true );
+ assertTrue( true );
}
}
Modified: directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/AbstractAsn1Object.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/AbstractAsn1Object.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/AbstractAsn1Object.java (original)
+++ directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/AbstractAsn1Object.java Mon May 12 04:49:35 2008
@@ -30,6 +30,7 @@
* An abstract class which implements basic TLV operations.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
*/
public abstract class AbstractAsn1Object implements Asn1Object
{
@@ -47,7 +48,7 @@
/** The identifier of the asqsocaited TLV */
- private transient int tlvId;
+ private int tlvId;
// ~ Methods
// ------------------------------------------------------------------------------------
Modified: directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/Asn1Object.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/Asn1Object.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/Asn1Object.java (original)
+++ directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/Asn1Object.java Mon May 12 04:49:35 2008
@@ -30,6 +30,7 @@
* An abstract class which implements basic TLV operations.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
*/
public interface Asn1Object
{
@@ -85,7 +86,7 @@
* @param expectedLength
* The expectedLength to set.
*/
- public void setExpectedLength( int expectedLength );
+ void setExpectedLength( int expectedLength );
/**
@@ -94,7 +95,7 @@
* @param currentLength
* The currentLength to set.
*/
- public void setCurrentLength( int currentLength );
+ void setCurrentLength( int currentLength );
/**
@@ -102,5 +103,5 @@
*
* @return Returns the parent.
*/
- public Asn1Object getParent();
+ Asn1Object getParent();
}
Modified: directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java (original)
+++ directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java Mon May 12 04:49:35 2008
@@ -32,7 +32,8 @@
* the informations needed to decode a PDU.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
+ * @version $Rev$, $Date$
+*/
public class AbstractContainer implements IAsn1Container
{
// ~ Instance fields
Modified: directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java (original)
+++ directory/shared/trunk/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java Mon May 12 04:49:35 2008
@@ -20,6 +20,8 @@
package org.apache.directory.shared.asn1.ber;
+import java.nio.ByteBuffer;
+
import org.apache.directory.shared.asn1.ber.grammar.IStates;
import org.apache.directory.shared.asn1.ber.tlv.ITLVBerDecoderMBean;
import org.apache.directory.shared.asn1.ber.tlv.TLV;
@@ -30,8 +32,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.nio.ByteBuffer;
-
/**
* A BER TLV Tag component decoder. This decoder instanciate a Tag. The tag
@@ -39,7 +39,8 @@
* delivered but should copy the data if they need it over the long term.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
+ * @version $Rev$, $Date$
+*/
public class Asn1Decoder implements ITLVBerDecoderMBean
{
// ~ Static fields/initializers
@@ -288,7 +289,7 @@
tlv.incLengthBytesRead();
length = ( length << 8 ) | ( octet & 0x00FF );
- if ( stream.hasRemaining() == false )
+ if ( !stream.hasRemaining() )
{
tlv.setLength( length );