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 2016/06/15 12:30:01 UTC
svn commit: r1748572 [13/23] - in
/directory/apacheds/branches/apacheds-value: ./
benchmarks/installers-maven-plugin/
benchmarks/installers-maven-plugin/.settings/
benchmarks/installers-maven-plugin/target/
benchmarks/installers-maven-plugin/target/cla...
Modified: directory/apacheds/branches/apacheds-value/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/wrapper/src/UninstallApp-NT.bat.in
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/wrapper/src/UninstallApp-NT.bat.in?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/wrapper/src/UninstallApp-NT.bat.in (original)
+++ directory/apacheds/branches/apacheds-value/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/wrapper/src/UninstallApp-NT.bat.in Wed Jun 15 12:29:57 2016
@@ -1,67 +0,0 @@
-REM Licensed to the Apache Software Foundation (ASF) under one
-REM or more contributor license agreements. See the NOTICE file
-REM distributed with this work for additional information
-REM regarding copyright ownership. The ASF licenses this file
-REM to you under the Apache License, Version 2.0 (the
-REM "License"); you may not use this file except in compliance
-REM with the License. You may obtain a copy of the License at
-REM
-REM http://www.apache.org/licenses/LICENSE-2.0
-REM
-REM Unless required by applicable law or agreed to in writing,
-REM software distributed under the License is distributed on an
-REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-REM KIND, either express or implied. See the License for the
-REM specific language governing permissions and limitations
-REM under the License.
-
-@echo off
-setlocal
-
-rem Copyright (c) 1999, 2006 Tanuki Software Inc.
-rem
-rem Java Service Wrapper general NT service uninstall script
-rem
-
-if "%OS%"=="Windows_NT" goto nt
-echo This script only works with NT-based versions of Windows.
-goto :eof
-
-:nt
-rem
-rem Find the application home.
-rem
-rem %~dp0 is location of current script under NT
-set _REALPATH=%~dp0
-
-rem Decide on the wrapper binary.
-set _WRAPPER_BASE=wrapper
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe
-if exist "%_WRAPPER_EXE%" goto conf
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe
-if exist "%_WRAPPER_EXE%" goto conf
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%.exe
-if exist "%_WRAPPER_EXE%" goto conf
-echo Unable to locate a Wrapper executable using any of the following names:
-echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe
-echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe
-echo %_REALPATH%%_WRAPPER_BASE%.exe
-pause
-goto :eof
-
-rem
-rem Find the apacheds.conf
-rem
-:conf
-set _WRAPPER_CONF="%~f1"
-if not %_WRAPPER_CONF%=="" goto startup
-set _WRAPPER_CONF="%_REALPATH%..\conf\apacheds.conf"
-
-rem
-rem Uninstall the Wrapper as an NT service.
-rem
-:startup
-"%_WRAPPER_EXE%" -r %_WRAPPER_CONF%
-if not errorlevel 1 goto :eof
-pause
-
Modified: directory/apacheds/branches/apacheds-value/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/wrapper/src/sh.script.in
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/wrapper/src/sh.script.in?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/wrapper/src/sh.script.in (original)
+++ directory/apacheds/branches/apacheds-value/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/wrapper/src/sh.script.in Wed Jun 15 12:29:57 2016
@@ -1,617 +0,0 @@
-#! /bin/sh
-#
-# Shell script to start/stop Apache Directory Server
-# If you want to change apacheds service settings please modify the apacheds.conf
-# file for the instance you wish to change.
-# chkconfig: 2345 91 35
-# description: This script starts and stops @app.long.name@
-#
-
-# 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.
-
-
-# Instances
-
-INSTANCE="$2"
-. /etc/sysconfig/apacheds
-
-#INSTANCE_HOME="/var/lib/apacheds"
-
-# Application
-APP_NAME="@app@"
-export APACHEDS_HOME
-APP_LONG_NAME="Apache Directory Server - $INSTANCE"
-
-
-# Wrapper
-WRAPPER_CMD="/opt/@app@-@app.version@/bin/apacheds"
-WRAPPER_CONF="/opt/@app@-@app.version@/conf/apacheds.conf"
-
-# Priority at which to run the wrapper. See "man nice" for valid priorities.
-# nice is only used if a priority is specified.
-PRIORITY=
-
-# Location of the pid file.
-PIDDIR="/var/run/apacheds/$INSTANCE"
-
-# If uncommented, causes the Wrapper to be shutdown using an anchor file.
-# When launched with the 'start' command, it will also ignore all INT and
-# TERM signals.
-#IGNORE_SIGNALS=true
-
-# If specified, the Wrapper will be run as the specified user.
-# IMPORTANT - Make sure that the user has the required privileges to write
-# the PID file and wrapper.log files. Failure to be able to write the log
-# file will cause the Wrapper to exit without any way to write out an error
-# message.
-# NOTE - This will set the user which is used to run the Wrapper as well as
-# the JVM and is not useful in situations where a privileged resource or
-# port needs to be allocated prior to the user being changed.
-RUN_AS_USER=$APP_NAME
-
-# Do not modify anything beyond this point
-#-----------------------------------------------------------------------------
-
-# Get the fully qualified path to the script
-case $0 in
- /*)
- SCRIPT="$0"
- ;;
- *)
- PWD=`pwd`
- SCRIPT="$PWD/$0"
- ;;
-esac
-
-# Resolve the true real path without any sym links.
-CHANGED=true
-while [ "X$CHANGED" != "X" ]
-do
- # Change spaces to ":" so the tokens can be parsed.
- SAFESCRIPT=`echo $SCRIPT | sed -e 's; ;:;g'`
- # Get the real path to this script, resolving any symbolic links
- TOKENS=`echo $SAFESCRIPT | sed -e 's;/; ;g'`
- REALPATH=
- for C in $TOKENS; do
- # Change any ":" in the token back to a space.
- C=`echo $C | sed -e 's;:; ;g'`
- REALPATH="$REALPATH/$C"
- # If REALPATH is a sym link, resolve it. Loop for nested links.
- while [ -h "$REALPATH" ] ; do
- LS="`ls -ld "$REALPATH"`"
- LINK="`expr "$LS" : '.*-> \(.*\)$'`"
- if expr "$LINK" : '/.*' > /dev/null; then
- # LINK is absolute.
- REALPATH="$LINK"
- else
- # LINK is relative.
- REALPATH="`dirname "$REALPATH"`""/$LINK"
- fi
- done
- done
-
- if [ "$REALPATH" = "$SCRIPT" ]
- then
- CHANGED=""
- else
- SCRIPT="$REALPATH"
- fi
-done
-
-# Change the current directory to the location of the script
-cd "`dirname "$REALPATH"`"
-REALDIR=`pwd`
-
-# If the PIDDIR is relative, set its value relative to the full REALPATH to avoid problems if
-# the working directory is later changed.
-FIRST_CHAR=`echo $PIDDIR | cut -c1,1`
-if [ "$FIRST_CHAR" != "/" ]
-then
- PIDDIR=$REALDIR/$PIDDIR
-fi
-# Same test for WRAPPER_CMD
-FIRST_CHAR=`echo $WRAPPER_CMD | cut -c1,1`
-if [ "$FIRST_CHAR" != "/" ]
-then
- WRAPPER_CMD=$REALDIR/$WRAPPER_CMD
-fi
-# Same test for WRAPPER_CONF
-FIRST_CHAR=`echo $WRAPPER_CONF | cut -c1,1`
-if [ "$FIRST_CHAR" != "/" ]
-then
- WRAPPER_CONF=$REALDIR/$WRAPPER_CONF
-fi
-
-# Process ID
-ANCHORFILE="$PIDDIR/$INSTANCE.anchor"
-PIDFILE="$PIDDIR/$INSTANCE.pid"
-LOCKDIR="/var/lock/subsys"
-LOCKFILE="$LOCKDIR/$INSTANCE"
-pid=""
-
-# Resolve the location of the 'ps' command
-PSEXE="/usr/bin/ps"
-if [ ! -x "$PSEXE" ]
-then
- PSEXE="/bin/ps"
- if [ ! -x "$PSEXE" ]
- then
- echo "Unable to locate 'ps'."
- echo "Please report this message along with the location of the command on your system."
- exit 1
- fi
-fi
-
-# Resolve the os
-DIST_OS=`uname -s | tr [:upper:] [:lower:] | tr -d [:blank:]`
-case "$DIST_OS" in
- 'sunos')
- DIST_OS="solaris"
- ;;
- 'hp-ux' | 'hp-ux64')
- DIST_OS="hpux"
- ;;
- 'darwin')
- DIST_OS="macosx"
- ;;
- 'unix_sv')
- DIST_OS="unixware"
- ;;
-esac
-
-# Resolve the architecture
-DIST_ARCH=`uname -p | tr [:upper:] [:lower:] | tr -d [:blank:]`
-if [ "$DIST_ARCH" = "unknown" ]
-then
- DIST_ARCH=`uname -m | tr [:upper:] [:lower:] | tr -d [:blank:]`
-fi
-case "$DIST_ARCH" in
- 'amd64' | 'athlon' | 'ia32' | 'ia64' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
- DIST_ARCH="x86"
- ;;
- 'ip27')
- DIST_ARCH="mips"
- ;;
- 'power' | 'powerpc' | 'power_pc' | 'ppc64')
- DIST_ARCH="ppc"
- ;;
- 'pa_risc' | 'pa-risc')
- DIST_ARCH="parisc"
- ;;
- 'sun4u' | 'sparcv9')
- DIST_ARCH="sparc"
- ;;
- '9000/800')
- DIST_ARCH="parisc"
- ;;
-esac
-
-outputFile() {
- if [ -f "$1" ]
- then
- echo " $1 (Found but not executable.)";
- else
- echo " $1"
- fi
-}
-
-# Decide on the wrapper binary to use.
-# If a 32-bit wrapper binary exists then it will work on 32 or 64 bit
-# platforms, if the 64-bit binary exists then the distribution most
-# likely wants to use long names. Otherwise, look for the default.
-# For macosx, we also want to look for universal binaries.
-WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
-if [ -x "$WRAPPER_TEST_CMD" ]
-then
- WRAPPER_CMD="$WRAPPER_TEST_CMD"
-else
- if [ "$DIST_OS" = "macosx" ]
- then
- WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-32"
- if [ -x "$WRAPPER_TEST_CMD" ]
- then
- WRAPPER_CMD="$WRAPPER_TEST_CMD"
- else
- WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- if [ -x "$WRAPPER_TEST_CMD" ]
- then
- WRAPPER_CMD="$WRAPPER_TEST_CMD"
- else
- WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-64"
- if [ -x "$WRAPPER_TEST_CMD" ]
- then
- WRAPPER_CMD="$WRAPPER_TEST_CMD"
- else
- if [ ! -x "$WRAPPER_CMD" ]
- then
- echo "Unable to locate any of the following binaries:"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
- outputFile "$WRAPPER_CMD-$DIST_OS-universal-32"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- outputFile "$WRAPPER_CMD-$DIST_OS-universal-64"
- outputFile "$WRAPPER_CMD"
- exit 1
- fi
- fi
- fi
- fi
- else
- WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- if [ -x "$WRAPPER_TEST_CMD" ]
- then
- WRAPPER_CMD="$WRAPPER_TEST_CMD"
- else
- if [ ! -x "$WRAPPER_CMD" ]
- then
- echo "Unable to locate any of the following binaries:"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- outputFile "$WRAPPER_CMD"
- exit 1
- fi
- fi
- fi
-fi
-
-# Build the nice clause
-if [ "X$PRIORITY" = "X" ]
-then
- CMDNICE=""
-else
- CMDNICE="nice -$PRIORITY"
-fi
-
-# Build the anchor file clause.
-if [ "X$IGNORE_SIGNALS" = "X" ]
-then
- ANCHORPROP=
- IGNOREPROP=
-else
- ANCHORPROP=wrapper.anchorfile=\"$ANCHORFILE\"
- IGNOREPROP=wrapper.ignore_signals=TRUE
-fi
-
-# Build the lock file clause. Only create a lock file if the lock directory exists on this platform.
-LOCKPROP=
-if [ -d $LOCKDIR ]
-then
- if [ -w $LOCKDIR ]
- then
- LOCKPROP=wrapper.lockfile=\"$LOCKFILE\"
- fi
-fi
-
-checkUser() {
- # $1 touchLock flag
- # $2 command
- # $3 instance
-
- # Check the configured user. If necessary rerun this script as the desired user.
- if [ "X$RUN_AS_USER" != "X" ]
- then
- # Resolve the location of the 'id' command
- IDEXE="/usr/xpg4/bin/id"
- if [ ! -x "$IDEXE" ]
- then
- IDEXE="/usr/bin/id"
- if [ ! -x "$IDEXE" ]
- then
- IDEXE="/bin/id"
- if [ ! -x "$IDEXE" ]
- then
- echo "Unable to locate 'id'."
- echo "Please report this message along with the location of the command on your system."
- exit 1
- fi
- fi
- fi
-
- if [ "`$IDEXE -u -n`" = "$RUN_AS_USER" ]
- then
- # Already running as the configured user. Avoid password prompts by not calling su.
- RUN_AS_USER=""
- fi
- fi
- if [ "X$RUN_AS_USER" != "X" ]
- then
- # If LOCKPROP and $RUN_AS_USER are defined then the new user will most likely not be
- # able to create the lock file. The Wrapper will be able to update this file once it
- # is created but will not be able to delete it on shutdown. If $2 is defined then
- # the lock file should be created for the current command
- if [ "X$LOCKPROP" != "X" ]
- then
- if [ "X$1" != "X" ]
- then
- # Resolve the primary group
- RUN_AS_GROUP=`groups $RUN_AS_USER | awk '{print $3}' | tail -1`
- if [ "X$RUN_AS_GROUP" = "X" ]
- then
- RUN_AS_GROUP=$RUN_AS_USER
- fi
- touch $LOCKFILE
- chown $RUN_AS_USER:$RUN_AS_GROUP $LOCKFILE
- fi
- fi
-
- # Still want to change users, recurse. This means that the user will only be
- # prompted for a password once. Variables shifted by 1
- su -m $RUN_AS_USER -c "\"$REALPATH\" $2 $3"
- ret=$?
-
- # Now that we are the original user again, we may need to clean up the lock file.
- if [ "X$LOCKPROP" != "X" ]
- then
- getpid
- if [ "X$pid" = "X" ]
- then
- # Wrapper is not running so make sure the lock file is deleted.
- if [ -f "$LOCKFILE" ]
- then
- rm "$LOCKFILE"
- fi
- fi
- fi
-
- exit $ret
- fi
-}
-
-getpid() {
- if [ -f "$PIDFILE" ]
- then
- if [ -r "$PIDFILE" ]
- then
- pid=`cat "$PIDFILE"`
- if [ "X$pid" != "X" ]
- then
- # It is possible that 'a' process with the pid exists but that it is not the
- # correct process. This can happen in a number of cases, but the most
- # common is during system startup after an unclean shutdown.
- # The ps statement below looks for the specific wrapper command running as
- # the pid. If it is not found then the pid file is considered to be stale.
- pidtest=`$PSEXE -p $pid -o args | grep "$WRAPPER_CMD" | tail -1`
- if [ "X$pidtest" = "X" ]
- then
- # This is a stale pid file.
- rm -f "$PIDFILE"
- echo "Removed stale pid file: $PIDFILE"
- pid=""
- fi
- fi
- else
- echo "Cannot read $PIDFILE."
- exit 1
- fi
- fi
-}
-
-testpid() {
- pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
- if [ "X$pid" = "X" ]
- then
- # Process is gone so remove the pid file.
- rm -f "$PIDFILE"
- pid=""
- fi
-}
-
-usage() {
- echo "Please enter an instance name..."
- echo "Usage: $0 <command> <instance name>"
- echo " Available Commands: "
- echo " console - Run in interactive mode with log output to the console."
- echo " Press CTRL-C to stop."
- echo " start - Run the instance in the background"
- echo " stop - Stop the running instance"
- echo " repair - Repair the instance"
- echo " restart - Restart the instance if it is already running,"
- echo " or start if it wasn't already running"
- echo " status - Display the status of the instance (running or stopped)"
- echo " dump - Request a JVM dump of the running process"
-}
-
-console() {
- echo "Running $APP_LONG_NAME..."
- getpid
- if [ "X$pid" = "X" ]
- then
- # The string passed to eval must handles spaces in paths correctly.
- COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" set.INSTANCE_HOME=\"$INSTANCE_HOME\" set.INSTANCE=\"$INSTANCE\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" $ANCHORPROP $LOCKPROP wrapper.debug=true"
- eval $COMMAND_LINE
- else
- echo "$APP_LONG_NAME is already running."
- exit 1
- fi
-}
-
-start() {
- echo "Starting $APP_LONG_NAME..."
- getpid
- if [ "X$pid" = "X" ]
- then
- # The string passed to eval must handles spaces in paths correctly.
- COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" set.INSTANCE_HOME=$INSTANCE_HOME set.INSTANCE=$INSTANCE wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $LOCKPROP"
- eval $COMMAND_LINE
- else
- echo "$APP_LONG_NAME is already running."
- exit 1
- fi
-}
-
-repair() {
- echo "Repairing $APP_LONG_NAME..."
- getpid
- if [ "X$pid" = "X" ]
- then
- # The string passed to eval must handles spaces in paths correctly.
- COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" repair \"$WRAPPER_CONF\" set.REPAIR_COMMAND=repair set.INSTANCE_HOME=$INSTANCE_HOME set.INSTANCE=$INSTANCE wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $LOCKPROP"
- eval $COMMAND_LINE
- else
- echo "$APP_LONG_NAME is already running."
- exit 1
- fi
-}
-
-stopit() {
- echo "Stopping $APP_LONG_NAME..."
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "$APP_LONG_NAME was not running."
- else
- if [ "X$IGNORE_SIGNALS" = "X" ]
- then
- # Running so try to stop it.
- kill $pid
- if [ $? -ne 0 ]
- then
- # An explanation for the failure should have been given
- echo "Unable to stop $APP_LONG_NAME."
- exit 1
- fi
- else
- rm -f "$ANCHORFILE"
- if [ -f "$ANCHORFILE" ]
- then
- # An explanation for the failure should have been given
- echo "Unable to stop $APP_LONG_NAME."
- exit 1
- fi
- fi
-
- # We can not predict how long it will take for the wrapper to
- # actually stop as it depends on settings in apacheds.conf.
- # Loop until it does.
- savepid=$pid
- CNT=0
- TOTCNT=0
- while [ "X$pid" != "X" ]
- do
- # Show a waiting message every 5 seconds.
- if [ "$CNT" -lt "5" ]
- then
- CNT=`expr $CNT + 1`
- else
- echo "Waiting for $APP_LONG_NAME to exit..."
- CNT=0
- fi
- TOTCNT=`expr $TOTCNT + 1`
-
- sleep 1
-
- testpid
- done
-
- pid=$savepid
- testpid
- if [ "X$pid" != "X" ]
- then
- echo "Failed to stop $APP_LONG_NAME."
- exit 1
- else
- echo "Stopped $APP_LONG_NAME."
- fi
- fi
-}
-
-status() {
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "$APP_LONG_NAME is not running."
- exit 1
- else
- echo "$APP_LONG_NAME is running ($pid)."
- exit 0
- fi
-}
-
-dump() {
- echo "Dumping $APP_LONG_NAME..."
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "$APP_LONG_NAME was not running."
-
- else
- kill -3 $pid
-
- if [ $? -ne 0 ]
- then
- echo "Failed to dump $APP_LONG_NAME."
- exit 1
- else
- echo "Dumped $APP_LONG_NAME."
- fi
- fi
-}
-
-# Make sure they entered an instance name
-if [ "x"$2 = "x" ]
-then
- usage
- exit 1
-fi
-
-case "$1" in
-
- 'console')
- checkUser touchlock $1 $INSTANCE
- console
- ;;
-
- 'start')
- checkUser touchlock $1 $INSTANCE
- start
- ;;
-
- 'repair')
- checkUser touchlock $1 $INSTANCE
- stopit
- repair
- start
- ;;
-
- 'stop')
- checkUser "" $1 $INSTANCE
- stopit
- ;;
-
- 'restart')
- checkUser touchlock $1 $INSTANCE
- stopit
- start
- ;;
-
- 'status')
- checkUser "" $1 $INSTANCE
- status
- ;;
-
- 'dump')
- checkUser "" $1 $INSTANCE
- dump
- ;;
-
- *)
- echo "Usage: $0 { console | start | stop | restart | status | dump } <instance name>"
- exit 1
- ;;
-esac
-
-exit 0
Modified: directory/apacheds/branches/apacheds-value/installers-maven-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/installers-maven-plugin/src/site/site.xml?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/installers-maven-plugin/src/site/site.xml (original)
+++ directory/apacheds/branches/apacheds-value/installers-maven-plugin/src/site/site.xml Wed Jun 15 12:29:57 2016
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<!--
- @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
--->
-<project name="${project.name}">
- <body>
- <menu ref="parent" />
- <menu name="Overview">
- <item name="Goals" href="plugin-info.html" />
- </menu>
- <menu ref="reports" />
- </body>
-</project>
Modified: directory/apacheds/branches/apacheds-value/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java Wed Jun 15 12:29:57 2016
@@ -29,13 +29,12 @@ import org.apache.directory.api.asn1.Enc
import org.apache.directory.api.ldap.model.constants.Loggers;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.entry.Attribute;
-import org.apache.directory.api.ldap.model.entry.BinaryValue;
import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
import org.apache.directory.api.ldap.model.entry.DefaultModification;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.entry.Modification;
import org.apache.directory.api.ldap.model.entry.ModificationOperation;
-import org.apache.directory.api.ldap.model.entry.StringValue;
+import org.apache.directory.api.ldap.model.entry.Value;
import org.apache.directory.api.ldap.model.exception.LdapAuthenticationException;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.name.Dn;
@@ -140,8 +139,8 @@ public class KeyDerivationInterceptor ex
LOG.debug( "Adding the entry '{}' for Dn '{}'.", entry, normName.getName() );
// Get the entry's password. We will use the first one.
- BinaryValue userPassword = ( BinaryValue ) entry.get( userPasswordAT ).get();
- String strUserPassword = userPassword.getString();
+ Value userPassword = entry.get( userPasswordAT ).get();
+ String strUserPassword = userPassword.getValue();
if ( LOG.isDebugEnabled() )
{
@@ -256,24 +255,24 @@ public class KeyDerivationInterceptor ex
if ( userPasswordAT.equals( attr.getAttributeType() ) )
{
- Object firstValue = attr.get();
+ Value firstValue = attr.get();
String password = null;
- if ( firstValue instanceof StringValue )
+ if ( firstValue.isHumanReadable() )
{
- password = ( ( StringValue ) firstValue ).getString();
+ password = firstValue.getValue();
LOG.debug( "{} Attribute id : 'userPassword', Values : [ '{}' ]", operation, password );
LOG_KRB.debug( "{} Attribute id : 'userPassword', Values : [ '{}' ]", operation, password );
}
- else if ( firstValue instanceof BinaryValue )
+ else
{
- password = ( ( BinaryValue ) firstValue ).getString();
+ password = Strings.utf8ToString( firstValue.getBytes() );
if ( LOG.isDebugEnabled() )
{
StringBuffer sb = new StringBuffer();
sb.append( "'" + password + "' ( " );
- sb.append( Strings.dumpBytes( ( ( BinaryValue ) firstValue ).getBytes() ).trim() );
+ sb.append( Strings.dumpBytes( firstValue.getBytes() ).trim() );
sb.append( " )" );
LOG.debug( "{} Attribute id : 'userPassword', Values : [ {} ]", operation, sb.toString() );
LOG_KRB.debug( "{} Attribute id : 'userPassword', Values : [ {} ]", operation, sb.toString() );
Modified: directory/apacheds/branches/apacheds-value/interceptors/admin/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/admin/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/admin/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/admin/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java Wed Jun 15 12:29:57 2016
@@ -49,7 +49,6 @@ import org.apache.directory.api.ldap.mod
import org.apache.directory.api.ldap.model.subtree.AdministrativeRole;
import org.apache.directory.api.ldap.util.tree.DnNode;
import org.apache.directory.api.util.Strings;
-import org.apache.directory.server.constants.ServerDNConstants;
import org.apache.directory.server.core.api.CoreSession;
import org.apache.directory.server.core.api.DirectoryService;
import org.apache.directory.server.core.api.InterceptorEnum;
@@ -94,16 +93,11 @@ public class AdministrativePointIntercep
/** A {@link Logger} for this class */
private static final Logger LOG = LoggerFactory.getLogger( AdministrativePointInterceptor.class );
- /**
- * Speedup for logs
- */
- private static final boolean IS_DEBUG = LOG.isDebugEnabled();
-
/** A reference to the nexus for direct backend operations */
private PartitionNexus nexus;
/** The possible roles */
- private static final Set<String> ROLES = new HashSet<String>();
+ private static final Set<String> ROLES = new HashSet<>();
// Initialize the ROLES field
static
@@ -127,7 +121,7 @@ public class AdministrativePointIntercep
}
/** A Map to associate a role with it's OID */
- private static final Map<String, String> ROLES_OID = new HashMap<String, String>();
+ private static final Map<String, String> ROLES_OID = new HashMap<>();
// Initialize the roles/oid map
static
@@ -150,7 +144,7 @@ public class AdministrativePointIntercep
}
/** The possible inner area roles */
- private static final Set<String> INNER_AREA_ROLES = new HashSet<String>();
+ private static final Set<String> INNER_AREA_ROLES = new HashSet<>();
static
{
@@ -163,7 +157,7 @@ public class AdministrativePointIntercep
}
/** The possible specific area roles */
- private static final Set<String> SPECIFIC_AREA_ROLES = new HashSet<String>();
+ private static final Set<String> SPECIFIC_AREA_ROLES = new HashSet<>();
static
{
@@ -260,9 +254,9 @@ public class AdministrativePointIntercep
return;
}
- for ( Value<?> value : adminPoint )
+ for ( Value value : adminPoint )
{
- String role = value.getString();
+ String role = value.getValue();
// Deal with AccessControl AP
if ( isAccessControlSpecificRole( role ) )
@@ -606,9 +600,9 @@ public class AdministrativePointIntercep
* Check if we can safely add a role. If it's an AAP, we have to be sure that
* it's the only role present in the AT.
*/
- private void checkAddRole( Value<?> role, Attribute adminPoint, Dn dn ) throws LdapException
+ private void checkAddRole( Value role, Attribute adminPoint, Dn dn ) throws LdapException
{
- String roleStr = Strings.toLowerCaseAscii( Strings.trim( role.getString() ) );
+ String roleStr = Strings.toLowerCaseAscii( Strings.trim( role.getValue() ) );
// Check that the added AdministrativeRole is valid
if ( !ROLES.contains( roleStr ) )
@@ -661,9 +655,9 @@ public class AdministrativePointIntercep
/**
* Check if we can safely delete a role
*/
- private void checkDelRole( Value<?> role, Attribute adminPoint, Dn dn ) throws LdapException
+ private void checkDelRole( Value role, Attribute adminPoint, Dn dn ) throws LdapException
{
- String roleStr = Strings.toLowerCaseAscii( Strings.trim( role.getString() ) );
+ String roleStr = Strings.toLowerCaseAscii( Strings.trim( role.getValue() ) );
// Check that the removed AdministrativeRole is valid
if ( !ROLES.contains( roleStr ) )
@@ -754,9 +748,7 @@ public class AdministrativePointIntercep
//-------------------------------------------------------------------------------------------
private List<Entry> getAdministrativePoints() throws LdapException
{
- List<Entry> entries = new ArrayList<Entry>();
-
- Dn adminDn = new Dn( schemaManager, ServerDNConstants.ADMIN_SYSTEM_DN );
+ List<Entry> entries = new ArrayList<>();
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -832,9 +824,9 @@ public class AdministrativePointIntercep
Dn dn = deleteContext.getDn();
// Remove the APs in the AP cache
- for ( Value<?> value : adminPoint )
+ for ( Value value : adminPoint )
{
- String role = value.getString();
+ String role = value.getValue();
// Deal with Autonomous AP : delete the 4 associated SAP/AAP
if ( isAutonomousAreaRole( role ) )
@@ -975,8 +967,8 @@ public class AdministrativePointIntercep
*/
private boolean isAAP( Attribute adminPoint )
{
- return ( adminPoint.contains( SchemaConstants.AUTONOMOUS_AREA )
- || adminPoint.contains( SchemaConstants.AUTONOMOUS_AREA_OID ) );
+ return adminPoint.contains( SchemaConstants.AUTONOMOUS_AREA )
+ || adminPoint.contains( SchemaConstants.AUTONOMOUS_AREA_OID );
}
@@ -1127,6 +1119,7 @@ public class AdministrativePointIntercep
/**
* Registers and initializes all {@link Authenticator}s to this service.
*/
+ @Override
public void init( DirectoryService directoryService ) throws LdapException
{
LOG.debug( "Initializing the AdministrativeInterceptor" );
@@ -1137,8 +1130,6 @@ public class AdministrativePointIntercep
// Load all the AdministratvePoint :
// Autonomous Administrative Point first, then Specific
// administrative point, finally the Inner administrative Point
- Dn adminDn = new Dn( schemaManager, ServerDNConstants.ADMIN_SYSTEM_DN );
-
// get the list of all the AAPs
List<Entry> administrativePoints = getAdministrativePoints();
@@ -1158,6 +1149,7 @@ public class AdministrativePointIntercep
/**
* {@inheritDoc}
*/
+ @Override
public void destroy()
{
}
@@ -1174,6 +1166,7 @@ public class AdministrativePointIntercep
*
* @throws LdapException If we had some error while processing the Add operation
*/
+ @Override
public void add( AddOperationContext addContext ) throws LdapException
{
LOG.debug( ">>> Entering into the Administrative Interceptor, addRequest" );
@@ -1201,7 +1194,7 @@ public class AdministrativePointIntercep
try
{
// Loop on all the added roles to check if they are valid
- for ( Value<?> role : adminPoint )
+ for ( Value role : adminPoint )
{
checkAddRole( role, adminPoint, dn );
}
@@ -1234,6 +1227,7 @@ public class AdministrativePointIntercep
* </ul>
* {@inheritDoc}
*/
+ @Override
public void delete( DeleteOperationContext deleteContext ) throws LdapException
{
LOG.debug( ">>> Entering into the Administrative Interceptor, delRequest" );
@@ -1262,9 +1256,9 @@ public class AdministrativePointIntercep
{
// Check that the removed AdministrativeRoles are valid. We don't have to do
// any other check, as the deleted entry has no children.
- for ( Value<?> role : adminPoint )
+ for ( Value role : adminPoint )
{
- if ( !isValidRole( role.getString() ) )
+ if ( !isValidRole( role.getValue() ) )
{
String message = "Cannot remove the given role, it's not a valid one :" + role;
LOG.error( message );
@@ -1301,6 +1295,7 @@ public class AdministrativePointIntercep
*
* {@inheritDoc}
*/
+ @Override
public void modify( ModifyOperationContext modifyContext ) throws LdapException
{
LOG.debug( ">>> Entering into the Administrative Interceptor, modifyRequest" );
@@ -1367,9 +1362,9 @@ public class AdministrativePointIntercep
switch ( modification.getOperation() )
{
case ADD_ATTRIBUTE:
- for ( Value<?> role : attribute )
+ for ( Value role : attribute )
{
- addRole( role.getString(), dn, uuid, acapCache, caapCache, teapCache,
+ addRole( role.getValue(), dn, uuid, acapCache, caapCache, teapCache,
ssapCache );
// Add the role to the modified attribute
@@ -1383,10 +1378,9 @@ public class AdministrativePointIntercep
if ( attribute.size() == 0 )
{
// Complete removal. Loop on all the existing roles and remove them
- for ( Value<?> role : modifiedAdminRole )
+ for ( Value role : modifiedAdminRole )
{
- //checkDelRole( role, modifiedAdminRole, dn, directoryService.getAdministrativePoints() );
- delRole( role.getString(), dn, uuid, acapCache, caapCache, teapCache, ssapCache );
+ delRole( role.getValue(), dn, uuid, acapCache, caapCache, teapCache, ssapCache );
}
modifiedAdminRole.clear();
@@ -1394,12 +1388,12 @@ public class AdministrativePointIntercep
}
// Now deal with the values to remove
- for ( Value<?> value : attribute )
+ for ( Value value : attribute )
{
- if ( !isValidRole( value.getString() ) )
+ if ( !isValidRole( value.getValue() ) )
{
// Not a valid role : we will throw an exception
- String msg = "Invalid role : " + value.getString();
+ String msg = "Invalid role : " + value.getValue();
LOG.error( msg );
throw new LdapInvalidAttributeValueException(
ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX,
@@ -1416,7 +1410,7 @@ public class AdministrativePointIntercep
}
modifiedAdminRole.remove( value );
- delRole( value.getString(), dn, uuid, acapCache, caapCache, teapCache, ssapCache );
+ delRole( value.getValue(), dn, uuid, acapCache, caapCache, teapCache, ssapCache );
}
@@ -1457,6 +1451,7 @@ public class AdministrativePointIntercep
/**
* {@inheritDoc}
*/
+ @Override
public void move( MoveOperationContext moveContext ) throws LdapException
{
LOG.debug( ">>> Entering into the Administrative Interceptor, moveRequest" );
@@ -1485,6 +1480,7 @@ public class AdministrativePointIntercep
/**
* {@inheritDoc}
*/
+ @Override
public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
{
LOG.debug( ">>> Entering into the Administrative Interceptor, moveAndRenameRequest" );
@@ -1513,6 +1509,7 @@ public class AdministrativePointIntercep
/**
* {@inheritDoc}
*/
+ @Override
public void rename( RenameOperationContext renameContext ) throws LdapException
{
LOG.debug( ">>> Entering into the Administrative Interceptor, renameRequest" );
Modified: directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java Wed Jun 15 12:29:57 2016
@@ -109,6 +109,7 @@ public abstract class AbstractAuthentica
/**
* {@inheritDoc}
*/
+ @Override
public AuthenticationLevel getAuthenticatorType()
{
return authenticatorType;
@@ -121,6 +122,7 @@ public abstract class AbstractAuthentica
* @param directoryService the directory core for this authenticator
* @throws LdapException if there is a problem starting up the authenticator
*/
+ @Override
public final void init( DirectoryService directoryService ) throws LdapException
{
this.directoryService = directoryService;
@@ -141,6 +143,7 @@ public abstract class AbstractAuthentica
* (<tt>factoryConfiguration</tt> and <tt>configuration</tt>).
* Please put your deinitialization code into {@link #doDestroy()}.
*/
+ @Override
public final void destroy()
{
try
@@ -165,6 +168,7 @@ public abstract class AbstractAuthentica
/**
* Does nothing leaving it so subclasses can override.
*/
+ @Override
public void invalidateCache( Dn bindDn )
{
}
@@ -173,6 +177,7 @@ public abstract class AbstractAuthentica
/**
* {@inheritDoc}
*/
+ @Override
public boolean isValid( Dn bindDn )
{
// The authenticator is valid if the baseDn is null or if it's a parent of the bindDn
@@ -183,6 +188,7 @@ public abstract class AbstractAuthentica
/**
* {@inheritDoc}
*/
+ @Override
public Dn getBaseDn()
{
return baseDn;
@@ -192,6 +198,7 @@ public abstract class AbstractAuthentica
/**
* {@inheritDoc}
*/
+ @Override
public void setBaseDn( Dn baseDn )
{
this.baseDn = baseDn;
@@ -201,6 +208,7 @@ public abstract class AbstractAuthentica
/**
* {@inheritDoc}
*/
+ @Override
public void checkPwdPolicy( Entry userEntry ) throws LdapException
{
if ( !directoryService.isPwdPolicyEnabled() )
@@ -223,7 +231,8 @@ public abstract class AbstractAuthentica
if ( accountLockAttr != null )
{
String lockedTime = accountLockAttr.getString();
- if ( lockedTime.equals( "000001010000Z" ) )
+
+ if ( "000001010000Z".equals( lockedTime ) )
{
throw new PasswordPolicyException( "account was permanently locked", ACCOUNT_LOCKED.getValue() );
}
@@ -313,13 +322,10 @@ public abstract class AbstractAuthentica
Attribute pwdGraceUseAttr = userEntry.get( PWD_GRACE_USE_TIME_AT );
// check for grace authentication count
- if ( pwdGraceUseAttr != null )
+ if ( ( pwdGraceUseAttr != null ) && ( pwdGraceUseAttr.size() >= pPolicyConfig.getPwdGraceAuthNLimit() ) )
{
- if ( pwdGraceUseAttr.size() >= pPolicyConfig.getPwdGraceAuthNLimit() )
- {
- throw new PasswordPolicyException( "password expired and max grace logins were used",
- PASSWORD_EXPIRED.getValue() );
- }
+ throw new PasswordPolicyException( "password expired and max grace logins were used",
+ PASSWORD_EXPIRED.getValue() );
}
}
else
Modified: directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AnonymousAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AnonymousAuthenticator.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AnonymousAuthenticator.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AnonymousAuthenticator.java Wed Jun 15 12:29:57 2016
@@ -61,6 +61,7 @@ public class AnonymousAuthenticator exte
* If the context is not configured to allow anonymous connections,
* this method throws a {@link javax.naming.NoPermissionException}.
*/
+ @Override
public LdapPrincipal authenticate( BindOperationContext bindContext ) throws LdapNoPermissionException
{
// We only allow Anonymous binds if the service allows them
Modified: directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java Wed Jun 15 12:29:57 2016
@@ -54,7 +54,6 @@ import org.apache.directory.api.ldap.mod
import org.apache.directory.api.ldap.model.constants.LdapSecurityConstants;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.entry.Attribute;
-import org.apache.directory.api.ldap.model.entry.BinaryValue;
import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
import org.apache.directory.api.ldap.model.entry.DefaultModification;
import org.apache.directory.api.ldap.model.entry.Entry;
@@ -119,10 +118,10 @@ public class AuthenticationInterceptor e
private static final boolean IS_DEBUG = LOG.isDebugEnabled();
/** A Set of all the existing Authenticator to be used by the bind operation */
- private Set<Authenticator> authenticators = new HashSet<Authenticator>();
+ private Set<Authenticator> authenticators = new HashSet<>();
/** A map of authenticators associated with the authentication level required */
- private final Map<AuthenticationLevel, Collection<Authenticator>> authenticatorsMapByType = new HashMap<AuthenticationLevel, Collection<Authenticator>>();
+ private final Map<AuthenticationLevel, Collection<Authenticator>> authenticatorsMapByType = new HashMap<>();
private CoreSession adminSession;
@@ -163,13 +162,14 @@ public class AuthenticationInterceptor e
/**
* Registers and initializes all {@link Authenticator}s to this service.
*/
+ @Override
public void init( DirectoryService directoryService ) throws LdapException
{
super.init( directoryService );
adminSession = directoryService.getAdminSession();
- if ( ( authenticators == null ) || ( authenticators.size() == 0 ) )
+ if ( ( authenticators == null ) || authenticators.isEmpty() )
{
setDefaultAuthenticators();
}
@@ -191,7 +191,7 @@ public class AuthenticationInterceptor e
{
if ( authenticators == null )
{
- authenticators = new HashSet<Authenticator>();
+ authenticators = new HashSet<>();
}
authenticators.clear();
@@ -253,11 +253,12 @@ public class AuthenticationInterceptor e
/**
* Deinitializes and deregisters all {@link Authenticator}s from this service.
*/
+ @Override
public void destroy()
{
authenticatorsMapByType.clear();
- Set<Authenticator> copy = new HashSet<Authenticator>( authenticators );
- authenticators = new HashSet<Authenticator>();
+ Set<Authenticator> copy = new HashSet<>( authenticators );
+ authenticators = new HashSet<>();
for ( Authenticator authenticator : copy )
{
@@ -283,7 +284,7 @@ public class AuthenticationInterceptor e
if ( authenticatorList == null )
{
- authenticatorList = new ArrayList<Authenticator>();
+ authenticatorList = new ArrayList<>();
authenticatorsMapByType.put( authenticator.getAuthenticatorType(), authenticatorList );
}
@@ -304,7 +305,7 @@ public class AuthenticationInterceptor e
{
Collection<Authenticator> result = authenticatorsMapByType.get( type );
- if ( ( result != null ) && ( result.size() > 0 ) )
+ if ( ( result != null ) && ( !result.isEmpty() ) )
{
return result;
}
@@ -318,6 +319,7 @@ public class AuthenticationInterceptor e
/**
* {@inheritDoc}
*/
+ @Override
public void add( AddOperationContext addContext ) throws LdapException
{
if ( IS_DEBUG )
@@ -353,11 +355,11 @@ public class AuthenticationInterceptor e
if ( userPasswordAttribute != null )
{
- BinaryValue userPassword = ( BinaryValue ) userPasswordAttribute.get();
+ Value userPassword = userPasswordAttribute.get();
try
{
- check( addContext, entry, userPassword.getValue(), policyConfig );
+ check( addContext, entry, userPassword.getBytes(), policyConfig );
}
catch ( PasswordPolicyException e )
{
@@ -398,7 +400,7 @@ public class AuthenticationInterceptor e
if ( policyConfig.getPwdInHistory() > 0 )
{
Attribute pwdHistoryAt = new DefaultAttribute( pwdHistoryAT );
- byte[] pwdHistoryVal = new PasswordHistory( pwdChangedTime, userPassword.getValue() ).getHistoryValue();
+ byte[] pwdHistoryVal = new PasswordHistory( pwdChangedTime, userPassword.getBytes() ).getHistoryValue();
pwdHistoryAt.add( pwdHistoryVal );
entry.add( pwdHistoryAt );
}
@@ -415,19 +417,19 @@ public class AuthenticationInterceptor e
throws LdapUnwillingToPerformException, LdapAuthenticationException
{
Authenticator selectedAuthenticator = null;
- Collection<Authenticator> authenticators = authenticatorsMapByType.get( level );
+ Collection<Authenticator> levelAuthenticators = authenticatorsMapByType.get( level );
- if ( ( authenticators == null ) || ( authenticators.size() == 0 ) )
+ if ( ( levelAuthenticators == null ) || levelAuthenticators.isEmpty() )
{
// No authenticators associated with this level : get out
throw new LdapAuthenticationException( "Cannot Bind for Dn "
+ bindDn.getName() + ", no authenticator for the requested level " + level );
}
- if ( authenticators.size() == 1 )
+ if ( levelAuthenticators.size() == 1 )
{
// Just pick the existing one
- for ( Authenticator authenticator : authenticators )
+ for ( Authenticator authenticator : levelAuthenticators )
{
// Check that the bindDN fits
if ( authenticator.isValid( bindDn ) )
@@ -448,7 +450,7 @@ public class AuthenticationInterceptor e
// select the one that fits the bindDN
Dn innerDn = Dn.ROOT_DSE;
- for ( Authenticator authenticator : authenticators )
+ for ( Authenticator authenticator : levelAuthenticators )
{
if ( authenticator.isValid( bindDn ) )
{
@@ -468,6 +470,7 @@ public class AuthenticationInterceptor e
/**
* {@inheritDoc}
*/
+ @Override
public void bind( BindOperationContext bindContext ) throws LdapException
{
if ( IS_DEBUG )
@@ -596,7 +599,7 @@ public class AuthenticationInterceptor e
pwdFailTimeAt.add( failureTime );
Modification pwdFailTimeMod = new DefaultModification( REPLACE_ATTRIBUTE, pwdFailTimeAt );
- List<Modification> mods = new ArrayList<Modification>();
+ List<Modification> mods = new ArrayList<>();
mods.add( pwdFailTimeMod );
int numFailures = pwdFailTimeAt.size();
@@ -665,12 +668,12 @@ public class AuthenticationInterceptor e
}
}
- String upDn = ( bindDn == null ? "" : bindDn.getName() );
+ String upDn = bindDn == null ? "" : bindDn.getName();
throw new LdapAuthenticationException( I18n.err( I18n.ERR_229, upDn ) );
}
else if ( policyConfig != null )
{
- List<Modification> mods = new ArrayList<Modification>();
+ List<Modification> mods = new ArrayList<>();
if ( policyConfig.getPwdMaxIdle() > 0 )
{
@@ -709,7 +712,7 @@ public class AuthenticationInterceptor e
if ( expired )
{
Attribute pwdGraceUseAttr = userEntry.get( pwdGraceUseTimeAT );
- int numGraceAuth = 0;
+ int numGraceAuth;
if ( pwdGraceUseAttr != null )
{
@@ -770,6 +773,7 @@ public class AuthenticationInterceptor e
/**
* {@inheritDoc}
*/
+ @Override
public boolean compare( CompareOperationContext compareContext ) throws LdapException
{
if ( IS_DEBUG )
@@ -779,15 +783,14 @@ public class AuthenticationInterceptor e
checkAuthenticated( compareContext );
checkPwdReset( compareContext );
- boolean result = next( compareContext );
-
- return result;
+ return next( compareContext );
}
/**
* {@inheritDoc}
*/
+ @Override
public void delete( DeleteOperationContext deleteContext ) throws LdapException
{
if ( IS_DEBUG )
@@ -805,6 +808,7 @@ public class AuthenticationInterceptor e
/**
* {@inheritDoc}
*/
+ @Override
public Entry getRootDse( GetRootDseOperationContext getRootDseContext ) throws LdapException
{
if ( IS_DEBUG )
@@ -822,6 +826,7 @@ public class AuthenticationInterceptor e
/**
* {@inheritDoc}
*/
+ @Override
public boolean hasEntry( HasEntryOperationContext hasEntryContext ) throws LdapException
{
if ( IS_DEBUG )
@@ -839,6 +844,7 @@ public class AuthenticationInterceptor e
/**
* {@inheritDoc}
*/
+ @Override
public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
{
if ( IS_DEBUG )
@@ -857,10 +863,8 @@ public class AuthenticationInterceptor e
{
for ( AuthenticationLevel authMech : authenticatorsMapByType.keySet() )
{
- Collection<Authenticator> authenticators = getAuthenticators( authMech );
-
// try each authenticator
- for ( Authenticator authenticator : authenticators )
+ for ( Authenticator authenticator : getAuthenticators( authMech ) )
{
authenticator.invalidateCache( principalDn );
}
@@ -871,6 +875,7 @@ public class AuthenticationInterceptor e
/**
* {@inheritDoc}
*/
+ @Override
public void modify( ModifyOperationContext modifyContext ) throws LdapException
{
if ( IS_DEBUG )
@@ -948,7 +953,7 @@ public class AuthenticationInterceptor e
boolean removePwdReset = false;
- List<Modification> mods = new ArrayList<Modification>();
+ List<Modification> mods = new ArrayList<>();
if ( pwdModDetails.isAddOrReplace() )
{
@@ -1040,7 +1045,7 @@ public class AuthenticationInterceptor e
if ( policyConfig.isPwdMustChange() )
{
Attribute pwdMustChangeAt = new DefaultAttribute( pwdResetAT );
- Modification pwdMustChangeMod = null;
+ Modification pwdMustChangeMod;
if ( modifyContext.getSession().isAnAdministrator() )
{
@@ -1087,9 +1092,9 @@ public class AuthenticationInterceptor e
Modification buildPwdHistory( ModifyOperationContext modifyContext, Attribute pwdHistoryAt,
int histSize, byte[] newPassword, boolean isPPolicyReqCtrlPresent ) throws LdapOperationException
{
- List<PasswordHistory> pwdHistLst = new ArrayList<PasswordHistory>();
+ List<PasswordHistory> pwdHistLst = new ArrayList<>();
- for ( Value<?> value : pwdHistoryAt )
+ for ( Value value : pwdHistoryAt )
{
PasswordHistory pwdh = new PasswordHistory( Strings.utf8ToString( value.getBytes() ) );
@@ -1264,6 +1269,7 @@ public class AuthenticationInterceptor e
/**
* {@inheritDoc}
*/
+ @Override
public void move( MoveOperationContext moveContext ) throws LdapException
{
if ( IS_DEBUG )
@@ -1281,6 +1287,7 @@ public class AuthenticationInterceptor e
/**
* {@inheritDoc}
*/
+ @Override
public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
{
if ( IS_DEBUG )
@@ -1298,6 +1305,7 @@ public class AuthenticationInterceptor e
/**
* {@inheritDoc}
*/
+ @Override
public void rename( RenameOperationContext renameContext ) throws LdapException
{
if ( IS_DEBUG )
@@ -1315,6 +1323,7 @@ public class AuthenticationInterceptor e
/**
* {@inheritDoc}
*/
+ @Override
public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
{
if ( IS_DEBUG )
@@ -1332,6 +1341,7 @@ public class AuthenticationInterceptor e
/**
* {@inheritDoc}
*/
+ @Override
public void unbind( UnbindOperationContext unbindContext ) throws LdapException
{
next( unbindContext );
@@ -1449,22 +1459,16 @@ public class AuthenticationInterceptor e
int pwdLen = password.length();
- if ( maxLen > 0 )
+ if ( ( maxLen > 0 ) && ( pwdLen > maxLen ) )
{
- if ( pwdLen > maxLen )
- {
- throw new PasswordPolicyException( "Password should not have more than " + maxLen + " characters",
- INSUFFICIENT_PASSWORD_QUALITY.getValue() );
- }
+ throw new PasswordPolicyException( "Password should not have more than " + maxLen + " characters",
+ INSUFFICIENT_PASSWORD_QUALITY.getValue() );
}
- if ( minLen > 0 )
+ if ( ( minLen > 0 ) && ( pwdLen < minLen ) )
{
- if ( pwdLen < minLen )
- {
- throw new PasswordPolicyException( "Password should have a minimum of " + minLen + " characters",
- PASSWORD_TOO_SHORT.getValue() );
- }
+ throw new PasswordPolicyException( "Password should have a minimum of " + minLen + " characters",
+ PASSWORD_TOO_SHORT.getValue() );
}
}
@@ -1794,9 +1798,9 @@ public class AuthenticationInterceptor e
*/
public boolean isPwdPolicyEnabled()
{
- return ( ( pwdPolicyContainer != null )
+ return ( pwdPolicyContainer != null )
&& ( ( pwdPolicyContainer.getDefaultPolicy() != null )
- || ( pwdPolicyContainer.hasCustomConfigs() ) ) );
+ || ( pwdPolicyContainer.hasCustomConfigs() ) );
}
@@ -1835,12 +1839,12 @@ public class AuthenticationInterceptor e
long currentTime = DateUtils.getDate( DateUtils.getGeneralizedTime() ).getTime();
- Iterator<Value<?>> itr = pwdFailTimeAt.iterator();
+ Iterator<Value> itr = pwdFailTimeAt.iterator();
while ( itr.hasNext() )
{
- Value<?> value = itr.next();
- String failureTime = value.getString();
+ Value value = itr.next();
+ String failureTime = value.getValue();
long time = DateUtils.getDate( failureTime ).getTime();
time += interval;
Modified: directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/Authenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/Authenticator.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/Authenticator.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/Authenticator.java Wed Jun 15 12:29:57 2016
@@ -118,12 +118,4 @@ public interface Authenticator
* @param baseDn The Base DN to set
*/
void setBaseDn( Dn baseDn );
-
- /**
- * Performs an unbind on the given context
- *
- * @param unbindContext The Unbind context
- * @exception If the unbind failed
- */
- //void unbind( UnbindOperationContext unbindContext ) throws Exception;
}
Modified: directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java Wed Jun 15 12:29:57 2016
@@ -216,6 +216,7 @@ public class DelegatingAuthenticator ext
/**
* {@inheritDoc}
*/
+ @Override
public LdapPrincipal authenticate( BindOperationContext bindContext )
throws Exception
{
@@ -326,6 +327,7 @@ public class DelegatingAuthenticator ext
/**
* We don't handle any password policy when using a delegated authentication
*/
+ @Override
public void checkPwdPolicy( Entry userEntry ) throws LdapException
{
// no check for delegating authentication
@@ -335,6 +337,7 @@ public class DelegatingAuthenticator ext
/**
* We don't handle any cache when using a delegated authentication
*/
+ @Override
public void invalidateCache( Dn bindDn )
{
// cache is not implemented here
Modified: directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/PasswordHistory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/PasswordHistory.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/PasswordHistory.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/PasswordHistory.java Wed Jun 15 12:29:57 2016
@@ -52,6 +52,11 @@ public class PasswordHistory implements
private static final char DELIMITER = '#';
+ /**
+ * Create a new instance of PasswordHistory
+ *
+ * @param pwdHistoryVal The history date
+ */
public PasswordHistory( String pwdHistoryVal )
{
int pos = pwdHistoryVal.indexOf( DELIMITER );
@@ -69,6 +74,10 @@ public class PasswordHistory implements
}
+ /**
+ * Create a new instance of PasswordHistory
+ *
+ */
public PasswordHistory( String time, byte[] password )
{
this.time = time;
@@ -117,12 +126,19 @@ public class PasswordHistory implements
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public int compareTo( PasswordHistory o )
{
return o.getTime().compareTo( time );
}
+ /**
+ * @see Object#toString()
+ */
@Override
public boolean equals( Object o )
{
Modified: directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java Wed Jun 15 12:29:57 2016
@@ -141,7 +141,7 @@ public class SimpleAuthenticator extends
{
synchronized ( credentialCache )
{
- principal = ( LdapPrincipal ) credentialCache.get( bindContext.getDn().getNormName() );
+ principal = ( LdapPrincipal ) credentialCache.get( bindContext.getDn() );
}
}
@@ -189,6 +189,7 @@ public class SimpleAuthenticator extends
* authenticates a user with the plain-text password.
* </p>
*/
+ @Override
public LdapPrincipal authenticate( BindOperationContext bindContext ) throws LdapException
{
if ( IS_DEBUG )
@@ -280,7 +281,7 @@ public class SimpleAuthenticator extends
if ( userEntry == null )
{
Dn dn = bindContext.getDn();
- String upDn = ( dn == null ? "" : dn.getName() );
+ String upDn = dn == null ? "" : dn.getName();
throw new LdapAuthenticationException( I18n.err( I18n.ERR_231, upDn ) );
}
@@ -321,7 +322,7 @@ public class SimpleAuthenticator extends
byte[][] userPasswords = new byte[userPasswordAttr.size()][];
int pos = 0;
- for ( Value<?> userPassword : userPasswordAttr )
+ for ( Value userPassword : userPasswordAttr )
{
userPasswords[pos] = userPassword.getBytes();
pos++;
@@ -336,6 +337,7 @@ public class SimpleAuthenticator extends
* Remove the principal form the cache. This is used when the user changes
* his password.
*/
+ @Override
public void invalidateCache( Dn bindDn )
{
synchronized ( credentialCache )
Modified: directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/StrongAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/StrongAuthenticator.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/StrongAuthenticator.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/StrongAuthenticator.java Wed Jun 15 12:29:57 2016
@@ -62,6 +62,7 @@ public class StrongAuthenticator extends
* User has already been authenticated during SASL negotiation. Set the authentication level
* to strong and return an {@link LdapPrincipal}.
*/
+ @Override
public LdapPrincipal authenticate( BindOperationContext bindContext ) throws LdapAuthenticationException
{
// Possibly check if user account is disabled, other account checks.
Modified: directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/ppolicy/PpolicyConfigContainer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/ppolicy/PpolicyConfigContainer.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/ppolicy/PpolicyConfigContainer.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/ppolicy/PpolicyConfigContainer.java Wed Jun 15 12:29:57 2016
@@ -37,7 +37,7 @@ public class PpolicyConfigContainer
{
/** a map holding the entry specific password policies */
- private Map<Dn, PasswordPolicyConfiguration> ppolicyConfigMap = new HashMap<Dn, PasswordPolicyConfiguration>();
+ private Map<Dn, PasswordPolicyConfiguration> ppolicyConfigMap = new HashMap<>();
/** the default password policy Dn */
private Dn defaultPolicyDn;
@@ -65,7 +65,7 @@ public class PpolicyConfigContainer
*/
public boolean hasCustomConfigs()
{
- return ( !ppolicyConfigMap.isEmpty() );
+ return !ppolicyConfigMap.isEmpty();
}