Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 8203 invoked from network); 18 Mar 2008 06:15:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Mar 2008 06:15:42 -0000 Received: (qmail 68503 invoked by uid 500); 18 Mar 2008 06:15:40 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 68435 invoked by uid 500); 18 Mar 2008 06:15:39 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 68401 invoked by uid 99); 18 Mar 2008 06:15:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Mar 2008 23:15:39 -0700 X-ASF-Spam-Status: No, hits=-1999.6 required=10.0 tests=ALL_TRUSTED,SUBJECT_FUZZY_TION X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Mar 2008 06:15:08 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B3D861A9878; Mon, 17 Mar 2008 23:14:31 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r638228 [19/20] - in /directory/sandbox/akarasulu/bigbang/apacheds: ./ apacheds-xbean-spring/src/site/ benchmarks/src/site/ bootstrap-extract/src/site/ bootstrap-partition/src/site/ bootstrap-plugin/src/main/java/org/apache/directory/server... Date: Tue, 18 Mar 2008 06:13:18 -0000 To: commits@directory.apache.org From: akarasulu@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080318061431.B3D861A9878@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ImpressServers.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ImpressServers.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ImpressServers.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ImpressServers.java Mon Mar 17 23:12:41 2008 @@ -1,21 +1,18 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * + * Copyright 2005 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * */ /** @@ -34,18 +31,24 @@ /** + * The Impress server option specifies a list of Imagen Impress servers + * available to the client. Servers SHOULD be listed in order of + * preference. + * + * The code for the Impress server option is 10. The minimum length for + * this option is 4 octets, and the length MUST always be a multiple of + * 4. + * * @author Apache Directory Project * @version $Rev$, $Date$ */ public class ImpressServers extends AddressListOption { - /** - * Creates a new instance of ImpressServers. - * - * @param impressServers + /* + * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag() */ - public ImpressServers( byte[] impressServers ) + public byte getTag() { - super( 10, impressServers ); + return 10; } } Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/LogServers.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/LogServers.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/LogServers.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/LogServers.java Mon Mar 17 23:12:41 2008 @@ -18,14 +18,6 @@ * */ -/** - * The log server option specifies a list of MIT-LCS UDP log servers - * available to the client. Servers SHOULD be listed in order of - * preference. - * - * The code for the log server option is 7. The minimum length for this - * option is 4 octets, and the length MUST always be a multiple of 4. - */ package org.apache.directory.server.dhcp.options.vendor; @@ -33,18 +25,23 @@ /** + * The log server option specifies a list of MIT-LCS UDP log servers + * available to the client. Servers SHOULD be listed in order of + * preference. + * + * The code for the log server option is 7. The minimum length for this + * option is 4 octets, and the length MUST always be a multiple of 4. + * * @author Apache Directory Project * @version $Rev$, $Date$ */ public class LogServers extends AddressListOption { - /** - * Creates a new instance of LogServers. - * - * @param logServers + /* + * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag() */ - public LogServers( byte[] logServers ) + public byte getTag() { - super( 7, logServers ); + return 7; } } Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/LprServers.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/LprServers.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/LprServers.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/LprServers.java Mon Mar 17 23:12:41 2008 @@ -18,14 +18,6 @@ * */ -/** - * The LPR server option specifies a list of RFC 1179 line printer - * servers available to the client. Servers SHOULD be listed in order - * of preference. - * - * The code for the LPR server option is 9. The minimum length for this - * option is 4 octets, and the length MUST always be a multiple of 4. - */ package org.apache.directory.server.dhcp.options.vendor; @@ -33,18 +25,23 @@ /** + * The LPR server option specifies a list of RFC 1179 line printer + * servers available to the client. Servers SHOULD be listed in order + * of preference. + * + * The code for the LPR server option is 9. The minimum length for this + * option is 4 octets, and the length MUST always be a multiple of 4. + * * @author Apache Directory Project * @version $Rev$, $Date$ */ public class LprServers extends AddressListOption { - /** - * Creates a new instance of LprServers. - * - * @param lprServers + /* + * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag() */ - public LprServers( byte[] lprServers ) + public byte getTag() { - super( 9, lprServers ); + return 9; } } Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/MeritDumpFile.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/MeritDumpFile.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/MeritDumpFile.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/MeritDumpFile.java Mon Mar 17 23:12:41 2008 @@ -18,6 +18,12 @@ * */ +package org.apache.directory.server.dhcp.options.vendor; + + +import org.apache.directory.server.dhcp.options.StringOption; + + /** * This option specifies the path-name of a file to which the client's * core image should be dumped in the event the client crashes. The @@ -25,38 +31,17 @@ * the NVT ASCII character set. * * The code for this option is 14. Its minimum length is 1. - */ -package org.apache.directory.server.dhcp.options.vendor; - - -import java.nio.ByteBuffer; - -import org.apache.directory.server.dhcp.options.DhcpOption; - - -/** + * * @author Apache Directory Project * @version $Rev$, $Date$ */ -public class MeritDumpFile extends DhcpOption +public class MeritDumpFile extends StringOption { - private byte[] meritDumpFile; - - - /** - * Creates a new instance of MeritDumpFile. - * - * @param meritDumpFile + /* + * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag() */ - public MeritDumpFile( byte[] meritDumpFile ) - { - super( 14, 1 ); - this.meritDumpFile = meritDumpFile; - } - - - protected void valueToByteBuffer( ByteBuffer out ) + public byte getTag() { - out.put( meritDumpFile ); + return 14; } } Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/NameServers.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/NameServers.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/NameServers.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/NameServers.java Mon Mar 17 23:12:41 2008 @@ -18,6 +18,12 @@ * */ +package org.apache.directory.server.dhcp.options.vendor; + + +import org.apache.directory.server.dhcp.options.AddressListOption; + + /** * The name server option specifies a list of IEN 116 name servers * available to the client. Servers SHOULD be listed in order of @@ -26,26 +32,17 @@ * The code for the name server option is 5. The minimum length for * this option is 4 octets, and the length MUST always be a multiple of * 4. - */ -package org.apache.directory.server.dhcp.options.vendor; - - -import org.apache.directory.server.dhcp.options.AddressListOption; - - -/** + * * @author Apache Directory Project * @version $Rev$, $Date$ */ public class NameServers extends AddressListOption { - /** - * Creates a new instance of NameServers. - * - * @param nameServers + /* + * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag() */ - public NameServers( byte[] nameServers ) + public byte getTag() { - super( 5, nameServers ); + return 5; } } Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ResourceLocationServers.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ResourceLocationServers.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ResourceLocationServers.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/ResourceLocationServers.java Mon Mar 17 23:12:41 2008 @@ -18,14 +18,6 @@ * */ -/** - * This option specifies a list of RFC 887 Resource Location - * servers available to the client. Servers SHOULD be listed in order - * of preference. - * - * The code for this option is 11. The minimum length for this option - * is 4 octets, and the length MUST always be a multiple of 4. - */ package org.apache.directory.server.dhcp.options.vendor; @@ -33,18 +25,23 @@ /** + * This option specifies a list of RFC 887 Resource Location + * servers available to the client. Servers SHOULD be listed in order + * of preference. + * + * The code for this option is 11. The minimum length for this option + * is 4 octets, and the length MUST always be a multiple of 4. + * * @author Apache Directory Project * @version $Rev$, $Date$ */ public class ResourceLocationServers extends AddressListOption { - /** - * Creates a new instance of ResourceLocationServers. - * - * @param resourceLocationServers + /* + * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag() */ - public ResourceLocationServers( byte[] resourceLocationServers ) + public byte getTag() { - super( 11, resourceLocationServers ); + return 11; } } Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/RootPath.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/RootPath.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/RootPath.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/RootPath.java Mon Mar 17 23:12:41 2008 @@ -18,44 +18,43 @@ * */ -/** - * This option specifies the path-name that contains the client's root - * disk. The path is formatted as a character string consisting of - * characters from the NVT ASCII character set. - * - * The code for this option is 17. Its minimum length is 1. - */ package org.apache.directory.server.dhcp.options.vendor; -import java.nio.ByteBuffer; - -import org.apache.directory.server.dhcp.options.DhcpOption; +import org.apache.directory.server.dhcp.options.StringOption; /** + * This option specifies the path-name that contains the client's root + * disk. The path is formatted as a character string consisting of + * characters from the NVT ASCII character set. + * + * The code for this option is 17. Its minimum length is 1. + * * @author Apache Directory Project * @version $Rev$, $Date$ */ -public class RootPath extends DhcpOption +public class RootPath extends StringOption { - private byte[] rootPath; + public RootPath() + { + } /** - * Creates a new instance of RootPath. - * - * @param rootPath + * @param path */ - public RootPath( byte[] rootPath ) + public RootPath(String path) { - super( 17, 1 ); - this.rootPath = rootPath; + setString( path ); } - protected void valueToByteBuffer( ByteBuffer out ) + /* + * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag() + */ + public byte getTag() { - out.put( rootPath ); + return 17; } } Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/Routers.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/Routers.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/Routers.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/Routers.java Mon Mar 17 23:12:41 2008 @@ -18,14 +18,6 @@ * */ -/** - * The router option specifies a list of IP addresses for routers on the - * client's subnet. Routers SHOULD be listed in order of preference. - * - * The code for the router option is 3. The minimum length for the - * router option is 4 octets, and the length MUST always be a multiple - * of 4. - */ package org.apache.directory.server.dhcp.options.vendor; @@ -33,18 +25,23 @@ /** + * The router option specifies a list of IP addresses for routers on the + * client's subnet. Routers SHOULD be listed in order of preference. + * + * The code for the router option is 3. The minimum length for the + * router option is 4 octets, and the length MUST always be a multiple + * of 4. + * * @author Apache Directory Project * @version $Rev$, $Date$ */ public class Routers extends AddressListOption { - /** - * Creates a new instance of Routers. - * - * @param routers + /* + * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag() */ - public Routers( byte[] routers ) + public byte getTag() { - super( 3, routers ); + return 3; } } Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/SubnetMask.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/SubnetMask.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/SubnetMask.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/SubnetMask.java Mon Mar 17 23:12:41 2008 @@ -18,6 +18,14 @@ * */ +package org.apache.directory.server.dhcp.options.vendor; + + +import java.net.InetAddress; + +import org.apache.directory.server.dhcp.options.AddressOption; + + /** * The subnet mask option specifies the client's subnet mask as per RFC * 950. @@ -26,26 +34,30 @@ * reply, the subnet mask option MUST be first. * * The code for the subnet mask option is 1, and its length is 4 octets. - */ -package org.apache.directory.server.dhcp.options.vendor; - - -import org.apache.directory.server.dhcp.options.AddressOption; - - -/** + * * @author Apache Directory Project * @version $Rev$, $Date$ */ public class SubnetMask extends AddressOption { + public SubnetMask() + { + } + /** - * Creates a new instance of SubnetMask. - * - * @param subnetMask + * @param netmask + */ + public SubnetMask(InetAddress netmask) + { + setAddress( netmask ); + } + + + /* + * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag() */ - public SubnetMask( byte[] subnetMask ) + public byte getTag() { - super( 1, subnetMask ); + return 1; } } Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/SwapServer.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/SwapServer.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/SwapServer.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/SwapServer.java Mon Mar 17 23:12:41 2008 @@ -18,11 +18,6 @@ * */ -/** - * This specifies the IP address of the client's swap server. - * - * The code for this option is 16 and its length is 4. - */ package org.apache.directory.server.dhcp.options.vendor; @@ -30,18 +25,20 @@ /** + * This specifies the IP address of the client's swap server. + * + * The code for this option is 16 and its length is 4. + * * @author Apache Directory Project * @version $Rev$, $Date$ */ public class SwapServer extends AddressOption { - /** - * Creates a new instance of SwapServer. - * - * @param swapServer + /* + * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag() */ - public SwapServer( byte[] swapServer ) + public byte getTag() { - super( 16, swapServer ); + return 16; } } Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/TimeOffset.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/TimeOffset.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/TimeOffset.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/TimeOffset.java Mon Mar 17 23:12:41 2008 @@ -18,6 +18,12 @@ * */ +package org.apache.directory.server.dhcp.options.vendor; + + +import org.apache.directory.server.dhcp.options.AddressOption; + + /** * The time offset field specifies the offset of the client's subnet in * seconds from Coordinated Universal Time (UTC). The offset is @@ -26,38 +32,17 @@ * indicates a location west of the zero meridian. * * The code for the time offset option is 2, and its length is 4 octets. - */ -package org.apache.directory.server.dhcp.options.vendor; - - -import java.nio.ByteBuffer; - -import org.apache.directory.server.dhcp.options.DhcpOption; - - -/** + * * @author Apache Directory Project * @version $Rev$, $Date$ */ -public class TimeOffset extends DhcpOption +public class TimeOffset extends AddressOption { - private byte[] timeOffset; - - - /** - * Creates a new instance of TimeOffset. - * - * @param timeOffset + /* + * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag() */ - public TimeOffset( byte[] timeOffset ) - { - super( 2, 4 ); - this.timeOffset = timeOffset; - } - - - protected void valueToByteBuffer( ByteBuffer out ) + public byte getTag() { - out.put( timeOffset ); + return 2; } } Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/TimeServers.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/TimeServers.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/TimeServers.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/options/vendor/TimeServers.java Mon Mar 17 23:12:41 2008 @@ -18,6 +18,12 @@ * */ +package org.apache.directory.server.dhcp.options.vendor; + + +import org.apache.directory.server.dhcp.options.AddressListOption; + + /** * The time server option specifies a list of RFC 868 time servers * available to the client. Servers SHOULD be listed in order of @@ -26,26 +32,17 @@ * The code for the time server option is 4. The minimum length for * this option is 4 octets, and the length MUST always be a multiple of * 4. - */ -package org.apache.directory.server.dhcp.options.vendor; - - -import org.apache.directory.server.dhcp.options.AddressListOption; - - -/** + * * @author Apache Directory Project * @version $Rev$, $Date$ */ public class TimeServers extends AddressListOption { - /** - * Creates a new instance of TimeServers. - * - * @param timeServers + /* + * @see org.apache.directory.server.dhcp.options.DhcpOption#getTag() */ - public TimeServers( byte[] timeServers ) + public byte getTag() { - super( 4, timeServers ); + return 4; } } Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpDecoder.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpDecoder.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpDecoder.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpDecoder.java Mon Mar 17 23:12:41 2008 @@ -25,7 +25,7 @@ import org.apache.directory.server.dhcp.io.DhcpMessageDecoder; import org.apache.mina.common.ByteBuffer; import org.apache.mina.common.IoSession; -import org.apache.mina.filter.codec.ProtocolDecoderAdapter; +import org.apache.mina.filter.codec.ProtocolDecoder; import org.apache.mina.filter.codec.ProtocolDecoderOutput; @@ -33,11 +33,25 @@ * @author Apache Directory Project * @version $Rev$, $Date$ */ -public class DhcpDecoder extends ProtocolDecoderAdapter +public class DhcpDecoder implements ProtocolDecoder { public void decode( IoSession session, ByteBuffer in, ProtocolDecoderOutput out ) throws DhcpException { DhcpMessageDecoder decoder = new DhcpMessageDecoder(); out.write( decoder.decode( in.buf() ) ); + } + + + public void dispose( IoSession arg0 ) throws Exception + { + } + + + /* + * @see org.apache.mina.filter.codec.ProtocolDecoder#finishDecode(org.apache.mina.common.IoSession, org.apache.mina.filter.codec.ProtocolDecoderOutput) + */ + public void finishDecode( IoSession session, ProtocolDecoderOutput out ) throws Exception + { + // TODO Auto-generated method stub } } Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpEncoder.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpEncoder.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpEncoder.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpEncoder.java Mon Mar 17 23:12:41 2008 @@ -25,7 +25,7 @@ import org.apache.directory.server.dhcp.messages.DhcpMessage; import org.apache.mina.common.ByteBuffer; import org.apache.mina.common.IoSession; -import org.apache.mina.filter.codec.ProtocolEncoderAdapter; +import org.apache.mina.filter.codec.ProtocolEncoder; import org.apache.mina.filter.codec.ProtocolEncoderOutput; @@ -33,17 +33,24 @@ * @author Apache Directory Project * @version $Rev$, $Date$ */ -public class DhcpEncoder extends ProtocolEncoderAdapter +public class DhcpEncoder implements ProtocolEncoder { + // FIXME: what's the point of splitting this class from the actual encoder? + private DhcpMessageEncoder encoder = new DhcpMessageEncoder(); + + public void encode( IoSession session, Object message, ProtocolEncoderOutput out ) { - DhcpMessageEncoder encoder = new DhcpMessageEncoder(); - ByteBuffer buf = ByteBuffer.allocate( 1024 ); encoder.encode( buf.buf(), ( DhcpMessage ) message ); buf.flip(); out.write( buf ); + } + + + public void dispose( IoSession arg0 ) throws Exception + { } } Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolHandler.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolHandler.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolHandler.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/protocol/DhcpProtocolHandler.java Mon Mar 17 23:12:41 2008 @@ -20,92 +20,155 @@ package org.apache.directory.server.dhcp.protocol; - import java.net.InetAddress; import java.net.InetSocketAddress; -import org.apache.directory.server.dhcp.DhcpService; import org.apache.directory.server.dhcp.messages.DhcpMessage; -import org.apache.directory.server.dhcp.service.DhcpServiceImpl; -import org.apache.mina.common.ConnectFuture; +import org.apache.directory.server.dhcp.messages.MessageType; +import org.apache.directory.server.dhcp.service.DhcpService; +import org.apache.mina.common.BroadcastIoSession; import org.apache.mina.common.IdleStatus; -import org.apache.mina.common.IoConnector; import org.apache.mina.common.IoHandler; import org.apache.mina.common.IoSession; import org.apache.mina.filter.codec.ProtocolCodecFilter; -import org.apache.mina.transport.socket.nio.DatagramConnector; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - /** + * Implementation of a DHCP protocol handler which delegates the work of + * generating replys to a DhcpService implementation. + * + * @see org.apache.directory.server.dhcp.service.DhcpService * @author Apache Directory Project * @version $Rev$, $Date$ */ -public class DhcpProtocolHandler implements IoHandler -{ - private static final Logger log = LoggerFactory.getLogger( DhcpProtocolHandler.class ); - - - public void sessionCreated( IoSession session ) throws Exception - { - log.debug( "{} CREATED", session.getRemoteAddress() ); - session.getFilterChain().addFirst( "codec", new ProtocolCodecFilter( new DhcpProtocolCodecFactory() ) ); - } - - - public void sessionOpened( IoSession session ) - { - log.debug( "{} OPENED", session.getRemoteAddress() ); - } - - - public void sessionClosed( IoSession session ) - { - log.debug( "{} CLOSED", session.getRemoteAddress() ); - } - - - public void sessionIdle( IoSession session, IdleStatus status ) - { - log.debug( "{} IDLE ({})", session.getRemoteAddress(), status ); - } - - - public void exceptionCaught( IoSession session, Throwable cause ) - { - log.debug( session.getRemoteAddress() + " EXCEPTION", cause ); - session.close(); - } - - - public void messageReceived( IoSession session, Object message ) throws Exception - { - log.debug( "{} RCVD: {}", session.getRemoteAddress(), message ); - - DhcpMessage request = ( DhcpMessage ) message; - - if ( request.getOpCode() == 1 ) - { - DhcpService dhcpService = new DhcpServiceImpl(); - DhcpMessage reply = dhcpService.getReplyFor( request ); - - int PORT = 68; - IoConnector connector = new DatagramConnector(); - InetAddress broadcast = InetAddress.getByName( null ); - - ConnectFuture future = connector.connect( new InetSocketAddress( broadcast, PORT ), - new DhcpProtocolHandler() ); - future.join(); - IoSession replySession = future.getSession(); - replySession.write( reply ).join(); - replySession.close(); - } - } - - - public void messageSent( IoSession session, Object message ) - { - log.debug( "{} SENT: {}", session.getRemoteAddress(), message ); - } +public class DhcpProtocolHandler implements IoHandler { + 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:
+ * 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/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/test/java/org/apache/directory/server/dhcp/AbstractDhcpTestCase.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/test/java/org/apache/directory/server/dhcp/AbstractDhcpTestCase.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/test/java/org/apache/directory/server/dhcp/AbstractDhcpTestCase.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dhcp/src/test/java/org/apache/directory/server/dhcp/AbstractDhcpTestCase.java Mon Mar 17 23:12:41 2008 @@ -57,17 +57,14 @@ protected void print( DhcpMessage message ) { log.debug( String.valueOf( message.getMessageType() ) ); - log.debug( String.valueOf( message.getHardwareAddressType() ) ); - log.debug( String.valueOf( message.getHardwareAddressLength() ) ); - log.debug( String.valueOf( message.getHardwareOptions() ) ); + log.debug( String.valueOf( message.getHardwareAddress() ) ); log.debug( String.valueOf( message.getTransactionId() ) ); log.debug( String.valueOf( message.getSeconds() ) ); log.debug( String.valueOf( message.getFlags() ) ); - log.debug( String.valueOf( message.getActualClientAddress() ) ); + log.debug( String.valueOf( message.getCurrentClientAddress() ) ); log.debug( String.valueOf( message.getAssignedClientAddress() ) ); log.debug( String.valueOf( message.getNextServerAddress() ) ); log.debug( String.valueOf( message.getRelayAgentAddress() ) ); - log.debug( String.valueOf( message.getClientHardwareAddress() ) ); log.debug( String.valueOf( message.getServerHostname() ) ); log.debug( String.valueOf( message.getBootFileName() ) ); } Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-dns/pom.xml URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dns/pom.xml?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dns/pom.xml (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dns/pom.xml Mon Mar 17 23:12:41 2008 @@ -34,14 +34,6 @@ - - - org.apache.directory.server apacheds-core Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DefaultSearchHandler.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DefaultSearchHandler.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DefaultSearchHandler.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DefaultSearchHandler.java Mon Mar 17 23:12:41 2008 @@ -21,6 +21,7 @@ import org.apache.directory.server.constants.ServerDNConstants; +import org.apache.directory.server.core.entry.ServerSearchResult; import org.apache.directory.server.core.jndi.ServerLdapContext; import org.apache.directory.server.ldap.LdapServer; import org.apache.directory.shared.ldap.constants.JndiPropertyConstants; @@ -29,6 +30,7 @@ import org.apache.directory.shared.ldap.exception.OperationAbandonedException; import org.apache.directory.shared.ldap.filter.PresenceNode; import org.apache.directory.shared.ldap.message.AbandonListener; +import org.apache.directory.shared.ldap.message.AliasDerefMode; import org.apache.directory.shared.ldap.message.LdapResult; import org.apache.directory.shared.ldap.message.ManageDsaITControl; import org.apache.directory.shared.ldap.message.PersistentSearchControl; Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ExtendedHandler.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ExtendedHandler.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ExtendedHandler.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ExtendedHandler.java Mon Mar 17 23:12:41 2008 @@ -24,7 +24,6 @@ import java.util.HashMap; import java.util.Map; -import org.apache.directory.server.core.DirectoryService; import org.apache.directory.server.ldap.ExtendedOperationHandler; import org.apache.directory.shared.ldap.message.ExtendedRequest; import org.apache.mina.common.IoSession; Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/PersistentSearchListener.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/PersistentSearchListener.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/PersistentSearchListener.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/PersistentSearchListener.java Mon Mar 17 23:12:41 2008 @@ -28,6 +28,8 @@ import javax.naming.event.NamingExceptionEvent; import javax.naming.event.ObjectChangeListener; +import org.apache.directory.server.core.entry.ServerEntry; +import org.apache.directory.server.core.entry.ServerEntryUtils; import org.apache.directory.server.core.jndi.ServerLdapContext; import org.apache.directory.server.ldap.SessionRegistry; import org.apache.directory.shared.ldap.codec.search.controls.ChangeType; @@ -243,6 +245,8 @@ } } + Object attr; + switch ( evt.getType() ) { case ( NamingEvent.OBJECT_ADDED ): @@ -252,7 +256,16 @@ } respEntry.setObjectName( newBinding ); - respEntry.setAttributes( ( Attributes ) evt.getChangeInfo() ); + attr = evt.getChangeInfo(); + + if ( attr instanceof ServerEntry ) + { + respEntry.setAttributes( ServerEntryUtils.toAttributesImpl( (ServerEntry)attr ) ); + } + else + { + respEntry.setAttributes( ( Attributes ) attr ); + } if ( ecControl != null ) { @@ -268,7 +281,16 @@ } respEntry.setObjectName( oldBinding ); - respEntry.setAttributes( ( Attributes ) evt.getOldBinding().getObject() ); + attr = evt.getOldBinding().getObject(); + + if ( attr instanceof ServerEntry ) + { + respEntry.setAttributes( ServerEntryUtils.toAttributesImpl( (ServerEntry)attr ) ); + } + else + { + respEntry.setAttributes( ( Attributes ) attr ); + } if ( ecControl != null ) { @@ -284,7 +306,16 @@ } respEntry.setObjectName( oldBinding ); - respEntry.setAttributes( ( Attributes ) evt.getOldBinding().getObject() ); + attr = evt.getOldBinding().getObject(); + + if ( attr instanceof ServerEntry ) + { + respEntry.setAttributes( ServerEntryUtils.toAttributesImpl( (ServerEntry)attr ) ); + } + else + { + respEntry.setAttributes( ( Attributes ) attr ); + } if ( ecControl != null ) { @@ -300,7 +331,16 @@ } respEntry.setObjectName( newBinding ); - respEntry.setAttributes( ( Attributes ) evt.getNewBinding().getObject() ); + attr = evt.getNewBinding().getObject(); + + if ( attr instanceof ServerEntry ) + { + respEntry.setAttributes( ServerEntryUtils.toAttributesImpl( (ServerEntry)attr ) ); + } + else + { + respEntry.setAttributes( ( Attributes ) attr ); + } if ( ecControl != null ) { Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchResponseIterator.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchResponseIterator.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchResponseIterator.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchResponseIterator.java Mon Mar 17 23:12:41 2008 @@ -47,7 +47,6 @@ import org.apache.directory.shared.ldap.message.SearchResponseEntryImpl; import org.apache.directory.shared.ldap.message.SearchResponseReference; import org.apache.directory.shared.ldap.message.SearchResponseReferenceImpl; -import org.apache.directory.shared.ldap.message.ServerSearchResult; import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.directory.shared.ldap.util.ExceptionUtils; import org.apache.mina.common.IoSession; @@ -105,7 +104,7 @@ { if ( underlying.hasMore() ) { - ServerSearchResult result = ( ServerSearchResult ) underlying.next(); + SearchResult result = (SearchResult ) underlying.next(); /* * Now we have to build the prefetched object from the 'result' @@ -113,13 +112,15 @@ */ Attribute ref = result.getAttributes().get( SchemaConstants.REF_AT ); - if ( !ctx.isReferral( result.getDn() ) + LdapDN dn = new LdapDN( result.getName() ); + + if ( !ctx.isReferral( dn ) || req.getControls().containsKey( ManageDsaITControl.CONTROL_OID ) ) { SearchResponseEntry respEntry; respEntry = new SearchResponseEntryImpl( req.getMessageId() ); respEntry.setAttributes( result.getAttributes() ); - respEntry.setObjectName( result.getDn() ); + respEntry.setObjectName( dn ); prefetched = respEntry; } else Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java Mon Mar 17 23:12:41 2008 @@ -37,7 +37,7 @@ import javax.naming.directory.DirContext; import javax.naming.directory.ModificationItem; -import org.apache.directory.shared.ldap.ldif.Entry; +import org.apache.directory.shared.ldap.ldif.LdifEntry; import org.apache.directory.shared.ldap.ldif.LdifReader; import org.apache.directory.shared.ldap.message.ModificationItemImpl; import org.slf4j.Logger; @@ -183,7 +183,7 @@ while ( ldifIterator.hasNext() ) { - Entry entry = ldifIterator.next(); + LdifEntry entry = ldifIterator.next(); String dn = entry.getDn(); Modified: directory/sandbox/akarasulu/bigbang/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/AbstractBootstrapProducer.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/AbstractBootstrapProducer.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/AbstractBootstrapProducer.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/AbstractBootstrapProducer.java Mon Mar 17 23:12:41 2008 @@ -231,10 +231,30 @@ private final MatchingRuleRegistry matchingRuleRegistry; private final AttributeTypeRegistry attributeTypeRegistry; private String superiorId; + + /** The equality OID for this AttributeType */ private String equalityId; + + /** The MatchingRule associated with the equalityID */ + private MatchingRule equalityMR; + + /** The substring OID for this AttributeType */ private String substrId; + + /** The MatchingRule associated with the substrID */ + private MatchingRule substrMR; + + /** The ordering OID for this AttributeType */ private String orderingId; + + /** The MatchingRule associated with the orderingID */ + private MatchingRule orderingMR; + + /** The syntax OID for this attributeType */ private String syntaxId; + + /** The Syntax associated with the syntaxID */ + private Syntax syntax; public BootstrapAttributeType(String oid, Registries registries) @@ -276,19 +296,24 @@ } + /** + * @return The MatchingRule associated with the AttributeType + */ public MatchingRule getEquality() throws NamingException { - if ( equalityId != null ) - { - return this.matchingRuleRegistry.lookup( equalityId ); - } + if ( equalityMR == null ) + { + if ( equalityId != null ) + { + equalityMR = this.matchingRuleRegistry.lookup( equalityId ); + } + else if ( superiorId != null ) + { + equalityMR = getSuperior().getEquality(); + } + } - if ( superiorId != null ) - { - return getSuperior().getEquality(); - } - - return null; + return equalityMR; } @@ -300,17 +325,19 @@ public MatchingRule getSubstr() throws NamingException { - if ( substrId != null ) - { - return this.matchingRuleRegistry.lookup( substrId ); - } - - if ( superiorId != null ) + if ( substrMR == null ) { - return getSuperior().getSubstr(); + if ( substrId != null ) + { + substrMR = matchingRuleRegistry.lookup( substrId ); + } + else if ( superiorId != null ) + { + substrMR = getSuperior().getSubstr(); + } } - return null; + return substrMR; } @@ -332,19 +359,24 @@ } + /** + * @return The Ordering Matching Rule associated with this AttributeType + */ public MatchingRule getOrdering() throws NamingException { - if ( orderingId != null ) + if ( orderingMR == null ) { - return this.matchingRuleRegistry.lookup( orderingId ); + if ( orderingId != null ) + { + orderingMR = matchingRuleRegistry.lookup( orderingId ); + } + else if ( superiorId != null ) + { + orderingMR = getSuperior().getOrdering(); + } } - if ( superiorId != null ) - { - return getSuperior().getOrdering(); - } - - return null; + return orderingMR; } @@ -360,19 +392,24 @@ } + /** + * @return The Syntax associated with the AttributeType + */ public Syntax getSyntax() throws NamingException { - if ( syntaxId != null ) - { - return this.syntaxRegistry.lookup( syntaxId ); - } - - if ( superiorId != null ) - { - return getSuperior().getSyntax(); - } + if ( syntax == null ) + { + if ( syntaxId != null ) + { + syntax = syntaxRegistry.lookup( syntaxId ); + } + else if ( superiorId != null ) + { + syntax = getSuperior().getSyntax(); + } + } - return null; + return syntax; } Modified: directory/sandbox/akarasulu/bigbang/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/BootstrapSchemaLoader.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/BootstrapSchemaLoader.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/BootstrapSchemaLoader.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/BootstrapSchemaLoader.java Mon Mar 17 23:12:41 2008 @@ -323,7 +323,7 @@ */ private BootstrapProducer getProducer( BootstrapSchema schema, String producerBase ) throws NamingException { - Class clazz = null; + Class clazz = null; boolean failedTargetLoad = false; String defaultClassName; String targetClassName = schema.getBaseClassName() + producerBase; Modified: directory/sandbox/akarasulu/bigbang/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdComparator.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdComparator.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdComparator.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/NameOrNumericIdComparator.java Mon Mar 17 23:12:41 2008 @@ -123,7 +123,6 @@ } catch ( NamingException e ) { - e.printStackTrace(); throw new RuntimeException( "Failed to lookup OID for " + strValue, e ); } } Modified: directory/sandbox/akarasulu/bigbang/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java Mon Mar 17 23:12:41 2008 @@ -29,6 +29,7 @@ import org.apache.directory.server.schema.NameAndOptionalUIDNormalizer; import org.apache.directory.server.schema.bootstrap.ProducerTypeEnum; import org.apache.directory.server.schema.registries.Registries; +import org.apache.directory.shared.ldap.schema.ByteArrayComparator; import org.apache.directory.shared.ldap.schema.CachingNormalizer; import org.apache.directory.shared.ldap.schema.ComparableComparator; import org.apache.directory.shared.ldap.schema.DeepTrimNormalizer; @@ -176,14 +177,14 @@ ( 2.5.13.17 NAME 'octetStringMatch' SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 ) */ - comparator = new ComparableComparator(); + comparator = new ByteArrayComparator(); cb.schemaObjectProduced( this, "2.5.13.17", comparator ); /* ( 2.5.13.18 NAME 'octetStringOrderingMatch' SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 ) */ - comparator = new ComparableComparator(); + comparator = new ByteArrayComparator(); cb.schemaObjectProduced( this, "2.5.13.18", comparator ); /* Modified: directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultComparatorRegistry.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultComparatorRegistry.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultComparatorRegistry.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultComparatorRegistry.java Mon Mar 17 23:12:41 2008 @@ -44,11 +44,15 @@ { /** static class logger */ private static final Logger LOG = LoggerFactory.getLogger( DefaultComparatorRegistry.class ); + /** the comparators in this registry */ private final Map byOid; + /** maps oids to a comparator description */ private final Map oidToDescription; + /** A speedup for debug */ + private static final boolean DEBUG = LOG.isDebugEnabled(); // ------------------------------------------------------------------------ // C O N S T R U C T O R S @@ -81,7 +85,8 @@ oidToDescription.put( description.getNumericOid(), description ); byOid.put( description.getNumericOid(), comparator ); - if ( LOG.isDebugEnabled() ) + + if ( DEBUG ) { LOG.debug( "registed comparator with OID: " + description.getNumericOid() ); } @@ -106,10 +111,12 @@ if ( byOid.containsKey( oid ) ) { Comparator c = byOid.get( oid ); - if ( LOG.isDebugEnabled() ) + + if ( DEBUG ) { LOG.debug( "looked up comparator with OID: " + oid ); } + return c; } Modified: directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultNormalizerRegistry.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultNormalizerRegistry.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultNormalizerRegistry.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultNormalizerRegistry.java Mon Mar 17 23:12:41 2008 @@ -45,8 +45,13 @@ { /** static class logger */ private static final Logger LOG = LoggerFactory.getLogger( DefaultNormalizerRegistry.class ); + + /** A speedup for debug */ + private static final boolean DEBUG = LOG.isDebugEnabled(); + /** a map of Normalizers looked up by OID */ private final Map byOid; + /** maps an OID to a normalizerDescription */ private final Map oidToDescription; @@ -81,7 +86,8 @@ oidToDescription.put( oid, description ); byOid.put( oid, normalizer ); - if ( LOG.isDebugEnabled() ) + + if ( DEBUG ) { LOG.debug( "registered normalizer with oid: " + oid ); } @@ -96,10 +102,12 @@ } Normalizer normalizer = byOid.get( oid ); - if ( LOG.isDebugEnabled() ) + + if ( DEBUG ) { LOG.debug( "registered normalizer with oid: " + oid ); } + return normalizer; } Modified: directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultOidRegistry.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultOidRegistry.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultOidRegistry.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultOidRegistry.java Mon Mar 17 23:12:41 2008 @@ -28,6 +28,7 @@ import java.util.Map; import javax.naming.NamingException; +import javax.naming.directory.NoSuchAttributeException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -110,7 +111,7 @@ return oid; } - NamingException fault = new NamingException( "OID for name '" + name + "' was not " + NamingException fault = new NoSuchAttributeException( "OID for name '" + name + "' was not " + "found within the OID registry" ); LOG.error( fault.getMessage() ); throw fault; Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/commands/importcmd/ImportCommandExecutor.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/commands/importcmd/ImportCommandExecutor.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/commands/importcmd/ImportCommandExecutor.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/commands/importcmd/ImportCommandExecutor.java Mon Mar 17 23:12:41 2008 @@ -47,7 +47,7 @@ import org.apache.directory.shared.ldap.codec.modifyDn.ModifyDNRequest; import org.apache.directory.shared.ldap.codec.unbind.UnBindRequest; import org.apache.directory.shared.ldap.ldif.ChangeType; -import org.apache.directory.shared.ldap.ldif.Entry; +import org.apache.directory.shared.ldap.ldif.LdifEntry; import org.apache.directory.shared.ldap.ldif.LdifReader; import org.apache.directory.shared.ldap.message.ModificationItemImpl; import org.apache.directory.shared.ldap.message.ResultCodeEnum; @@ -213,7 +213,7 @@ * @throws NamingException ?? * @throws EncoderException ?? */ - private int addEntry( Entry entry, int messageId ) throws IOException, DecoderException, + private int addEntry( LdifEntry entry, int messageId ) throws IOException, DecoderException, NamingException, EncoderException { AddRequest addRequest = new AddRequest(); @@ -294,7 +294,7 @@ * @throws NamingException ?? * @throws EncoderException ?? */ - private int deleteEntry( Entry entry, int messageId ) throws IOException, DecoderException, + private int deleteEntry( LdifEntry entry, int messageId ) throws IOException, DecoderException, NamingException, EncoderException { DelRequest delRequest = new DelRequest(); @@ -356,7 +356,7 @@ * @throws DecoderException ?? * @throws EncoderException ?? */ - private int changeModRDNEntry( Entry entry, int messageId ) throws IOException, DecoderException, + private int changeModRDNEntry( LdifEntry entry, int messageId ) throws IOException, DecoderException, NamingException, EncoderException { ModifyDNRequest modifyDNRequest = new ModifyDNRequest(); @@ -425,7 +425,7 @@ * @throws DecoderException ?? * @throws EncoderException ?? */ - private int changeModifyEntry( Entry entry, int messageId ) throws IOException, DecoderException, + private int changeModifyEntry( LdifEntry entry, int messageId ) throws IOException, DecoderException, NamingException, EncoderException { ModifyRequest modifyRequest = new ModifyRequest(); @@ -517,7 +517,7 @@ * @throws DecoderException ?? * @throws EncoderException ?? */ - private int changeEntry( Entry entry, int messageId ) throws IOException, DecoderException, + private int changeEntry( LdifEntry entry, int messageId ) throws IOException, DecoderException, NamingException, EncoderException { switch ( entry.getChangeType().getChangeType() ) @@ -842,13 +842,13 @@ if ( ldifReader.containsEntries() ) { // Parse the file and inject every entry - Iterator entries = ldifReader.iterator(); + Iterator entries = ldifReader.iterator(); long t0 = System.currentTimeMillis(); int nbAdd = 0; while ( entries.hasNext() ) { - Entry entry = entries.next(); + LdifEntry entry = entries.next(); // Check if we have had some error, has next() does not throw any exception if ( ldifReader.hasError() ) @@ -907,13 +907,13 @@ else { // Parse the file and inject every modification - Iterator entries = ldifReader.iterator(); + Iterator entries = ldifReader.iterator(); long t0 = System.currentTimeMillis(); int nbMod = 0; while ( entries.hasNext() ) { - Entry entry = entries.next(); + LdifEntry entry = entries.next(); // Check if we have had some error, has next() does not throw any exception if ( ldifReader.hasError() ) Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/manifest/MANIFEST.MF URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/manifest/MANIFEST.MF?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/manifest/MANIFEST.MF (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/manifest/MANIFEST.MF Mon Mar 17 23:12:41 2008 @@ -2,38 +2,38 @@ Main-Class: org.apache.directory.server.tools.ApachedsTools Class-Path: ../lib/logger.jar ../lib/daemon.jar ../lib/bootstrapper.jar ../lib/antlr-2.7.6.jar - ../lib/apacheds-kerberos-shared-1.5.1-SNAPSHOT.jar - ../lib/apacheds-protocol-changepw-1.5.1-SNAPSHOT.jar - ../lib/apacheds-protocol-shared-1.5.1-SNAPSHOT.jar - ../lib/apacheds-protocol-kerberos-1.5.1-SNAPSHOT.jar - ../lib/apacheds-protocol-ldap-1.5.1-SNAPSHOT.jar - ../lib/apacheds-protocol-ntp-1.5.1-SNAPSHOT.jar - ../lib/apacheds-protocol-dns-1.5.1-SNAPSHOT.jar - ../lib/apacheds-core-1.5.1-SNAPSHOT.jar - ../lib/apacheds-core-shared-1.5.1-SNAPSHOT.jar - ../lib/apacheds-jdbm-store-1.5.1-SNAPSHOT.jar - ../lib/apacheds-btree-base-1.5.1-SNAPSHOT.jar - ../lib/apacheds-server-jndi-1.5.1-SNAPSHOT.jar - ../lib/apacheds-server-main-1.5.1-SNAPSHOT.jar - ../lib/apacheds-schema-registries-1.5.1-SNAPSHOT.jar - ../lib/apacheds-schema-bootstrap-1.5.1-SNAPSHOT.jar - ../lib/apacheds-bootstrap-partition-1.5.1-SNAPSHOT.jar - ../lib/apacheds-bootstrap-extract-1.5.1-SNAPSHOT.jar + ../lib/apacheds-kerberos-shared-1.5.2-SNAPSHOT.jar + ../lib/apacheds-protocol-changepw-1.5.2-SNAPSHOT.jar + ../lib/apacheds-protocol-shared-1.5.2-SNAPSHOT.jar + ../lib/apacheds-protocol-kerberos-1.5.2-SNAPSHOT.jar + ../lib/apacheds-protocol-ldap-1.5.2-SNAPSHOT.jar + ../lib/apacheds-protocol-ntp-1.5.2-SNAPSHOT.jar + ../lib/apacheds-protocol-dns-1.5.2-SNAPSHOT.jar + ../lib/apacheds-core-1.5.2-SNAPSHOT.jar + ../lib/apacheds-core-shared-1.5.2-SNAPSHOT.jar + ../lib/apacheds-jdbm-store-1.5.2-SNAPSHOT.jar + ../lib/apacheds-btree-base-1.5.2-SNAPSHOT.jar + ../lib/apacheds-server-jndi-1.5.2-SNAPSHOT.jar + ../lib/apacheds-server-main-1.5.2-SNAPSHOT.jar + ../lib/apacheds-schema-registries-1.5.2-SNAPSHOT.jar + ../lib/apacheds-schema-bootstrap-1.5.2-SNAPSHOT.jar + ../lib/apacheds-bootstrap-partition-1.5.2-SNAPSHOT.jar + ../lib/apacheds-bootstrap-extract-1.5.2-SNAPSHOT.jar ../lib/commons-collections-3.2.jar ../lib/commons-lang-2.3.jar - ../lib/jcl104-over-slf4j-1.4.0.jar + ../lib/jcl104-over-slf4j-1.4.3.jar ../lib/nlog4j-1.2.25.jar - ../lib/slf4j-api-1.4.0.jar - ../lib/commons-cli-1.0.jar + ../lib/slf4j-api-1.4.3.jar + ../lib/commons-cli-1.1.jar ../lib/jdbm-1.0.jar - ../lib/mina-core-1.0.3.jar - ../lib/shared-asn1-codec-0.9.8-SNAPSHOT.jar - ../lib/mina-filter-ssl-1.0.3.jar - ../lib/shared-asn1-0.9.8-SNAPSHOT.jar - ../lib/shared-ldap-0.9.8-SNAPSHOT.jar + ../lib/mina-core-1.1.6.jar + ../lib/shared-asn1-codec-0.9.9-SNAPSHOT.jar + ../lib/mina-filter-ssl-1.1.6.jar + ../lib/shared-asn1-0.9.9-SNAPSHOT.jar + ../lib/shared-ldap-0.9.9-SNAPSHOT.jar ../lib/antlr-2.7.7.jar - ../lib/spring-beans-1.2.9.jar - ../lib/spring-context-1.2.9.jar - ../lib/spring-core-1.2.9.jar + ../lib/spring-beans-2.0.6.jar + ../lib/spring-context-2.0.6.jar + ../lib/spring-core-2.0.6.jar Specification-Title: apacheds-tools Specification-Version: 1.0 Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/test/java/org/apache/directory/server/tools/commands/AbstractTestCase.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/test/java/org/apache/directory/server/tools/commands/AbstractTestCase.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/test/java/org/apache/directory/server/tools/commands/AbstractTestCase.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/test/java/org/apache/directory/server/tools/commands/AbstractTestCase.java Mon Mar 17 23:12:41 2008 @@ -38,7 +38,7 @@ /** * Abstract Class to extends to test the commands */ -public class AbstractTestCase extends TestCase +public abstract class AbstractTestCase extends TestCase { /** Flag to check if the server has been launched */ protected boolean bindSuccessful; Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java Mon Mar 17 23:12:41 2008 @@ -30,7 +30,7 @@ import org.apache.directory.server.ldap.LdapServer; import org.apache.directory.server.protocol.shared.SocketAcceptor; import org.apache.directory.shared.ldap.exception.LdapConfigurationException; -import org.apache.directory.shared.ldap.ldif.Entry; +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.mina.util.AvailablePortFinder; @@ -63,7 +63,7 @@ public abstract class AbstractServerTest extends TestCase { private static final Logger LOG = LoggerFactory.getLogger( AbstractServerTest.class ); - private static final List EMPTY_LIST = Collections.unmodifiableList( new ArrayList( 0 ) ); + private static final List EMPTY_LIST = Collections.unmodifiableList( new ArrayList( 0 ) ); private static final String CTX_FACTORY = "com.sun.jndi.ldap.LdapCtxFactory"; /** the context root for the system partition */ @@ -101,7 +101,7 @@ * @return a list of entries added to the server in the order they were added * @throws NamingException of the load fails */ - protected List loadTestLdif( boolean verifyEntries ) throws NamingException + protected List loadTestLdif( boolean verifyEntries ) throws NamingException { InputStream in = getClass().getResourceAsStream( getClass().getSimpleName() + ".ldif" ); if ( in == null ) @@ -110,10 +110,10 @@ } LdifReader ldifReader = new LdifReader( in ); - List entries = new ArrayList(); + List entries = new ArrayList(); while ( ldifReader.hasNext() ) { - Entry entry = ldifReader.next(); + LdifEntry entry = ldifReader.next(); rootDSE.createSubcontext( entry.getDn(), entry.getAttributes() ); if ( verifyEntries ) @@ -140,7 +140,7 @@ * @param entry the entry to verify * @throws NamingException if there are problems accessing the entry */ - protected void verify( Entry entry ) throws NamingException + protected void verify( LdifEntry entry ) throws NamingException { Attributes readAttributes = rootDSE.getAttributes( entry.getDn() ); NamingEnumeration readIds = entry.getAttributes().getIDs(); @@ -359,11 +359,11 @@ { try { - Iterator iterator = new LdifReader( in ); + Iterator iterator = new LdifReader( in ); while ( iterator.hasNext() ) { - Entry entry = iterator.next(); + LdifEntry entry = iterator.next(); LdapDN dn = new LdapDN( entry.getDn() ); rootDSE.createSubcontext( dn, entry.getAttributes() ); } @@ -386,9 +386,9 @@ protected void injectEntries( String ldif ) throws NamingException { LdifReader reader = new LdifReader(); - List entries = reader.parseLdif( ldif ); + List entries = reader.parseLdif( ldif ); - for ( Entry entry : entries ) + for ( LdifEntry entry : entries ) { rootDSE.createSubcontext( new LdapDN( entry.getDn() ), entry.getAttributes() ); } Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/MiscTest.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/MiscTest.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/MiscTest.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/MiscTest.java Mon Mar 17 23:12:41 2008 @@ -43,6 +43,7 @@ import org.apache.directory.server.core.entry.DefaultServerEntry; import org.apache.directory.server.core.entry.ServerEntry; +import org.apache.directory.server.core.entry.ServerEntryUtils; import org.apache.directory.server.core.partition.Partition; import org.apache.directory.server.core.partition.impl.btree.Index; import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; @@ -358,21 +359,28 @@ public void testBogusAttributeInSearchFilter() throws Exception { SearchControls cons = new SearchControls(); - NamingEnumeration e = sysRoot.search( "", "(bogusAttribute=abc123)", cons ); + NamingEnumeration e = sysRoot.search( "", "(bogusAttribute=abc123)", cons ); assertNotNull( e ); assertEquals( e.getClass(), EmptyEnumeration.class ); + e = sysRoot.search( "", "(!(bogusAttribute=abc123))", cons ); assertNotNull( e ); + assertFalse( e.hasMore() ); assertEquals( e.getClass(), EmptyEnumeration.class ); + e = sysRoot.search( "", "(|(bogusAttribute=abc123)(bogusAttribute=abc123))", cons ); assertNotNull( e ); + assertFalse( e.hasMore() ); assertEquals( e.getClass(), EmptyEnumeration.class ); + e = sysRoot.search( "", "(|(bogusAttribute=abc123)(ou=abc123))", cons ); assertNotNull( e ); + assertFalse( e.hasMore() ); assertFalse( e.getClass().equals( EmptyEnumeration.class ) ); e = sysRoot.search( "", "(OBJECTclass=*)", cons ); assertNotNull( e ); + assertTrue( e.hasMore() ); assertFalse( e.getClass().equals( EmptyEnumeration.class ) ); e = sysRoot.search( "", "(objectclass=*)", cons ); Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyAddTest.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyAddTest.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyAddTest.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyAddTest.java Mon Mar 17 23:12:41 2008 @@ -34,6 +34,7 @@ import javax.naming.directory.InvalidAttributeIdentifierException; import javax.naming.directory.InvalidAttributeValueException; import javax.naming.directory.ModificationItem; +import javax.naming.directory.NoSuchAttributeException; import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; import javax.naming.ldap.InitialLdapContext; @@ -70,6 +71,8 @@ Attribute attribute = new AttributeImpl( "objectClass" ); attribute.add( "top" ); attribute.add( "person" ); + attribute.add( "organizationalperson" ); + attribute.add( "inetorgperson" ); attributes.put( attribute ); attributes.put( "cn", cn ); attributes.put( "sn", sn ); @@ -241,20 +244,20 @@ { // Change description attribute Attributes attrs = new AttributesImpl( true ); - attrs.put( new AttributeImpl( "attr1", "attr 1" ) ); - attrs.put( new AttributeImpl( "attr2", "attr 2" ) ); - attrs.put( new AttributeImpl( "attr3", "attr 3" ) ); - attrs.put( new AttributeImpl( "attr4", "attr 4" ) ); - attrs.put( new AttributeImpl( "attr5", "attr 5" ) ); - attrs.put( new AttributeImpl( "attr6", "attr 6" ) ); - attrs.put( new AttributeImpl( "attr7", "attr 7" ) ); - attrs.put( new AttributeImpl( "attr8", "attr 8" ) ); - attrs.put( new AttributeImpl( "attr9", "attr 9" ) ); - attrs.put( new AttributeImpl( "attr10", "attr 10" ) ); - attrs.put( new AttributeImpl( "attr11", "attr 11" ) ); - attrs.put( new AttributeImpl( "attr12", "attr 12" ) ); - attrs.put( new AttributeImpl( "attr13", "attr 13" ) ); - attrs.put( new AttributeImpl( "attr14", "attr 14" ) ); + attrs.put( new AttributeImpl( "telephoneNumber", "attr 1" ) ); + attrs.put( new AttributeImpl( "telephoneNumber", "attr 2" ) ); + attrs.put( new AttributeImpl( "telephoneNumber", "attr 3" ) ); + attrs.put( new AttributeImpl( "telephoneNumber", "attr 4" ) ); + attrs.put( new AttributeImpl( "telephoneNumber", "attr 5" ) ); + attrs.put( new AttributeImpl( "telephoneNumber", "attr 6" ) ); + attrs.put( new AttributeImpl( "telephoneNumber", "attr 7" ) ); + attrs.put( new AttributeImpl( "telephoneNumber", "attr 8" ) ); + attrs.put( new AttributeImpl( "telephoneNumber", "attr 9" ) ); + attrs.put( new AttributeImpl( "telephoneNumber", "attr 10" ) ); + attrs.put( new AttributeImpl( "telephoneNumber", "attr 11" ) ); + attrs.put( new AttributeImpl( "telephoneNumber", "attr 12" ) ); + attrs.put( new AttributeImpl( "telephoneNumber", "attr 13" ) ); + attrs.put( new AttributeImpl( "telephoneNumber", "attr 14" ) ); Attribute attr = new AttributeImpl( "description", PERSON_DESCRIPTION ); @@ -330,7 +333,7 @@ // Check, whether attribute objectClass is unchanged Attributes attrs = ctx.getAttributes( RDN_TORI_AMOS ); ocls = attrs.get( "objectClass" ); - assertEquals( ocls.size(), 2 ); + assertEquals( ocls.size(), 4 ); assertTrue( ocls.contains( "top" ) ); assertTrue( ocls.contains( "person" ) ); } @@ -401,7 +404,7 @@ /** - * Modu=ify the entry with a bad attribute : this should fail + * Modify the entry with a bad attribute : this should fail * * @throws NamingException */ @@ -415,7 +418,7 @@ { ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs ); } - catch ( InvalidAttributeIdentifierException iaie ) + catch ( NoSuchAttributeException nsae ) { // We have a failure : the attribute is unknown in the schema assertTrue( true ); @@ -439,7 +442,7 @@ String rdn = "cn=Kate Bush"; ctx.createSubcontext(rdn, attrs); - // Add a decsription with two values + // Add a description with two values String[] descriptions = { "Kate Bush is a British singer-songwriter.", "She has become one of the most influential female artists of the twentieth century." }; @@ -464,11 +467,11 @@ String base = ""; // Check entry - NamingEnumeration enm = ctx.search(base, filter, sctls); + NamingEnumeration enm = ctx.search(base, filter, sctls); assertTrue(enm.hasMore()); while (enm.hasMore()) { - SearchResult sr = (SearchResult) enm.next(); + SearchResult sr = enm.next(); attrs = sr.getAttributes(); Attribute desc = sr.getAttributes().get("description"); assertNotNull(desc); @@ -581,5 +584,26 @@ { } + } + + + /** + * Add a new attribute to a person entry. + * + * @throws NamingException + */ + public void testAddNewBinaryAttributeValue() throws NamingException + { + // Add a binary attribute + byte[] newValue = new byte[]{0x00, 0x01, 0x02, 0x03}; + Attributes attrs = new AttributesImpl( "userCertificate;binary", newValue ); + ctx.modifyAttributes( RDN_TORI_AMOS, DirContext.ADD_ATTRIBUTE, attrs ); + + // Verify, that attribute value is added + attrs = ctx.getAttributes( RDN_TORI_AMOS ); + Attribute attr = attrs.get( "userCertificate" ); + assertNotNull( attr ); + assertTrue( attr.contains( newValue ) ); + assertEquals( 1, attr.size() ); } } Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyRemoveTest.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyRemoveTest.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyRemoveTest.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyRemoveTest.java Mon Mar 17 23:12:41 2008 @@ -503,6 +503,8 @@ // expected } catch (InvalidAttributeValueException e) { // expected + } catch ( Exception e ) { + e.printStackTrace(); } ctx.destroySubcontext(rdn); Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyReplaceITest.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyReplaceITest.java?rev=638228&r1=638227&r2=638228&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyReplaceITest.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyReplaceITest.java Mon Mar 17 23:12:41 2008 @@ -132,7 +132,7 @@ String rdn = "cn=Kate Bush"; ctx.createSubcontext( rdn, attrs ); - Attribute attr = new AttributeImpl( "numberOfOctaves" ); + Attribute attr = new AttributeImpl( "l" ); ModificationItemImpl item = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, attr ); ctx.modifyAttributes( rdn, new ModificationItemImpl[]