| | |
| | | |
| | | <!-- The build target that should be used for nightly builds. --> |
| | | <target name="nightly" |
| | | depends="checkstyle,dsml,srczip,javadoc,docgen,coverage,testallwithcoverage" |
| | | depends="nightlybuild,nightlytests" |
| | | description="Perform all processing needed for nightly builds."> |
| | | </target> |
| | | |
| | | <!-- The build target that should be used for build part of nightly builds. --> |
| | | <target name="nightlybuild" |
| | | depends="checkstyle,dsml,srczip,javadoc,docgen" |
| | | description="Perform all processing related to build for nightly builds."> |
| | | </target> |
| | | |
| | | <!-- The build target that should be used for test part of nightly builds. --> |
| | | <target name="nightlytests" |
| | | depends="coverage,testallwithcoverage" |
| | | description="Perform all processing related to unit tests for nightly builds."> |
| | | </target> |
| | | |
| | | |
| | | <!-- The build target that should be used for weekly builds. --> |
| | |
| | | <genmsg sourceProps="${msg.prop.dir}/runtime_information.properties" |
| | | destJava="${msg.javagen.dir}/org/opends/messages/RuntimeMessages.java"> |
| | | </genmsg> |
| | | <genmsg sourceProps="${msg.prop.dir}/servicetag.properties" |
| | | destJava="${msg.javagen.dir}/org/opends/messages/ServiceTagMessages.java"> |
| | | </genmsg> |
| | | </target> |
| | | |
| | | |
| | | <!-- Remove all dynamically-generated build files. --> |
| | | <target name="clean" depends="cleanadmin,cleanmessages,cleansnmp" |
| | | <target name="clean" depends="init,cleanadmin,cleanmessages,cleansnmp" |
| | | description="Clean up any files generated during the build process"> |
| | | |
| | | <delete dir="${build.dir}" /> |
| | |
| | | </or> |
| | | </condition> |
| | | |
| | | <condition property="isadmingendirpresent"> |
| | | <available file="${admin.src.dir}" type="dir" /> |
| | | </condition> |
| | | |
| | | <condition property="ismsggendirpresent"> |
| | | <available file="${msg.javagen.dir}" type="dir" /> |
| | | </condition> |
| | | |
| | | </target> |
| | | |
| | | |
| | |
| | | <mkdir dir="${pdir}/config/messages" /> |
| | | <mkdir dir="${pdir}/config/MakeLDIF" /> |
| | | <mkdir dir="${pdir}/config/snmp/security" /> |
| | | <mkdir dir="${pdir}/config/servicetag" /> |
| | | <mkdir dir="${pdir}/db" /> |
| | | <mkdir dir="${pdir}/import-tmp" /> |
| | | <mkdir dir="${pdir}/changelogDb" /> |
| | |
| | | <mkdir dir="${pdir}/lib/extensions" /> |
| | | <mkdir dir="${pdir}/locks" /> |
| | | <mkdir dir="${pdir}/logs" /> |
| | | <mkdir dir="${pdir}/bin/StatusPanel.app" /> |
| | | <mkdir dir="${pdir}/bin/StatusPanel.app/Contents" /> |
| | | <mkdir dir="${pdir}/bin/StatusPanel.app/Contents/MacOS" /> |
| | | <mkdir dir="${pdir}/bin/StatusPanel.app/Contents/Resources" /> |
| | | <mkdir dir="${pdir}/bin/StatusPanel.app/Contents/Resources/Java" /> |
| | | <mkdir dir="${pdir}/bin/ControlPanel.app" /> |
| | | <mkdir dir="${pdir}/bin/ControlPanel.app/Contents" /> |
| | | <mkdir dir="${pdir}/bin/ControlPanel.app/Contents/MacOS" /> |
| | | <mkdir dir="${pdir}/bin/ControlPanel.app/Contents/Resources" /> |
| | | <mkdir dir="${pdir}/bin/ControlPanel.app/Contents/Resources/Java" /> |
| | | <mkdir dir="${pdir}/QuickSetup.app" /> |
| | | <mkdir dir="${pdir}/QuickSetup.app/Contents" /> |
| | | <mkdir dir="${pdir}/QuickSetup.app/Contents/MacOS" /> |
| | |
| | | <copy todir="${pdir}/config/schema"> |
| | | <fileset dir="${resource.dir}/schema" /> |
| | | </copy> |
| | | |
| | | <copy todir="${pdir}/config/servicetag"> |
| | | <fileset dir="${resource.dir}/servicetag" /> |
| | | </copy> |
| | | |
| | | <copy todir="${pdir}/config/messages"> |
| | | <fileset dir="${resource.dir}/messages" /> |
| | |
| | | <include name="Uninstall.app/Contents/MacOS/JavaApplicationStub" /> |
| | | </fileset> |
| | | </chmod> |
| | | <copy todir="${pdir}/bin/StatusPanel.app"> |
| | | <fileset dir="${resource.dir}/mac/StatusPanel.app" /> |
| | | <copy todir="${pdir}/bin/ControlPanel.app"> |
| | | <fileset dir="${resource.dir}/mac/ControlPanel.app" /> |
| | | </copy> |
| | | <chmod perm="755"> |
| | | <fileset dir="${pdir}/bin"> |
| | | <include name="StatusPanel.app/Contents/MacOS/JavaApplicationStub" /> |
| | | <include name="ControlPanel.app/Contents/MacOS/JavaApplicationStub" /> |
| | | </fileset> |
| | | </chmod> |
| | | |
| | |
| | | <zipfileset dir="${package.dir}" includes="${SHORT_NAME}-${VERSION_NUMBER_STRING}" |
| | | filemode="644" dirmode="700" /> |
| | | <zipfileset dir="${package.dir}" includes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/**/*" |
| | | excludes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/bin/*,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_client-script.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_script-util.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_server-script.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_mixed-script.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/setup,${SHORT_NAME}-${VERSION_NUMBER_STRING}/uninstall,${SHORT_NAME}-${VERSION_NUMBER_STRING}/upgrade,${SHORT_NAME}-${VERSION_NUMBER_STRING}/QuickSetup.app/Contents/MacOS/JavaApplicationStub,${SHORT_NAME}-${VERSION_NUMBER_STRING}/Uninstall.app/Contents/MacOS/JavaApplicationStub,${SHORT_NAME}-${VERSION_NUMBER_STRING}/bin/StatusPanel.app/Contents/MacOS/JavaApplicationStub" |
| | | excludes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/bin/*,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_client-script.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_script-util.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_server-script.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_mixed-script.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/setup,${SHORT_NAME}-${VERSION_NUMBER_STRING}/uninstall,${SHORT_NAME}-${VERSION_NUMBER_STRING}/upgrade,${SHORT_NAME}-${VERSION_NUMBER_STRING}/QuickSetup.app/Contents/MacOS/JavaApplicationStub,${SHORT_NAME}-${VERSION_NUMBER_STRING}/Uninstall.app/Contents/MacOS/JavaApplicationStub,${SHORT_NAME}-${VERSION_NUMBER_STRING}/bin/ControlPanel.app/Contents/MacOS/JavaApplicationStub" |
| | | filemode="644" dirmode="755" /> |
| | | <zipfileset dir="${package.dir}" |
| | | includes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_client-script.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_script-util.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_server-script.sh,${SHORT_NAME}-${VERSION_NUMBER_STRING}/lib/_mixed-script.sh" |
| | |
| | | filemode="755" dirmode="755" /> |
| | | <zipfileset dir="${package.dir}" includes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/bin/README_WINDOWS.txt" |
| | | filemode="644" dirmode="755" /> |
| | | <zipfileset dir="${package.dir}" includes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/setup,${SHORT_NAME}-${VERSION_NUMBER_STRING}/uninstall,${SHORT_NAME}-${VERSION_NUMBER_STRING}/upgrade,${SHORT_NAME}-${VERSION_NUMBER_STRING}/QuickSetup.app/Contents/MacOS/JavaApplicationStub,${SHORT_NAME}-${VERSION_NUMBER_STRING}/Uninstall.app/Contents/MacOS/JavaApplicationStub,${SHORT_NAME}-${VERSION_NUMBER_STRING}/bin/StatusPanel.app/Contents/MacOS/JavaApplicationStub" |
| | | <zipfileset dir="${package.dir}" includes="${SHORT_NAME}-${VERSION_NUMBER_STRING}/setup,${SHORT_NAME}-${VERSION_NUMBER_STRING}/uninstall,${SHORT_NAME}-${VERSION_NUMBER_STRING}/upgrade,${SHORT_NAME}-${VERSION_NUMBER_STRING}/QuickSetup.app/Contents/MacOS/JavaApplicationStub,${SHORT_NAME}-${VERSION_NUMBER_STRING}/Uninstall.app/Contents/MacOS/JavaApplicationStub,${SHORT_NAME}-${VERSION_NUMBER_STRING}/bin/ControlPanel.app/Contents/MacOS/JavaApplicationStub" |
| | | filemode="755" dirmode="755" /> |
| | | </zip> |
| | | <property name="package.built" value="true"/> |
| | |
| | | <include name="*.jar"/> |
| | | </fileset> |
| | | <dirset dir="${classes.dir}"/> |
| | | </path> |
| | | </path> |
| | | <nbjpdastart addressproperty="jpda.address" name="Directory Server" transport="dt_socket"> |
| | | <classpath refid="cp"/> |
| | | </nbjpdastart> |
| | |
| | | </java> |
| | | </target> |
| | | |
| | | |
| | | <!-- Internal target to prepare to generate a code coverage report. --> |
| | | <target name="coverage"> |
| | | <property name="coverage.enabled" value="true" /> |
| | |
| | | |
| | | |
| | | <!-- Remove all dynamically-generated build files. --> |
| | | <target name="cleanadmin" description="Clean up any generated source files for admin"> |
| | | <target name="cleanadmin" if="isadmingendirpresent" description="Clean up any generated source files for admin"> |
| | | <delete includeemptydirs="true"> |
| | | <fileset dir="${admin.src.dir}" includes="**/*" /> |
| | | </delete> |
| | |
| | | </target> |
| | | |
| | | <!-- Remove all dynamically-generated build files. --> |
| | | <target name="cleanmessages" description="Clean up any generated source files for messages"> |
| | | <target name="cleanmessages" if="ismsggendirpresent" description="Clean up any generated source files for messages"> |
| | | <delete includeemptydirs="true"> |
| | | <fileset dir="${msg.javagen.dir}" includes="**/*" /> |
| | | </delete> |
| | |
| | | <jar jarfile="${pdir}/lib/extensions/snmp-mib2605.jar" |
| | | basedir="${classes.dir}" |
| | | includes="org/opends/server/snmp/**" |
| | | compress="true" index="true" /> |
| | | compress="true" index="true" > |
| | | <manifest> |
| | | <attribute name="Extension-Name" value="snmp-mib2605"/> |
| | | <attribute name="Implementation-Version" value="${VERSION_NUMBER_STRING}"/> |
| | | <attribute name="Revision-Number" value="${REVISION_NUMBER}"/> |
| | | </manifest> |
| | | </jar> |
| | | <echo message="SNMP Extension is built"/> |
| | | <echo message="${pdir}/lib/extensions/snmp-mib2605.jar"/> |
| | | </target> |
| New file |
| | |
| | | #!/bin/sh |
| | | # |
| | | # CDDL HEADER START |
| | | # |
| | | # The contents of this file are subject to the terms of the |
| | | # Common Development and Distribution License, Version 1.0 only |
| | | # (the "License"). You may not use this file except in compliance |
| | | # with the License. |
| | | # |
| | | # You can obtain a copy of the license at |
| | | # trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | # or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | # See the License for the specific language governing permissions |
| | | # and limitations under the License. |
| | | # |
| | | # When distributing Covered Code, include this CDDL HEADER in each |
| | | # file and include the License file at |
| | | # trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | # add the following below this CDDL HEADER, with the fields enclosed |
| | | # by brackets "[]" replaced with your own identifying information: |
| | | # Portions Copyright [yyyy] [name of copyright owner] |
| | | # |
| | | # CDDL HEADER END |
| | | # |
| | | # |
| | | # Copyright 2008 Sun Microsystems, Inc. |
| | | |
| | | |
| | | # This script may be used to display the control panel. |
| | | OPENDS_INVOKE_CLASS="org.opends.guitools.controlpanel.ControlPanelLauncher" |
| | | export OPENDS_INVOKE_CLASS |
| | | |
| | | SCRIPT_NAME="control-panel" |
| | | export SCRIPT_NAME |
| | | |
| | | SCRIPT_DIR=`dirname "${0}"` |
| | | "${SCRIPT_DIR}/../lib/_client-script.sh" "${@}" |
| New file |
| | |
| | | |
| | | @echo off |
| | | rem CDDL HEADER START |
| | | rem |
| | | rem The contents of this file are subject to the terms of the |
| | | rem Common Development and Distribution License, Version 1.0 only |
| | | rem (the "License"). You may not use this file except in compliance |
| | | rem with the License. |
| | | rem |
| | | rem You can obtain a copy of the license at |
| | | rem trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | rem or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | rem See the License for the specific language governing permissions |
| | | rem and limitations under the License. |
| | | rem |
| | | rem When distributing Covered Code, include this CDDL HEADER in each |
| | | rem file and include the License file at |
| | | rem trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | rem add the following below this CDDL HEADER, with the fields enclosed |
| | | rem by brackets "[]" replaced with your own identifying information: |
| | | rem Portions Copyright [yyyy] [name of copyright owner] |
| | | rem |
| | | rem CDDL HEADER END |
| | | rem |
| | | rem |
| | | rem Copyright 2006-2008 Sun Microsystems, Inc. |
| | | |
| | | setlocal |
| | | for %%i in (%~sf0) do set DIR_HOME=%%~dPsi.. |
| | | |
| | | set INSTANCE_ROOT=%DIR_HOME% |
| | | |
| | | set SCRIPT_NAME=control-panel |
| | | |
| | | rem Set environment variables |
| | | set SCRIPT_UTIL_CMD=set-full-environment |
| | | call "%INSTANCE_ROOT%\lib\_script-util.bat" |
| | | if NOT %errorlevel% == 0 exit /B %errorlevel% |
| | | |
| | | if "%~1" == "" goto callLaunch |
| | | goto callJava |
| | | |
| | | :callLaunch |
| | | "%DIR_HOME%\lib\winlauncher.exe" launch "%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.guitools.controlpanel.ControlPanelLauncher |
| | | goto end |
| | | |
| | | :callJava |
| | | "%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.guitools.controlpanel.ControlPanelLauncher %* |
| | | |
| | | rem return part |
| | | if %errorlevel% == 50 goto version |
| | | goto end |
| | | |
| | | :version |
| | | rem version information was requested. Return code should be 0. |
| | | exit /B 0 |
| | | |
| | | :end |
| | |
| | | |
| | | |
| | | # This script may be used to perform some replication specific operations. |
| | | OPENDS_INVOKE_CLASS="org.opends.guitools.replicationcli.ReplicationCliMain" |
| | | OPENDS_INVOKE_CLASS="org.opends.server.tools.dsreplication.ReplicationCliMain" |
| | | export OPENDS_INVOKE_CLASS |
| | | |
| | | SCRIPT_NAME="dsreplication" |
| | |
| | | |
| | | setlocal |
| | | |
| | | set OPENDS_INVOKE_CLASS="org.opends.guitools.replicationcli.ReplicationCliMain" |
| | | set OPENDS_INVOKE_CLASS="org.opends.server.tools.dsreplication.ReplicationCliMain" |
| | | set SCRIPT_NAME=dsreplication |
| | | for %%i in (%~sf0) do call "%%~dPsi\..\lib\_client-script.bat" %* |
| | |
| | | |
| | | |
| | | # This script may be used to display the status panel. |
| | | OPENDS_INVOKE_CLASS="org.opends.guitools.statuspanel.StatusCli" |
| | | OPENDS_INVOKE_CLASS="org.opends.server.tools.status.StatusCli" |
| | | export OPENDS_INVOKE_CLASS |
| | | |
| | | SCRIPT_NAME="status" |
| | |
| | | # Copyright 2008 Sun Microsystems, Inc. |
| | | |
| | | |
| | | # This script may be used to display the status panel. |
| | | OPENDS_INVOKE_CLASS="org.opends.guitools.statuspanel.StatusPanelLauncher" |
| | | # This script may be used to display the control panel. |
| | | OPENDS_INVOKE_CLASS="org.opends.guitools.controlpanel.ControlPanelLauncher" |
| | | export OPENDS_INVOKE_CLASS |
| | | |
| | | SCRIPT_NAME="status-panel" |
| | | SCRIPT_NAME="control-panel" |
| | | export SCRIPT_NAME |
| | | |
| | | SCRIPT_DIR=`dirname "${0}"` |
| | |
| | | cd /d %CUR_DIR% |
| | | |
| | | |
| | | set SCRIPT_NAME=status-panel |
| | | set SCRIPT_NAME=control-panel |
| | | |
| | | rem Set environment variables |
| | | set SCRIPT_UTIL_CMD=set-full-environment |
| | |
| | | |
| | | :callLaunch |
| | | if exist "%INSTALL_ROOT%\lib\set-java-args.bat" DO call "%INSTALL_ROOT%\lib\set-java-args.bat" |
| | | "%INSTALL_ROOT%\lib\winlauncher.exe" launch "%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.guitools.statuspanel.StatusPanelLauncher |
| | | "%INSTALL_ROOT%\lib\winlauncher.exe" launch "%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.guitools.controlpanel.ControlPanelLauncher |
| | | goto end |
| | | |
| | | :callJava |
| | | if exist "%INSTALL_ROOT%\lib\set-java-args.bat" DO call "%INSTALL_ROOT%\lib\set-java-args.bat" |
| | | "%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.guitools.statuspanel.StatusPanelLauncher %* |
| | | "%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.guitools.controlpanel.ControlPanelLauncher %* |
| | | |
| | | rem return part |
| | | if %errorlevel% == 50 goto version |
| | |
| | | |
| | | setlocal |
| | | |
| | | set OPENDS_INVOKE_CLASS="org.opends.guitools.statuspanel.StatusCli" |
| | | set OPENDS_INVOKE_CLASS="org.opends.server.tools.status.StatusCli" |
| | | set SCRIPT_NAME=status |
| | | for %%i in (%~sf0) do call "%%~dPsi\..\lib\_client-script.bat" %* |
| | |
| | | ds-cfg-type: uid |
| | | ds-cfg-invoke-for-internal-operations: true |
| | | |
| | | dn: cn=Network Group,cn=Plugins,cn=config |
| | | objectClass: top |
| | | objectClass: ds-cfg-plugin |
| | | objectClass: ds-cfg-network-group-plugin |
| | | cn: Network Group |
| | | ds-cfg-java-class: org.opends.server.plugins.NetworkGroupPlugin |
| | | ds-cfg-enabled: true |
| | | ds-cfg-invoke-for-internal-operations: false |
| | | ds-cfg-plugin-type: postConnect |
| | | ds-cfg-plugin-type: preParseAdd |
| | | ds-cfg-plugin-type: preParseBind |
| | | ds-cfg-plugin-type: preParseCompare |
| | | ds-cfg-plugin-type: preParseDelete |
| | | ds-cfg-plugin-type: preParseExtended |
| | | ds-cfg-plugin-type: preParseModify |
| | | ds-cfg-plugin-type: preParseModifyDn |
| | | ds-cfg-plugin-type: preParseSearch |
| | | ds-cfg-plugin-type: preParseUnbind |
| | | ds-cfg-plugin-type: postResponseBind |
| | | ds-cfg-plugin-type: postResponseExtended |
| | | |
| | | dn: cn=Change Number Control,cn=Plugins,cn=config |
| | | objectClass: top |
| | | objectClass: ds-cfg-plugin |
| | | objectClass: ds-cfg-change-number-control-plugin |
| | | cn: Change Number Control |
| | | ds-cfg-enabled: true |
| | | ds-cfg-plugin-type: postOperationAdd |
| | | ds-cfg-plugin-type: postOperationDelete |
| | | ds-cfg-plugin-type: postOperationModify |
| | | ds-cfg-plugin-type: postOperationModifyDn |
| | | ds-cfg-java-class: org.opends.server.plugins.ChangeNumberControlPlugin |
| | | |
| | | dn: cn=Root DNs,cn=config |
| | | objectClass: top |
| | | objectClass: ds-cfg-root-dn |
| | |
| | | ds-cfg-num-worker-threads: 24 |
| | | ds-cfg-max-work-queue-capacity: 0 |
| | | |
| | | dn: cn=Administration Connector,cn=config |
| | | objectClass: top |
| | | objectClass: ds-cfg-administration-connector |
| | | cn: Administration Connector |
| | | ds-cfg-listen-address: 0.0.0.0 |
| | | ds-cfg-listen-port: 4444 |
| | | ds-cfg-ssl-cert-nickname: admin-cert |
| | | ds-cfg-key-manager-provider: cn=Administration,cn=Key Manager Providers,cn=config |
| | | ds-cfg-trust-manager-provider: cn=Administration,cn=Trust Manager Providers,cn=config |
| | | |
| | | dn: cn=Administration,cn=Key Manager Providers,cn=config |
| | | objectClass: top |
| | | objectClass: ds-cfg-key-manager-provider |
| | | objectClass: ds-cfg-file-based-key-manager-provider |
| | | cn: Administration |
| | | ds-cfg-java-class: org.opends.server.extensions.FileBasedKeyManagerProvider |
| | | ds-cfg-enabled: true |
| | | ds-cfg-key-store-type: JKS |
| | | ds-cfg-key-store-file: config/admin-keystore |
| | | ds-cfg-key-store-pin-file: config/admin-keystore.pin |
| | | |
| | | dn: cn=Administration,cn=Trust Manager Providers,cn=config |
| | | objectClass: top |
| | | objectClass: ds-cfg-trust-manager-provider |
| | | objectClass: ds-cfg-file-based-trust-manager-provider |
| | | cn: Administration |
| | | ds-cfg-java-class: org.opends.server.extensions.FileBasedTrustManagerProvider |
| | | ds-cfg-enabled: true |
| | | ds-cfg-trust-store-type: JKS |
| | | ds-cfg-trust-store-file: config/admin-truststore |
| | | |
| | | dn: cn=Extensions,cn=config |
| | | objectClass: top |
| | | objectClass: ds-cfg-branch |
| | |
| | | # can be overridden on a per-client basis by prefixing |
| | | # the argument name with the name of the client. |
| | | # hostname=localhost |
| | | # port=389 |
| | | # port=4444 |
| | | # bindDN=cn=directory manager |
| | | # useSSL=false |
| | | # useStartTLS=false |
| | | |
| | | # Default dsconfig argument values. This overrides the |
| | | # Default ldapcompare argument values. This overrides the |
| | | # default value for the "port" argument defined above. |
| | | # dsconfig.port=1389 |
| | | # ldapcompare.port=389 |
| | | |
| | | # Default dsframework argument values. This overrides |
| | | # the default value for the "port" argument defined |
| | | # above. |
| | | # dsframework.port=1389 |
| | | # Default ldapdelete argument values. This overrides the |
| | | # default value for the "port" argument defined above. |
| | | # ldapdelete.port=389 |
| | | |
| | | # Default stop-ds argument values. This overrides |
| | | # the default value for the "port" argument defined |
| | | # above. |
| | | # stop-ds.port=1389 |
| | | # Default ldapmodify argument values. This overrides the |
| | | # default value for the "port" argument defined above. |
| | | # ldapmodify.port=389 |
| | | |
| | | # Default ldappasswordmodify argument values. This overrides the |
| | | # default value for the "port" argument defined above. |
| | | # ldappasswordmodify.port=389 |
| | | |
| | | # Default ldapsearch argument values. This overrides the |
| | | # default value for the "port" argument defined above. |
| | | # ldapsearch.port=389 |
| | | |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| | | <plist version="1.0"> |
| | | <dict> |
| | | <key>CFBundleAllowMixedLocalizations</key> |
| | | <string>true</string> |
| | | <key>CFBundleDevelopmentRegion</key> |
| | | <string>English</string> |
| | | <key>CFBundleExecutable</key> |
| | | <string>JavaApplicationStub</string> |
| | | <key>CFBundleGetInfoString</key> |
| | | <string>OpenDS Control Panel</string> |
| | | <key>CFBundleIconFile</key> |
| | | <string>OpenDS.icns</string> |
| | | <key>CFBundleInfoDictionaryVersion</key> |
| | | <string>6.0</string> |
| | | <key>CFBundleName</key> |
| | | <string>OpenDS Control Panel</string> |
| | | <key>CFBundlePackageType</key> |
| | | <string>APPL</string> |
| | | <key>CFBundleSignature</key> |
| | | <string>????</string> |
| | | <key>CFBundleVersion</key> |
| | | <string>1.0</string> |
| | | <key>Java</key> |
| | | <dict> |
| | | <key>ClassPath</key> |
| | | <array> |
| | | <string>$JAVAROOT/../../../../../lib/quicksetup.jar</string> |
| | | <string>$JAVAROOT/../../../../../lib/activation.jar</string> |
| | | <string>$JAVAROOT/../../../../../lib/aspectjrt.jar</string> |
| | | <string>$JAVAROOT/../../../../../lib/OpenDS.jar</string> |
| | | <string>$JAVAROOT/../../../../../lib/mail.jar</string> |
| | | <string>$JAVAROOT/../../../../../lib/je.jar</string> |
| | | </array> |
| | | <key>JVMVersion</key> |
| | | <string>1.5+</string> |
| | | <key>MainClass</key> |
| | | <string>org.opends.guitools.controlpanel.ControlPanelLauncher</string> |
| | | </dict> |
| | | </dict> |
| | | </plist> |
| | |
| | | NAME 'ds-task-import-ldif-file' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.459 |
| | | NAME 'ds-task-import-template-file' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.460 |
| | | NAME 'ds-task-import-random-seed' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.170 |
| | | NAME 'ds-task-import-append' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 |
| | |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.436 |
| | | NAME 'ds-cfg-workflow-id' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.437 |
| | |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.438 |
| | | NAME 'ds-cfg-workflow-element-id' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.439 |
| | | NAME 'ds-cfg-workflow-element' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.440 |
| | |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.459 |
| | | NAME 'ds-task-import-template-file' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.460 |
| | | NAME 'ds-task-import-random-seed' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.461 |
| | | NAME 'ds-cfg-allowed-auth-method' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.462 |
| | | NAME 'ds-cfg-allowed-ldap-port' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.463 |
| | | NAME 'ds-cfg-bind-dn-filter' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.464 |
| | | NAME 'ds-cfg-ip-address-filter' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.465 |
| | | NAME 'ds-cfg-is-security-mandatory' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.466 |
| | | NAME 'ds-cfg-user-entry-filter' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.467 |
| | | NAME 'ds-cfg-priority' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.468 |
| | | NAME 'ds-cfg-max-connections' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.469 |
| | | NAME 'ds-cfg-max-connections-from-same-ip' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.470 |
| | | NAME 'ds-cfg-max-ops-per-connection' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.471 |
| | | NAME 'ds-cfg-max-concurrent-ops-per-connection' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.472 |
| | | NAME 'ds-cfg-search-size-limit' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.473 |
| | | NAME 'ds-cfg-search-time-limit' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.474 |
| | | NAME 'ds-cfg-min-substring-length' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.475 |
| | | NAME 'ds-cfg-referral-policy' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.476 |
| | | NAME 'ds-cfg-referral-bind-policy' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.477 |
| | | NAME 'ds-cfg-referral-hop-limit' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.478 |
| | | NAME 'ds-cfg-assured-type' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.479 |
| | | NAME 'ds-cfg-assured-sd-level' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.480 |
| | | NAME 'ds-cfg-assured-timeout' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.481 |
| | | NAME 'ds-cfg-group-id' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.482 |
| | | NAME 'ds-cfg-referrals-url' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.483 |
| | | NAME 'ds-cfg-degraded-status-threshold' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 |
| | | SINGLE-VALUE |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.484 |
| | | NAME 'ds-cfg-allowed-operations' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.485 |
| | | NAME 'ds-cfg-allowed-attributes' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.486 |
| | | NAME 'ds-cfg-prohibited-attributes' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.487 |
| | | NAME 'ds-cfg-allowed-search-scopes' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.488 |
| | | NAME 'ds-cfg-allowed-subtrees' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | attributeTypes: ( 1.3.6.1.4.1.26027.1.1.489 |
| | | NAME 'ds-cfg-prohibited-subtrees' |
| | | SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | objectClasses: ( 1.3.6.1.4.1.26027.1.2.1 |
| | | NAME 'ds-cfg-access-control-handler' |
| | | SUP top |
| | |
| | | ds-cfg-max-send-delay $ |
| | | ds-cfg-window-size $ |
| | | ds-cfg-heartbeat-interval $ |
| | | ds-cfg-isolation-policy ) |
| | | ds-cfg-isolation-policy $ |
| | | ds-cfg-assured-type $ |
| | | ds-cfg-assured-sd-level $ |
| | | ds-cfg-assured-timeout $ |
| | | ds-cfg-group-id $ |
| | | ds-cfg-referrals-url) |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | objectClasses: ( 1.3.6.1.4.1.26027.1.2.58 |
| | | NAME 'ds-cfg-length-based-password-validator' |
| | |
| | | ds-cfg-window-size $ |
| | | ds-cfg-queue-size $ |
| | | ds-cfg-replication-db-directory $ |
| | | ds-cfg-replication-purge-delay ) |
| | | ds-cfg-replication-purge-delay $ |
| | | ds-cfg-group-id $ |
| | | ds-cfg-assured-timeout $ |
| | | ds-cfg-degraded-status-threshold) |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | objectClasses: ( 1.3.6.1.4.1.26027.1.2.65 |
| | | NAME 'ds-backup-directory' |
| | |
| | | SUP top |
| | | STRUCTURAL |
| | | MUST ( ds-cfg-network-group-id $ |
| | | ds-cfg-enabled $ |
| | | ds-cfg-workflow ) |
| | | ds-cfg-priority $ |
| | | ds-cfg-enabled ) |
| | | MAY ds-cfg-workflow |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | objectClasses: ( 1.3.6.1.4.1.26027.1.2.177 |
| | | NAME 'ds-cfg-workflow' |
| | |
| | | ds-cfg-java-class $ |
| | | ds-cfg-enabled ) |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | objectClasses: ( 1.3.6.1.4.1.26027.1.2.183 |
| | | NAME 'ds-cfg-administration-connector' |
| | | SUP top |
| | | STRUCTURAL |
| | | MUST ( cn $ |
| | | ds-cfg-listen-port $ |
| | | ds-cfg-key-manager-provider $ |
| | | ds-cfg-trust-manager-provider $ |
| | | ds-cfg-ssl-cert-nickname ) |
| | | MAY ( ds-cfg-listen-address ) |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | objectClasses: ( 1.3.6.1.4.1.26027.1.2.184 |
| | | NAME 'ds-cfg-network-group-criteria' |
| | | SUP top |
| | | STRUCTURAL |
| | | MUST (cn) |
| | | MAY ( ds-cfg-allowed-auth-method $ |
| | | ds-cfg-allowed-ldap-port $ |
| | | ds-cfg-bind-dn-filter $ |
| | | ds-cfg-ip-address-filter $ |
| | | ds-cfg-is-security-mandatory $ |
| | | ds-cfg-user-entry-filter) |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | objectClasses: ( 1.3.6.1.4.1.26027.1.2.185 |
| | | NAME 'ds-cfg-network-group-resource-limits' |
| | | SUP top |
| | | STRUCTURAL |
| | | MUST (cn) |
| | | MAY ( ds-cfg-max-connections $ |
| | | ds-cfg-max-connections-from-same-ip $ |
| | | ds-cfg-max-ops-per-connection $ |
| | | ds-cfg-max-concurrent-ops-per-connection $ |
| | | ds-cfg-search-size-limit $ |
| | | ds-cfg-search-time-limit $ |
| | | ds-cfg-min-substring-length $ |
| | | ds-cfg-referral-policy $ |
| | | ds-cfg-referral-bind-policy $ |
| | | ds-cfg-referral-hop-limit) |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | objectClasses: ( 1.3.6.1.4.1.26027.1.2.186 |
| | | NAME 'ds-cfg-network-group-plugin' |
| | | SUP ds-cfg-plugin |
| | | STRUCTURAL |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | objectClasses: ( 1.3.6.1.4.1.26027.1.2.187 |
| | | NAME 'ds-cfg-change-number-control-plugin' |
| | | SUP ds-cfg-plugin |
| | | STRUCTURAL |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| | | objectClasses: ( 1.3.6.1.4.1.26027.1.2.188 |
| | | NAME 'ds-cfg-network-group-request-filtering-policy' |
| | | SUP top |
| | | STRUCTURAL |
| | | MUST (cn) |
| | | MAY ( ds-cfg-allowed-operations $ |
| | | ds-cfg-allowed-attributes $ |
| | | ds-cfg-prohibited-attributes $ |
| | | ds-cfg-allowed-search-scopes $ |
| | | ds-cfg-allowed-subtrees $ |
| | | ds-cfg-prohibited-subtrees ) |
| | | X-ORIGIN 'OpenDS Directory Server' ) |
| New file |
| | |
| | | org.opends.server.servicetag.productname=OpenDS |
| | | org.opends.server.servicetag.version=2.0 |
| | | org.opends.server.servicetag.uuid=urn:uuid:98acc202-57f7-11dd-9496-080020a9ed93 |
| | | org.opends.server.servicetag.parent=Unknown |
| | | org.opends.server.servicetag.parenturn=Unknown |
| | | org.opends.server.servicetag.vendor=Opends.org |
| | | |
| | | |
| | | |
| | | |
| New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <!-- |
| | | ! CDDL HEADER START |
| | | ! |
| | | ! The contents of this file are subject to the terms of the |
| | | ! Common Development and Distribution License, Version 1.0 only |
| | | ! (the "License"). You may not use this file except in compliance |
| | | ! with the License. |
| | | ! |
| | | ! You can obtain a copy of the license at |
| | | ! trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | ! or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | ! See the License for the specific language governing permissions |
| | | ! and limitations under the License. |
| | | ! |
| | | ! When distributing Covered Code, include this CDDL HEADER in each |
| | | ! file and include the License file at |
| | | ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | ! add the following below this CDDL HEADER, with the fields enclosed |
| | | ! by brackets "[]" replaced with your own identifying information: |
| | | ! Portions Copyright [yyyy] [name of copyright owner] |
| | | ! |
| | | ! CDDL HEADER END |
| | | ! |
| | | ! |
| | | ! Copyright 2007-2008 Sun Microsystems, Inc. |
| | | ! --> |
| | | <adm:managed-object name="administration-connector" |
| | | plural-name="administration-connectors" |
| | | package="org.opends.server.admin.std" |
| | | xmlns:adm="http://www.opends.org/admin" |
| | | xmlns:ldap="http://www.opends.org/admin-ldap"> |
| | | <adm:synopsis> |
| | | The |
| | | <adm:user-friendly-name /> |
| | | is used to interact with administration tools using LDAP. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | It is a dedicated entry point for administration. |
| | | </adm:description> |
| | | <adm:tag name="core-server" /> |
| | | <adm:profile name="ldap"> |
| | | <ldap:object-class> |
| | | <ldap:name>ds-cfg-administration-connector</ldap:name> |
| | | <ldap:superior>top</ldap:superior> |
| | | </ldap:object-class> |
| | | </adm:profile> |
| | | <adm:property-reference name="listen-port" /> |
| | | <adm:property name="listen-address" multi-valued="true"> |
| | | <adm:synopsis> |
| | | Specifies the address or set of addresses on which this |
| | | <adm:user-friendly-name /> |
| | | should listen for connections from LDAP clients. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | Multiple addresses may be provided as separate values for this |
| | | attribute. If no values are provided, then the |
| | | <adm:user-friendly-name /> |
| | | listens on all interfaces. |
| | | </adm:description> |
| | | <adm:requires-admin-action> |
| | | <adm:server-restart /> |
| | | </adm:requires-admin-action> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>0.0.0.0</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:ip-address /> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-listen-address</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="key-manager-provider" mandatory="true"> |
| | | <adm:synopsis> |
| | | Specifies the name of the key manager that is used with |
| | | the |
| | | <adm:user-friendly-name /> |
| | | . |
| | | </adm:synopsis> |
| | | <adm:requires-admin-action> |
| | | <adm:server-restart /> |
| | | </adm:requires-admin-action> |
| | | <adm:default-behavior> |
| | | <adm:undefined /> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:aggregation relation-name="key-manager-provider" |
| | | parent-path="/"> |
| | | <adm:constraint> |
| | | <adm:synopsis> |
| | | The referenced key manager provider must be enabled. |
| | | </adm:synopsis> |
| | | <adm:target-is-enabled-condition> |
| | | <adm:contains property="enabled" value="true" /> |
| | | </adm:target-is-enabled-condition> |
| | | </adm:constraint> |
| | | </adm:aggregation> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-key-manager-provider</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="trust-manager-provider" mandatory="true"> |
| | | <adm:synopsis> |
| | | Specifies the name of the trust manager that is used with |
| | | the |
| | | <adm:user-friendly-name /> |
| | | . |
| | | </adm:synopsis> |
| | | <adm:requires-admin-action> |
| | | <adm:server-restart /> |
| | | </adm:requires-admin-action> |
| | | <adm:default-behavior> |
| | | <adm:undefined /> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:aggregation relation-name="trust-manager-provider" |
| | | parent-path="/"> |
| | | <adm:constraint> |
| | | <adm:synopsis> |
| | | The referenced trust manager provider must be enabled. |
| | | </adm:synopsis> |
| | | <adm:target-is-enabled-condition> |
| | | <adm:contains property="enabled" value="true" /> |
| | | </adm:target-is-enabled-condition> |
| | | </adm:constraint> |
| | | </adm:aggregation> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-trust-manager-provider</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="ssl-cert-nickname" mandatory="true"> |
| | | <adm:synopsis> |
| | | Specifies the nickname (also called the alias) of the certificate |
| | | that the |
| | | <adm:user-friendly-name /> |
| | | will use when performing SSL communication. |
| | | </adm:synopsis> |
| | | <adm:requires-admin-action> |
| | | <adm:server-restart /> |
| | | </adm:requires-admin-action> |
| | | <adm:default-behavior> |
| | | <adm:alias> |
| | | <adm:synopsis>Let the server decide.</adm:synopsis> |
| | | </adm:alias> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:string></adm:string> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-ssl-cert-nickname</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | </adm:managed-object> |
| New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <!-- |
| | | ! CDDL HEADER START |
| | | ! |
| | | ! The contents of this file are subject to the terms of the |
| | | ! Common Development and Distribution License, Version 1.0 only |
| | | ! (the "License"). You may not use this file except in compliance |
| | | ! with the License. |
| | | ! |
| | | ! You can obtain a copy of the license at |
| | | ! trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | ! or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | ! See the License for the specific language governing permissions |
| | | ! and limitations under the License. |
| | | ! |
| | | ! When distributing Covered Code, include this CDDL HEADER in each |
| | | ! file and include the License file at |
| | | ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | ! add the following below this CDDL HEADER, with the fields enclosed |
| | | ! by brackets "[]" replaced with your own identifying information: |
| | | ! Portions Copyright [yyyy] [name of copyright owner] |
| | | ! |
| | | ! CDDL HEADER END |
| | | ! |
| | | ! |
| | | ! Copyright 2007-2008 Sun Microsystems, Inc. |
| | | ! --> |
| | | <adm:managed-object name="change-number-control-plugin" |
| | | plural-name="change-number-control-plugins" package="org.opends.server.admin.std" |
| | | extends="plugin" xmlns:adm="http://www.opends.org/admin" |
| | | xmlns:ldap="http://www.opends.org/admin-ldap"> |
| | | <adm:synopsis> |
| | | The |
| | | <adm:user-friendly-name /> |
| | | returns the change number generated by the replication subsystem. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | The <adm:user-friendly-name /> returns the change number generated |
| | | by the Multi-Master Replication subsystem when : |
| | | - the Multi-Master Replication is configured and enabled |
| | | - the request is a write operation (add, delete, moidfy, moddn) |
| | | - the control is part of a request. |
| | | If all of the above are true, the response contains a control response |
| | | with a string representing the change number. |
| | | The implementation for the chnage number control plug-in is contained |
| | | in the org.opends.server.plugins.ChangeNumberControlPlugin class. It must be |
| | | configured with the postOperationAdd, postOperationDelete, |
| | | postOperationModify and postOperationModifyDN plug-in types, |
| | | but it does not have any other custom configuration. |
| | | </adm:description> |
| | | <adm:profile name="ldap"> |
| | | <ldap:object-class> |
| | | <ldap:name>ds-cfg-change-number-control-plugin</ldap:name> |
| | | <ldap:superior>ds-cfg-plugin</ldap:superior> |
| | | </ldap:object-class> |
| | | </adm:profile> |
| | | <adm:property-override name="java-class" advanced="true"> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>org.opends.server.plugins.ChangeNumberControlPlugin</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | </adm:property-override> |
| | | <adm:property-override name="plugin-type" advanced="true"> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>postOperationAdd</adm:value> |
| | | <adm:value>postOperationDelete</adm:value> |
| | | <adm:value>postOperationModify</adm:value> |
| | | <adm:value>postOperationModifyDN</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | </adm:property-override> |
| | | </adm:managed-object> |
| | |
| | | </adm:property> |
| | | <adm:property name="max-request-size" advanced="true"> |
| | | <adm:synopsis> |
| | | Specifies the size of the largest LDAP request message that will |
| | | Specifies the size in bytes of the largest LDAP request message that will |
| | | be allowed by this LDAP Connection handler. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | |
| | | <ldap:superior>top</ldap:superior> |
| | | </ldap:object-class> |
| | | </adm:profile> |
| | | |
| | | <adm:relation name="network-group-criteria" |
| | | managed-object-name="network-group-criteria"> |
| | | <adm:synopsis> |
| | | Specifies the set of criteria associated to this network group. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | A client connection can belong to a <adm:user-friendly-name /> only |
| | | if it matches all the criteria defined for this |
| | | <adm:user-friendly-name />. |
| | | </adm:description> |
| | | <adm:one-to-zero-or-one /> |
| | | <adm:profile name="ldap"> |
| | | <ldap:rdn-sequence>cn=Criteria</ldap:rdn-sequence> |
| | | </adm:profile> |
| | | </adm:relation> |
| | | |
| | | <adm:relation name="network-group-resource-limits" |
| | | managed-object-name="network-group-resource-limits"> |
| | | <adm:synopsis> |
| | | Specifies the set of resource limits enforced by this |
| | | <adm:user-friendly-name />. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | All client connections belonging to a <adm:user-friendly-name /> |
| | | must comply with the resource limits policy. |
| | | </adm:description> |
| | | <adm:one-to-zero-or-one /> |
| | | <adm:profile name="ldap"> |
| | | <ldap:rdn-sequence>cn=ResourceLimits</ldap:rdn-sequence> |
| | | </adm:profile> |
| | | </adm:relation> |
| | | |
| | | <adm:relation name="network-group-request-filtering-policy" |
| | | managed-object-name="network-group-request-filtering-policy"> |
| | | <adm:synopsis> |
| | | Specifies the request filtering policy enforced by this |
| | | <adm:user-friendly-name />. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | All client connections belonging to a <adm:user-friendly-name /> |
| | | must comply with the request filtering policy. |
| | | </adm:description> |
| | | <adm:one-to-zero-or-one /> |
| | | <adm:profile name="ldap"> |
| | | <ldap:rdn-sequence>cn=RequestFilteringPolicy</ldap:rdn-sequence> |
| | | </adm:profile> |
| | | </adm:relation> |
| | | |
| | | <adm:property name="enabled" mandatory="true"> |
| | | <adm:synopsis> |
| | | Indicates whether the |
| | |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="workflow" mandatory="true" read-only="true" |
| | | multi-valued="true"> |
| | | <adm:property name="priority" mandatory="true"> |
| | | <adm:synopsis> |
| | | Specifies the order in which the network groups are evaluated. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | A client connection is first compared against network group with |
| | | priority 1. If the client connection does not match the network group |
| | | criteria, the client connection is compared against network group |
| | | with priority 2 etc... |
| | | </adm:description> |
| | | <adm:syntax> |
| | | <adm:integer lower-limit="0"/> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-priority</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="workflow" multi-valued="true"> |
| | | <adm:synopsis> |
| | | Identifies the workflows in the network group. |
| | | </adm:synopsis> |
| | | <adm:default-behavior> |
| | | <adm:undefined /> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:aggregation relation-name="workflow" parent-path="/"> |
| | | <adm:constraint> |
| New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <!-- |
| | | ! CDDL HEADER START |
| | | ! |
| | | ! The contents of this file are subject to the terms of the |
| | | ! Common Development and Distribution License, Version 1.0 only |
| | | ! (the "License"). You may not use this file except in compliance |
| | | ! with the License. |
| | | ! |
| | | ! You can obtain a copy of the license at |
| | | ! trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | ! or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | ! See the License for the specific language governing permissions |
| | | ! and limitations under the License. |
| | | ! |
| | | ! When distributing Covered Code, include this CDDL HEADER in each |
| | | ! file and include the License file at |
| | | ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | ! add the following below this CDDL HEADER, with the fields enclosed |
| | | ! by brackets "[]" replaced with your own identifying information: |
| | | ! Portions Copyright [yyyy] [name of copyright owner] |
| | | ! |
| | | ! CDDL HEADER END |
| | | ! |
| | | ! |
| | | ! Copyright 2007-2008 Sun Microsystems, Inc. |
| | | ! --> |
| | | <adm:managed-object name="network-group-criteria" plural-name="network-group-criteria" |
| | | package="org.opends.server.admin.std" |
| | | xmlns:adm="http://www.opends.org/admin" |
| | | xmlns:ldap="http://www.opends.org/admin-ldap"> |
| | | |
| | | <adm:synopsis> |
| | | The <adm:user-friendly-name /> is used to classify incoming connections. |
| | | </adm:synopsis> |
| | | |
| | | <adm:tag name="core-server" /> |
| | | |
| | | <adm:profile name="ldap"> |
| | | <ldap:object-class> |
| | | <ldap:name>ds-cfg-network-group-criteria</ldap:name> |
| | | <ldap:superior>top</ldap:superior> |
| | | </ldap:object-class> |
| | | </adm:profile> |
| | | |
| | | <adm:property name="allowed-auth-method" multi-valued="true"> |
| | | <adm:synopsis> |
| | | Specifies the allowed authorization methods for a client connection to |
| | | match the <adm:user-friendly-name />. |
| | | </adm:synopsis> |
| | | <adm:default-behavior> |
| | | <adm:undefined /> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:enumeration> |
| | | <adm:value name="anonymous"> |
| | | <adm:synopsis> |
| | | Anonymous connections. |
| | | </adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="simple"> |
| | | <adm:synopsis> |
| | | Simple bind connections, with bind DN and password. |
| | | </adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="sasl"> |
| | | <adm:synopsis> |
| | | SASL/external connections, with a certificate containing the |
| | | user authentication. |
| | | </adm:synopsis> |
| | | </adm:value> |
| | | </adm:enumeration> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-allowed-auth-method</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | <adm:property name="allowed-ldap-port" multi-valued="true"> |
| | | <adm:synopsis> |
| | | Specifies the allowed LDAP ports for the client connection to match the |
| | | <adm:user-friendly-name />. |
| | | </adm:synopsis> |
| | | <adm:default-behavior> |
| | | <adm:undefined /> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:enumeration> |
| | | <adm:value name="ldap"> |
| | | <adm:synopsis> |
| | | Connection over ldap port. |
| | | </adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="ldaps"> |
| | | <adm:synopsis> |
| | | Connection over ldaps port. |
| | | </adm:synopsis> |
| | | </adm:value> |
| | | </adm:enumeration> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-allowed-ldap-port</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | <adm:property name="bind-dn-filter" multi-valued="true"> |
| | | <adm:synopsis> |
| | | Specifies a bind DN filter for the client connection to match the |
| | | <adm:user-friendly-name />. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | A valid bind DN filter is a string composed of zero or more |
| | | wildcards. A double wildcard ** replaces one or more RDN |
| | | components (as in uid=dmiller,**,dc=example,dc=com). A simple |
| | | wildcard * replaces either a whole RDN, or a whole type, or a |
| | | value substring (as in uid=bj*,ou=people,dc=example,dc=com). |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:undefined /> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:string /> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-bind-dn-filter</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | <adm:property name="ip-address-filter" multi-valued="true"> |
| | | <adm:synopsis> |
| | | Specifies an IP address filter for the <adm:user-friendly-name />. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | A valid IP address mask can be one of the followings: |
| | | 129.34.55.67 |
| | | 129.*.78.55 |
| | | .sun.com |
| | | foo.sun.com |
| | | foo.*.sun.* |
| | | 128.*.*.* |
| | | 129.45.23.67/22 |
| | | 128.33.21.21/32 |
| | | *.*.*.* |
| | | 129.45.67.34/0 |
| | | foo.com |
| | | foo |
| | | 2001:fecd:ba23:cd1f:dcb1:1010:9234:4088/124 |
| | | 2001:fecd:ba23:cd1f:dcb1:1010:9234:4088 |
| | | [2001:fecd:ba23:cd1f:dcb1:1010:9234:4088]/45 |
| | | ::/128 |
| | | ::1/128 |
| | | :: |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:undefined /> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:ip-address-mask /> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-ip-address-filter</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | <adm:property name="is-security-mandatory"> |
| | | <adm:synopsis> |
| | | Specifies whether security is mandatory for the |
| | | <adm:user-friendly-name />. |
| | | </adm:synopsis> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value> |
| | | false |
| | | </adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:boolean /> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-is-security-mandatory</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | <adm:property name="user-entry-filter"> |
| | | <adm:synopsis> |
| | | Specifies a search filter that the entry of a bound client |
| | | must match. |
| | | </adm:synopsis> |
| | | <adm:default-behavior> |
| | | <adm:undefined /> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:string /> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-user-entry-filter</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | </adm:managed-object> |
| New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <!-- |
| | | ! CDDL HEADER START |
| | | ! |
| | | ! The contents of this file are subject to the terms of the |
| | | ! Common Development and Distribution License, Version 1.0 only |
| | | ! (the "License"). You may not use this file except in compliance |
| | | ! with the License. |
| | | ! |
| | | ! You can obtain a copy of the license at |
| | | ! trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | ! or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | ! See the License for the specific language governing permissions |
| | | ! and limitations under the License. |
| | | ! |
| | | ! When distributing Covered Code, include this CDDL HEADER in each |
| | | ! file and include the License file at |
| | | ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | ! add the following below this CDDL HEADER, with the fields enclosed |
| | | ! by brackets "[]" replaced with your own identifying information: |
| | | ! Portions Copyright [yyyy] [name of copyright owner] |
| | | ! |
| | | ! CDDL HEADER END |
| | | ! |
| | | ! |
| | | ! Copyright 2007-2008 Sun Microsystems, Inc. |
| | | ! --> |
| | | <adm:managed-object name="network-group-plugin" |
| | | plural-name="network-group-plugins" package="org.opends.server.admin.std" |
| | | extends="plugin" xmlns:adm="http://www.opends.org/admin" |
| | | xmlns:ldap="http://www.opends.org/admin-ldap" |
| | | hidden="true"> |
| | | |
| | | <adm:synopsis> |
| | | The |
| | | <adm:user-friendly-name /> |
| | | allows to group connections into different network groups and |
| | | enforce specific resource limit policies for each network group. |
| | | </adm:synopsis> |
| | | |
| | | <adm:description> |
| | | The |
| | | <adm:user-friendly-name /> |
| | | creates network groups based on client connection criteria. Each network |
| | | group defines resource limit policies applied to all its connections. |
| | | </adm:description> |
| | | |
| | | <adm:profile name="ldap"> |
| | | <ldap:object-class> |
| | | <ldap:name>ds-cfg-network-group-plugin</ldap:name> |
| | | <ldap:superior>ds-cfg-plugin</ldap:superior> |
| | | </ldap:object-class> |
| | | </adm:profile> |
| | | |
| | | <adm:property-override name="java-class" advanced="true"> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>org.opends.server.plugins.NetworkGroupPlugin</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | </adm:property-override> |
| | | |
| | | <adm:property-override name="plugin-type" advanced="true"> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>postconnect</adm:value> |
| | | <adm:value>preparseadd</adm:value> |
| | | <adm:value>preparsebind</adm:value> |
| | | <adm:value>preparsecompare</adm:value> |
| | | <adm:value>preparsedelete</adm:value> |
| | | <adm:value>preparseextended</adm:value> |
| | | <adm:value>preparsemodify</adm:value> |
| | | <adm:value>preparsemodifydn</adm:value> |
| | | <adm:value>preparsesearch</adm:value> |
| | | <adm:value>preparseunbind</adm:value> |
| | | <adm:value>postresponsebind</adm:value> |
| | | <adm:value>postresponseextended</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | </adm:property-override> |
| | | |
| | | </adm:managed-object> |
| New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <!-- |
| | | ! CDDL HEADER START |
| | | ! |
| | | ! The contents of this file are subject to the terms of the |
| | | ! Common Development and Distribution License, Version 1.0 only |
| | | ! (the "License"). You may not use this file except in compliance |
| | | ! with the License. |
| | | ! |
| | | ! You can obtain a copy of the license at |
| | | ! trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | ! or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | ! See the License for the specific language governing permissions |
| | | ! and limitations under the License. |
| | | ! |
| | | ! When distributing Covered Code, include this CDDL HEADER in each |
| | | ! file and include the License file at |
| | | ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | ! add the following below this CDDL HEADER, with the fields enclosed |
| | | ! by brackets "[]" replaced with your own identifying information: |
| | | ! Portions Copyright [yyyy] [name of copyright owner] |
| | | ! |
| | | ! CDDL HEADER END |
| | | ! |
| | | ! |
| | | ! Copyright 2008 Sun Microsystems, Inc. |
| | | ! --> |
| | | <adm:managed-object name="network-group-request-filtering-policy" |
| | | plural-name="network-group-request-filtering-policies" |
| | | package="org.opends.server.admin.std" |
| | | xmlns:adm="http://www.opends.org/admin" |
| | | xmlns:ldap="http://www.opends.org/admin-ldap"> |
| | | |
| | | <adm:synopsis> |
| | | The |
| | | <adm:user-friendly-name /> is used to define the type of requests |
| | | allowed in the network group. |
| | | </adm:synopsis> |
| | | |
| | | <adm:tag name="core-server" /> |
| | | |
| | | <adm:profile name="ldap"> |
| | | <ldap:object-class> |
| | | <ldap:name>ds-cfg-network-group-request-filtering-policy</ldap:name> |
| | | <ldap:superior>top</ldap:superior> |
| | | </ldap:object-class> |
| | | </adm:profile> |
| | | |
| | | <adm:property name="allowed-operations" mandatory="false" multi-valued="true"> |
| | | <adm:synopsis> |
| | | Specifies which operations are allowed in the network group. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | When this attribute is specified, only the listed operations are |
| | | allowed in the network group. If the attribute is not defined, all |
| | | the operations are allowed. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:undefined /> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:enumeration> |
| | | <adm:value name="add"> |
| | | <adm:synopsis>Add operations.</adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="bind"> |
| | | <adm:synopsis>Bind operations.</adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="compare"> |
| | | <adm:synopsis>Compare operations</adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="delete"> |
| | | <adm:synopsis>Delete operations</adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="extended"> |
| | | <adm:synopsis>Extended operations</adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="inequality-search"> |
| | | <adm:synopsis>Inequality Search operations</adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="modify"> |
| | | <adm:synopsis>Modify operations</adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="rename"> |
| | | <adm:synopsis>Rename operations</adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="search"> |
| | | <adm:synopsis>Search operations</adm:synopsis> |
| | | </adm:value> |
| | | </adm:enumeration> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-allowed-operations</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | <adm:property name="allowed-attributes" mandatory="false" multi-valued="true"> |
| | | <adm:synopsis> |
| | | Specifies which attributes are allowed in search and compare operations. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | When this attribute is specified, only the listed attributes are allowed |
| | | in search and compare operations. If it is not set, all the attributes |
| | | are allowed, except those listed in ds-cfg-prohibited-attributes. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:undefined /> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:string /> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-allowed-attributes</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | <adm:property name="prohibited-attributes" mandatory="false" |
| | | multi-valued="true"> |
| | | <adm:synopsis> |
| | | Specifies which attributes are not allowed in search and compare |
| | | operations. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | When this attribute is specified, all the listed attributes are prohibited |
| | | in search and compare operations. It should not be used in conjunction |
| | | with ds-cfg-allowed-attributes. |
| | | |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:undefined /> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:string /> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-prohibited-attributes</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | <adm:property name="allowed-search-scopes" mandatory="false" |
| | | multi-valued="true"> |
| | | <adm:synopsis> |
| | | Specifies which search scopes are allowed in the network group. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | When this attribute is specified, only the listed scopes are |
| | | allowed in the network group. If it is not set, all search scopes are |
| | | allowed. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:undefined /> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:enumeration> |
| | | <adm:value name="base"> |
| | | <adm:synopsis>Base-object search.</adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="one"> |
| | | <adm:synopsis>One-level search.</adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="sub"> |
| | | <adm:synopsis>Whole subtree search</adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="children"> |
| | | <adm:synopsis>Subordinate subtree search</adm:synopsis> |
| | | </adm:value> |
| | | </adm:enumeration> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-allowed-search-scopes</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | <adm:property name="allowed-subtrees" mandatory="false" |
| | | multi-valued="true"> |
| | | <adm:synopsis> |
| | | Specifies which subtrees are exposed to clients. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | When this attribute is specified, only the listed subtrees are exposed. If |
| | | it is not set, all the substrees are exposed. Note that |
| | | ds-cfg-prohibited-subtrees restricts the list of exposed subtrees. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:undefined /> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:dn /> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-allowed-subtrees</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | <adm:property name="prohibited-subtrees" mandatory="false" |
| | | multi-valued="true"> |
| | | <adm:synopsis> |
| | | Specifies which subtrees are not exposed to clients. Each prohibited |
| | | subtree must be subordinate to an allowed subtree. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | When this attribute is specified, all the listed subtrees cannot be |
| | | accessed. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:undefined /> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:dn /> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-prohibited-subtrees</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | </adm:managed-object> |
| New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <!-- |
| | | ! CDDL HEADER START |
| | | ! |
| | | ! The contents of this file are subject to the terms of the |
| | | ! Common Development and Distribution License, Version 1.0 only |
| | | ! (the "License"). You may not use this file except in compliance |
| | | ! with the License. |
| | | ! |
| | | ! You can obtain a copy of the license at |
| | | ! trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | ! or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | ! See the License for the specific language governing permissions |
| | | ! and limitations under the License. |
| | | ! |
| | | ! When distributing Covered Code, include this CDDL HEADER in each |
| | | ! file and include the License file at |
| | | ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | ! add the following below this CDDL HEADER, with the fields enclosed |
| | | ! by brackets "[]" replaced with your own identifying information: |
| | | ! Portions Copyright [yyyy] [name of copyright owner] |
| | | ! |
| | | ! CDDL HEADER END |
| | | ! |
| | | ! |
| | | ! Copyright 2007-2008 Sun Microsystems, Inc. |
| | | ! --> |
| | | <adm:managed-object name="network-group-resource-limits" |
| | | plural-name="network-group-resource-limits" |
| | | package="org.opends.server.admin.std" |
| | | xmlns:adm="http://www.opends.org/admin" |
| | | xmlns:ldap="http://www.opends.org/admin-ldap"> |
| | | |
| | | <adm:synopsis> |
| | | The |
| | | <adm:user-friendly-name /> are used to define resource limits |
| | | enforced by the network group. |
| | | </adm:synopsis> |
| | | |
| | | <adm:tag name="core-server" /> |
| | | |
| | | <adm:profile name="ldap"> |
| | | <ldap:object-class> |
| | | <ldap:name>ds-cfg-network-group-resource-limits</ldap:name> |
| | | <ldap:superior>top</ldap:superior> |
| | | </ldap:object-class> |
| | | </adm:profile> |
| | | |
| | | <adm:property name="max-connections" mandatory="false"> |
| | | <adm:synopsis> |
| | | Specifies the maximum number of connections in the network group. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | A value of 0 means that no limit is enforced. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>0</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:integer lower-limit="0"/> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-max-connections</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | <adm:property name="max-connections-from-same-ip" |
| | | mandatory="false"> |
| | | <adm:synopsis> |
| | | Specifies the maximum number of connections from the same client |
| | | (identified by its IP address). |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | A value of 0 means that no limit is enforced. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>0</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:integer lower-limit="0"/> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-max-connections-from-same-ip</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | <adm:property name="max-ops-per-connection" mandatory="false"> |
| | | <adm:synopsis> |
| | | Specifies the maximum number of operations per connection. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | A value of 0 means that no limit is enforced. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>0</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:integer lower-limit="0"/> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-max-ops-per-connection</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | <adm:property name="max-concurrent-ops-per-connection" |
| | | mandatory="false"> |
| | | <adm:synopsis> |
| | | Specifies the maximum number of concurrent operations per connection. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | A value of 0 means that no limit is enforced. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>0</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:integer lower-limit="0"/> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-max-concurrent-ops-per-connection |
| | | </ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | <adm:property name="search-size-limit" mandatory="false"> |
| | | <adm:synopsis> |
| | | Specifies the maximum number of entries that the Directory Server |
| | | should return to the client during a search operation. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | A value of 0 indicates that no size limit is enforced. Note that this |
| | | is the network-group limit, but it may be overridden on a |
| | | per-user basis. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>1000</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:integer lower-limit="0"/> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-search-size-limit</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | <adm:property name="search-time-limit" mandatory="false"> |
| | | <adm:synopsis> |
| | | Specifies the maximum length of time that the Directory Server should |
| | | spend processing a search operation. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | A value of 0 seconds indicates that no time limit is enforced. Note that |
| | | this is the network group time limit, but it may be overridden |
| | | on a per-user basis. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>60 seconds</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:duration base-unit="s" lower-limit="0" /> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-search-time-limit</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | <adm:property name="min-substring-length" mandatory="false"> |
| | | <adm:synopsis> |
| | | Specifies the minimum length for a search substring. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | Search operations with short search substring are likely to match |
| | | a high number of entries and might degrade performances. A value of 0 |
| | | indicates that no limit is enforced. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>0</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:integer lower-limit="0"/> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-min-substring-length</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | <adm:property name="referral-policy" mandatory="false"> |
| | | <adm:synopsis> |
| | | Specifies the referral policy. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | The referral policy defines the behavior when a referral is |
| | | received. The server can either discard the referral, forward |
| | | the referral to the client or follow the referral. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>forward</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:enumeration> |
| | | <adm:value name="discard"> |
| | | <adm:synopsis>Discard referrals.</adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="forward"> |
| | | <adm:synopsis>Forward referrals.</adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="follow"> |
| | | <adm:synopsis>Follow referrals</adm:synopsis> |
| | | </adm:value> |
| | | </adm:enumeration> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-referral-policy</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | <adm:property name="referral-bind-policy" mandatory="false"> |
| | | <adm:synopsis> |
| | | Specifies the referral bind policy. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | The referral bind policy is used only when the referral policy |
| | | is set to "follow". It specifies whether the referral is followed |
| | | with the client bind DN and password or anonymously. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>anonymous</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:enumeration> |
| | | <adm:value name="anonymous"> |
| | | <adm:synopsis>Follow referrals anonymously.</adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="use-password"> |
| | | <adm:synopsis> |
| | | Follow referrals with the client bind DN and password. |
| | | </adm:synopsis> |
| | | </adm:value> |
| | | </adm:enumeration> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-referral-bind-policy</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | <adm:property name="referral-hop-limit" mandatory="false"> |
| | | <adm:synopsis> |
| | | Specifies the maximum number of hops when following referrals. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | A value of 0 means that no limit is enforced. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>0</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:integer lower-limit="0"/> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-referral-hop-limit</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | |
| | | </adm:managed-object> |
| | |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="assured-type" mandatory="false" advanced="true"> |
| | | <adm:synopsis> |
| | | Defines the assured mode of the replicated domain. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | The assured mode can be disable or enabled. When enabled, two sub modes |
| | | are available: Safe Data or Safe Read modes. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>not-assured</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:enumeration> |
| | | <adm:value name="not-assured"> |
| | | <adm:synopsis> |
| | | Updates sent for replication (for being replayed on other LDAP |
| | | servers of the topology) are sent without waiting for any |
| | | aknowledgement and the LDAP client call returns immediately. |
| | | </adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="safe-data"> |
| | | <adm:synopsis> |
| | | Assured mode is enabled in Safe Data sub mode: updates sent for |
| | | replication are subject to acknowledgement defined by the |
| | | assured-sd-level property. After acknowlegement is received, LDAP |
| | | client call returns. |
| | | </adm:synopsis> |
| | | </adm:value> |
| | | <adm:value name="safe-read"> |
| | | <adm:synopsis> |
| | | Assured mode is enabled in Safe Read sub mode: updates sent for |
| | | replication are subject to acknowledgement of LDAP servers of the |
| | | topology having the same group id than us (defined with |
| | | assured-sr-group-id property). After acknowlegement is received, |
| | | LDAP client call returns. |
| | | </adm:synopsis> |
| | | </adm:value> |
| | | </adm:enumeration> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-assured-type</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="assured-sd-level" mandatory="false" advanced="true"> |
| | | <adm:synopsis> |
| | | The level of acknowledgment for Safe Data assured sub mode. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | When assured mode configured in Safe Data mode, this value defines the |
| | | number of replication servers that should acknowledge the sent update |
| | | before the LDAP client call can return. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>1</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:integer lower-limit="1" upper-limit="127"></adm:integer> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-assured-sd-level</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="assured-timeout" mandatory="false" advanced="true"> |
| | | <adm:synopsis> |
| | | The timeout value when waiting for assured mode acknowledgements. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | Defines the amount of milliseconds the server will wait for assured |
| | | acknowledgements (in either Safe Data or Safe Read assured sub modes) |
| | | before returning anyway the LDAP client call. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>1000ms</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:duration base-unit="ms" lower-limit="1" /> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-assured-timeout</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="group-id" mandatory="false" advanced="true"> |
| | | <adm:synopsis> |
| | | The group id associated with this replicated domain. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | This value defines the group id of the replicated domain. The replication |
| | | system will preferably connect and send updates to replicate to a |
| | | replication server with the same group id as him. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>1</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:integer lower-limit="1" upper-limit="127"></adm:integer> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-group-id</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="referrals-url" multi-valued="true" mandatory="false" |
| | | advanced="true"> |
| | | <adm:synopsis> |
| | | The URLs other LDAP servers should you to refer to us. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | URLs used by peer servers of the topology to refer to us through LDAP |
| | | referrals. If this attribute is not defined, every URLs available to |
| | | access this server will be used. If defined, only URLs specified here will |
| | | be used. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:undefined/> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:string> |
| | | <adm:pattern> |
| | | <adm:regex>^ldap://.+$</adm:regex> |
| | | <adm:usage>LDAP URL</adm:usage> |
| | | <adm:synopsis> |
| | | A LDAP URL compliant with RFC 2255. |
| | | </adm:synopsis> |
| | | </adm:pattern> |
| | | </adm:string> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-referrals-url</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | </adm:managed-object> |
| | |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="group-id" mandatory="false"> |
| | | <adm:synopsis> |
| | | The group id for the replication server. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | This value defines the group id of the replication server. The replication |
| | | system of a LDAP server uses the group id of the replicated domain and |
| | | tries to connect, if possible, to a replication with the same group id. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>1</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:integer lower-limit="1" upper-limit="127"></adm:integer> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-group-id</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="assured-timeout" mandatory="false"> |
| | | <adm:synopsis> |
| | | The timeout value when waiting for assured mode acknowledgements. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | Defines the amount of milliseconds the replication server will wait for |
| | | assured acknowledgements (in either Safe Data or Safe Read assured sub |
| | | modes) before forgetting them and answer to the entity that sent an update |
| | | and is waiting for acknowledgment. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>1000ms</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:duration base-unit="ms" lower-limit="1" /> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-assured-timeout</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | <adm:property name="degraded-status-threshold" mandatory="false"> |
| | | <adm:synopsis> |
| | | The number of pending changes as threshold value for putting a directory |
| | | server in degraded status. |
| | | </adm:synopsis> |
| | | <adm:description> |
| | | This value represents a number of pending changes a replication server has |
| | | in queue for sending to a directory server. Once this value is crossed, |
| | | the matching directory server goes in degraded status. When number of |
| | | pending changes goes back under this value, the directory server is put |
| | | back in normal status. 0 means status analyzer is disabled and directory |
| | | servers are never put in degraded status. |
| | | </adm:description> |
| | | <adm:default-behavior> |
| | | <adm:defined> |
| | | <adm:value>5000</adm:value> |
| | | </adm:defined> |
| | | </adm:default-behavior> |
| | | <adm:syntax> |
| | | <adm:integer lower-limit="0"></adm:integer> |
| | | </adm:syntax> |
| | | <adm:profile name="ldap"> |
| | | <ldap:attribute> |
| | | <ldap:name>ds-cfg-degraded-status-threshold</ldap:name> |
| | | </ldap:attribute> |
| | | </adm:profile> |
| | | </adm:property> |
| | | </adm:managed-object> |
| | |
| | | </cli:relation> |
| | | </adm:profile> |
| | | </adm:relation> |
| | | <adm:relation name="network-group" hidden="true"> |
| | | <adm:relation name="network-group"> |
| | | <adm:one-to-many naming-property="network-group-id" /> |
| | | <adm:profile name="ldap"> |
| | | <ldap:rdn-sequence>cn=Network Groups,cn=config</ldap:rdn-sequence> |
| | |
| | | </cli:relation> |
| | | </adm:profile> |
| | | </adm:relation> |
| | | <adm:relation name="workflow" hidden="true"> |
| | | <adm:relation name="workflow"> |
| | | <adm:one-to-many naming-property="workflow-id" /> |
| | | <adm:profile name="ldap"> |
| | | <ldap:rdn-sequence>cn=Workflows,cn=config</ldap:rdn-sequence> |
| | |
| | | </cli:relation> |
| | | </adm:profile> |
| | | </adm:relation> |
| | | <adm:relation name="workflow-element" hidden="true"> |
| | | <adm:relation name="workflow-element"> |
| | | <adm:one-to-many naming-property="workflow-element-id" /> |
| | | <adm:profile name="ldap"> |
| | | <ldap:rdn-sequence> |
| | |
| | | </cli:relation> |
| | | </adm:profile> |
| | | </adm:relation> |
| | | <adm:relation name="administration-connector"> |
| | | <adm:one-to-one /> |
| | | <adm:profile name="ldap"> |
| | | <ldap:rdn-sequence>cn=Administration Connector,cn=config</ldap:rdn-sequence> |
| | | </adm:profile> |
| | | </adm:relation> |
| | | <adm:relation name="extension"> |
| | | <adm:one-to-many /> |
| | | <adm:profile name="ldap"> |
| | |
| | | */ |
| | | LDAPS_PORT("ldapsport",ADSPropertySyntax.INTEGER), |
| | | /** |
| | | * The administration connector port of the server. |
| | | */ |
| | | ADMIN_PORT("adminport",ADSPropertySyntax.INTEGER), |
| | | /** |
| | | * The certificate used by the server. |
| | | */ |
| | | CERTIFICATE("certificate",ADSPropertySyntax.STRING), |
| | |
| | | */ |
| | | LDAPS_ENABLED("ldapsEnabled",ADSPropertySyntax.BOOLEAN), |
| | | /** |
| | | * Whether ADMIN is enabled or not. |
| | | */ |
| | | ADMIN_ENABLED("adminEnabled",ADSPropertySyntax.BOOLEAN), |
| | | /** |
| | | * Whether StartTLS is enabled or not. |
| | | */ |
| | | STARTTLS_ENABLED("startTLSEnabled",ADSPropertySyntax.BOOLEAN), |
| | |
| | | */ |
| | | LDAPS_PORT, |
| | | /** |
| | | * The associated value is an Integer. |
| | | */ |
| | | ADMIN_PORT, |
| | | /** |
| | | * The associated value is an ArrayList of Boolean. |
| | | */ |
| | | LDAP_ENABLED, |
| | |
| | | /** |
| | | * The associated value is an ArrayList of Boolean. |
| | | */ |
| | | ADMIN_ENABLED, |
| | | /** |
| | | * The associated value is an ArrayList of Boolean. |
| | | */ |
| | | STARTTLS_ENABLED, |
| | | /** |
| | | * The associated value is an ArrayList of Integer. |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns the URL to access this server using the administration connector. |
| | | * Returns <CODE>null</CODE> if the server cannot get the administration |
| | | * connector. |
| | | * @return the URL to access this server using the administration connector. |
| | | */ |
| | | public String getAdminConnectorURL() |
| | | { |
| | | String adminConnectorUrl = null; |
| | | String host = getHostName(); |
| | | int port = -1; |
| | | |
| | | if (!serverProperties.isEmpty()) |
| | | { |
| | | ArrayList s = (ArrayList)serverProperties.get( |
| | | ServerProperty.ADMIN_ENABLED); |
| | | ArrayList p = (ArrayList)serverProperties.get( |
| | | ServerProperty.ADMIN_PORT); |
| | | if (s != null) |
| | | { |
| | | for (int i=0; i<s.size(); i++) |
| | | { |
| | | if (Boolean.TRUE.equals(s.get(i))) |
| | | { |
| | | port = (Integer)p.get(i); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (port != -1) |
| | | { |
| | | adminConnectorUrl = ConnectionUtils.getLDAPUrl(host, port, true); |
| | | } |
| | | return adminConnectorUrl; |
| | | } |
| | | |
| | | /** |
| | | * Returns a String of type host-name:port-number for the server. If |
| | | * the provided securePreferred is set to true the port that will be used |
| | | * (if LDAPS is enabled) will be the LDAPS port. |
| | | * will be the administration connector port. |
| | | * @param securePreferred whether to try to use the secure port as part |
| | | * of the returning String or not. |
| | | * @return a String of type host-name:port-number for the server. |
| | |
| | | if (securePreferred) |
| | | { |
| | | s = (ArrayList)serverProperties.get( |
| | | ServerProperty.LDAPS_ENABLED); |
| | | p = (ArrayList)serverProperties.get(ServerProperty.LDAPS_PORT); |
| | | ServerProperty.ADMIN_ENABLED); |
| | | p = (ArrayList)serverProperties.get(ServerProperty.ADMIN_PORT); |
| | | if (s != null) |
| | | { |
| | | for (int i=0; i<s.size(); i++) |
| | |
| | | { |
| | | boolean secure; |
| | | |
| | | Object v = adsProperties.get(ADSContext.ServerProperty.LDAPS_ENABLED); |
| | | Object v = adsProperties.get(ADSContext.ServerProperty.ADMIN_ENABLED); |
| | | secure = securePreferred && "true".equalsIgnoreCase(String.valueOf(v)); |
| | | try |
| | | { |
| | | if (secure) |
| | | { |
| | | port = Integer.parseInt((String)adsProperties.get( |
| | | ADSContext.ServerProperty.LDAPS_PORT)); |
| | | ADSContext.ServerProperty.ADMIN_PORT)); |
| | | } |
| | | else |
| | | { |
| | |
| | | ServerProperty [] props = |
| | | { |
| | | ServerProperty.LDAP_PORT, ServerProperty.LDAPS_PORT, |
| | | ServerProperty.LDAP_ENABLED, ServerProperty.LDAPS_ENABLED |
| | | ServerProperty.ADMIN_PORT, |
| | | ServerProperty.LDAP_ENABLED, ServerProperty.LDAPS_ENABLED, |
| | | ServerProperty.ADMIN_ENABLED |
| | | }; |
| | | for (ServerProperty prop : props) { |
| | | ArrayList s = (ArrayList) serverProperties.get(prop); |
| | |
| | | ADSContext.ServerProperty.HOST_NAME, |
| | | ADSContext.ServerProperty.LDAP_PORT, |
| | | ADSContext.ServerProperty.LDAPS_PORT, |
| | | ADSContext.ServerProperty.ADMIN_PORT, |
| | | ADSContext.ServerProperty.LDAP_ENABLED, |
| | | ADSContext.ServerProperty.LDAPS_ENABLED |
| | | ADSContext.ServerProperty.LDAPS_ENABLED, |
| | | ADSContext.ServerProperty.ADMIN_ENABLED |
| | | }; |
| | | for (int i=0; i<props.length; i++) |
| | | { |
| | |
| | | { |
| | | {ServerProperty.LDAP_ENABLED, ServerProperty.LDAP_PORT}, |
| | | {ServerProperty.LDAPS_ENABLED, ServerProperty.LDAPS_PORT}, |
| | | {ServerProperty.ADMIN_ENABLED, ServerProperty.ADMIN_PORT}, |
| | | {ServerProperty.JMX_ENABLED, ServerProperty.JMX_PORT}, |
| | | {ServerProperty.JMXS_ENABLED, ServerProperty.JMXS_PORT} |
| | | }; |
| | |
| | | ADSContext.ServerProperty.LDAP_PORT}, |
| | | {ADSContext.ServerProperty.LDAPS_ENABLED, |
| | | ADSContext.ServerProperty.LDAPS_PORT}, |
| | | {ADSContext.ServerProperty.ADMIN_ENABLED, |
| | | ADSContext.ServerProperty.ADMIN_PORT}, |
| | | {ADSContext.ServerProperty.JMX_ENABLED, |
| | | ADSContext.ServerProperty.JMX_PORT}, |
| | | {ADSContext.ServerProperty.JMXS_ENABLED, |
| | |
| | | |
| | | |
| | | updateLdapConfiguration(desc, ctx, filter); |
| | | updateAdminConnectorConfiguration(desc, ctx, filter); |
| | | updateJmxConfiguration(desc, ctx, filter); |
| | | updateReplicas(desc, ctx, filter); |
| | | updateReplication(desc, ctx, filter); |
| | |
| | | } |
| | | } |
| | | |
| | | private static void updateAdminConnectorConfiguration(ServerDescriptor desc, |
| | | InitialLdapContext ctx, TopologyCacheFilter cacheFilter) |
| | | throws NamingException |
| | | { |
| | | SearchControls ctls = new SearchControls(); |
| | | ctls.setSearchScope(SearchControls.SUBTREE_SCOPE); |
| | | ctls.setReturningAttributes( |
| | | new String[] { |
| | | "ds-cfg-listen-port", |
| | | "objectclass" |
| | | }); |
| | | String filter = "(objectclass=ds-cfg-administration-connector)"; |
| | | |
| | | LdapName jndiName = new LdapName("cn=config"); |
| | | NamingEnumeration listeners = ctx.search(jndiName, filter, ctls); |
| | | |
| | | Integer adminConnectorPort = null; |
| | | |
| | | // we should have a single administration connector |
| | | if (listeners.hasMore()) { |
| | | SearchResult sr = (SearchResult) listeners.next(); |
| | | String port = getFirstValue(sr, "ds-cfg-listen-port"); |
| | | adminConnectorPort = new Integer(port); |
| | | } |
| | | |
| | | // Even if we have a single port, use an array to be consistent with |
| | | // other protocols. |
| | | ArrayList<Integer> adminPorts = new ArrayList<Integer>(); |
| | | ArrayList<Boolean> adminEnabled = new ArrayList<Boolean>(); |
| | | if (adminConnectorPort != null) |
| | | { |
| | | adminPorts.add(adminConnectorPort); |
| | | adminEnabled.add(Boolean.TRUE); |
| | | } |
| | | desc.serverProperties.put(ServerProperty.ADMIN_PORT, adminPorts); |
| | | desc.serverProperties.put(ServerProperty.ADMIN_ENABLED, adminEnabled); |
| | | } |
| | | |
| | | private static void updateJmxConfiguration(ServerDescriptor desc, |
| | | InitialLdapContext ctx, TopologyCacheFilter cacheFilter) |
| | | throws NamingException |
| | |
| | | /** |
| | | * An X509TrustManager which trusts everything. |
| | | */ |
| | | class BlindTrustManager implements X509TrustManager { |
| | | public class BlindTrustManager implements X509TrustManager { |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | |
| | | import javax.naming.directory.Attributes; |
| | | import javax.naming.directory.SearchControls; |
| | | import javax.naming.directory.SearchResult; |
| | | import javax.naming.ldap.Control; |
| | | import javax.naming.ldap.InitialLdapContext; |
| | | import javax.naming.ldap.StartTlsRequest; |
| | | import javax.naming.ldap.StartTlsResponse; |
| | |
| | | } |
| | | |
| | | /** |
| | | * Clones the provided InitialLdapContext and returns a connection using |
| | | * the same parameters. |
| | | * @param ctx hte connection to be cloned. |
| | | * @param timeout the timeout to establish the connection. |
| | | * @param trustManager the trust manager to be used to connect. |
| | | * @param keyManager the key manager to be used to connect. |
| | | * @return the new InitialLdapContext connected to the server. |
| | | * @throws NamingException if there was an error creating the new connection. |
| | | */ |
| | | public static InitialLdapContext cloneInitialLdapContext( |
| | | final InitialLdapContext ctx, int timeout, TrustManager trustManager, |
| | | KeyManager keyManager) throws NamingException |
| | | { |
| | | Hashtable<?, ?> env = ctx.getEnvironment(); |
| | | Hashtable<?, ?> newEnv = new Hashtable<Object, Object>(env); |
| | | Control[] ctls = ctx.getConnectControls(); |
| | | Control[] newCtls = null; |
| | | if (ctls != null) |
| | | { |
| | | newCtls = new Control[ctls.length]; |
| | | for (int i=0; i<ctls.length; i++) |
| | | { |
| | | newCtls[i] = ctls[i]; |
| | | } |
| | | } |
| | | /* Contains the DirContext and the Exception if any */ |
| | | final Object[] pair = new Object[] {null, null}; |
| | | final Hashtable fEnv = env; |
| | | final TrustManager fTrustManager = trustManager; |
| | | final KeyManager fKeyManager = keyManager; |
| | | final Control[] fNewCtls = newCtls; |
| | | |
| | | Thread t = new Thread(new Runnable() { |
| | | public void run() { |
| | | try { |
| | | if (isSSL(ctx) || isStartTLS(ctx)) |
| | | { |
| | | TrustedSocketFactory.setCurrentThreadTrustManager(fTrustManager, |
| | | fKeyManager); |
| | | } |
| | | pair[0] = new InitialLdapContext(fEnv, fNewCtls); |
| | | |
| | | } catch (NamingException ne) { |
| | | pair[1] = ne; |
| | | |
| | | } catch (RuntimeException re) { |
| | | pair[1] = re; |
| | | } |
| | | } |
| | | }); |
| | | return getInitialLdapContext(t, pair, timeout); |
| | | } |
| | | |
| | | /** |
| | | * Creates an LDAP+StartTLS connection and returns the corresponding |
| | | * LdapContext. |
| | | * This method first creates an LdapContext with anonymous bind. Then it |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns the administration connector URL for the given server properties. |
| | | * It returns NULL if according to the server properties no administration |
| | | * connector URL can be generated. |
| | | * @param serverProperties the server properties to be used to generate |
| | | * the administration connector URL. |
| | | * @return the administration connector URL for the given server properties. |
| | | */ |
| | | private String getAdminConnectorUrl( |
| | | Map<ServerProperty,Object> serverProperties) |
| | | { |
| | | String adminUrl = null; |
| | | adminUrl = "ldaps://"+getHostNameForLdapUrl(serverProperties)+":"+ |
| | | serverProperties.get(ServerProperty.ADMIN_PORT); |
| | | |
| | | return adminUrl; |
| | | } |
| | | |
| | | /** |
| | | * Returns the host name to be used to generate an LDAP URL based on the |
| | | * contents of the provided server properties. |
| | | * @param serverProperties the server properties. |
| | |
| | | LinkedHashSet<PreferredConnection> ldapUrls = |
| | | new LinkedHashSet<PreferredConnection>(); |
| | | |
| | | String adminConnectorUrl = getAdminConnectorUrl(serverProperties); |
| | | String ldapsUrl = getLdapsUrl(serverProperties); |
| | | String startTLSUrl = getStartTlsLdapUrl(serverProperties); |
| | | String ldapUrl = getLdapUrl(serverProperties); |
| | |
| | | for (PreferredConnection connection : preferredLDAPURLs) |
| | | { |
| | | String url = connection.getLDAPURL(); |
| | | if (url.equalsIgnoreCase(ldapsUrl) && |
| | | if (url.equalsIgnoreCase(adminConnectorUrl)) |
| | | { |
| | | ldapUrls.add(connection); |
| | | } |
| | | else if (url.equalsIgnoreCase(ldapsUrl) && |
| | | connection.getType() == PreferredConnection.Type.LDAPS) |
| | | { |
| | | ldapUrls.add(connection); |
| | |
| | | } |
| | | } |
| | | |
| | | if (adminConnectorUrl != null) |
| | | { |
| | | ldapUrls.add( |
| | | new PreferredConnection(adminConnectorUrl, |
| | | PreferredConnection.Type.LDAPS)); |
| | | } |
| | | if (ldapsUrl != null) |
| | | { |
| | | ldapUrls.add( |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel; |
| | | |
| | | import java.awt.event.WindowAdapter; |
| | | import java.awt.event.WindowEvent; |
| | | |
| | | import javax.swing.JFrame; |
| | | import javax.swing.UIManager; |
| | | import javax.swing.WindowConstants; |
| | | |
| | | import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo; |
| | | import org.opends.guitools.controlpanel.datamodel.ServerDescriptor; |
| | | import org.opends.guitools.controlpanel.ui.ControlCenterMainPane; |
| | | import org.opends.guitools.controlpanel.ui.MainMenuBar; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.messages.AdminToolMessages; |
| | | |
| | | /** |
| | | * The class that is in charge of creating the main dialog of the ControlPanel |
| | | * and the ControlCenterInfo (the data structure that is used by all the GUI |
| | | * components and that contains information about the server status and server |
| | | * configuration). |
| | | */ |
| | | public class ControlPanel |
| | | { |
| | | private JFrame dlg; |
| | | private ControlPanelInfo info; |
| | | private ControlCenterMainPane controlCenterPane; |
| | | |
| | | /** |
| | | * Main method that is used for testing purposes. The control-panel |
| | | * command-line is launched through the ControlPanelLauncher (which displays |
| | | * a splash screen and calls the <code>initialize</code> and |
| | | * <code>createAndDisplayMethods</code>. |
| | | * @param args the arguments that are passed. |
| | | */ |
| | | public static void main(String[] args) { |
| | | try |
| | | { |
| | | UIManager.setLookAndFeel( |
| | | UIManager.getSystemLookAndFeelClassName()); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | t.printStackTrace(); |
| | | } |
| | | final ControlPanel test = new ControlPanel(); |
| | | test.initialize(args); |
| | | javax.swing.SwingUtilities.invokeLater(new Runnable() { |
| | | public void run() { |
| | | test.createAndDisplayGUI(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * Method that creates the ControlCenterInfo object that will be in all the |
| | | * control panel. Here it basically reads the configuration of the |
| | | * configuration file. |
| | | * @param args the arguments that are passed in the command line. |
| | | */ |
| | | public void initialize(String[] args) |
| | | { |
| | | info = ControlPanelInfo.getInstance(); |
| | | info.regenerateDescriptor(); |
| | | info.startPooling(ControlPanelInfo.DEFAULT_POOLING); |
| | | } |
| | | |
| | | /** |
| | | * Creates the main Control Panel dialog and displays it. |
| | | */ |
| | | public void createAndDisplayGUI() |
| | | { |
| | | // Create and set up the content pane. |
| | | controlCenterPane = new ControlCenterMainPane(info); |
| | | // Create and set up the window. |
| | | dlg = new JFrame(); |
| | | dlg.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
| | | final MainMenuBar menuBar = new MainMenuBar(info); |
| | | dlg.addWindowListener(new WindowAdapter() { |
| | | public void windowClosing(WindowEvent e) { |
| | | menuBar.quitClicked(); |
| | | } |
| | | }); |
| | | dlg.setJMenuBar(menuBar); |
| | | dlg.setTitle(AdminToolMessages.INFO_CONTROL_PANEL_TITLE.get().toString()); |
| | | dlg.setContentPane(controlCenterPane); |
| | | |
| | | dlg.pack(); |
| | | Utilities.centerOnScreen(dlg); |
| | | dlg.setVisible(true); |
| | | if (info.getServerDescriptor().getStatus() == |
| | | ServerDescriptor.ServerStatus.STARTED) |
| | | { |
| | | controlCenterPane.getLoginDialog().setVisible(true); |
| | | controlCenterPane.getLoginDialog().toFront(); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.tools.ToolConstants.*; |
| | | |
| | | import java.io.File; |
| | | import java.io.PrintStream; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | |
| | | import javax.swing.SwingUtilities; |
| | | import javax.swing.UIManager; |
| | | |
| | | import org.opends.guitools.controlpanel.util.ControlPanelLog; |
| | | import org.opends.messages.AdminToolMessages; |
| | | import org.opends.messages.Message; |
| | | import org.opends.quicksetup.Installation; |
| | | import org.opends.quicksetup.QuickSetupLog; |
| | | import org.opends.quicksetup.util.Utils; |
| | | import org.opends.server.util.ServerConstants; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.opends.server.util.args.ArgumentException; |
| | | import org.opends.server.util.args.ArgumentParser; |
| | | import org.opends.server.util.args.BooleanArgument; |
| | | |
| | | /** |
| | | * The class that is invoked directly by the control-panel command-line. This |
| | | * class basically displays a splash screen and then calls the methods in |
| | | * ControlPanel. It also is in charge of detecting whether there are issues |
| | | * with the |
| | | * |
| | | */ |
| | | public class ControlPanelLauncher |
| | | { |
| | | static private ArgumentParser argParser; |
| | | |
| | | /** Prefix for log files. */ |
| | | static public final String LOG_FILE_PREFIX = "opends-control-panel-"; |
| | | |
| | | /** Suffix for log files. */ |
| | | static public final String LOG_FILE_SUFFIX = ".log"; |
| | | |
| | | static private final Logger LOG = |
| | | Logger.getLogger(ControlPanelLauncher.class.getName()); |
| | | |
| | | /** |
| | | * Main method invoked by the control-panel script. |
| | | * @param args the arguments. |
| | | */ |
| | | public static void main(String[] args) |
| | | { |
| | | try { |
| | | ControlPanelLog.initLogFileHandler( |
| | | File.createTempFile(LOG_FILE_PREFIX, LOG_FILE_SUFFIX)); |
| | | } catch (Throwable t) { |
| | | System.err.println("Unable to initialize log"); |
| | | t.printStackTrace(); |
| | | } |
| | | |
| | | argParser = new ArgumentParser(ControlPanelLauncher.class.getName(), |
| | | INFO_CONTROL_PANEL_LAUNCHER_USAGE_DESCRIPTION.get(), false); |
| | | BooleanArgument showUsage; |
| | | String scriptName; |
| | | if (Utils.isWindows()) { |
| | | scriptName = Installation.WINDOWS_CONTROLPANEL_FILE_NAME; |
| | | } else { |
| | | scriptName = Installation.UNIX_CONTROLPANEL_FILE_NAME; |
| | | } |
| | | if (System.getProperty(ServerConstants.PROPERTY_SCRIPT_NAME) == null) |
| | | { |
| | | System.setProperty(ServerConstants.PROPERTY_SCRIPT_NAME, scriptName); |
| | | } |
| | | try |
| | | { |
| | | showUsage = new BooleanArgument("showusage", OPTION_SHORT_HELP, |
| | | OPTION_LONG_HELP, |
| | | INFO_DESCRIPTION_USAGE.get()); |
| | | argParser.addArgument(showUsage); |
| | | argParser.setUsageArgument(showUsage); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | System.err.println("ERROR: "+t); |
| | | t.printStackTrace(); |
| | | } |
| | | |
| | | // Validate user provided data |
| | | try |
| | | { |
| | | argParser.parseArguments(args); |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | Message message = ERR_ERROR_PARSING_ARGS.get(ae.getMessage()); |
| | | System.err.println(message); |
| | | System.out.println(Message.raw(argParser.getUsage())); |
| | | |
| | | System.exit(ErrorReturnCode.ERROR_PARSING_ARGS.getReturnCode()); |
| | | } |
| | | if (!argParser.usageOrVersionDisplayed()) |
| | | { |
| | | int exitCode = launchControlPanel(args); |
| | | if (exitCode != 0) |
| | | { |
| | | String logFileName = null; |
| | | if (QuickSetupLog.getLogFile() != null) |
| | | { |
| | | logFileName = QuickSetupLog.getLogFile().toString(); |
| | | } |
| | | if (logFileName != null) |
| | | { |
| | | System.err.println(StaticUtils.wrapText( |
| | | ERR_CONTROL_PANEL_LAUNCHER_GUI_LAUNCH_FAILED_DETAILS.get( |
| | | logFileName), |
| | | Utils.getCommandLineMaxLineWidth())); |
| | | } |
| | | else |
| | | { |
| | | System.err.println(StaticUtils.wrapText( |
| | | ERR_CONTROL_PANEL_LAUNCHER_GUI_LAUNCH_FAILED.get(), |
| | | Utils.getCommandLineMaxLineWidth())); |
| | | } |
| | | System.exit(exitCode); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Launches the graphical status panel. It is launched in a |
| | | * different thread that the main thread because if we have a problem with the |
| | | * graphical system (for instance the DISPLAY environment variable is not |
| | | * correctly set) the native libraries will call exit. However if we launch |
| | | * this from another thread, the thread will just be killed. |
| | | * |
| | | * This code also assumes that if the call to ControlPanelSplashScreen.main |
| | | * worked (and the splash screen was displayed) we will never get out of it |
| | | * (we will call a System.exit() when we close the graphical status dialog). |
| | | * |
| | | * @params String[] args the arguments used to call the |
| | | * ControlPanelSplashScreen main method. |
| | | * @return 0 if everything worked fine, or 1 if we could not display properly |
| | | * the ControlPanelSplashScreen. |
| | | */ |
| | | private static int launchControlPanel(final String[] args) |
| | | { |
| | | final int[] returnValue = { -1 }; |
| | | Thread t = new Thread(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | try |
| | | { |
| | | // Setup MacOSX native menu bar before AWT is loaded. |
| | | Utils.setMacOSXMenuBar( |
| | | AdminToolMessages.INFO_CONTROL_PANEL_TITLE.get()); |
| | | try |
| | | { |
| | | UIManager.setLookAndFeel( |
| | | UIManager.getSystemLookAndFeelClassName()); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | LOG.log(Level.WARNING, "Error setting look and feel: "+t, t); |
| | | } |
| | | |
| | | ControlPanelSplashScreen.main(args); |
| | | returnValue[0] = 0; |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | if (ControlPanelLog.isInitialized()) |
| | | { |
| | | LOG.log(Level.WARNING, "Error launching GUI: "+t); |
| | | StringBuilder buf = new StringBuilder(); |
| | | while (t != null) |
| | | { |
| | | StackTraceElement[] stack = t.getStackTrace(); |
| | | for (int i = 0; i < stack.length; i++) |
| | | { |
| | | buf.append(stack[i].toString()+"\n"); |
| | | } |
| | | |
| | | t = t.getCause(); |
| | | if (t != null) |
| | | { |
| | | buf.append("Root cause:\n"); |
| | | } |
| | | } |
| | | LOG.log(Level.WARNING, buf.toString()); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | /* |
| | | * This is done to avoid displaying the stack that might occur if there are |
| | | * problems with the display environment. |
| | | */ |
| | | PrintStream printStream = System.err; |
| | | System.setErr(Utils.getEmptyPrintStream()); |
| | | t.start(); |
| | | try |
| | | { |
| | | t.join(); |
| | | } |
| | | catch (InterruptedException ie) |
| | | { |
| | | /* An error occurred, so the return value will be -1. We got nothing to |
| | | do with this exception. */ |
| | | } |
| | | System.setErr(printStream); |
| | | return returnValue[0]; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * The enumeration containing the different return codes that the command-line |
| | | * can have. |
| | | * |
| | | */ |
| | | enum ErrorReturnCode |
| | | { |
| | | /** |
| | | * Successful display of the status. |
| | | */ |
| | | SUCCESSFUL(0), |
| | | /** |
| | | * We did no have an error but the status was not displayed (displayed |
| | | * version or usage). |
| | | */ |
| | | SUCCESSFUL_NOP(0), |
| | | /** |
| | | * Unexpected error (potential bug). |
| | | */ |
| | | ERROR_UNEXPECTED(1), |
| | | /** |
| | | * Cannot parse arguments. |
| | | */ |
| | | ERROR_PARSING_ARGS(2), |
| | | /** |
| | | * User cancelled (for instance not accepting the certificate proposed) or |
| | | * could not use the provided connection parameters in interactive mode. |
| | | */ |
| | | USER_CANCELLED_OR_DATA_ERROR(3), |
| | | /** |
| | | * This occurs for instance when the authentication provided by the user is |
| | | * not valid. |
| | | */ |
| | | ERROR_READING_CONFIGURATION_WITH_LDAP(4); |
| | | |
| | | private int returnCode; |
| | | private ErrorReturnCode(int returnCode) |
| | | { |
| | | this.returnCode = returnCode; |
| | | } |
| | | |
| | | /** |
| | | * Returns the corresponding return code value. |
| | | * @return the corresponding return code value. |
| | | */ |
| | | public int getReturnCode() |
| | | { |
| | | return returnCode; |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * The splash screen for the control panel. |
| | | * |
| | | */ |
| | | class ControlPanelSplashScreen extends org.opends.quicksetup.SplashScreen |
| | | { |
| | | private static final long serialVersionUID = 4472839063380302713L; |
| | | |
| | | private static ControlPanel controlPanel; |
| | | |
| | | private static final Logger LOG = |
| | | Logger.getLogger(ControlPanelLauncher.class.getName()); |
| | | |
| | | /** |
| | | * The main method for this class. |
| | | * It can be called from the event thread and outside the event thread. |
| | | * @param args arguments to be passed to the method ControlPanel.initialize |
| | | */ |
| | | public static void main(String[] args) |
| | | { |
| | | ControlPanelSplashScreen screen = new ControlPanelSplashScreen(); |
| | | screen.display(args); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * This methods constructs the ControlPanel object. |
| | | * This method assumes that is being called outside the event thread. |
| | | * @param args arguments to be passed to the method ControlPanel.initialize. |
| | | */ |
| | | protected void constructApplication(String[] args) |
| | | { |
| | | try |
| | | { |
| | | controlPanel = new ControlPanel(); |
| | | controlPanel.initialize(args); |
| | | } catch (Throwable t) |
| | | { |
| | | if (ControlPanelLog.isInitialized()) |
| | | { |
| | | LOG.log(Level.SEVERE, "Error launching GUI: "+t, t); |
| | | } |
| | | InternalError error = |
| | | new InternalError("Failed to invoke initialize method"); |
| | | error.initCause(t); |
| | | throw error; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * This method displays the StatusPanel dialog. |
| | | * @see org.opends.guitools.controlpanel.ControlPanel#createAndDisplayGUI() |
| | | * This method assumes that is being called outside the event thread. |
| | | */ |
| | | protected void displayApplication() |
| | | { |
| | | Runnable runnable = new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | try |
| | | { |
| | | LOG.log(Level.INFO, "going to call createAndDisplayGUI."); |
| | | controlPanel.createAndDisplayGUI(); |
| | | LOG.log(Level.INFO, "called createAndDisplayGUI."); |
| | | } catch (Throwable t) |
| | | { |
| | | LOG.log(Level.SEVERE, "Error displaying GUI: "+t, t); |
| | | InternalError error = |
| | | new InternalError("Failed to invoke display method"); |
| | | error.initCause(t); |
| | | throw error; |
| | | } |
| | | } |
| | | }; |
| | | if (SwingUtilities.isEventDispatchThread()) |
| | | { |
| | | runnable.run(); |
| | | } |
| | | else |
| | | { |
| | | try |
| | | { |
| | | SwingUtilities.invokeAndWait(runnable); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | LOG.log(Level.SEVERE, "Error calling SwingUtilities.invokeAndWait: "+t, |
| | | t); |
| | | InternalError error = |
| | | new InternalError( |
| | | "Failed to invoke SwingUtilities.invokeAndWait method"); |
| | | error.initCause(t); |
| | | throw error; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.browser; |
| | | |
| | | import org.opends.guitools.controlpanel.ui.nodes.BasicNode; |
| | | |
| | | /** |
| | | * This is an abstract class that is extended to search for nodes or |
| | | * to refresh the contents of the nodes. |
| | | */ |
| | | public abstract class AbstractNodeTask implements Runnable { |
| | | |
| | | BasicNode node; |
| | | boolean cancelled; |
| | | |
| | | /** |
| | | * The constructor of the node searcher. |
| | | * @param node the node to be searched/refreshed. |
| | | */ |
| | | protected AbstractNodeTask(BasicNode node) { |
| | | this.node = node; |
| | | cancelled = false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the node that is being searched/refreshed. |
| | | * @return the node that is being searched/refreshed. |
| | | */ |
| | | public BasicNode getNode() { |
| | | return node; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Cancels the searching/refreshing process. |
| | | * |
| | | */ |
| | | public void cancel() { |
| | | cancelled = true; |
| | | } |
| | | |
| | | /** |
| | | * Tells whether the search/refresh operation is cancelled. |
| | | * @return <CODE>true</CODE> if the operation is cancelled and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean isCancelled() { |
| | | return cancelled; |
| | | } |
| | | |
| | | /** |
| | | * The method that is called to refresh/search the node. |
| | | */ |
| | | public abstract void run(); |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.browser; |
| | | |
| | | |
| | | /** |
| | | * Error record. |
| | | * We group all the error variables in one class to decrease the number of |
| | | * variables in BasicNode. |
| | | */ |
| | | public class BasicNodeError { |
| | | private NodeRefresher.State state; |
| | | private Exception exception; |
| | | private Object arg; |
| | | |
| | | /** |
| | | * The constructor of the BasicNodeError. |
| | | * @param state the state of the refresher when the exception occurred. |
| | | * @param x the exception. |
| | | * @param arg the argument of the exception. |
| | | */ |
| | | public BasicNodeError(NodeRefresher.State state, Exception x, Object arg) { |
| | | this.state = state; |
| | | exception = x; |
| | | this.arg = arg; |
| | | } |
| | | |
| | | /** |
| | | * Returns the state of the refresher when the exception occurred. |
| | | * @return the state of the refresher when the exception occurred. |
| | | */ |
| | | public NodeRefresher.State getState() { |
| | | return state; |
| | | } |
| | | |
| | | /** |
| | | * Returns the exception. |
| | | * @return the exception. |
| | | */ |
| | | public Exception getException() { |
| | | return exception; |
| | | } |
| | | |
| | | /** |
| | | * Returns the argument of the exception. |
| | | * @return the argument of the exception. |
| | | */ |
| | | public Object getArg() { |
| | | return arg; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.browser; |
| | | |
| | | import java.awt.Font; |
| | | import java.io.IOException; |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Enumeration; |
| | | import java.util.Set; |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | | |
| | | import javax.naming.NameNotFoundException; |
| | | import javax.naming.NamingException; |
| | | import javax.naming.directory.SearchControls; |
| | | import javax.naming.directory.SearchResult; |
| | | import javax.naming.ldap.Control; |
| | | import javax.naming.ldap.InitialLdapContext; |
| | | import javax.naming.ldap.ManageReferralControl; |
| | | import javax.naming.ldap.SortControl; |
| | | import javax.naming.ldap.SortKey; |
| | | import javax.swing.Icon; |
| | | import javax.swing.JTree; |
| | | import javax.swing.SwingUtilities; |
| | | import javax.swing.event.TreeExpansionEvent; |
| | | import javax.swing.event.TreeExpansionListener; |
| | | import javax.swing.tree.DefaultTreeModel; |
| | | import javax.swing.tree.TreeNode; |
| | | import javax.swing.tree.TreePath; |
| | | |
| | | import org.opends.admin.ads.ADSContext; |
| | | import org.opends.admin.ads.util.ConnectionUtils; |
| | | import org.opends.guitools.controlpanel.event.BrowserEvent; |
| | | import org.opends.guitools.controlpanel.event.BrowserEventListener; |
| | | import org.opends.guitools.controlpanel.event.ReferralAuthenticationListener; |
| | | import org.opends.guitools.controlpanel.ui.nodes.BasicNode; |
| | | import org.opends.guitools.controlpanel.ui.nodes.BrowserNodeInfo; |
| | | import org.opends.guitools.controlpanel.ui.nodes.RootNode; |
| | | import org.opends.guitools.controlpanel.ui.nodes.SuffixNode; |
| | | import org.opends.guitools.controlpanel.ui.renderer.BrowserCellRenderer; |
| | | import org.opends.guitools.controlpanel.util.NumSubordinateHacker; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.quicksetup.Constants; |
| | | import org.opends.server.config.ConfigConstants; |
| | | import org.opends.server.types.LDAPURL; |
| | | |
| | | /** |
| | | * This is the main class of the LDAP entry browser. It is in charge of |
| | | * updating a tree that is passed as parameter. Every instance of |
| | | * BrowserController is associated with a unique JTree. |
| | | * The different visualization options are passed to BrowserController using |
| | | * some setter and getter methods (the user can specify for instance whether |
| | | * the entries must be sorted or not). |
| | | */ |
| | | public class BrowserController |
| | | implements TreeExpansionListener, ReferralAuthenticationListener |
| | | { |
| | | /** |
| | | * The mask used to display the number of ACIs or not. |
| | | */ |
| | | public final static int DISPLAY_ACI_COUNT = 0x01; |
| | | |
| | | /** |
| | | * The list of attributes that are used to sort the entries (if the sorting |
| | | * option is used). |
| | | */ |
| | | public static final String[] SORT_ATTRIBUTES = {"cn", "givenname", "o", "ou", |
| | | "sn", "uid"}; |
| | | |
| | | /** |
| | | * This is a key value. It is used to specify that the attribute that should |
| | | * be used to display the entry is the RDN attribute. |
| | | */ |
| | | public static final String RDN_ATTRIBUTE = "rdn attribute"; |
| | | |
| | | /** |
| | | * The filter used to retrieve all the entries. |
| | | */ |
| | | public static final String ALL_OBJECTS_FILTER = |
| | | "(|(objectClass=*)(objectClass=ldapsubentry))"; |
| | | |
| | | private JTree tree; |
| | | private DefaultTreeModel treeModel; |
| | | private RootNode rootNode; |
| | | private int displayFlags; |
| | | private String displayAttribute; |
| | | private boolean showAttributeName; |
| | | private InitialLdapContext ctxConfiguration; |
| | | private InitialLdapContext ctxUserData; |
| | | boolean followReferrals; |
| | | boolean sorted; |
| | | boolean showContainerOnly; |
| | | private boolean automaticExpand; |
| | | private boolean automaticallyExpandedNode; |
| | | private String[] containerClasses; |
| | | private NumSubordinateHacker numSubordinateHacker; |
| | | private int queueTotalSize; |
| | | private int maxChildren = 0; |
| | | private Collection<BrowserEventListener> listeners = |
| | | new ArrayList<BrowserEventListener>(); |
| | | private LDAPConnectionPool connectionPool; |
| | | private IconPool iconPool; |
| | | |
| | | private NodeSearcherQueue refreshQueue; |
| | | |
| | | private String filter; |
| | | |
| | | /** |
| | | * Constructor of the BrowserController. |
| | | * @param tree the tree that must be updated. |
| | | * @param cpool the connection pool object that will provide the connections |
| | | * to be used. |
| | | * @param ipool the icon pool to be used to retrieve the icons that will be |
| | | * used to render the nodes in the tree. |
| | | */ |
| | | public BrowserController(JTree tree, LDAPConnectionPool cpool, |
| | | IconPool ipool) |
| | | { |
| | | this.tree = tree; |
| | | iconPool = ipool; |
| | | rootNode = new RootNode(); |
| | | rootNode.setIcon(iconPool.getIconForRootNode()); |
| | | treeModel = new DefaultTreeModel(rootNode); |
| | | tree.setModel(treeModel); |
| | | tree.addTreeExpansionListener(this); |
| | | tree.setCellRenderer(new BrowserCellRenderer()); |
| | | displayFlags = DISPLAY_ACI_COUNT; |
| | | displayAttribute = RDN_ATTRIBUTE; |
| | | followReferrals = true; |
| | | sorted = false; |
| | | showContainerOnly = true; |
| | | containerClasses = new String[0]; |
| | | queueTotalSize = 0; |
| | | connectionPool = cpool; |
| | | connectionPool.addReferralAuthenticationListener(this); |
| | | |
| | | refreshQueue = new NodeSearcherQueue("New red", 2); |
| | | |
| | | // NUMSUBORDINATE HACK |
| | | // Create an empty hacker to avoid null value test. |
| | | // However this value will be overriden by full hacker. |
| | | numSubordinateHacker = new NumSubordinateHacker(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set the connection for accessing the directory. Since we must use |
| | | * different controls when searching the configuration and the user data, |
| | | * two connections must be provided (this is done to avoid synchronization |
| | | * issues). |
| | | * @param ctxConfiguration the connection to be used to retrieve the data in |
| | | * the configuration base DNs. |
| | | * @param ctxUserData the connection to be used to retrieve the data in the |
| | | * user base DNs. |
| | | * @throws NamingException if an error occurs. |
| | | */ |
| | | public void setConnections(InitialLdapContext ctxConfiguration, |
| | | InitialLdapContext ctxUserData) throws NamingException { |
| | | String rootNodeName; |
| | | if (ctxConfiguration != null) |
| | | { |
| | | this.ctxConfiguration = ctxConfiguration; |
| | | this.ctxUserData = ctxUserData; |
| | | |
| | | this.ctxConfiguration.setRequestControls( |
| | | getConfigurationRequestControls()); |
| | | this.ctxUserData.setRequestControls(getRequestControls()); |
| | | rootNodeName = ConnectionUtils.getHostName(ctxConfiguration) + ":" + |
| | | ConnectionUtils.getPort(ctxConfiguration); |
| | | } |
| | | else { |
| | | rootNodeName = ""; |
| | | } |
| | | rootNode.setDisplayName(rootNodeName); |
| | | startRefresh(null); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return the connection for accessing the directory configuration. |
| | | * @return the connection for accessing the directory configuration. |
| | | */ |
| | | public InitialLdapContext getConfigurationConnection() { |
| | | return ctxConfiguration; |
| | | } |
| | | |
| | | /** |
| | | * Return the connection for accessing the directory user data. |
| | | * @return the connection for accessing the directory user data. |
| | | */ |
| | | public InitialLdapContext getUserDataConnection() { |
| | | return ctxUserData; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return the JTree controlled by this controller. |
| | | * @return the JTree controlled by this controller. |
| | | */ |
| | | public JTree getTree() { |
| | | return tree; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return the connection pool used by this controller. |
| | | * If a client class adds authentication to the connection |
| | | * pool, it must inform the controller by calling notifyAuthDataChanged(). |
| | | * @return the connection pool used by this controller. |
| | | */ |
| | | public LDAPConnectionPool getConnectionPool() { |
| | | return connectionPool; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return the icon pool used by this controller. |
| | | * @return the icon pool used by this controller. |
| | | */ |
| | | public IconPool getIconPool() { |
| | | return iconPool; |
| | | } |
| | | |
| | | /** |
| | | * Tells wether the given suffix is in the tree or not. |
| | | * @param suffixDn the DN of the suffix to be analyzed. |
| | | * @return <CODE>true</CODE> if the provided String is the DN of a suffix |
| | | * and <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean hasSuffix(String suffixDn) { |
| | | return (findSuffixNode(suffixDn, rootNode) != null); |
| | | } |
| | | |
| | | /** |
| | | * Add an LDAP suffix to this controller. |
| | | * A new node is added in the JTree and a refresh is started. |
| | | * @param suffixDn the DN of the suffix. |
| | | * @param parentSuffixDn the DN of the parent suffix (or <CODE>null</CODE> if |
| | | * there is no parent DN). |
| | | * @return the TreePath of the new node. |
| | | */ |
| | | public TreePath addSuffix(String suffixDn, String parentSuffixDn) { |
| | | SuffixNode parentNode; |
| | | if (parentSuffixDn != null) { |
| | | parentNode = findSuffixNode(parentSuffixDn, rootNode); |
| | | if (parentNode == null) { |
| | | throw new IllegalArgumentException("Invalid suffix dn " + |
| | | parentSuffixDn); |
| | | } |
| | | } |
| | | else { |
| | | parentNode = rootNode; |
| | | } |
| | | int index = findChildNode(parentNode, suffixDn); |
| | | if (index >= 0) { // A node has alreay this dn -> bug |
| | | throw new IllegalArgumentException("Duplicate suffix dn " + suffixDn); |
| | | } |
| | | else { |
| | | index = - (index + 1); |
| | | } |
| | | SuffixNode newNode = new SuffixNode(suffixDn); |
| | | treeModel.insertNodeInto(newNode, parentNode, index); |
| | | startRefreshNode(newNode, null, true); |
| | | |
| | | return new TreePath(treeModel.getPathToRoot(newNode)); |
| | | } |
| | | |
| | | /** |
| | | * Add an LDAP suffix to this controller. |
| | | * A new node is added in the JTree and a refresh is started. |
| | | * @param nodeDn the DN of the node to be added. |
| | | * @return the TreePath of the new node. |
| | | */ |
| | | public TreePath addNodeUnderRoot(String nodeDn) { |
| | | SuffixNode parentNode = rootNode; |
| | | int index = findChildNode(parentNode, nodeDn); |
| | | if (index >= 0) { // A node has alreay this dn -> bug |
| | | throw new IllegalArgumentException("Duplicate node dn " + nodeDn); |
| | | } |
| | | else { |
| | | index = - (index + 1); |
| | | } |
| | | BasicNode newNode = new BasicNode(nodeDn); |
| | | treeModel.insertNodeInto(newNode, parentNode, index); |
| | | startRefreshNode(newNode, null, true); |
| | | |
| | | return new TreePath(treeModel.getPathToRoot(newNode)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Remove the suffix from this controller. |
| | | * The controller updates the JTree and returns the TreePath |
| | | * of the parent node. |
| | | * @param suffixDn the DN of the suffix to be removed. |
| | | * @return the TreePath of the parent node of the removed node. |
| | | */ |
| | | public TreePath removeSuffix(String suffixDn) { |
| | | TreePath result = null; |
| | | BasicNode node = findSuffixNode(suffixDn, rootNode); |
| | | TreeNode parentNode = node.getParent(); |
| | | /* If the parent is null... the node is no longer in the tree */ |
| | | if (parentNode != null) { |
| | | removeOneNode(node); |
| | | result = new TreePath(treeModel.getPathToRoot(parentNode)); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Remove all the suffixes. |
| | | * The controller removes all the nodes from the JTree except the root. |
| | | * @return the TreePath of the root node. |
| | | */ |
| | | public TreePath removeAllUnderRoot() { |
| | | stopRefresh(); |
| | | removeAllChildNodes(rootNode, false /* Delete suffixes */); |
| | | return new TreePath(treeModel.getPathToRoot(rootNode)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return the display flags. |
| | | * @return the display flags. |
| | | */ |
| | | public int getDisplayFlags() { |
| | | return displayFlags; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set the display flags and call startRefresh(). |
| | | * @param flags the display flags to be set. |
| | | */ |
| | | public void setDisplayFlags(int flags) { |
| | | displayFlags = flags; |
| | | startRefresh(null); |
| | | } |
| | | |
| | | /** |
| | | * Set the display attribute (the attribute that will be used to retrieve |
| | | * the string that will appear in the tree when rendering the node). |
| | | * This routine collapses the JTree and invokes startRefresh(). |
| | | * @param displayAttribute the display attribute to be used. |
| | | */ |
| | | public void setDisplayAttribute(String displayAttribute) { |
| | | this.displayAttribute = displayAttribute; |
| | | stopRefresh(); |
| | | removeAllChildNodes(rootNode, true /* Keep suffixes */); |
| | | startRefresh(null); |
| | | } |
| | | |
| | | /** |
| | | * Returns the attribute used to display the entry. |
| | | * RDN_ATTRIBUTE is the rdn is used. |
| | | * @return the attribute used to display the entry. |
| | | */ |
| | | public String getDisplayAttribute() { |
| | | return displayAttribute; |
| | | } |
| | | |
| | | /** |
| | | * Says wether to show the attribute name or not. |
| | | * This routine collapses the JTree and invokes startRefresh(). |
| | | * @param showAttributeName whether to show the attribute name or not. |
| | | */ |
| | | public void showAttributeName(boolean showAttributeName) { |
| | | this.showAttributeName = showAttributeName; |
| | | stopRefresh(); |
| | | removeAllChildNodes(rootNode, true /* Keep suffixes */); |
| | | startRefresh(null); |
| | | } |
| | | |
| | | /** |
| | | * Says wether we are showing the attribute name or not. |
| | | * @return <CODE>true</CODE> if we are showing the attribute name and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean isAttributeNameShown() { |
| | | return showAttributeName; |
| | | } |
| | | |
| | | /** |
| | | * Sets the maximum number of children to display for a node. |
| | | * 0 if there is no limit |
| | | * @param maxChildren the maximum number of children to display for a node. |
| | | */ |
| | | public void setMaxChildren(int maxChildren) { |
| | | this.maxChildren = maxChildren; |
| | | } |
| | | |
| | | /** |
| | | * Return the maximum number of children to display. |
| | | * @return the maximum number of children to display. |
| | | */ |
| | | public int getMaxChildren() { |
| | | return maxChildren; |
| | | } |
| | | |
| | | /** |
| | | * Return true if this controller follows referrals. |
| | | * @return <CODE>true</CODE> if this controller follows referrals and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean getFollowReferrals() { |
| | | return followReferrals; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Enable/display the following of referrals. |
| | | * This routine starts a refresh on each referral node. |
| | | * @param followReferrals whether to follow referrals or not. |
| | | */ |
| | | public void setFollowReferrals(boolean followReferrals) { |
| | | this.followReferrals = followReferrals; |
| | | startRefreshReferralNodes(rootNode); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return true if entries are displayed sorted. |
| | | * @return <CODE>true</CODE> if entries are displayed sorted and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean isSorted() { |
| | | return sorted; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Enable/disable entry sort. |
| | | * This routine collapses the JTree and invokes startRefresh(). |
| | | * @param sorted whether to sort the entries or not. |
| | | * @throws NamingException if there is an error updating the request controls |
| | | * of the internal connections. |
| | | */ |
| | | public void setSorted(boolean sorted) throws NamingException { |
| | | stopRefresh(); |
| | | removeAllChildNodes(rootNode, true /* Keep suffixes */); |
| | | this.sorted = sorted; |
| | | ctxConfiguration.setRequestControls(getConfigurationRequestControls()); |
| | | ctxUserData.setRequestControls(getRequestControls()); |
| | | connectionPool.setRequestControls(getRequestControls()); |
| | | startRefresh(null); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return true if only container entries are displayed. |
| | | * An entry is a container if: |
| | | * - it has some children |
| | | * - or its class is one of the container classes |
| | | * specified with setContainerClasses(). |
| | | * @return <CODE>true</CODE> if only container entries are displayed and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean isShowContainerOnly() { |
| | | return showContainerOnly; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Enable or disable container display and call startRefresh(). |
| | | * @param showContainerOnly whether to display only containers or all the |
| | | * entries. |
| | | */ |
| | | public void setShowContainerOnly(boolean showContainerOnly) { |
| | | this.showContainerOnly = showContainerOnly; |
| | | startRefresh(null); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Find the BrowserNodeInfo associated to a TreePath and returns |
| | | * the describing IBrowserNodeInfo. |
| | | * @param path the TreePath associated with the node we are searching. |
| | | * @return the BrowserNodeInfo associated to the TreePath. |
| | | */ |
| | | public BrowserNodeInfo getNodeInfoFromPath(TreePath path) { |
| | | BasicNode node = (BasicNode)path.getLastPathComponent(); |
| | | return new BrowserNodeInfoImpl(node); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return the array of container classes for this controller. |
| | | * Warning: the returned array is not cloned. |
| | | * @return the array of container classes for this controller. |
| | | */ |
| | | public String[] getContainerClasses() { |
| | | return containerClasses; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set the list of container classes and calls startRefresh(). |
| | | * Warning: the array is not cloned. |
| | | * @param containerClasses the lis of container classes. |
| | | */ |
| | | public void setContainerClasses(String[] containerClasses) { |
| | | this.containerClasses = containerClasses; |
| | | startRefresh(null); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * NUMSUBORDINATE HACK |
| | | * Make the hacker public so that RefreshTask can use it. |
| | | * @return the NumSubordinateHacker object used by the controller. |
| | | */ |
| | | public NumSubordinateHacker getNumSubordinateHacker() { |
| | | return numSubordinateHacker; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * NUMSUBORDINATE HACK |
| | | * Set the hacker. Note this method does not trigger any |
| | | * refresh. The caller is supposed to do it afterward. |
| | | * @param h the NumSubordinateHacker. |
| | | */ |
| | | public void setNumSubordinateHacker(NumSubordinateHacker h) { |
| | | if (h == null) { |
| | | throw new IllegalArgumentException("hacker cannot be null"); |
| | | } |
| | | numSubordinateHacker = h; |
| | | } |
| | | |
| | | /** |
| | | * Add a BrowserEventListener to this controller. |
| | | * @param l the listener to be added. |
| | | */ |
| | | public void addBrowserEventListener(BrowserEventListener l) { |
| | | listeners.add(l); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Remove a BrowserEventListener from this controller. |
| | | * @param l the listener to be removed. |
| | | */ |
| | | public void removeBrowserEventListener(BrowserEventListener l) { |
| | | listeners.remove(l); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Notify this controller that an entry has been added. |
| | | * The controller adds a new node in the JTree and starts refreshing this new |
| | | * node. |
| | | * This routine returns the tree path about the new entry. |
| | | * @param parentInfo the parent node of the entry added. |
| | | * @param newEntryDn the dn of the entry to be added. |
| | | * @return the tree path associated with the new entry. |
| | | */ |
| | | public TreePath notifyEntryAdded(BrowserNodeInfo parentInfo, |
| | | String newEntryDn) { |
| | | BasicNode parentNode = parentInfo.getNode(); |
| | | BasicNode childNode = new BasicNode(newEntryDn); |
| | | int childIndex; |
| | | if (sorted) { |
| | | childIndex = findChildNode(parentNode, newEntryDn); |
| | | if (childIndex >= 0) { |
| | | throw new IllegalArgumentException("Duplicate DN " + newEntryDn); |
| | | } |
| | | else { |
| | | childIndex = - (childIndex + 1); |
| | | } |
| | | } |
| | | else { |
| | | childIndex = parentNode.getChildCount(); |
| | | } |
| | | parentNode.setLeaf(false); |
| | | treeModel.insertNodeInto(childNode, parentNode, childIndex); |
| | | startRefreshNode(childNode, null, false); |
| | | return new TreePath(treeModel.getPathToRoot(childNode)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Notify this controller that a entry has been deleted. |
| | | * The controller removes the corresponding node from the JTree and returns |
| | | * the TreePath of the parent node. |
| | | * @param nodeInfo the node to be deleted. |
| | | * @return the tree path associated with the parent of the deleted node. |
| | | */ |
| | | public TreePath notifyEntryDeleted(BrowserNodeInfo nodeInfo) { |
| | | TreePath result = null; |
| | | BasicNode node = nodeInfo.getNode(); |
| | | if (node == rootNode) { |
| | | throw new IllegalArgumentException("Root node cannot be removed"); |
| | | } |
| | | TreeNode parentNode = node.getParent(); |
| | | |
| | | /* If the parent is null... the node is no longer in the tree */ |
| | | if (parentNode != null) { |
| | | removeOneNode(node); |
| | | result = new TreePath(treeModel.getPathToRoot(parentNode)); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Notify this controller that an entry has changed. |
| | | * The controller starts refreshing the corresponding node. |
| | | * Child nodes are not refreshed. |
| | | * @param nodeInfo the node that changed. |
| | | */ |
| | | public void notifyEntryChanged(BrowserNodeInfo nodeInfo) { |
| | | BasicNode node = nodeInfo.getNode(); |
| | | startRefreshNode(node, null, false); |
| | | } |
| | | |
| | | /** |
| | | * Notify this controller that a child entry has changed. |
| | | * The controller has to refresh the corresponding node and (if necessary) |
| | | * itself. |
| | | * @param nodeInfo the parent of the node that changed. |
| | | * @param dn the DN of the entry that changed. |
| | | */ |
| | | public void notifyChildEntryChanged(BrowserNodeInfo nodeInfo, String dn) { |
| | | BasicNode node = nodeInfo.getNode(); |
| | | startRefreshNode(node, null, true); |
| | | } |
| | | |
| | | /** |
| | | * Notify this controller that a child entry has been added. |
| | | * The controller has to refresh the corresponding node and (if necessary) |
| | | * itself. |
| | | * @param nodeInfo the parent of the node that was added. |
| | | * @param dn the DN of the entry that was added. |
| | | */ |
| | | public void notifyChildEntryAdded(BrowserNodeInfo nodeInfo, String dn) { |
| | | BasicNode node = nodeInfo.getNode(); |
| | | startRefreshNode(node, null, true); |
| | | } |
| | | |
| | | /** |
| | | * Notify this controller that a child entry has been deleted. |
| | | * The controller has to refresh the corresponding node and (if necessary) |
| | | * itself. |
| | | * @param nodeInfo the parent of the node that was deleted. |
| | | * @param dn the DN of the entry that was deleted. |
| | | */ |
| | | public void notifyChildEntryDeleted(BrowserNodeInfo nodeInfo, String dn) { |
| | | BasicNode node = nodeInfo.getNode(); |
| | | if (node.getParent() != null) { |
| | | startRefreshNode((BasicNode) node.getParent(), null, true); |
| | | } else { |
| | | startRefreshNode(node, null, true); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Notify this controller that authentication data have changed in the |
| | | * connection pool. |
| | | */ |
| | | public void notifyAuthDataChanged() { |
| | | notifyAuthDataChanged(null); |
| | | } |
| | | |
| | | /** |
| | | * Notify this controller that authentication data have changed in the |
| | | * connection pool for the specified url. |
| | | * The controller starts refreshing the node which represent entries from the |
| | | * url. |
| | | * @param url the URL of the connection that changed. |
| | | */ |
| | | public void notifyAuthDataChanged(LDAPURL url) { |
| | | // TODO: temporary implementation |
| | | // we should refresh only nodes : |
| | | // - whose URL matches 'url' |
| | | // - whose errorType == ERROR_SOLVING_REFERRAL and |
| | | // errorArg == url |
| | | startRefreshReferralNodes(rootNode); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Start a refresh from the specified node. |
| | | * If some refresh are on-going on descendent nodes, they are stopped. |
| | | * If nodeInfo is null, refresh is started from the root. |
| | | * @param nodeInfo the node to be refreshed. |
| | | */ |
| | | public void startRefresh(BrowserNodeInfo nodeInfo) { |
| | | BasicNode node; |
| | | if (nodeInfo == null) { |
| | | node = rootNode; |
| | | } |
| | | else { |
| | | node = nodeInfo.getNode(); |
| | | } |
| | | stopRefreshNode(node); |
| | | startRefreshNode(node, null, true); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Equivalent to startRefresh(null). |
| | | */ |
| | | public void startRefresh() { |
| | | startRefresh(null); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Stop the current refreshing. |
| | | * Nodes being expanded are collapsed. |
| | | */ |
| | | public void stopRefresh() { |
| | | stopRefreshNode(rootNode); |
| | | // TODO: refresh must be stopped in a clean state. |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Shutdown the controller : all the backgroup threads are stopped. |
| | | * After this call, the controller is no longer usable. |
| | | */ |
| | | public void shutDown() { |
| | | tree.removeTreeExpansionListener(this); |
| | | refreshQueue.shutdown(); |
| | | connectionPool.flush(); |
| | | } |
| | | |
| | | /** |
| | | * Start refreshing the whole tree from the specified node. |
| | | * We queue a refresh which: |
| | | * - updates the base node |
| | | * - is recursive |
| | | * @param node the parent node that will be refreshed. |
| | | * @param localEntry the local entry corresponding to the node. |
| | | * @param recursive whether the refresh must be executed recursively or not. |
| | | */ |
| | | void startRefreshNode(BasicNode node, SearchResult localEntry, |
| | | boolean recursive) { |
| | | if (node == rootNode) { |
| | | // For the root node, readBaseEntry is meaningless. |
| | | if (recursive) { |
| | | // The root cannot be queued directly. |
| | | // We need to queue each child individually. |
| | | Enumeration e = rootNode.children(); |
| | | while (e.hasMoreElements()) { |
| | | BasicNode child = (BasicNode)e.nextElement(); |
| | | startRefreshNode(child, null, true); |
| | | } |
| | | } |
| | | } |
| | | else { |
| | | refreshQueue.queue(new NodeRefresher(node, this, localEntry, recursive)); |
| | | // The task does not *see* suffixes. |
| | | // So we need to propagate the refresh on |
| | | // the subsuffixes if any. |
| | | if (recursive && (node instanceof SuffixNode)) { |
| | | Enumeration e = node.children(); |
| | | while (e.hasMoreElements()) { |
| | | BasicNode child = (BasicNode)e.nextElement(); |
| | | if (child instanceof SuffixNode) { |
| | | startRefreshNode(child, null, true); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Stop refreshing below this node. |
| | | * TODO: this method is very costly when applied to something else than the |
| | | * root node. |
| | | * @param node the node where the refresh must stop. |
| | | */ |
| | | void stopRefreshNode(BasicNode node) { |
| | | if (node == rootNode) { |
| | | refreshQueue.cancelAll(); |
| | | } |
| | | else { |
| | | Enumeration e = node.children(); |
| | | while (e.hasMoreElements()) { |
| | | BasicNode child = (BasicNode)e.nextElement(); |
| | | stopRefreshNode(child); |
| | | } |
| | | refreshQueue.cancelForNode(node); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Call startRefreshNode() on each referral node accessible from parentNode. |
| | | * @param parentNode the parent node. |
| | | */ |
| | | void startRefreshReferralNodes(BasicNode parentNode) { |
| | | Enumeration e = parentNode.children(); |
| | | while (e.hasMoreElements()) { |
| | | BasicNode child = (BasicNode)e.nextElement(); |
| | | if ((child.getReferral() != null) || (child.getRemoteUrl() != null)) { |
| | | startRefreshNode(child, null, true); |
| | | } |
| | | else { |
| | | startRefreshReferralNodes(child); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Remove all the children below parentNode *without changing the leaf state*. |
| | | * If specified, it keeps the SuffixNode and recurse on them. Inform the tree |
| | | * model. |
| | | * @param parentNode the parent node. |
| | | * @param keepSuffixes whether the suffixes should be kept or not. |
| | | */ |
| | | void removeAllChildNodes(BasicNode parentNode, boolean keepSuffixes) { |
| | | for (int i = parentNode.getChildCount() - 1; i >= 0; i--) { |
| | | BasicNode child = (BasicNode)parentNode.getChildAt(i); |
| | | if ((child instanceof SuffixNode) && keepSuffixes) { |
| | | removeAllChildNodes(child, true); |
| | | child.setRefreshNeededOnExpansion(true); |
| | | } |
| | | else { |
| | | child.removeFromParent(); |
| | | } |
| | | } |
| | | treeModel.nodeStructureChanged(parentNode); |
| | | } |
| | | |
| | | /** |
| | | * For BrowserController private use. When a node is expanded, refresh it |
| | | * if it needs it (to search the children for instance). |
| | | * @param event the tree expansion event. |
| | | */ |
| | | public void treeExpanded(TreeExpansionEvent event) { |
| | | if (!automaticallyExpandedNode) |
| | | { |
| | | automaticExpand = false; |
| | | } |
| | | BasicNode basicNode = (BasicNode)event.getPath().getLastPathComponent(); |
| | | if (basicNode.isRefreshNeededOnExpansion()) { |
| | | basicNode.setRefreshNeededOnExpansion(false); |
| | | // Starts a recursive refresh which does not read the base entry |
| | | startRefreshNode(basicNode, null, true); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * For BrowserController private use. When a node is collapsed the refresh |
| | | * tasks on it are canceled. |
| | | * @param event the tree collapse event. |
| | | */ |
| | | public void treeCollapsed(TreeExpansionEvent event) { |
| | | Object node = event.getPath().getLastPathComponent(); |
| | | if (!(node instanceof RootNode)) { |
| | | BasicNode basicNode = (BasicNode)node; |
| | | stopRefreshNode(basicNode); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Sets which is the inspected node. This method simply marks the selected |
| | | * node in the tree so that it can have a different rendering. This is |
| | | * useful for instance when the right panel has a list of entries to which |
| | | * the menu action apply, to make a difference between the selected node in |
| | | * the tree (to which the action in the main menu will not apply) and the |
| | | * selected nodes in the right pane. |
| | | * @param node the selected node. |
| | | */ |
| | | public void setInspectedNode(BrowserNodeInfo node) { |
| | | BrowserCellRenderer renderer = (BrowserCellRenderer)tree.getCellRenderer(); |
| | | if (node == null) { |
| | | renderer.setInspectedNode(null); |
| | | } else { |
| | | renderer.setInspectedNode(node.getNode()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Routines for the task classes |
| | | * ============================= |
| | | * |
| | | * Note that these routines only read controller variables. |
| | | * They do not alter any variable: so they can be safely |
| | | * called by task threads without synchronize clauses. |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * The tree model created by the controller and assigned |
| | | * to the JTree. |
| | | * @return the tree model. |
| | | */ |
| | | public DefaultTreeModel getTreeModel() { |
| | | return treeModel; |
| | | } |
| | | |
| | | /** |
| | | * Sets the filter that must be used by the browser controller to retrieve |
| | | * entries. |
| | | * @param filter the LDAP filter. |
| | | */ |
| | | public void setFilter(String filter) |
| | | { |
| | | this.filter = filter; |
| | | } |
| | | |
| | | /** |
| | | * Returns the filter that is being used to search the entries. |
| | | * @return the filter that is being used to search the entries. |
| | | */ |
| | | public String getFilter() |
| | | { |
| | | return filter; |
| | | } |
| | | |
| | | /** |
| | | * Returns the filter used to make a object base search. |
| | | * @return the filter used to make a object base search. |
| | | */ |
| | | String getObjectSearchFilter() |
| | | { |
| | | return ALL_OBJECTS_FILTER; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return the LDAP search filter to use for searching child entries. |
| | | * If showContainerOnly is true, the filter will select only the |
| | | * container entries. If not, the filter will select all the children. |
| | | * @return the LDAP search filter to use for searching child entries. |
| | | */ |
| | | String getChildSearchFilter() { |
| | | String result; |
| | | if (showContainerOnly) { |
| | | if (followReferrals) { |
| | | /* In the case we are following referrals, we have to consider referrals |
| | | as nodes. |
| | | Suppose the following scenario: a referral points to a remote entry |
| | | that has children (node), BUT the referral entry in the local server |
| | | has no children. It won't be included in the filter and it won't |
| | | appear in the tree. But what we are displaying is the remote entry, |
| | | the result is that we have a NODE that does not appear in the tree and |
| | | so the user cannot browse it. |
| | | |
| | | This has some side effects: |
| | | If we cannot follow the referral, a leaf will appear on the tree (as it |
| | | if were a node). |
| | | If the referral points to a leaf entry, a leaf will appear on the tree |
| | | (as if it were a node). |
| | | |
| | | This is minor compared to the impossibility of browsing a subtree with |
| | | the NODE/LEAF layout. |
| | | */ |
| | | result = "(|(&(hasSubordinates=true)"+filter+")(objectClass=referral)"; |
| | | } else { |
| | | result = "(|(&(hasSubordinates=true)"+filter+")"; |
| | | } |
| | | for (int i = 0; i < containerClasses.length; i++) { |
| | | result += "(objectClass=" + containerClasses[i] + ")"; |
| | | } |
| | | result += ")"; |
| | | } |
| | | else { |
| | | result = filter; |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Return the LDAP connection to reading the base entry of a node. |
| | | * @param node the node for which we want the LDAP connection. |
| | | * @throws NamingException if there is an error retrieving the connection. |
| | | * @return the LDAP connection to reading the base entry of a node. |
| | | */ |
| | | InitialLdapContext findConnectionForLocalEntry(BasicNode node) |
| | | throws NamingException { |
| | | return findConnectionForLocalEntry(node, isConfigurationNode(node)); |
| | | } |
| | | |
| | | /** |
| | | * Return the LDAP connection to reading the base entry of a node. |
| | | * @param node the node for which we want toe LDAP connection. |
| | | * @param isConfigurationNode whether the node is a configuration node or not. |
| | | * @throws NamingException if there is an error retrieving the connection. |
| | | * @return the LDAP connection to reading the base entry of a node. |
| | | */ |
| | | InitialLdapContext findConnectionForLocalEntry(BasicNode node, |
| | | boolean isConfigurationNode) |
| | | throws NamingException { |
| | | InitialLdapContext result; |
| | | if (node == rootNode) { |
| | | result = ctxConfiguration; |
| | | } |
| | | else { |
| | | BasicNode parent = (BasicNode)node.getParent(); |
| | | if (parent != null) { |
| | | result = findConnectionForDisplayedEntry(parent, isConfigurationNode); |
| | | } else { |
| | | if (isConfigurationNode) |
| | | { |
| | | result = ctxConfiguration; |
| | | } |
| | | else |
| | | { |
| | | result = ctxUserData; |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * Returns whether a given node is a configuration node or not. |
| | | * @param node the node to analyze. |
| | | * @return <CODE>true</CODE> if the node is a configuration node and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | private boolean isConfigurationNode(BasicNode node) |
| | | { |
| | | boolean isConfigurationNode = false; |
| | | if (node instanceof SuffixNode) |
| | | { |
| | | String dn = node.getDN(); |
| | | if (Utilities.areDnsEqual(dn, ADSContext.getAdministrationSuffixDN()) || |
| | | Utilities.areDnsEqual(dn, ConfigConstants.DN_DEFAULT_SCHEMA_ROOT) || |
| | | Utilities.areDnsEqual(dn, ConfigConstants.DN_TASK_ROOT) || |
| | | Utilities.areDnsEqual(dn, ConfigConstants.DN_CONFIG_ROOT) || |
| | | Utilities.areDnsEqual(dn, ConfigConstants.DN_MONITOR_ROOT) || |
| | | Utilities.areDnsEqual(dn, ConfigConstants.DN_TRUST_STORE_ROOT) || |
| | | Utilities.areDnsEqual(dn, ConfigConstants.DN_BACKUP_ROOT) || |
| | | Utilities.areDnsEqual(dn, Constants.REPLICATION_CHANGES_DN)) |
| | | { |
| | | isConfigurationNode = true; |
| | | } |
| | | } |
| | | else if (node instanceof RootNode) |
| | | { |
| | | isConfigurationNode = true; |
| | | } |
| | | else |
| | | { |
| | | BasicNode parentNode = (BasicNode)node.getParent(); |
| | | return isConfigurationNode(parentNode); |
| | | } |
| | | |
| | | return isConfigurationNode; |
| | | } |
| | | |
| | | /** |
| | | * Return the LDAP connection to search the displayed entry (which can be the |
| | | * local or remote entry). |
| | | * @param node the node for which we want toe LDAP connection. |
| | | * @return the LDAP connection to search the displayed entry. |
| | | * @throws NamingException if there is an error retrieving the connection. |
| | | */ |
| | | public InitialLdapContext findConnectionForDisplayedEntry(BasicNode node) |
| | | throws NamingException { |
| | | return findConnectionForDisplayedEntry(node, isConfigurationNode(node)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return the LDAP connection to search the displayed entry (which can be the |
| | | * local or remote entry). |
| | | * @param node the node for which we want toe LDAP connection. |
| | | * @param isConfigurationNode whether the node is a configuration node or not. |
| | | * @return the LDAP connection to search the displayed entry. |
| | | * @throws NamingException if there is an error retrieving the connection. |
| | | */ |
| | | InitialLdapContext findConnectionForDisplayedEntry(BasicNode node, |
| | | boolean isConfigurationNode) |
| | | throws NamingException { |
| | | InitialLdapContext result; |
| | | if (followReferrals && (node.getRemoteUrl() != null)) { |
| | | result = connectionPool.getConnection(node.getRemoteUrl()); |
| | | } |
| | | else { |
| | | result = findConnectionForLocalEntry(node, isConfigurationNode); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Release a connection returned by selectConnectionForChildEntries() or |
| | | * selectConnectionForBaseEntry(). |
| | | * @param ctx the connection to be released. |
| | | */ |
| | | void releaseLDAPConnection(InitialLdapContext ctx) { |
| | | if ((ctx != this.ctxConfiguration) && |
| | | (ctx != this.ctxUserData)) |
| | | { |
| | | // Thus it comes from the connection pool |
| | | connectionPool.releaseConnection(ctx); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the local entry URL for a given node. |
| | | * @param node the node. |
| | | * @return the local entry URL for a given node. |
| | | */ |
| | | LDAPURL findUrlForLocalEntry(BasicNode node) { |
| | | LDAPURL result; |
| | | if (node == rootNode) { |
| | | result = LDAPConnectionPool.makeLDAPUrl(ctxConfiguration, ""); |
| | | } |
| | | else { |
| | | BasicNode parent = (BasicNode)node.getParent(); |
| | | if (parent != null) { |
| | | LDAPURL parentUrl = findUrlForDisplayedEntry(parent); |
| | | result = LDAPConnectionPool.makeLDAPUrl(parentUrl, node.getDN()); |
| | | } else { |
| | | result = LDAPConnectionPool.makeLDAPUrl(ctxConfiguration, node.getDN()); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the displayed entry URL for a given node. |
| | | * @param node the node. |
| | | * @return the displayed entry URL for a given node. |
| | | */ |
| | | LDAPURL findUrlForDisplayedEntry(BasicNode node) { |
| | | LDAPURL result; |
| | | if (followReferrals && (node.getRemoteUrl() != null)) { |
| | | result = node.getRemoteUrl(); |
| | | } |
| | | else { |
| | | result = findUrlForLocalEntry(node); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the DN to use for searching children of a given node. |
| | | * In most cases, it's node.getDN(). However if node has referral data |
| | | * and _followReferrals is true, the result is calculated from the |
| | | * referral resolution. |
| | | * |
| | | * @param node the node. |
| | | * @return the DN to use for searching children of a given node. |
| | | */ |
| | | String findBaseDNForChildEntries(BasicNode node) { |
| | | String result; |
| | | |
| | | if (followReferrals && (node.getRemoteUrl() != null)) { |
| | | result = node.getRemoteUrl().getRawBaseDN(); |
| | | } |
| | | else { |
| | | result = node.getDN(); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tells whether a node is displaying a remote entry. |
| | | * @param node the node. |
| | | * @return <CODE>true</CODE> if the node displays a remote entry and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | boolean isDisplayedEntryRemote(BasicNode node) { |
| | | boolean result = false; |
| | | if (followReferrals) { |
| | | if (node == rootNode) { |
| | | result = false; |
| | | } |
| | | else if (node.getRemoteUrl() != null) { |
| | | result = true; |
| | | } |
| | | else { |
| | | BasicNode parent = (BasicNode)node.getParent(); |
| | | if (parent != null) { |
| | | result = isDisplayedEntryRemote(parent); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the list of attributes for the red search. |
| | | * @return the list of attributes for the red search. |
| | | */ |
| | | String[] getAttrsForRedSearch() { |
| | | ArrayList<String> v = new ArrayList<String>(); |
| | | |
| | | v.add("objectClass"); |
| | | v.add("numsubordinates"); |
| | | v.add("ref"); |
| | | if ((displayFlags & DISPLAY_ACI_COUNT) != 0) { |
| | | v.add("aci"); |
| | | } |
| | | if (!displayAttribute.equals(RDN_ATTRIBUTE)) { |
| | | v.add(displayAttribute); |
| | | } |
| | | |
| | | String[] result = new String[v.size()]; |
| | | v.toArray(result); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the list of attributes for the green search. |
| | | * @return the list of attributes for the green search. |
| | | */ |
| | | String[] getAttrsForGreenSearch() { |
| | | if (!displayAttribute.equals(RDN_ATTRIBUTE)) { |
| | | return new String[] { |
| | | "aci", |
| | | displayAttribute}; |
| | | } else { |
| | | return new String[] { |
| | | "aci" |
| | | }; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns the list of attributes for the black search. |
| | | * @return the list of attributes for the black search. |
| | | */ |
| | | String[] getAttrsForBlackSearch() { |
| | | if (!displayAttribute.equals(RDN_ATTRIBUTE)) { |
| | | return new String[] { |
| | | "objectClass", |
| | | "numsubordinates", |
| | | "ref", |
| | | "aci", |
| | | displayAttribute}; |
| | | } else { |
| | | return new String[] { |
| | | "objectClass", |
| | | "numsubordinates", |
| | | "ref", |
| | | "aci" |
| | | }; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns the basic search controls. |
| | | * @return the basic search controls. |
| | | */ |
| | | SearchControls getBasicSearchControls() { |
| | | SearchControls searchControls = new SearchControls(); |
| | | searchControls.setCountLimit(maxChildren); |
| | | return searchControls; |
| | | } |
| | | |
| | | /** |
| | | * Returns the request controls to search user data. |
| | | * @return the request controls to search user data. |
| | | */ |
| | | Control[] getRequestControls() |
| | | { |
| | | Control ctls[] = new Control[sorted ? 2 : 1]; |
| | | ctls[0] = new ManageReferralControl(true); |
| | | if (sorted) { |
| | | SortKey[] keys = new SortKey[SORT_ATTRIBUTES.length]; |
| | | for (int i=0; i<keys.length; i++) { |
| | | keys[i] = new SortKey(SORT_ATTRIBUTES[i]); |
| | | } |
| | | try |
| | | { |
| | | ctls[1] = new SortControl(keys, true); |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | // Bug |
| | | throw new IllegalStateException("Unexpected encoding exception: "+ioe, |
| | | ioe); |
| | | } |
| | | } |
| | | return ctls; |
| | | } |
| | | |
| | | /** |
| | | * Returns the request controls to search configuration data. |
| | | * @return the request controls to search configuration data. |
| | | */ |
| | | Control[] getConfigurationRequestControls() |
| | | { |
| | | Control ctls[] = new Control[0]; |
| | | return ctls; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Callbacks invoked by task classes |
| | | * ================================= |
| | | * |
| | | * The routines below are invoked by the task classes; they |
| | | * update the nodes and the tree model. |
| | | * |
| | | * To ensure the consistency of the tree model, these routines |
| | | * are not invoked directly by the task classes: they are |
| | | * invoked using SwingUtilities.invokeAndWait() (each of the |
| | | * methods XXX() below has a matching wrapper invokeXXX()). |
| | | * |
| | | */ |
| | | |
| | | /** |
| | | * Invoked when the refresh task has finished the red operation. |
| | | * It has read the attributes of the base entry ; the result of the |
| | | * operation is: |
| | | * - an LDAPEntry if successful |
| | | * - an Exception if failed |
| | | * @param task the task that progressed. |
| | | * @param oldState the previous state of the task. |
| | | * @param newState the new state of the task. |
| | | * @throws NamingException if there is an error reading entries. |
| | | */ |
| | | private void refreshTaskDidProgress(NodeRefresher task, |
| | | NodeRefresher.State oldState, |
| | | NodeRefresher.State newState) throws NamingException { |
| | | BasicNode node = task.getNode(); |
| | | boolean nodeChanged = false; |
| | | |
| | | //task.dump(); |
| | | |
| | | // Manage events |
| | | if (oldState == NodeRefresher.State.QUEUED) { |
| | | checkUpdateEvent(true); |
| | | } |
| | | if (task.isInFinalState()) { |
| | | checkUpdateEvent(false); |
| | | } |
| | | |
| | | if (newState == NodeRefresher.State.FAILED) { |
| | | // In case of NameNotFoundException, we simply remove the node from the |
| | | // tree. |
| | | // Except when it's due a to referral resolution: we keep the node |
| | | // in order the user can fix the referral. |
| | | if (isNameNotFoundException(task.getException()) && |
| | | (oldState != NodeRefresher.State.SOLVING_REFERRAL)) { |
| | | removeOneNode(node); |
| | | } |
| | | else { |
| | | if (oldState == NodeRefresher.State.SOLVING_REFERRAL) { |
| | | node.setRemoteUrl(task.getRemoteUrl()); |
| | | if (task.getRemoteEntry() != null) { |
| | | /* This is the case when there are multiple hops in the referral |
| | | and so we have a remote referral entry but not the entry that it |
| | | points to */ |
| | | updateNodeRendering(node, task.getRemoteEntry()); |
| | | } |
| | | /* It is a referral and we try to follow referrals. |
| | | We remove its children (that are supposed to be |
| | | entries on the remote server). |
| | | If this referral entry has children locally (even if this goes |
| | | against the recommendation of the standards) these children will |
| | | NOT be displayed. */ |
| | | node.setLeaf(true); |
| | | removeAllChildNodes(node, true /* Keep suffixes */); |
| | | } |
| | | node.setError(new BasicNodeError(oldState, task.getException(), |
| | | task.getExceptionArg())); |
| | | nodeChanged = updateNodeRendering(node, task.getDisplayedEntry()); |
| | | } |
| | | } |
| | | else if ((newState == NodeRefresher.State.CANCELLED) && |
| | | (newState == NodeRefresher.State.INTERRUPTED)) { |
| | | |
| | | // Let's collapse task.getNode() |
| | | tree.collapsePath(new TreePath(treeModel.getPathToRoot(node))); |
| | | |
| | | // TODO: should we reflect this situation visually ? |
| | | } |
| | | else { |
| | | |
| | | if ((oldState != NodeRefresher.State.SEARCHING_CHILDREN) && |
| | | (newState == NodeRefresher.State.SEARCHING_CHILDREN)) { |
| | | // The children search is going to start |
| | | if (canDoDifferentialUpdate(task)) { |
| | | Enumeration e = node.children(); |
| | | while (e.hasMoreElements()) { |
| | | BasicNode child = (BasicNode)e.nextElement(); |
| | | child.setObsolete(true); |
| | | } |
| | | } |
| | | else { |
| | | removeAllChildNodes(node, true /* Keep suffixes */); |
| | | } |
| | | } |
| | | |
| | | if (oldState == NodeRefresher.State.READING_LOCAL_ENTRY) { |
| | | /* The task is going to try to solve the referral if there's one. |
| | | If succeeds we will update the remote url. Set it to null for |
| | | the case when there was a referral and it has been deleted */ |
| | | node.setRemoteUrl((String)null); |
| | | SearchResult localEntry = task.getLocalEntry(); |
| | | nodeChanged = updateNodeRendering(node, localEntry); |
| | | } |
| | | else if (oldState == NodeRefresher.State.SOLVING_REFERRAL) { |
| | | node.setRemoteUrl(task.getRemoteUrl()); |
| | | updateNodeRendering(node, task.getRemoteEntry()); |
| | | nodeChanged = true; |
| | | } |
| | | else if (oldState == NodeRefresher.State.DETECTING_CHILDREN) { |
| | | if (node.isLeaf() != task.isLeafNode()) { |
| | | node.setLeaf(task.isLeafNode()); |
| | | updateNodeRendering(node, task.getDisplayedEntry()); |
| | | nodeChanged = true; |
| | | if (node.isLeaf()) { |
| | | /* We didn't detect any child: remove the previously existing |
| | | * ones */ |
| | | removeAllChildNodes(node, false /* Remove suffixes */); |
| | | } |
| | | } |
| | | } |
| | | else if (oldState == NodeRefresher.State.SEARCHING_CHILDREN) { |
| | | |
| | | updateChildNodes(task); |
| | | if (newState == NodeRefresher.State.FINISHED) { |
| | | // The children search is finished |
| | | if (canDoDifferentialUpdate(task)) { |
| | | // Remove obsolete child nodes |
| | | // Note: we scan in the reverse order to preserve indexes |
| | | for (int i = node.getChildCount()-1; i >= 0; i--) { |
| | | BasicNode child = (BasicNode)node.getChildAt(i); |
| | | if (child.isObsolete()) { |
| | | removeOneNode(child); |
| | | } |
| | | } |
| | | } |
| | | // The node may have become a leaf. |
| | | if (node.getChildCount() == 0) { |
| | | node.setLeaf(true); |
| | | updateNodeRendering(node, task.getDisplayedEntry()); |
| | | nodeChanged = true; |
| | | } |
| | | } |
| | | if (node.isSizeLimitReached()) |
| | | { |
| | | fireEvent(BrowserEvent.Type.SIZE_LIMIT_REACHED); |
| | | } |
| | | } |
| | | |
| | | if (newState == NodeRefresher.State.FINISHED) { |
| | | if (node.getError() != null) { |
| | | node.setError(null); |
| | | nodeChanged = updateNodeRendering(node, task.getDisplayedEntry()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | if (nodeChanged) { |
| | | treeModel.nodeChanged(task.getNode()); |
| | | } |
| | | |
| | | if (node.isLeaf() && (node.getChildCount() >= 1)) { |
| | | throw new IllegalStateException("Inconsistent node: " + node.getDN()); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Commodity method that calls the method refreshTaskDidProgress in the event |
| | | * thread. |
| | | * @param task the task that progressed. |
| | | * @param oldState the previous state of the task. |
| | | * @param newState the new state of the task. |
| | | * @throws InterruptedException if an errors occurs invoking the method. |
| | | */ |
| | | void invokeRefreshTaskDidProgress(final NodeRefresher task, |
| | | final NodeRefresher.State oldState, |
| | | final NodeRefresher.State newState) |
| | | throws InterruptedException { |
| | | |
| | | Runnable r = new Runnable() { |
| | | public void run() { |
| | | try { |
| | | refreshTaskDidProgress(task, oldState, newState); |
| | | } |
| | | catch(Exception x) { |
| | | x.printStackTrace(); |
| | | } |
| | | } |
| | | }; |
| | | swingInvoke(r); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Core routines shared by the callbacks above |
| | | * =========================================== |
| | | */ |
| | | |
| | | /** |
| | | * Updates the child nodes for a given task. |
| | | * @param task the task. |
| | | * @throws NamingException if an error occurs. |
| | | */ |
| | | private void updateChildNodes(NodeRefresher task) throws NamingException { |
| | | BasicNode parent = task.getNode(); |
| | | ArrayList<Integer> insertIndex = new ArrayList<Integer>(); |
| | | ArrayList<Integer> changedIndex = new ArrayList<Integer>(); |
| | | boolean differential = canDoDifferentialUpdate(task); |
| | | |
| | | // NUMSUBORDINATE HACK |
| | | // To avoid testing each child to the hacker, |
| | | // we verify here if the parent node is parent of |
| | | // any entry listed in the hacker. |
| | | // In most case, the dontTrust flag will false and |
| | | // no overhead will be caused in the child loop. |
| | | LDAPURL parentUrl = findUrlForDisplayedEntry(parent); |
| | | boolean dontTrust = numSubordinateHacker.containsChildrenOf(parentUrl); |
| | | |
| | | // Walk through the entries |
| | | for (SearchResult entry : task.getChildEntries()) |
| | | { |
| | | BasicNode child; |
| | | |
| | | // Search a child node matching the DN of the entry |
| | | int index; |
| | | if (differential) { |
| | | // System.out.println("Differential mode -> starting to search"); |
| | | index = findChildNode(parent, entry.getName()); |
| | | // System.out.println("Differential mode -> ending to search"); |
| | | } |
| | | else { |
| | | index = - (parent.getChildCount() + 1); |
| | | } |
| | | |
| | | // If no node matches, we create a new node |
| | | if (index < 0) { |
| | | // -(index + 1) is the location where to insert the new node |
| | | index = -(index + 1); |
| | | child = new BasicNode(entry.getName()); |
| | | parent.insert(child, index); |
| | | updateNodeRendering(child, entry); |
| | | insertIndex.add(new Integer(index)); |
| | | // System.out.println("Inserted " + child.getDN() + " at " + index); |
| | | } |
| | | else { // Else we update the existing one |
| | | child = (BasicNode)parent.getChildAt(index); |
| | | if (updateNodeRendering(child, entry)) { |
| | | changedIndex.add(new Integer(index)); |
| | | } |
| | | // The node is no longer obsolete |
| | | child.setObsolete(false); |
| | | } |
| | | |
| | | // NUMSUBORDINATE HACK |
| | | // Let's see if child has subordinates or not. |
| | | // Thanks to slapd, we cannot always trust the |
| | | // numSubOrdinates attribute. If the child entry's DN |
| | | // is found in the hacker's list, then we ignore |
| | | // the numSubordinate attribute... :(( |
| | | int numSubOrdinates = child.getNumSubOrdinates(); |
| | | boolean hasNoSubOrdinates; |
| | | if ((numSubOrdinates == 0) && dontTrust) { |
| | | LDAPURL childUrl = findUrlForDisplayedEntry(child); |
| | | if (numSubordinateHacker.contains(childUrl)) { |
| | | // The numSubOrdinates we have is unreliable. |
| | | // child may potentially have subordinates. |
| | | hasNoSubOrdinates = false; |
| | | // System.out.println("numSubordinates of " + childUrl + |
| | | // " is not reliable"); |
| | | } |
| | | else { |
| | | // We can trust this 0 value |
| | | hasNoSubOrdinates = true; |
| | | } |
| | | } |
| | | else { |
| | | hasNoSubOrdinates = (numSubOrdinates == 0); |
| | | } |
| | | |
| | | |
| | | |
| | | // Propagate the refresh |
| | | // Note: logically we should unconditionaly call: |
| | | // startRefreshNode(child, false, true); |
| | | // |
| | | // However doing that saturates _refreshQueue |
| | | // with many nodes. And, by design, RefreshTask |
| | | // won't do anything on a node if: |
| | | // - this node has no subordinates |
| | | // - *and* this node has no referral data |
| | | // So we test these conditions here and |
| | | // skip the call to startRefreshNode() if |
| | | // possible. |
| | | // |
| | | // The exception to this is the case where the |
| | | // node had children (in the tree). In this case |
| | | // we force the refresh. See bug 5015115 |
| | | // |
| | | if (!hasNoSubOrdinates || |
| | | (child.getReferral() != null) || |
| | | (child.getChildCount() > 0)) { |
| | | startRefreshNode(child, entry, true); |
| | | } |
| | | } |
| | | |
| | | |
| | | // Inform the tree model that we have created some new nodes |
| | | if (insertIndex.size() >= 1) { |
| | | treeModel.nodesWereInserted(parent, intArrayFromCollection(insertIndex)); |
| | | } |
| | | if (changedIndex.size() >= 1) { |
| | | treeModel.nodesChanged(parent, intArrayFromCollection(changedIndex)); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tells wheter a differential update can be made in the provided task. |
| | | * @param task the task. |
| | | * @return <CODE>true</CODE> if a differential update can be made and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | private boolean canDoDifferentialUpdate(NodeRefresher task) { |
| | | return ( |
| | | (task.getNode().getChildCount() >= 1) && |
| | | (task.getNode().getNumSubOrdinates() <= 100) |
| | | ); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Recompute the rendering props of a node (text, style, icon) depending on. |
| | | * - the state of this node |
| | | * - the LDAPEntry displayed by this node |
| | | * @param node the node to be rendered. |
| | | * @param entry the search result for the entry that the node represents. |
| | | */ |
| | | private boolean updateNodeRendering(BasicNode node, SearchResult entry) |
| | | throws NamingException { |
| | | if (entry != null) { |
| | | // Get the numsubordinates |
| | | node.setNumSubOrdinates(getNumSubOrdinates(entry)); |
| | | node.setReferral(getReferral(entry)); |
| | | Set<String> ocValues = ConnectionUtils.getValues(entry, "objectClass"); |
| | | if (ocValues != null) { |
| | | String[] array = new String[ocValues.size()]; |
| | | ocValues.toArray(array); |
| | | node.setObjectClassValues(array); |
| | | } |
| | | } |
| | | // Get the aci count |
| | | int aciCount; |
| | | |
| | | if (((displayFlags & DISPLAY_ACI_COUNT) != 0) && (entry != null)) { |
| | | Set<String> aciValues = ConnectionUtils.getValues(entry, "aci"); |
| | | if (aciValues != null) { |
| | | aciCount = aciValues.size(); |
| | | } |
| | | else { |
| | | aciCount = 0; |
| | | } |
| | | } |
| | | else { |
| | | aciCount = 0; |
| | | } |
| | | |
| | | // Select the icon according the objectClass,... |
| | | int modifiers = 0; |
| | | if (node.isLeaf() && (node.getNumSubOrdinates() <= 0)) { |
| | | modifiers |= IconPool.MODIFIER_LEAF; |
| | | } |
| | | if (node.getReferral() != null) { |
| | | modifiers |= IconPool.MODIFIER_REFERRAL; |
| | | } |
| | | if (node.getError() != null) { |
| | | if (node.getError().getException() != null) |
| | | { |
| | | node.getError().getException().printStackTrace(); |
| | | } |
| | | modifiers |= IconPool.MODIFIER_ERROR; |
| | | } |
| | | SortedSet<String> objectClasses = new TreeSet<String>(); |
| | | if (entry != null) { |
| | | Set<String> ocs = ConnectionUtils.getValues(entry, "objectClass"); |
| | | if (ocs != null) |
| | | { |
| | | objectClasses.addAll(ocs); |
| | | } |
| | | } |
| | | Icon newIcon; |
| | | if (node instanceof SuffixNode) |
| | | { |
| | | newIcon = iconPool.getSuffixIcon(); |
| | | } |
| | | else |
| | | { |
| | | newIcon = iconPool.getIcon(objectClasses, modifiers); |
| | | } |
| | | |
| | | // Contruct the icon text according the dn, the aci count... |
| | | StringBuilder sb2 = new StringBuilder(); |
| | | if (aciCount >= 1) { |
| | | sb2.append(String.valueOf(aciCount)); |
| | | if (aciCount == 1) { |
| | | sb2.append(" aci"); |
| | | } |
| | | else { |
| | | sb2.append(" acis"); |
| | | } |
| | | } |
| | | |
| | | StringBuilder sb1 = new StringBuilder(); |
| | | if (node instanceof SuffixNode) { |
| | | if (entry != null) { |
| | | sb1.append(entry.getName()); |
| | | } |
| | | } else { |
| | | boolean useRdn = true; |
| | | if (!displayAttribute.equals(RDN_ATTRIBUTE) && |
| | | (entry != null)) { |
| | | String value = ConnectionUtils.getFirstValue(entry,displayAttribute); |
| | | if (value != null) { |
| | | if (showAttributeName) { |
| | | value = displayAttribute+"="+value; |
| | | } |
| | | sb1.append(value); |
| | | useRdn = false; |
| | | } |
| | | } |
| | | if (useRdn) { |
| | | String rdn; |
| | | if (followReferrals && (node.getRemoteUrl() != null)) { |
| | | if (showAttributeName) { |
| | | rdn = node.getRemoteRDNWithAttributeName(); |
| | | } else { |
| | | rdn = node.getRemoteRDN(); |
| | | } |
| | | } |
| | | else { |
| | | if (showAttributeName) { |
| | | rdn = node.getRDNWithAttributeName(); |
| | | } else { |
| | | rdn = node.getRDN(); |
| | | } |
| | | } |
| | | sb1.append(rdn); |
| | | } |
| | | } |
| | | if (sb2.length() >= 1) { |
| | | sb1.append(" ("); |
| | | sb1.append(sb2); |
| | | sb1.append(")"); |
| | | } |
| | | String newDisplayName = sb1.toString(); |
| | | |
| | | // Select the font style according referral |
| | | int newStyle = 0; |
| | | if (isDisplayedEntryRemote(node)) { |
| | | newStyle |= Font.ITALIC; |
| | | } |
| | | |
| | | // Determine if the rendering needs to be updated |
| | | boolean changed = ( |
| | | (node.getIcon() != newIcon) || |
| | | (node.getDisplayName() != newDisplayName) || |
| | | (node.getFontStyle() != newStyle) |
| | | ); |
| | | if (changed) { |
| | | node.setIcon(newIcon); |
| | | node.setDisplayName(newDisplayName); |
| | | node.setFontStyle(newStyle); |
| | | } |
| | | |
| | | |
| | | return changed; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Find a child node matching a given DN. |
| | | * |
| | | * result >= 0 result is the index of the node matching childDn. |
| | | * result < 0 -(result + 1) is the index at which the new node must be |
| | | * inserted. |
| | | * @param parent the parent node of the node that is being searched. |
| | | * @param childDn the DN of the entry that is being searched. |
| | | * @return the index of the node matching childDn. |
| | | */ |
| | | public int findChildNode(BasicNode parent, String childDn) { |
| | | int childCount = parent.getChildCount(); |
| | | int i = 0; |
| | | while ((i < childCount) && |
| | | !childDn.equals(((BasicNode)parent.getChildAt(i)).getDN())) { |
| | | i++; |
| | | } |
| | | if (i >= childCount) { // Not found |
| | | i = -(childCount + 1); |
| | | } |
| | | |
| | | return i; |
| | | } |
| | | |
| | | /** |
| | | * Remove a single node from the tree model. |
| | | * It takes care to cancel all the tasks associated to this node. |
| | | * @param node the node to be removed. |
| | | */ |
| | | private void removeOneNode(BasicNode node) { |
| | | stopRefreshNode(node); |
| | | treeModel.removeNodeFromParent(node); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * BrowserEvent management |
| | | * ======================= |
| | | * |
| | | * This method computes the total size of the queues, |
| | | * compares this value with the last computed and |
| | | * decides if an update event should be fired or not. |
| | | * |
| | | * It's invoked by task classes through SwingUtilities.invokeLater() |
| | | * (see the wrapper below). That means the event handling routine |
| | | * (processBrowserEvent) is executed in the event thread. |
| | | * @param taskIsStarting whether the task is starting or not. |
| | | */ |
| | | private void checkUpdateEvent(boolean taskIsStarting) { |
| | | int newSize = refreshQueue.size(); |
| | | if (!taskIsStarting) { |
| | | newSize = newSize - 1; |
| | | } |
| | | if (newSize != queueTotalSize) { |
| | | if ((queueTotalSize == 0) && (newSize >= 1)) { |
| | | fireEvent(BrowserEvent.Type.UPDATE_START); |
| | | } |
| | | else if ((queueTotalSize >= 1) && (newSize == 0)) { |
| | | fireEvent(BrowserEvent.Type.UPDATE_END); |
| | | } |
| | | queueTotalSize = newSize; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns the size of the queue containing the different tasks. It can be |
| | | * used to know if there are search operations ongoing. |
| | | * @return the number of RefreshTask operations ongoing (or waiting to start). |
| | | */ |
| | | public int getQueueSize() |
| | | { |
| | | return refreshQueue.size(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Fires a BrowserEvent. |
| | | * @param type the type of the event. |
| | | */ |
| | | private void fireEvent(BrowserEvent.Type type) { |
| | | BrowserEvent event = new BrowserEvent(this, type); |
| | | for (BrowserEventListener listener : listeners) |
| | | { |
| | | listener.processBrowserEvent(event); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Miscellaneous private routines |
| | | * ============================== |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * Find a SuffixNode in the tree model. |
| | | * @param suffixDn the dn of the suffix node. |
| | | * @param suffixNode the node from which we start searching. |
| | | * @return the SuffixNode associated with the provided DN. <CODE>null</CODE> |
| | | * if nothing is found. |
| | | */ |
| | | SuffixNode findSuffixNode(String suffixDn, SuffixNode suffixNode) { |
| | | SuffixNode result; |
| | | |
| | | if (Utilities.areDnsEqual(suffixNode.getDN(), suffixDn)) { |
| | | result = suffixNode; |
| | | } |
| | | else { |
| | | int childCount = suffixNode.getChildCount(); |
| | | if (childCount == 0) { |
| | | result = null; |
| | | } |
| | | else { |
| | | BasicNode child; |
| | | int i = 0; |
| | | boolean found = false; |
| | | do { |
| | | child = (BasicNode)suffixNode.getChildAt(i) ; |
| | | if (Utilities.areDnsEqual(child.getDN(), suffixDn)) { |
| | | found = true; |
| | | } |
| | | i++; |
| | | } |
| | | while ((i < childCount) && !found); |
| | | if (!found) { |
| | | result = null; |
| | | } |
| | | else if (child instanceof SuffixNode) { |
| | | result = (SuffixNode)child; |
| | | } |
| | | else { |
| | | // A node matches suffixDn however it's not a suffix node. |
| | | // There's a bug in the caller. |
| | | throw new IllegalArgumentException(suffixDn +" is not a suffix node"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Return <CODE>true</CODE> if x is a non <code>null</code> |
| | | * NameNotFoundException. |
| | | * @return <CODE>true</CODE> if x is a non <code>null</code> |
| | | * NameNotFoundException. |
| | | */ |
| | | private boolean isNameNotFoundException(Object x) { |
| | | boolean result; |
| | | if ((x != null) && (x instanceof NameNotFoundException)) |
| | | { |
| | | result = true; |
| | | } |
| | | else { |
| | | result = false; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Get the value of the numsubordinates attribute. |
| | | * If numsubordinates is not present, returns 0. |
| | | * @param entry the entry to analyze. |
| | | * @throws NamingException if an error occurs. |
| | | * @return the value of the numsubordinate attribute. 0 if the attribute |
| | | * could not be found. |
| | | */ |
| | | public static int getNumSubOrdinates(SearchResult entry) |
| | | throws NamingException |
| | | { |
| | | int result; |
| | | |
| | | String v = ConnectionUtils.getFirstValue(entry, "numsubordinates"); |
| | | if (v == null) { |
| | | result = 0; |
| | | } |
| | | else { |
| | | try { |
| | | result = Integer.parseInt(v); |
| | | } |
| | | catch(NumberFormatException x) { |
| | | result = 0; |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the value of the 'ref' attribute. |
| | | * <CODE>null</CODE> if the attribute is not present. |
| | | * @param entry the entry to analyze. |
| | | * @throws NamingException if an error occurs. |
| | | * @return the value of the ref attribute. <CODE>null</CODE> if the attribute |
| | | * could not be found. |
| | | */ |
| | | public static String[] getReferral(SearchResult entry) throws NamingException |
| | | { |
| | | String[] result = null; |
| | | Set<String> values = ConnectionUtils.getValues(entry, "objectClass"); |
| | | if (values != null) { |
| | | for (String value : values) |
| | | { |
| | | boolean isReferral = value.equalsIgnoreCase("referral"); |
| | | if (isReferral) |
| | | { |
| | | Set<String> refValues = ConnectionUtils.getValues(entry, "ref"); |
| | | if (refValues != null) |
| | | { |
| | | result = new String[refValues.size()]; |
| | | refValues.toArray(result); |
| | | break; |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns true if the node is expanded. |
| | | * @param node the node to analyze. |
| | | * @return <CODE>true</CODE> if the node is expanded and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public boolean nodeIsExpanded(BasicNode node) { |
| | | TreePath tp = new TreePath(treeModel.getPathToRoot(node)); |
| | | return tree.isExpanded(tp); |
| | | } |
| | | |
| | | /** |
| | | * Expands node. Must be run from the event thread. This is called |
| | | * when the node is automatically expanded. |
| | | * @param node the node to expand. |
| | | */ |
| | | public void expandNode(BasicNode node) { |
| | | automaticallyExpandedNode = true; |
| | | TreePath tp = new TreePath(treeModel.getPathToRoot(node)); |
| | | tree.expandPath(tp); |
| | | tree.fireTreeExpanded(tp); |
| | | automaticallyExpandedNode = false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Collection utilities |
| | | */ |
| | | /** |
| | | * Returns an array of integer from a Collection of Integer objects. |
| | | * @param v the Collection of Integer objects. |
| | | * @return an array of int from a Collection of Integer objects. |
| | | */ |
| | | static int[] intArrayFromCollection(Collection<Integer> v) { |
| | | int[] result = new int[v.size()]; |
| | | int i = 0; |
| | | for (Integer value : v) |
| | | { |
| | | result[i] = value; |
| | | i++; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * Returns an array of SearchResult from a Collection of SearchResult objects. |
| | | * @param v the Collection of SearchResult objects. |
| | | * @return an array of SearchResult from a Collection of SearchResult objects. |
| | | */ |
| | | static SearchResult[] entryArrayFromCollection(Collection<SearchResult> v) { |
| | | SearchResult[] result = new SearchResult[v.size()]; |
| | | v.toArray(result); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * Returns an array of BasicNode from a Collection of BasicNode objects. |
| | | * @param v the Collection of BasicNode objects. |
| | | * @return an array of BasicNode from a Collection of BasicNode objects. |
| | | */ |
| | | static BasicNode[] nodeArrayFromCollection(Collection<BasicNode> v) { |
| | | BasicNode[] result = new BasicNode[v.size()]; |
| | | v.toArray(result); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * For debugging purpose: allows to switch easily |
| | | * between invokeLater() and invokeAndWait() for |
| | | * experimentation... |
| | | * @param r the runnable to be invoked. |
| | | * @throws InterruptedException if there is an error invoking SwingUtilities. |
| | | */ |
| | | static void swingInvoke(Runnable r) |
| | | throws InterruptedException { |
| | | try { |
| | | SwingUtilities.invokeAndWait(r); |
| | | } |
| | | catch(InterruptedException x) { |
| | | throw x; |
| | | } |
| | | catch(InvocationTargetException x) { |
| | | // Probably a very big trouble... |
| | | x.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * The default implementaion of the BrowserNodeInfo interface. |
| | | */ |
| | | class BrowserNodeInfoImpl implements BrowserNodeInfo |
| | | { |
| | | BasicNode node; |
| | | LDAPURL url; |
| | | boolean isRemote; |
| | | boolean isSuffix; |
| | | boolean isRootNode; |
| | | String[] referral; |
| | | int numSubOrdinates; |
| | | int errorType; |
| | | Exception errorException; |
| | | Object errorArg; |
| | | String[] objectClassValues; |
| | | String toString; |
| | | |
| | | /** |
| | | * The constructor of this object. |
| | | * @param node the node in the tree that is used. |
| | | */ |
| | | public BrowserNodeInfoImpl(BasicNode node) { |
| | | this.node = node; |
| | | url = findUrlForDisplayedEntry(node); |
| | | |
| | | isRootNode = node instanceof RootNode; |
| | | isRemote = isDisplayedEntryRemote(node); |
| | | isSuffix = node instanceof SuffixNode; |
| | | referral = node.getReferral(); |
| | | numSubOrdinates = node.getNumSubOrdinates(); |
| | | objectClassValues = node.getObjectClassValues(); |
| | | if (node.getError() != null) { |
| | | BasicNodeError error = node.getError(); |
| | | switch(error.getState()) { |
| | | case READING_LOCAL_ENTRY: |
| | | errorType = ERROR_READING_ENTRY; |
| | | break; |
| | | case SOLVING_REFERRAL: |
| | | errorType = ERROR_SOLVING_REFERRAL; |
| | | break; |
| | | case DETECTING_CHILDREN: |
| | | case SEARCHING_CHILDREN: |
| | | errorType = ERROR_SEARCHING_CHILDREN; |
| | | break; |
| | | |
| | | } |
| | | errorException = error.getException(); |
| | | errorArg = error.getArg(); |
| | | } |
| | | StringBuilder sb = new StringBuilder(); |
| | | sb.append(getURL()); |
| | | if (getReferral() != null) { |
| | | sb.append(" -> "); |
| | | sb.append(getReferral()); |
| | | } |
| | | toString = sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the node associated with this object. |
| | | * @return the node associated with this object. |
| | | */ |
| | | public BasicNode getNode() { |
| | | return node; |
| | | } |
| | | |
| | | /** |
| | | * Returns the LDAP URL associated with this object. |
| | | * @return the LDAP URL associated with this object. |
| | | */ |
| | | public LDAPURL getURL() { |
| | | return url; |
| | | } |
| | | |
| | | /** |
| | | * Tells whether this is a root node or not. |
| | | * @return <CODE>true</CODE> if this is a root node and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public boolean isRootNode() { |
| | | return isRootNode; |
| | | } |
| | | |
| | | /** |
| | | * Tells whether this is a suffix node or not. |
| | | * @return <CODE>true</CODE> if this is a suffix node and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public boolean isSuffix() { |
| | | return isSuffix; |
| | | } |
| | | |
| | | /** |
| | | * Tells whether this is a remote node or not. |
| | | * @return <CODE>true</CODE> if this is a remote node and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public boolean isRemote() { |
| | | return isRemote; |
| | | } |
| | | |
| | | /** |
| | | * Returns the list of referral associated with this node. |
| | | * @return the list of referral associated with this node. |
| | | */ |
| | | public String[] getReferral() { |
| | | return referral; |
| | | } |
| | | |
| | | /** |
| | | * Returns the number of subordinates of the entry associated with this |
| | | * node. |
| | | * @return the number of subordinates of the entry associated with this |
| | | * node. |
| | | */ |
| | | public int getNumSubOrdinates() { |
| | | return numSubOrdinates; |
| | | } |
| | | |
| | | /** |
| | | * Returns the error type associated we got when refreshing the node. |
| | | * <CODE>null</CODE> if no error was found. |
| | | * @return the error type associated we got when refreshing the node. |
| | | * <CODE>null</CODE> if no error was found. |
| | | */ |
| | | public int getErrorType() { |
| | | return errorType; |
| | | } |
| | | |
| | | /** |
| | | * Returns the exception associated we got when refreshing the node. |
| | | * <CODE>null</CODE> if no exception was found. |
| | | * @return the exception associated we got when refreshing the node. |
| | | * <CODE>null</CODE> if no exception was found. |
| | | */ |
| | | public Exception getErrorException() { |
| | | return errorException; |
| | | } |
| | | |
| | | /** |
| | | * Returns the error argument associated we got when refreshing the node. |
| | | * <CODE>null</CODE> if no error argument was found. |
| | | * @return the error argument associated we got when refreshing the node. |
| | | * <CODE>null</CODE> if no error argument was found. |
| | | */ |
| | | public Object getErrorArg() { |
| | | return errorArg; |
| | | } |
| | | |
| | | /** |
| | | * Return the tree path associated with the node in the tree. |
| | | * @return the tree path associated with the node in the tree. |
| | | */ |
| | | public TreePath getTreePath() { |
| | | return new TreePath(treeModel.getPathToRoot(node)); |
| | | } |
| | | |
| | | /** |
| | | * Returns the object class values of the entry associated with the node. |
| | | * @return the object class values of the entry associated with the node. |
| | | */ |
| | | public String[] getObjectClassValues() { |
| | | return objectClassValues; |
| | | } |
| | | |
| | | /** |
| | | * Returns a String representation of the object. |
| | | * @return a String representation of the object. |
| | | */ |
| | | public String toString() { |
| | | return toString; |
| | | } |
| | | |
| | | /** |
| | | * Compares the provide node with this object. |
| | | * @param node the node. |
| | | * @return <CODE>true</CODE> if the node info represents the same node as |
| | | * this and <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean representsSameNode(BrowserNodeInfo node) { |
| | | boolean representsSameNode = false; |
| | | if (node != null) { |
| | | representsSameNode = node.getNode() == node; |
| | | } |
| | | return representsSameNode; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns whether we are in automatic expand mode. This mode is used when |
| | | * the user specifies a filter and all the nodes are automatically expanded. |
| | | * @return <CODE>true</CODE> if we are in automatic expand mode and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean isAutomaticExpand() |
| | | { |
| | | return automaticExpand; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Sets the automatic expand mode. |
| | | * @param automaticExpand whether to expand automatically the nodes or not. |
| | | */ |
| | | public void setAutomaticExpand(boolean automaticExpand) |
| | | { |
| | | this.automaticExpand = automaticExpand; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.browser; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | import java.awt.Canvas; |
| | | import java.awt.Image; |
| | | import java.awt.MediaTracker; |
| | | import java.awt.image.ColorModel; |
| | | import java.awt.image.ImageObserver; |
| | | import java.awt.image.MemoryImageSource; |
| | | import java.awt.image.PixelGrabber; |
| | | import java.util.HashMap; |
| | | import java.util.Set; |
| | | import java.util.SortedSet; |
| | | |
| | | import javax.swing.ImageIcon; |
| | | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.quicksetup.ui.UIFactory; |
| | | |
| | | /** |
| | | * This class is used as a cache containing the icons that are used by the |
| | | * BrowserController to update the nodes. It keeps some icons associated with |
| | | * some entry types, to suffixes, to the root node, etc. |
| | | */ |
| | | public class IconPool { |
| | | |
| | | /** |
| | | * Mask for the leaf node. |
| | | */ |
| | | public static final int MODIFIER_LEAF = 0x01; |
| | | /** |
| | | * Mask for the referral node. |
| | | */ |
| | | public static final int MODIFIER_REFERRAL = 0x02; |
| | | /** |
| | | * Mask for the node that has an error. |
| | | */ |
| | | public static final int MODIFIER_ERROR = 0x04; |
| | | |
| | | private HashMap<String, ImageIcon> iconTable = |
| | | new HashMap<String, ImageIcon>(); |
| | | private HashMap<String, String> pathTable = new HashMap<String, String>(); |
| | | private HashMap<String, String> descriptionTable = |
| | | new HashMap<String, String>(); |
| | | private ImageIcon defaultLeafIcon; |
| | | private ImageIcon suffixIcon; |
| | | private ImageIcon defaultContainerIcon; |
| | | private ImageIcon rootNodeIcon; |
| | | private ImageIcon errorIcon; |
| | | private ImageIcon errorMaskIcon; |
| | | private ImageIcon referralMaskIcon; |
| | | |
| | | /** |
| | | * The path that contains the icons. |
| | | */ |
| | | public static final String IMAGE_PATH = |
| | | "org/opends/guitools/controlpanel/images"; |
| | | |
| | | |
| | | private static final String[] ICON_PATH = { |
| | | "person", "ds-user.png", |
| | | "organization", "ds-folder.png", |
| | | "organizationalunit", "ds-ou.png", |
| | | "groupofuniquenames", "ds-group.png", |
| | | "groupofurls", "ds-group.png", |
| | | "ds-virtual-static-group", "ds-group.png", |
| | | "passwordpolicy", "ds-ppol.png" |
| | | }; |
| | | |
| | | private static final String[] DESCRIPTION = { |
| | | "person", INFO_PERSON_ICON_DESCRIPTION.get().toString(), |
| | | "organization", INFO_ORGANIZATION_ICON_DESCRIPTION.get().toString(), |
| | | "organizationalunit", |
| | | INFO_ORGANIZATIONAL_UNIT_ICON_DESCRIPTION.get().toString(), |
| | | "groupofuniquenames", INFO_STATIC_GROUP_ICON_DESCRIPTION.get().toString(), |
| | | "groupofurls", INFO_DYNAMIC_GROUP_ICON_DESCRIPTION.get().toString(), |
| | | "ds-virtual-static-group", |
| | | INFO_VIRTUAL_STATIC_GROUP_ICON_DESCRIPTION.get().toString(), |
| | | "passwordpolicy", INFO_PASSWORD_POLICY_ICON_DESCRIPTION.get().toString() |
| | | }; |
| | | |
| | | private String GENERIC_OBJECT_DESCRIPTION = "Generic entry"; |
| | | |
| | | /** |
| | | * The default constructor. |
| | | * |
| | | */ |
| | | public IconPool() { |
| | | // Recopy ICON_PATH in pathTable for fast access |
| | | for (int i = 0; i < ICON_PATH.length; i = i+2) { |
| | | pathTable.put(ICON_PATH[i], ICON_PATH[i+1]); |
| | | } |
| | | for (int i = 0; i < DESCRIPTION.length; i = i+2) { |
| | | descriptionTable.put(DESCRIPTION[i], DESCRIPTION[i+1]); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * If objectClass is null, a default icon is used. |
| | | * @param objectClasses the objectclass values of the entry for which we want |
| | | * an icon. |
| | | * @param modifiers the modifiers associated with the entry (if there was |
| | | * an error, if it is a referral, etc.). |
| | | * @return the icon corresponding to the provided object classes and |
| | | * modifiers. |
| | | */ |
| | | public ImageIcon getIcon(SortedSet<String> objectClasses, int modifiers) { |
| | | ImageIcon result; |
| | | |
| | | String key = makeKey(objectClasses, modifiers); |
| | | result = iconTable.get(key); |
| | | if (result == null) { |
| | | result = makeIcon(objectClasses, modifiers); |
| | | iconTable.put(key, result); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * Creates an icon for a given path. |
| | | * @param path the path of the icon. |
| | | * @param description the description of the icon |
| | | * @return the associated ImageIcon. |
| | | */ |
| | | private ImageIcon createIcon(String path, String description) |
| | | { |
| | | ImageIcon icon = Utilities.createImageIcon(path); |
| | | if (description != null) |
| | | { |
| | | icon.setDescription(description); |
| | | } |
| | | return icon; |
| | | } |
| | | |
| | | /** |
| | | * Returns the icon associated with a leaf node. |
| | | * @return the icon associated with a leaf node. |
| | | */ |
| | | public ImageIcon getDefaultLeafIcon() { |
| | | if (defaultLeafIcon == null) { |
| | | defaultLeafIcon = createIcon(IMAGE_PATH + "/ds-generic.png", |
| | | GENERIC_OBJECT_DESCRIPTION); |
| | | } |
| | | return defaultLeafIcon; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the icon associated with a container node. |
| | | * @return the icon associated with a container node. |
| | | */ |
| | | public ImageIcon getDefaultContainerIcon() { |
| | | if (defaultContainerIcon == null) { |
| | | defaultContainerIcon = createIcon(IMAGE_PATH + "/ds-folder.png", |
| | | "Folder entry"); |
| | | } |
| | | return defaultContainerIcon; |
| | | } |
| | | |
| | | /** |
| | | * Returns the icon associated with a suffix node. |
| | | * @return the icon associated with a suffix node. |
| | | */ |
| | | public ImageIcon getSuffixIcon() { |
| | | if (suffixIcon == null) { |
| | | suffixIcon = createIcon(IMAGE_PATH + "/ds-suffix.png", |
| | | "Suffix entry"); |
| | | } |
| | | return suffixIcon; |
| | | } |
| | | |
| | | /** |
| | | * Returns the icon associated with a root node. |
| | | * @return the icon associated with a root node. |
| | | */ |
| | | public ImageIcon getIconForRootNode() { |
| | | if (rootNodeIcon == null) { |
| | | rootNodeIcon = createIcon(IMAGE_PATH + "/ds-directory.png", |
| | | "Root entry"); |
| | | } |
| | | return rootNodeIcon; |
| | | } |
| | | |
| | | /** |
| | | * Returns the icon associated with a node for which an error occurred. |
| | | * @return the icon associated with a node for which an error occurred. |
| | | */ |
| | | public ImageIcon getErrorIcon() { |
| | | if (errorIcon == null) { |
| | | errorIcon = UIFactory.getImageIcon(UIFactory.IconType.ERROR); |
| | | } |
| | | return errorIcon; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the icon associated with the error mask icon. |
| | | * @return the icon associated with the error mask icon. |
| | | */ |
| | | public ImageIcon getErrorMaskIcon() { |
| | | if (errorMaskIcon == null) { |
| | | errorMaskIcon = UIFactory.getImageIcon(UIFactory.IconType.ERROR); |
| | | } |
| | | return errorMaskIcon; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the icon associated with the referral mask icon. |
| | | * @return the icon associated with the referral mask icon. |
| | | */ |
| | | public ImageIcon getReferralMaskIcon() { |
| | | if (referralMaskIcon == null) { |
| | | referralMaskIcon = createIcon(IMAGE_PATH + "/ds-referral.png", |
| | | "Referral mask"); |
| | | } |
| | | return referralMaskIcon; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns an icon for a given objectclass applying some modifiers. |
| | | * @param objectClasses the objectclasses of the entry |
| | | * @param modifiers the modifiers of the icon (if the entry is inactivated, |
| | | * if it is a referral...). |
| | | * @return an icon for a given objectclass applying some modifiers. |
| | | */ |
| | | private ImageIcon makeIcon(Set<String> objectClasses, int modifiers) { |
| | | ImageIcon result; |
| | | |
| | | // Find the icon associated to the object class |
| | | if ((objectClasses == null) || (objectClasses.size() == 0)) { |
| | | result = getDefaultContainerIcon(); |
| | | } |
| | | else { |
| | | String iconFile = null; |
| | | for (String value : objectClasses) |
| | | { |
| | | iconFile = pathTable.get(value.toLowerCase()); |
| | | if (iconFile != null) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | if (iconFile == null) { |
| | | if ((modifiers & MODIFIER_LEAF) != 0) { |
| | | result = getDefaultLeafIcon(); |
| | | } |
| | | else { |
| | | result = getDefaultContainerIcon(); |
| | | } |
| | | } |
| | | else { |
| | | String description = null; |
| | | for (String value : objectClasses) |
| | | { |
| | | description = descriptionTable.get(value.toLowerCase()); |
| | | if (description != null) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | if (description == null) |
| | | { |
| | | description = GENERIC_OBJECT_DESCRIPTION; |
| | | } |
| | | result = createIcon(IMAGE_PATH + "/" + iconFile, |
| | | description); |
| | | } |
| | | } |
| | | |
| | | // Alter this icon according the modifiers |
| | | if ((modifiers & MODIFIER_REFERRAL) != 0) { |
| | | result = getReferralMaskIcon(); |
| | | } |
| | | if ((modifiers & MODIFIER_ERROR) != 0) { |
| | | result = maskedIcon(result, getErrorMaskIcon()); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | private String makeKey(SortedSet<String> ocValues, int modifiers) { |
| | | // TODO: verify the performance of IconPool.makeKey() |
| | | StringBuilder result = new StringBuilder(); |
| | | if(ocValues != null) { |
| | | result.append(Utilities.getStringFromCollection(ocValues, "")); |
| | | } |
| | | result.append(String.valueOf(modifiers)); |
| | | return result.toString(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Returns a RemoteImage corresponding to the superposition of the icon |
| | | * Image and the mask Image. |
| | | * |
| | | * @param icon the RemoteImage that we want to bar. |
| | | * @param mask the ImageIcond to be used as mask. |
| | | * @return a RemoteImage corresponding to the superposition of the icon |
| | | * Image and the mask Image. |
| | | */ |
| | | public static ImageIcon maskedIcon(ImageIcon icon, ImageIcon mask) { |
| | | ImageIcon fReturn; |
| | | int TRANSPARENT = 16711165; // The value of a transparent pixel |
| | | |
| | | int h = icon.getIconHeight(); |
| | | int w = icon.getIconWidth(); |
| | | |
| | | if (mask.getImageLoadStatus() != MediaTracker.COMPLETE) { |
| | | return null; |
| | | } |
| | | Image maskImage = mask.getImage(); |
| | | |
| | | Image scaledMaskImage = maskImage.getScaledInstance(w, h , |
| | | Image.SCALE_SMOOTH); |
| | | |
| | | ImageIcon scaledMask = new ImageIcon(scaledMaskImage); |
| | | if (scaledMask.getImageLoadStatus() != MediaTracker.COMPLETE) { |
| | | return null; |
| | | } |
| | | |
| | | int[] iconPixels = new int[w * h]; |
| | | try { |
| | | PixelGrabber pg = |
| | | new PixelGrabber(icon.getImage(), 0, 0, w, h, iconPixels, 0, w); |
| | | pg.grabPixels(); |
| | | |
| | | if ((pg.status() & ImageObserver.ABORT) !=0) { |
| | | return null; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | int[] filterPixels = new int[w * h]; |
| | | try { |
| | | PixelGrabber pgf = |
| | | new PixelGrabber(scaledMask.getImage(), 0, 0, w, h, filterPixels, 0, w); |
| | | pgf.grabPixels(); |
| | | |
| | | if ((pgf.status() & ImageObserver.ABORT) !=0) { |
| | | fReturn = null; |
| | | return fReturn; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | fReturn = null; |
| | | return fReturn; |
| | | } |
| | | |
| | | |
| | | int[] newPixels = new int[w * h]; |
| | | |
| | | for( int i = 0; i < h; i++) |
| | | for (int j = 0; j < w; j++) |
| | | if (filterPixels[j + i*w] != TRANSPARENT) { |
| | | newPixels[j + i*w] = filterPixels[j + i*w]; |
| | | } else { |
| | | newPixels[j + i*w] = iconPixels[j + i*w]; |
| | | } |
| | | Canvas component = new Canvas(); |
| | | |
| | | Image newImage = component.getToolkit().createImage( |
| | | new MemoryImageSource( |
| | | w, h, ColorModel.getRGBdefault(), newPixels, 0, w)); |
| | | fReturn = new ImageIcon(newImage, icon.getDescription()); |
| | | |
| | | return fReturn; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.browser; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.HashMap; |
| | | |
| | | import javax.naming.NamingException; |
| | | import javax.naming.ldap.Control; |
| | | import javax.naming.ldap.InitialLdapContext; |
| | | import javax.net.ssl.KeyManager; |
| | | |
| | | import org.opends.admin.ads.util.ApplicationTrustManager; |
| | | import org.opends.admin.ads.util.ConnectionUtils; |
| | | import org.opends.guitools.controlpanel.event.ReferralAuthenticationListener; |
| | | import org.opends.server.types.LDAPURL; |
| | | import org.opends.server.types.SearchScope; |
| | | |
| | | /** |
| | | * An LDAPConnectionPool is a pool of LDAPConnection. |
| | | * <BR><BR> |
| | | * When a client class needs to access an LDAPUrl, it simply passes |
| | | * this URL to getConnection() and gets an LDAPConnection back. |
| | | * When the client has finished with this LDAPConnection, it *must* |
| | | * pass it releaseConnection() which will take care of its disconnection |
| | | * or caching. |
| | | * <BR><BR> |
| | | * LDAPConnectionPool maintains a pool of authentications. This pool |
| | | * is populated using registerAuth(). When getConnection() has created |
| | | * a new connection for accessing a host:port, it looks in the authentication |
| | | * pool if any authentication is available for this host:port and, if yes, |
| | | * tries to bind the connection. If no authentication is available, the |
| | | * returned connection is simply connected (ie anonymous bind). |
| | | * <BR><BR> |
| | | * LDAPConnectionPool shares connections and maintains a usage counter |
| | | * for each connection: two calls to getConnection() withe the same URL |
| | | * will return the same connection. Two calls to releaseConnection() will |
| | | * be needed to make the connection 'potentially disconnectable'. |
| | | * <BR><BR> |
| | | * releaseConnection() does not disconnect systematically a connection |
| | | * whose usage counter is null. It keeps it connected a while (TODO: |
| | | * to be implemented). |
| | | * <BR><BR> |
| | | * TODO: synchronization is a bit simplistic... |
| | | */ |
| | | public class LDAPConnectionPool { |
| | | |
| | | HashMap<String, AuthRecord> authTable = new HashMap<String, AuthRecord>(); |
| | | HashMap<String, ConnectionRecord> connectionTable = |
| | | new HashMap<String, ConnectionRecord>(); |
| | | |
| | | ArrayList<ReferralAuthenticationListener> listeners; |
| | | |
| | | private Control[] requestControls = new Control[] {}; |
| | | private ApplicationTrustManager trustManager; |
| | | |
| | | /** |
| | | * Returns <CODE>true</CODE> if the connection passed is registered in the |
| | | * connection pool, <CODE>false</CODE> otherwise. |
| | | * @param ctx the connection. |
| | | * @return <CODE>true</CODE> if the connection passed is registered in the |
| | | * connection pool, <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean isConnectionRegistered(InitialLdapContext ctx) { |
| | | boolean isConnectionRegistered = false; |
| | | for (String key : connectionTable.keySet()) |
| | | { |
| | | ConnectionRecord cr = connectionTable.get(key); |
| | | if (cr.ctx != null) { |
| | | isConnectionRegistered = |
| | | ConnectionUtils.getHostName(cr.ctx).equals( |
| | | ConnectionUtils.getHostName(ctx)) && |
| | | (ConnectionUtils.getPort(cr.ctx) == ConnectionUtils.getPort(ctx)) && |
| | | ConnectionUtils.getBindDN(cr.ctx).equals( |
| | | ConnectionUtils.getBindDN(ctx)) && |
| | | ConnectionUtils.getBindPassword(cr.ctx).equals( |
| | | ConnectionUtils.getBindPassword(ctx)) && |
| | | (ConnectionUtils.isSSL(cr.ctx) == ConnectionUtils.isSSL(ctx)) && |
| | | (ConnectionUtils.isStartTLS(cr.ctx) == ConnectionUtils.isStartTLS(ctx)); |
| | | } |
| | | if (isConnectionRegistered) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | return isConnectionRegistered; |
| | | } |
| | | |
| | | /** |
| | | * Registers a connection in this connection pool. |
| | | * @param ctx the connection to be registered. |
| | | */ |
| | | public void registerConnection(InitialLdapContext ctx) { |
| | | registerAuth(ctx); |
| | | LDAPURL url = makeLDAPUrl( |
| | | ConnectionUtils.getHostName(ctx), |
| | | ConnectionUtils.getPort(ctx), |
| | | "", |
| | | ConnectionUtils.isSSL(ctx) |
| | | ); |
| | | String key = makeKeyFromLDAPUrl(url); |
| | | ConnectionRecord cr = new ConnectionRecord(); |
| | | cr.ctx = ctx; |
| | | cr.counter = 1; |
| | | cr.disconnectAfterUse = false; |
| | | connectionTable.put(key, cr); |
| | | } |
| | | |
| | | /** |
| | | * Unregisters a connection from this connection pool. |
| | | * @param ctx the connection to be unregistered. |
| | | * @throws NamingException if there is a problem unregistering the connection. |
| | | */ |
| | | public void unregisterConnection(InitialLdapContext ctx) |
| | | throws NamingException |
| | | { |
| | | LDAPURL url = makeLDAPUrl( |
| | | ConnectionUtils.getHostName(ctx), |
| | | ConnectionUtils.getPort(ctx), |
| | | "", |
| | | ConnectionUtils.isSSL(ctx)); |
| | | unRegisterAuth(url); |
| | | String key = makeKeyFromLDAPUrl(url); |
| | | connectionTable.remove(key); |
| | | } |
| | | |
| | | /** |
| | | * Adds a referral authentication listener. |
| | | * @param listener the referral authentication listener. |
| | | */ |
| | | public void addReferralAuthenticationListener( |
| | | ReferralAuthenticationListener listener) { |
| | | if (listeners == null) { |
| | | listeners = new ArrayList<ReferralAuthenticationListener>(); |
| | | } |
| | | listeners.add(listener); |
| | | } |
| | | |
| | | /** |
| | | * Removes a referral authentication listener. |
| | | * @param listener the referral authentication listener. |
| | | */ |
| | | public void removeReferralAuthenticationListener( |
| | | ReferralAuthenticationListener listener) { |
| | | if (listeners != null) { |
| | | listeners.remove(listener); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns an LDAPConnection for accessing the specified url. |
| | | * If no connection are available for the protocol/host/port |
| | | * of the URL, getConnection() makes a new one and call connect(). |
| | | * If authentication data available for this protocol/host/port, |
| | | * getConnection() call bind() on the new connection. |
| | | * If connect() or bind() failed, getConnection() forward the |
| | | * LDAPException. |
| | | * When getConnection() succeeds, the returned connection must |
| | | * be passed to releaseConnection() after use. |
| | | * @param ldapUrl the LDAP URL to which the connection must connect. |
| | | * @return a connection to the provided LDAP URL. |
| | | * @throws NamingException if there was an error connecting. |
| | | */ |
| | | public InitialLdapContext getConnection(LDAPURL ldapUrl) |
| | | throws NamingException { |
| | | String key = makeKeyFromLDAPUrl(ldapUrl); |
| | | ConnectionRecord cr; |
| | | |
| | | synchronized(this) { |
| | | cr = connectionTable.get(key); |
| | | if (cr == null) { |
| | | cr = new ConnectionRecord(); |
| | | cr.ctx = null; |
| | | cr.counter = 1; |
| | | cr.disconnectAfterUse = false; |
| | | connectionTable.put(key, cr); |
| | | } |
| | | else { |
| | | cr.counter++; |
| | | } |
| | | } |
| | | |
| | | synchronized(cr) { |
| | | try { |
| | | if (cr.ctx == null) { |
| | | cr.ctx = createLDAPConnection(ldapUrl, |
| | | authTable.get(key)); |
| | | cr.ctx.setRequestControls(requestControls); |
| | | } |
| | | } |
| | | catch(NamingException x) { |
| | | synchronized (this) { |
| | | cr.counter--; |
| | | if (cr.counter == 0) { |
| | | connectionTable.remove(key); |
| | | } |
| | | } |
| | | throw x; |
| | | } |
| | | } |
| | | |
| | | return cr.ctx; |
| | | } |
| | | |
| | | /** |
| | | * Sets the request controls to be used by the connections of this connection |
| | | * pool. |
| | | * @param ctls the request controls. |
| | | * @throws NamingException if an error occurs updating the connections. |
| | | */ |
| | | public synchronized void setRequestControls(Control[] ctls) |
| | | throws NamingException |
| | | { |
| | | requestControls = ctls; |
| | | for (ConnectionRecord cr : connectionTable.values()) |
| | | { |
| | | if (cr.ctx != null) |
| | | { |
| | | cr.ctx.setRequestControls(requestControls); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Release an LDAPConnection created by getConnection(). |
| | | * The connection should be considered as virtually disconnected |
| | | * and not be used anymore. |
| | | * @param ctx the connection to be released. |
| | | */ |
| | | public synchronized void releaseConnection(InitialLdapContext ctx) { |
| | | |
| | | String targetKey = null; |
| | | ConnectionRecord targetRecord = null; |
| | | synchronized(this) { |
| | | for (String key : connectionTable.keySet()) { |
| | | ConnectionRecord cr = connectionTable.get(key); |
| | | if (cr.ctx == ctx) { |
| | | targetKey = key; |
| | | targetRecord = cr; |
| | | if (targetKey != null) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (targetRecord == null) { // ldc is not in _connectionTable -> bug |
| | | throw new IllegalArgumentException("Invalid LDAP connection"); |
| | | } |
| | | else { |
| | | synchronized(targetRecord) { |
| | | targetRecord.counter--; |
| | | if ((targetRecord.counter == 0) && targetRecord.disconnectAfterUse) { |
| | | disconnectAndRemove(targetRecord); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Disconnect the connections which are not being used. |
| | | * Connections being used will be disconnected as soon |
| | | * as they are released. |
| | | */ |
| | | public synchronized void flush() { |
| | | for (ConnectionRecord cr : connectionTable.values()) |
| | | { |
| | | if (cr.counter <= 0) { |
| | | disconnectAndRemove(cr); |
| | | } |
| | | else { |
| | | cr.disconnectAfterUse = true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Register authentication data. |
| | | * If authentication data are already available for the protocol/host/port |
| | | * specified in the LDAPURl, they are replaced by the new data. |
| | | * If true is passed as 'connect' parameter, registerAuth() creates the |
| | | * connection and attemps to connect() and bind() . If connect() or bind() |
| | | * fail, registerAuth() forwards the NamingException and does not register |
| | | * the authentication data. |
| | | * @param ldapUrl the LDAP URL of the server. |
| | | * @param dn the bind DN. |
| | | * @param pw the password. |
| | | * @param connect whether to connect or not to the server with the |
| | | * provided authentication (for testing purposes). |
| | | * @throws NamingException if an error occurs connecting. |
| | | */ |
| | | public void registerAuth(LDAPURL ldapUrl, String dn, String pw, |
| | | boolean connect) |
| | | throws NamingException { |
| | | |
| | | String key = makeKeyFromLDAPUrl(ldapUrl); |
| | | AuthRecord ar; |
| | | ar = new AuthRecord(); |
| | | ar.ldapUrl = ldapUrl; |
| | | ar.dn = dn; |
| | | ar.password = pw; |
| | | |
| | | if (connect) { |
| | | InitialLdapContext ctx = createLDAPConnection(ldapUrl, ar); |
| | | ctx.close(); |
| | | } |
| | | |
| | | synchronized(this) { |
| | | authTable.put(key, ar); |
| | | ConnectionRecord cr = connectionTable.get(key); |
| | | if (cr != null) { |
| | | if (cr.counter <= 0) { |
| | | disconnectAndRemove(cr); |
| | | } |
| | | else { |
| | | cr.disconnectAfterUse = true; |
| | | } |
| | | } |
| | | } |
| | | notifyListeners(); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Register authentication data from an existing connection. |
| | | * This routine recreates the LDAP URL corresponding to |
| | | * the connection and passes it to registerAuth(LDAPURL). |
| | | * @param ctx the connection that we retrieve the authentication information |
| | | * from. |
| | | */ |
| | | public void registerAuth(InitialLdapContext ctx) { |
| | | LDAPURL url = makeLDAPUrl( |
| | | ConnectionUtils.getHostName(ctx), |
| | | ConnectionUtils.getPort(ctx), |
| | | "", |
| | | ConnectionUtils.isSSL(ctx)); |
| | | try { |
| | | registerAuth(url, ConnectionUtils.getBindDN(ctx), |
| | | ConnectionUtils.getBindPassword(ctx), false); |
| | | } |
| | | catch (NamingException x) { |
| | | throw new IllegalStateException("Bug"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Unregister authentication data. |
| | | * If for the given url there's a connection, try to bind as anonymous. |
| | | * If unbind fails throw NamingException. |
| | | * @param ldapUrl the url associated with the authentication to be |
| | | * unregistered. |
| | | * @throws NamingException if the unbind fails. |
| | | */ |
| | | public void unRegisterAuth(LDAPURL ldapUrl) throws NamingException { |
| | | String key = makeKeyFromLDAPUrl(ldapUrl); |
| | | |
| | | authTable.remove(key); |
| | | notifyListeners(); |
| | | } |
| | | |
| | | /** |
| | | * Get authentication DN registered for this url. |
| | | * @param ldapUrl the LDAP URL for which we want to get authentication DN. |
| | | * @return the bind DN of the authentication. |
| | | */ |
| | | public synchronized String getAuthDN(LDAPURL ldapUrl) { |
| | | String result; |
| | | String key = makeKeyFromLDAPUrl(ldapUrl); |
| | | AuthRecord ar = authTable.get(key); |
| | | if (ar == null) { |
| | | result = null; |
| | | } |
| | | else { |
| | | result = ar.dn; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get authentication password registered for this url. |
| | | * @param ldapUrl the LDAP URL for which we want to get authentication |
| | | * password. |
| | | * @return the password of the authentication. |
| | | */ |
| | | public synchronized String getAuthPassword(LDAPURL ldapUrl) { |
| | | String result; |
| | | String key = makeKeyFromLDAPUrl(ldapUrl); |
| | | AuthRecord ar = authTable.get(key); |
| | | if (ar == null) { |
| | | result = null; |
| | | } |
| | | else { |
| | | result = ar.password; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Disconnect the connection associated to a record |
| | | * and remove the record from connectionTable. |
| | | * @param cr the ConnectionRecord to remove. |
| | | */ |
| | | private void disconnectAndRemove(ConnectionRecord cr) |
| | | { |
| | | String key = makeKeyFromRecord(cr); |
| | | connectionTable.remove(key); |
| | | try |
| | | { |
| | | cr.ctx.close(); |
| | | } |
| | | catch (NamingException x) |
| | | { |
| | | // Bizarre. However it's not really a problem here. |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Notifies the listeners that a referral authentication change happened. |
| | | * |
| | | */ |
| | | private void notifyListeners() |
| | | { |
| | | for (ReferralAuthenticationListener listener : listeners) |
| | | { |
| | | listener.notifyAuthDataChanged(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Make the key string for an LDAP URL. |
| | | * @param url the LDAP URL. |
| | | * @return the key to be used in Maps for the provided LDAP URL. |
| | | */ |
| | | private static String makeKeyFromLDAPUrl(LDAPURL url) { |
| | | String protocol = isSecureLDAPUrl(url) ? "LDAPS" : "LDAP"; |
| | | return protocol + ":" + url.getHost() + ":" + url.getPort(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Make the key string for an connection record. |
| | | * @param rec the connection record. |
| | | * @return the key to be used in Maps for the provided connection record. |
| | | */ |
| | | private static String makeKeyFromRecord(ConnectionRecord rec) { |
| | | String protocol = ConnectionUtils.isSSL(rec.ctx) ? "LDAPS" : "LDAP"; |
| | | return protocol + ":" + ConnectionUtils.getHostName(rec.ctx) + ":" + |
| | | ConnectionUtils.getPort(rec.ctx); |
| | | } |
| | | |
| | | /** |
| | | * Creates an LDAP Connection for a given LDAP URL and using the |
| | | * authentication of a AuthRecord. |
| | | * @param ldapUrl the LDAP URL. |
| | | * @param ar the authentication information. |
| | | * @return a connection. |
| | | * @throws NamingException if an error occurs when connecting. |
| | | */ |
| | | private InitialLdapContext createLDAPConnection(LDAPURL ldapUrl, |
| | | AuthRecord ar) throws NamingException |
| | | { |
| | | InitialLdapContext ctx; |
| | | |
| | | if (isSecureLDAPUrl(ldapUrl)) |
| | | { |
| | | ctx = ConnectionUtils.createLdapsContext(ldapUrl.toString(), ar.dn, |
| | | ar.password, ConnectionUtils.getDefaultLDAPTimeout(), null, |
| | | getTrustManager() , getKeyManager()); |
| | | } |
| | | else |
| | | { |
| | | ctx = ConnectionUtils.createLdapContext(ldapUrl.toString(), ar.dn, |
| | | ar.password, ConnectionUtils.getDefaultLDAPTimeout(), null); |
| | | } |
| | | return ctx; |
| | | } |
| | | |
| | | /** |
| | | * Sets the ApplicationTrustManager used by the connection pool to |
| | | * connect to servers. |
| | | * @param trustManager the ApplicationTrustManager. |
| | | */ |
| | | public void setTrustManager(ApplicationTrustManager trustManager) |
| | | { |
| | | this.trustManager = trustManager; |
| | | } |
| | | |
| | | /** |
| | | * Returns the ApplicationTrustManager used by the connection pool to |
| | | * connect to servers. |
| | | * @return the ApplicationTrustManager used by the connection pool to |
| | | * connect to servers. |
| | | */ |
| | | public ApplicationTrustManager getTrustManager() |
| | | { |
| | | return trustManager; |
| | | } |
| | | |
| | | private KeyManager getKeyManager() |
| | | { |
| | | // TODO: we should get it from ControlPanelInfo |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * Returns whether the URL is ldaps URL or not. |
| | | * @param url the URL. |
| | | * @return <CODE>true</CODE> if the LDAP URL is secure and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public static boolean isSecureLDAPUrl(LDAPURL url) { |
| | | return !LDAPURL.DEFAULT_SCHEME.equalsIgnoreCase(url.getScheme()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Make an url from the specified arguments. |
| | | * @param host the host. |
| | | * @param port the port. |
| | | * @param dn the dn. |
| | | * @param secure whether it is a secure URL or not. |
| | | * @return an LDAP URL from the specified arguments. |
| | | */ |
| | | public static LDAPURL makeLDAPUrl(String host, int port, String dn, |
| | | boolean secure) { |
| | | return new LDAPURL( |
| | | secure ? "ldaps" : LDAPURL.DEFAULT_SCHEME, |
| | | host, |
| | | port, |
| | | dn, |
| | | null, // no attributes |
| | | SearchScope.BASE_OBJECT, |
| | | null, // No filter |
| | | null); // No extensions |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Make an url from the specified arguments. |
| | | * @param ctx the connection to the server. |
| | | * @param dn the base DN of the URL. |
| | | * @return an LDAP URL from the specified arguments. |
| | | */ |
| | | public static LDAPURL makeLDAPUrl(InitialLdapContext ctx, String dn) { |
| | | return new LDAPURL( |
| | | ConnectionUtils.isSSL(ctx) ? "ldaps" : LDAPURL.DEFAULT_SCHEME, |
| | | ConnectionUtils.getHostName(ctx), |
| | | ConnectionUtils.getPort(ctx), |
| | | dn, |
| | | null, // No attributes |
| | | SearchScope.BASE_OBJECT, |
| | | null, |
| | | null); // No filter |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Make an url from the specified arguments. |
| | | * @param url an LDAP URL to use as base of the new LDAP URL. |
| | | * @param dn the base DN for the new LDAP URL. |
| | | * @return an LDAP URL from the specified arguments. |
| | | */ |
| | | public static LDAPURL makeLDAPUrl(LDAPURL url, String dn) { |
| | | return new LDAPURL( |
| | | url.getScheme(), |
| | | url.getHost(), |
| | | url.getPort(), |
| | | dn, |
| | | null, // no attributes |
| | | SearchScope.BASE_OBJECT, |
| | | null, // No filter |
| | | null); // No extensions |
| | | } |
| | | |
| | | /** |
| | | * Returns a collection of AuthRecord. |
| | | * @return a collection of AuthRecord. |
| | | */ |
| | | Collection getRegisteredAuthentication() { |
| | | return authTable.values(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * A struct representing authentication data. |
| | | */ |
| | | class AuthRecord { |
| | | LDAPURL ldapUrl; |
| | | String dn; |
| | | String password; |
| | | } |
| | | |
| | | /** |
| | | * A struct representing an active connection. |
| | | */ |
| | | class ConnectionRecord { |
| | | InitialLdapContext ctx; |
| | | int counter; |
| | | boolean disconnectAfterUse; |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.browser; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Set; |
| | | |
| | | import javax.naming.InterruptedNamingException; |
| | | import javax.naming.NameNotFoundException; |
| | | import javax.naming.NamingEnumeration; |
| | | import javax.naming.NamingException; |
| | | import javax.naming.SizeLimitExceededException; |
| | | import javax.naming.directory.SearchControls; |
| | | import javax.naming.directory.SearchResult; |
| | | import javax.naming.ldap.InitialLdapContext; |
| | | import javax.naming.ldap.LdapName; |
| | | import javax.swing.SwingUtilities; |
| | | import javax.swing.tree.TreeNode; |
| | | |
| | | import org.opends.admin.ads.util.ConnectionUtils; |
| | | import org.opends.guitools.controlpanel.ui.nodes.BasicNode; |
| | | import org.opends.messages.AdminToolMessages; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.LDAPURL; |
| | | import org.opends.server.types.RDN; |
| | | |
| | | /** |
| | | * The class that is in charge of doing the LDAP searches required to update a |
| | | * node: search the local entry, detect if it has children, retrieve the |
| | | * attributes required to render the node, etc. |
| | | */ |
| | | class NodeRefresher extends AbstractNodeTask { |
| | | |
| | | /** |
| | | * The enumeration containing all the states the refresher can have. |
| | | * |
| | | */ |
| | | enum State |
| | | { |
| | | /** |
| | | * The refresher is queued, but not started. |
| | | */ |
| | | QUEUED, |
| | | /** |
| | | * The refresher is reading the local entry. |
| | | */ |
| | | READING_LOCAL_ENTRY, |
| | | /** |
| | | * The refresher is solving a referral. |
| | | */ |
| | | SOLVING_REFERRAL, |
| | | /** |
| | | * The refresher is detecting whether the entry has children or not. |
| | | */ |
| | | DETECTING_CHILDREN, |
| | | /** |
| | | * The refresher is searching for the children of the entry. |
| | | */ |
| | | SEARCHING_CHILDREN, |
| | | /** |
| | | * The refresher is finished. |
| | | */ |
| | | FINISHED, |
| | | /** |
| | | * The refresher is cancelled. |
| | | */ |
| | | CANCELLED, |
| | | /** |
| | | * The refresher has been interrupted. |
| | | */ |
| | | INTERRUPTED, |
| | | /** |
| | | * The refresher has failed. |
| | | */ |
| | | FAILED |
| | | }; |
| | | |
| | | BrowserController controller; |
| | | State state; |
| | | boolean recursive; |
| | | |
| | | SearchResult localEntry; |
| | | SearchResult remoteEntry; |
| | | LDAPURL remoteUrl; |
| | | boolean isLeafNode; |
| | | ArrayList<SearchResult> childEntries = new ArrayList<SearchResult>(); |
| | | boolean differential; |
| | | Exception exception; |
| | | Object exceptionArg; |
| | | |
| | | |
| | | /** |
| | | * The constructor of the refresher object. |
| | | * @param node the node on the tree to be updated. |
| | | * @param ctlr the BrowserController. |
| | | * @param localEntry the local entry corresponding to the node. |
| | | * @param recursive whether this task is recursive or not (children must be |
| | | * searched). |
| | | */ |
| | | public NodeRefresher(BasicNode node, BrowserController ctlr, |
| | | SearchResult localEntry, boolean recursive) { |
| | | super(node); |
| | | controller = ctlr; |
| | | state = State.QUEUED; |
| | | this.recursive = recursive; |
| | | |
| | | this.localEntry = localEntry; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the local entry the refresher is handling. |
| | | * @return the local entry the refresher is handling. |
| | | */ |
| | | public SearchResult getLocalEntry() { |
| | | return localEntry; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the remote entry for the node. It will be <CODE>null</CODE> if |
| | | * the entry is not a referral. |
| | | * @return the remote entry for the node. |
| | | */ |
| | | public SearchResult getRemoteEntry() { |
| | | return remoteEntry; |
| | | } |
| | | |
| | | /** |
| | | * Returns the URL of the remote entry. It will be <CODE>null</CODE> if |
| | | * the entry is not a referral. |
| | | * @return the URL of the remote entry. |
| | | */ |
| | | public LDAPURL getRemoteUrl() { |
| | | return remoteUrl; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Tells whether the node is a leaf or not. |
| | | * @return <CODE>true</CODE> if the node is a leaf and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public boolean isLeafNode() { |
| | | return isLeafNode; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the child entries of the node. |
| | | * @return the child entries of the node. |
| | | */ |
| | | public ArrayList<SearchResult> getChildEntries() { |
| | | return childEntries; |
| | | } |
| | | |
| | | /** |
| | | * Returns whether this refresher object is working on differential mode or |
| | | * not. |
| | | * @return <CODE>true</CODE> if the refresher is working on differential |
| | | * mode and <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean isDifferential() { |
| | | return differential; |
| | | } |
| | | |
| | | /** |
| | | * Returns the exception that occurred during the processing. It returns |
| | | * <CODE>null</CODE> if no exception occurred. |
| | | * @return the exception that occurred during the processing. |
| | | */ |
| | | public Exception getException() { |
| | | return exception; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the argument of the exception that occurred during the processing. |
| | | * It returns <CODE>null</CODE> if no exception occurred or if the exception |
| | | * has no arguments. |
| | | * @return the argument exception that occurred during the processing. |
| | | */ |
| | | public Object getExceptionArg() { |
| | | return exceptionArg; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the displayed entry in the browser. This depends on the |
| | | * visualization options in the BrowserController. |
| | | * @return the remote entry if the entry is a referral and the |
| | | * BrowserController is following referrals and the local entry otherwise. |
| | | */ |
| | | public SearchResult getDisplayedEntry() { |
| | | SearchResult result; |
| | | if (controller.getFollowReferrals() && (remoteEntry != null)) { |
| | | result = remoteEntry; |
| | | } |
| | | else { |
| | | result = localEntry; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * Returns the LDAP URL of the displayed entry in the browser. This depends |
| | | * on the visualization options in the BrowserController. |
| | | * @return the remote entry LDAP URL if the entry is a referral and the |
| | | * BrowserController is following referrals and the local entry LDAP URL |
| | | * otherwise. |
| | | */ |
| | | public LDAPURL getDisplayedUrl() { |
| | | LDAPURL result; |
| | | if (controller.getFollowReferrals() && (remoteUrl != null)) { |
| | | result = remoteUrl; |
| | | } |
| | | else { |
| | | result = controller.findUrlForLocalEntry(getNode()); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * Returns whether the refresh is over or not. |
| | | * @return <CODE>true</CODE> if the refresh is over and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public boolean isInFinalState() { |
| | | return ( |
| | | (state == State.FINISHED) || |
| | | (state == State.CANCELLED) || |
| | | (state == State.FAILED) || |
| | | (state == State.INTERRUPTED) |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * The method that actually does the refresh. |
| | | */ |
| | | public void run() { |
| | | final BasicNode node = getNode(); |
| | | |
| | | try { |
| | | boolean checkExpand = false; |
| | | if (localEntry == null) { |
| | | changeStateTo(State.READING_LOCAL_ENTRY); |
| | | runReadLocalEntry(); |
| | | } |
| | | if (controller.getFollowReferrals() && isReferralEntry(localEntry)) { |
| | | changeStateTo(State.SOLVING_REFERRAL); |
| | | runSolveReferral(); |
| | | } |
| | | if (node.isLeaf()) { |
| | | changeStateTo(State.DETECTING_CHILDREN); |
| | | runDetectChildren(); |
| | | } |
| | | if (controller.nodeIsExpanded(node) && recursive) { |
| | | changeStateTo(State.SEARCHING_CHILDREN); |
| | | runSearchChildren(); |
| | | /* If the node is not expanded, we have to refresh its children |
| | | when we expand it */ |
| | | } else if (recursive && (!node.isLeaf() || !isLeafNode)) { |
| | | node.setRefreshNeededOnExpansion(true); |
| | | checkExpand = true; |
| | | } |
| | | changeStateTo(State.FINISHED); |
| | | if (checkExpand && mustAutomaticallyExpand(node)) |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | controller.expandNode(node); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | catch (NamingException ne) |
| | | { |
| | | exception = ne; |
| | | exceptionArg = null; |
| | | } |
| | | catch(SearchAbandonException x) { |
| | | exception = x.getException(); |
| | | exceptionArg = x.getArg(); |
| | | try { |
| | | changeStateTo(x.getState()); |
| | | } |
| | | catch(SearchAbandonException xx) { |
| | | // We've done all what we can... |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Tells whether a custom filter is being used (specified by the user in the |
| | | * browser dialog) or not. |
| | | * @return <CODE>true</CODE> if a custom filter is being used and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | private boolean useCustomFilter() |
| | | { |
| | | return !controller.getFilter().equals(BrowserController.ALL_OBJECTS_FILTER); |
| | | } |
| | | |
| | | /** |
| | | * Performs the search in the case the user specified a custom filter. |
| | | * @param node the parent node we perform the search from. |
| | | * @param ctx the connection to be used. |
| | | * @throws NamingException if a problem occurred. |
| | | */ |
| | | private void searchForCustomFilter(BasicNode node, InitialLdapContext ctx) |
| | | throws NamingException |
| | | { |
| | | SearchControls ctls = controller.getBasicSearchControls(); |
| | | ctls.setSearchScope(SearchControls.SUBTREE_SCOPE); |
| | | ctls.setReturningAttributes(new String[]{"dn"}); |
| | | ctls.setCountLimit(1); |
| | | NamingEnumeration<SearchResult> s = ctx.search(new LdapName(node.getDN()), |
| | | controller.getFilter(), |
| | | ctls); |
| | | if (!s.hasMoreElements()) |
| | | { |
| | | throw new NameNotFoundException("Entry "+node.getDN()+ |
| | | " does not verify filter "+controller.getFilter()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Performs the search in the case the user specified a custom filter. |
| | | * @param dn the parent DN we perform the search from. |
| | | * @param ctx the connection to be used. |
| | | * @throws NamingException if a problem occurred. |
| | | */ |
| | | private void searchForCustomFilter(String dn, InitialLdapContext ctx) |
| | | throws NamingException |
| | | { |
| | | SearchControls ctls = controller.getBasicSearchControls(); |
| | | ctls.setSearchScope(SearchControls.SUBTREE_SCOPE); |
| | | ctls.setReturningAttributes(new String[]{}); |
| | | ctls.setCountLimit(1); |
| | | NamingEnumeration<SearchResult> s = ctx.search(new LdapName(dn), |
| | | controller.getFilter(), |
| | | ctls); |
| | | if (!s.hasMoreElements()) |
| | | { |
| | | throw new NameNotFoundException("Entry "+dn+ |
| | | " does not verify filter "+controller.getFilter()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Read the local entry associated to the current node. |
| | | */ |
| | | private void runReadLocalEntry() throws SearchAbandonException { |
| | | BasicNode node = getNode(); |
| | | InitialLdapContext ctx = null; |
| | | |
| | | try { |
| | | ctx = controller.findConnectionForLocalEntry(node); |
| | | |
| | | if (useCustomFilter()) |
| | | { |
| | | // Check that the entry verifies the filter |
| | | searchForCustomFilter(node, ctx); |
| | | } |
| | | |
| | | SearchControls ctls = controller.getBasicSearchControls(); |
| | | ctls.setReturningAttributes(controller.getAttrsForRedSearch()); |
| | | ctls.setSearchScope(SearchControls.OBJECT_SCOPE); |
| | | |
| | | NamingEnumeration<SearchResult> s = ctx.search(new LdapName(node.getDN()), |
| | | controller.getObjectSearchFilter(), |
| | | ctls); |
| | | if (s.hasMore()) |
| | | { |
| | | localEntry = s.next(); |
| | | localEntry.setName(node.getDN()); |
| | | } |
| | | if (localEntry == null) { |
| | | /* Not enough rights to read the entry or the entry simply does not |
| | | exist */ |
| | | throw new NameNotFoundException("Can't find entry: "+node.getDN()); |
| | | } |
| | | throwAbandonIfNeeded(null); |
| | | } |
| | | catch(NamingException x) { |
| | | throwAbandonIfNeeded(x); |
| | | } |
| | | finally { |
| | | if (ctx != null) { |
| | | controller.releaseLDAPConnection(ctx); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Solve the referral associated to the current node. |
| | | * This routine assumes that node.getReferral() is non null |
| | | * and that BrowserController.getFollowReferrals() == true. |
| | | * It also protect the browser against looping referrals by |
| | | * limiting the number of hops. |
| | | * @throws SearchAbandonException if the hop count limit for referrals has |
| | | * been exceeded. |
| | | * @throws NamingException if an error occurred searching the entry. |
| | | */ |
| | | private void runSolveReferral() |
| | | throws SearchAbandonException, NamingException { |
| | | int hopCount = 0; |
| | | String[] referral = getNode().getReferral(); |
| | | while ((referral != null) && (hopCount < 10)) { |
| | | readRemoteEntry(referral); |
| | | referral = BrowserController.getReferral(remoteEntry); |
| | | hopCount++; |
| | | } |
| | | if (referral != null) { // -> hopCount has reached the max |
| | | throwAbandonIfNeeded(new ReferralLimitExceededException( |
| | | AdminToolMessages.ERR_REFERRAL_LIMIT_EXCEEDED.get(hopCount))); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Searches for the remote entry. |
| | | * @param referral the referral list to be used to search the remote entry. |
| | | * @throws SearchAbandonException if an error occurs. |
| | | */ |
| | | private void readRemoteEntry(String[] referral) |
| | | throws SearchAbandonException { |
| | | LDAPConnectionPool connectionPool = controller.getConnectionPool(); |
| | | LDAPURL url = null; |
| | | SearchResult entry = null; |
| | | String remoteDn = null; |
| | | Exception lastException = null; |
| | | Object lastExceptionArg = null; |
| | | |
| | | int i = 0; |
| | | while ((i < referral.length) && (entry == null)) { |
| | | InitialLdapContext ctx = null; |
| | | try { |
| | | url = LDAPURL.decode(referral[i], false); |
| | | ctx = connectionPool.getConnection(url); |
| | | remoteDn = url.getRawBaseDN(); |
| | | if ((remoteDn == null) || |
| | | remoteDn.equals("")) { |
| | | /* The referral has not a target DN specified: we |
| | | have to use the DN of the entry that contains the |
| | | referral... */ |
| | | if (remoteEntry != null) { |
| | | remoteDn = remoteEntry.getName(); |
| | | } else { |
| | | remoteDn = localEntry.getName(); |
| | | } |
| | | /* We have to recreate the url including the target DN |
| | | we are using */ |
| | | url = new LDAPURL(url.getScheme(), url.getHost(), url.getPort(), |
| | | remoteDn, url.getAttributes(), url.getScope(), url.getRawFilter(), |
| | | url.getExtensions()); |
| | | } |
| | | if (useCustomFilter()) |
| | | { |
| | | // Check that the entry verifies the filter |
| | | searchForCustomFilter(remoteDn, ctx); |
| | | } |
| | | SearchControls ctls = controller.getBasicSearchControls(); |
| | | ctls.setReturningAttributes(controller.getAttrsForBlackSearch()); |
| | | ctls.setSearchScope(SearchControls.OBJECT_SCOPE); |
| | | NamingEnumeration<SearchResult> sr = ctx.search(remoteDn, |
| | | controller.getObjectSearchFilter(), |
| | | ctls); |
| | | if (sr.hasMore()) |
| | | { |
| | | entry = sr.next(); |
| | | entry.setName(remoteDn); |
| | | } |
| | | throwAbandonIfNeeded(null); |
| | | } |
| | | catch(InterruptedNamingException x) { |
| | | throwAbandonIfNeeded(x); |
| | | } |
| | | catch(NamingException x) { |
| | | lastException = x; |
| | | lastExceptionArg = referral[i]; |
| | | } |
| | | catch(DirectoryException de) { |
| | | lastException = de; |
| | | lastExceptionArg = referral[i]; |
| | | } |
| | | finally { |
| | | if (ctx != null) { |
| | | connectionPool.releaseConnection(ctx); |
| | | } |
| | | } |
| | | i = i + 1; |
| | | } |
| | | if (entry == null) { |
| | | throw new SearchAbandonException( |
| | | State.FAILED, lastException, lastExceptionArg); |
| | | } |
| | | else { |
| | | remoteUrl = url; |
| | | remoteEntry = entry; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Tells whether the provided node must be automatically expanded or not. |
| | | * This is used when the user provides a custom filter, in this case we |
| | | * expand automatically the tree. |
| | | * @param node the node to analyze. |
| | | * @return <CODE>true</CODE> if the node must be expanded and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | private boolean mustAutomaticallyExpand(BasicNode node) |
| | | { |
| | | boolean mustAutomaticallyExpand = false; |
| | | if (controller.isAutomaticExpand()) |
| | | { |
| | | // Limit the number of expansion levels to 3 |
| | | int nLevels = 0; |
| | | TreeNode parent = node; |
| | | while (parent != null) |
| | | { |
| | | nLevels ++; |
| | | parent = parent.getParent(); |
| | | } |
| | | mustAutomaticallyExpand = nLevels <= 4; |
| | | } |
| | | return mustAutomaticallyExpand; |
| | | } |
| | | |
| | | /** |
| | | * Detects whether the entries has children or not. |
| | | * @throws SearchAbandonException if the search was abandoned. |
| | | * @throws NamingException if an error during the search occurred. |
| | | */ |
| | | private void runDetectChildren() |
| | | throws SearchAbandonException, NamingException { |
| | | if (controller.isShowContainerOnly() || !isNumSubOrdinatesUsable()) { |
| | | runDetectChildrenManually(); |
| | | } |
| | | else { |
| | | SearchResult entry = getDisplayedEntry(); |
| | | isLeafNode = (BrowserController.getNumSubOrdinates(entry) == 0); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Detects whether the entry has children by performing a search using the |
| | | * entry as base DN. |
| | | * @throws SearchAbandonException if there is an error. |
| | | */ |
| | | private void runDetectChildrenManually() throws SearchAbandonException { |
| | | BasicNode parentNode = getNode(); |
| | | InitialLdapContext ctx = null; |
| | | NamingEnumeration<SearchResult> searchResults = null; |
| | | |
| | | try { |
| | | // We set the search constraints so that only one entry is returned. |
| | | // It's enough to know if the entry has children or not. |
| | | SearchControls ctls = controller.getBasicSearchControls(); |
| | | ctls.setCountLimit(1); |
| | | String[] attrs = {"dn"}; |
| | | ctls.setReturningAttributes(attrs); |
| | | if (useCustomFilter()) |
| | | { |
| | | ctls.setSearchScope(SearchControls.SUBTREE_SCOPE); |
| | | } |
| | | else |
| | | { |
| | | ctls.setSearchScope(SearchControls.OBJECT_SCOPE); |
| | | } |
| | | // Send an LDAP search |
| | | ctx = controller.findConnectionForDisplayedEntry(parentNode); |
| | | searchResults = ctx.search( |
| | | new LdapName(controller.findBaseDNForChildEntries(parentNode)), |
| | | controller.getChildSearchFilter(), |
| | | ctls); |
| | | |
| | | throwAbandonIfNeeded(null); |
| | | |
| | | if (searchResults.hasMoreElements()) { // May be parentNode has children |
| | | isLeafNode = false; |
| | | } |
| | | else { // parentNode has no children |
| | | isLeafNode = true; |
| | | } |
| | | } |
| | | catch (NamingException x) { |
| | | throwAbandonIfNeeded(x); |
| | | } |
| | | finally { |
| | | if (ctx != null) { |
| | | controller.releaseLDAPConnection(ctx); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // NUMSUBORDINATE HACK |
| | | // numsubordinates is not usable if the displayed entry |
| | | // is listed in in the hacker. |
| | | // Note: *usable* means *usable for detecting children presence*. |
| | | private boolean isNumSubOrdinatesUsable() throws NamingException { |
| | | boolean result; |
| | | SearchResult entry = getDisplayedEntry(); |
| | | int numSubOrdinates = BrowserController.getNumSubOrdinates(entry); |
| | | if (numSubOrdinates == 0) { // We must check |
| | | LDAPURL url = getDisplayedUrl(); |
| | | if (controller.getNumSubordinateHacker().contains(url)) { |
| | | // The numSubOrdinate we have is unreliable. |
| | | result = false; |
| | | // System.out.println("numSubOrdinates of " + url + |
| | | // " is not reliable"); |
| | | } |
| | | else { |
| | | result = true; |
| | | } |
| | | } |
| | | else { // Other values are usable |
| | | result = true; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Searchs for the children. |
| | | * @throws SearchAbandonException if an error occurs. |
| | | */ |
| | | private void runSearchChildren() throws SearchAbandonException { |
| | | InitialLdapContext ctx = null; |
| | | BasicNode parentNode = getNode(); |
| | | parentNode.setSizeLimitReached(false); |
| | | try { |
| | | // Send an LDAP search |
| | | SearchControls ctls = controller.getBasicSearchControls(); |
| | | if (useCustomFilter()) |
| | | { |
| | | ctls.setSearchScope(SearchControls.SUBTREE_SCOPE); |
| | | } |
| | | else |
| | | { |
| | | ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE); |
| | | } |
| | | ctls.setReturningAttributes(controller.getAttrsForRedSearch()); |
| | | ctx = controller.findConnectionForDisplayedEntry(parentNode); |
| | | String parentDn = controller.findBaseDNForChildEntries(parentNode); |
| | | int parentComponents; |
| | | try |
| | | { |
| | | DN dn = DN.decode(parentDn); |
| | | parentComponents = dn.getNumComponents(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Error decoding dn: "+parentDn+" . "+t, |
| | | t); |
| | | } |
| | | NamingEnumeration<SearchResult> entries = ctx.search( |
| | | new LdapName(parentDn), |
| | | controller.getChildSearchFilter(), |
| | | ctls); |
| | | |
| | | while (entries.hasMore()) |
| | | { |
| | | SearchResult r = entries.next(); |
| | | String name; |
| | | if (r.getName().length() == 0) |
| | | { |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | name = r.getName()+","+parentDn; |
| | | } |
| | | boolean add = false; |
| | | if (useCustomFilter()) |
| | | { |
| | | // Check that is an inmediate child: use a faster method by just |
| | | // comparing the number of components. |
| | | DN dn = null; |
| | | try |
| | | { |
| | | dn = DN.decode(name); |
| | | add = dn.getNumComponents() == parentComponents + 1; |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Error decoding dns: "+t, t); |
| | | } |
| | | |
| | | if (!add) |
| | | { |
| | | // Is not a direct child. Check if the parent has been added, |
| | | // if it is the case, do not add the parent. If is not the case, |
| | | // search for the parent and add it. |
| | | RDN[] rdns = new RDN[parentComponents + 1]; |
| | | int diff = dn.getNumComponents() - rdns.length; |
| | | for (int i=0; i < rdns.length; i++) |
| | | { |
| | | rdns[i] = dn.getRDN(i + diff); |
| | | } |
| | | final DN parentToAddDN = new DN(rdns); |
| | | boolean mustAddParent = true; |
| | | for (SearchResult addedEntry : childEntries) |
| | | { |
| | | try |
| | | { |
| | | DN addedDN = DN.decode(addedEntry.getName()); |
| | | if (addedDN.equals(parentToAddDN)) |
| | | { |
| | | mustAddParent = false; |
| | | break; |
| | | } |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Error decoding dn: "+ |
| | | addedEntry.getName()+" . "+t, t); |
| | | } |
| | | } |
| | | if (mustAddParent) |
| | | { |
| | | final boolean resultValue[] = {true}; |
| | | // Check the children added to the tree |
| | | try |
| | | { |
| | | SwingUtilities.invokeAndWait(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | for (int i=0; i<getNode().getChildCount(); i++) |
| | | { |
| | | BasicNode node = (BasicNode)getNode().getChildAt(i); |
| | | try |
| | | { |
| | | DN dn = DN.decode(node.getDN()); |
| | | if (dn.equals(parentToAddDN)) |
| | | { |
| | | resultValue[0] = false; |
| | | break; |
| | | } |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalStateException("Error decoding dn: "+ |
| | | node.getDN()+" . "+t, t); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | // Ignore |
| | | } |
| | | mustAddParent = resultValue[0]; |
| | | } |
| | | if (mustAddParent) |
| | | { |
| | | SearchResult parentResult = searchManuallyEntry(ctx, |
| | | parentToAddDN.toString()); |
| | | childEntries.add(parentResult); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | add = true; |
| | | } |
| | | if (add) |
| | | { |
| | | r.setName(name); |
| | | childEntries.add(r); |
| | | // Time to time we update the display |
| | | if (childEntries.size() >= 20) { |
| | | changeStateTo(State.SEARCHING_CHILDREN); |
| | | childEntries.clear(); |
| | | } |
| | | } |
| | | throwAbandonIfNeeded(null); |
| | | } |
| | | } |
| | | catch (SizeLimitExceededException slee) |
| | | { |
| | | parentNode.setSizeLimitReached(true); |
| | | } |
| | | catch (NamingException x) { |
| | | throwAbandonIfNeeded(x); |
| | | } |
| | | finally { |
| | | if (ctx != null) |
| | | { |
| | | controller.releaseLDAPConnection(ctx); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns the entry for the given dn. |
| | | * The code assumes that the request controls are set in the connection. |
| | | * @param ctx the connection to be used. |
| | | * @param dn the DN of the entry to be searched. |
| | | * @throws NamingException if an error occurs. |
| | | */ |
| | | private SearchResult searchManuallyEntry(InitialLdapContext ctx, String dn) |
| | | throws NamingException |
| | | { |
| | | SearchResult sr = null; |
| | | // Send an LDAP search |
| | | SearchControls ctls = controller.getBasicSearchControls(); |
| | | ctls.setSearchScope(SearchControls.OBJECT_SCOPE); |
| | | ctls.setReturningAttributes(controller.getAttrsForRedSearch()); |
| | | NamingEnumeration<SearchResult> entries = ctx.search( |
| | | new LdapName(dn), |
| | | controller.getObjectSearchFilter(), |
| | | ctls); |
| | | |
| | | while (entries.hasMore()) |
| | | { |
| | | sr = entries.next(); |
| | | sr.setName(dn); |
| | | } |
| | | return sr; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Utilities |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * Change the state of the task and inform the BrowserController. |
| | | * @param newState the new state for the refresher. |
| | | */ |
| | | private void changeStateTo(State newState) throws SearchAbandonException { |
| | | State oldState = state; |
| | | state = newState; |
| | | try { |
| | | controller.invokeRefreshTaskDidProgress(this, oldState, newState); |
| | | } |
| | | catch(InterruptedException x) { |
| | | throwAbandonIfNeeded(x); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Transform an exception into a TaskAbandonException. |
| | | * If no exception is passed, the routine checks if the task has |
| | | * been cancelled and throws an TaskAbandonException accordingly. |
| | | * @param x the exception. |
| | | * @throws SearchAbandonException if the task/refresher must be abandoned. |
| | | */ |
| | | private void throwAbandonIfNeeded(Exception x) throws SearchAbandonException { |
| | | SearchAbandonException tax = null; |
| | | if (x != null) { |
| | | if ((x instanceof InterruptedException) || |
| | | (x instanceof InterruptedNamingException)) { |
| | | tax = new SearchAbandonException(State.INTERRUPTED, x, null); |
| | | } |
| | | else { |
| | | tax = new SearchAbandonException(State.FAILED, x, null); |
| | | } |
| | | } |
| | | else if (isCancelled()) { |
| | | tax = new SearchAbandonException(State.CANCELLED, null, null); |
| | | } |
| | | if (tax != null) { |
| | | throw tax; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * DEBUG : Dump the state of the task. |
| | | */ |
| | | void dump() { |
| | | System.out.println("============="); |
| | | System.out.println(" node: " + getNode().getDN()); |
| | | System.out.println(" recursive: " + recursive); |
| | | System.out.println(" differential: " + differential); |
| | | |
| | | System.out.println(" state: " + state); |
| | | System.out.println(" localEntry: " + localEntry); |
| | | System.out.println(" remoteEntry: " + remoteEntry); |
| | | System.out.println(" remoteUrl: " + remoteUrl); |
| | | System.out.println(" isLeafNode: " + isLeafNode); |
| | | System.out.println(" exception: " + exception); |
| | | System.out.println(" exceptionArg: " + exceptionArg); |
| | | System.out.println("============="); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Checks that the entry's objectClass contains 'referral' and that the |
| | | * attribute 'ref' is present. |
| | | * @param entry the search result. |
| | | * @return <CODE>true</CODE> if the entry's objectClass contains 'referral' |
| | | * and the attribute 'ref' is present and <CODE>false</CODE> otherwise. |
| | | * @throws NamingException if an error occurs. |
| | | */ |
| | | static boolean isReferralEntry(SearchResult entry) throws NamingException { |
| | | boolean result = false; |
| | | Set<String> ocValues = ConnectionUtils.getValues(entry, "objectClass"); |
| | | if (ocValues != null) { |
| | | for (String value : ocValues) |
| | | { |
| | | boolean isReferral = value.equalsIgnoreCase("referral"); |
| | | |
| | | if (isReferral) { |
| | | result = (ConnectionUtils.getFirstValue(entry, "ref") != null); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.browser; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | |
| | | import org.opends.guitools.controlpanel.ui.nodes.BasicNode; |
| | | |
| | | /** |
| | | * This is the class that contains all the AbstractNodeTask objects that |
| | | * are running or that are waiting to be executed. Basically BrowserController |
| | | * will listen for events and will create a AbstractNodeTask object that |
| | | * will add to this queue in order it to be asynchronously executed. |
| | | * |
| | | * The queue will basically start a certain number of threads and this threads |
| | | * will "consume" the AbstractNodeTask objects that are added to this queue. |
| | | * |
| | | */ |
| | | class NodeSearcherQueue implements Runnable { |
| | | |
| | | private String name; |
| | | private ArrayList<AbstractNodeTask> waitingQueue = |
| | | new ArrayList<AbstractNodeTask>(); |
| | | private HashMap<BasicNode, AbstractNodeTask> workingList = |
| | | new HashMap<BasicNode, AbstractNodeTask>(); |
| | | private HashMap<BasicNode, BasicNode> cancelList = |
| | | new HashMap<BasicNode, BasicNode>(); |
| | | private ThreadGroup threadGroup; |
| | | |
| | | |
| | | /** |
| | | * Construct a queue with the specified name. |
| | | * The name is for debugging purpose only. |
| | | * @param name the name of the queue. |
| | | * @param threadCount then number of threads that the queue will use. |
| | | */ |
| | | public NodeSearcherQueue(String name, int threadCount) { |
| | | this.name = name; |
| | | threadGroup = new ThreadGroup(name); |
| | | for (int i = 0; i < threadCount; i++) { |
| | | Thread t = new Thread(threadGroup, this, name + "[" + i + "]"); |
| | | t.setPriority(Thread.MIN_PRIORITY); |
| | | t.start(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns the name of this queue. |
| | | * @return the name of this queue. |
| | | */ |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Shutdown this queue. |
| | | * All the associated threads are stopped. |
| | | */ |
| | | public void shutdown() { |
| | | threadGroup.interrupt(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Add an object in this queue. |
| | | * If the object is already in the waiting sub-queue, it is silently ignored. |
| | | * @param nodeTask the task to be added. |
| | | */ |
| | | public synchronized void queue(AbstractNodeTask nodeTask) { |
| | | if (nodeTask == null) throw new IllegalArgumentException("null argument"); |
| | | waitingQueue.add(nodeTask); |
| | | notify(); |
| | | // System.out.println("Queued " + nodeTask + " in " + _name); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Cancel an object. |
| | | * If the object is in the waiting sub-queue, it's simply removed from. |
| | | * If the object is in the working subqueue, it's kept in place but marked as |
| | | * cancelled. It's the responsibility of the consumer to detect that and flush |
| | | * the object asap. |
| | | * @param node the node whose associated tasks must be cancelled. |
| | | */ |
| | | public synchronized void cancelForNode(BasicNode node) { |
| | | if (node == null) throw new IllegalArgumentException("null argument"); |
| | | // Remove all the associated tasks from the waiting queue |
| | | for (int i = waitingQueue.size()-1; i >= 0; i--) { |
| | | AbstractNodeTask task = waitingQueue.get(i); |
| | | if (task.getNode() == node) { |
| | | waitingQueue.remove(i); |
| | | } |
| | | } |
| | | // Mark the on-going task as cancelled |
| | | AbstractNodeTask task = workingList.get(node); |
| | | if (task != null) { |
| | | cancelList.put(node, node); |
| | | task.cancel(); |
| | | } |
| | | notify(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Cancel all the object from this queue. |
| | | */ |
| | | public synchronized void cancelAll() { |
| | | waitingQueue.clear(); |
| | | for (BasicNode node : workingList.keySet()) |
| | | { |
| | | AbstractNodeTask task = workingList.get(node); |
| | | cancelList.put(node, node); |
| | | task.cancel(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Fetch an object from this queue. |
| | | * The returned object is moved from the waiting sub-queue to the working |
| | | * sub-queue. |
| | | * @return the next object to be handled. |
| | | * @throws InterruptedException if the call to fetch was interrupted by |
| | | * another thread. |
| | | */ |
| | | private synchronized AbstractNodeTask fetch() throws InterruptedException { |
| | | AbstractNodeTask result = null; |
| | | |
| | | // Get the first obj from waitingQueue which is |
| | | // not in workingList yet. |
| | | do { |
| | | int waitingSize = waitingQueue.size(); |
| | | int i = 0; |
| | | while ((i < waitingSize) && !canBeFetched(i)) { |
| | | i++; |
| | | } |
| | | if (i == waitingSize) { // Nothing found |
| | | wait(); |
| | | } |
| | | else { |
| | | result = waitingQueue.get(i); |
| | | waitingQueue.remove(i); |
| | | workingList.put(result.getNode(), result); |
| | | } |
| | | } |
| | | while (result == null); |
| | | |
| | | // System.out.println("Fetched " + result + " from " + _name); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * Whether the task in the waiting queue i can be fetched. |
| | | * @param i the index of the task. |
| | | * @return <CODE>true</CODE> if the task can be fetched and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | private boolean canBeFetched(int i) { |
| | | AbstractNodeTask task = waitingQueue.get(i); |
| | | return workingList.get(task.getNode()) == null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Flush an object from this queue. |
| | | * The object is removed from the working sub-queue. |
| | | * @param task the task to be flushed. |
| | | */ |
| | | private synchronized void flush(AbstractNodeTask task) { |
| | | if (task == null) throw new IllegalArgumentException("null argument"); |
| | | workingList.remove(task.getNode()); |
| | | cancelList.remove(task.getNode()); |
| | | notify(); |
| | | // System.out.println("Flushed " + task + " from " + _name); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return the number of object in this queue (i.e. the number of object in |
| | | * both sub-queues). |
| | | * @return the number of objects in this queue. |
| | | */ |
| | | public int size() { |
| | | return waitingQueue.size() + workingList.size(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * The method that is executed by the different threads that are created in |
| | | * the NodeSearchQueue constructor. |
| | | * Basically this method fetches objects from the waiting queue and runs them. |
| | | */ |
| | | public void run() { |
| | | boolean interrupted = false; |
| | | |
| | | while (!interrupted) { |
| | | try { |
| | | // Fetch and process a node also |
| | | // taking care of update events |
| | | AbstractNodeTask task = fetch(); |
| | | task.run(); |
| | | flush(task); |
| | | } |
| | | catch(InterruptedException x) { |
| | | interrupted = true; |
| | | } |
| | | catch(Exception x) { |
| | | // At this level, either it's an interruption |
| | | // either it's a bug... |
| | | if (! (x instanceof InterruptedException)) { |
| | | x.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.browser; |
| | | |
| | | import javax.naming.NamingException; |
| | | |
| | | import org.opends.messages.Message; |
| | | |
| | | /** |
| | | * The exception that is launched when we exceed the maximum number of hops |
| | | * following referrals. |
| | | * |
| | | */ |
| | | class ReferralLimitExceededException extends NamingException |
| | | { |
| | | private static final long serialVersionUID = -5640515839144837865L; |
| | | |
| | | /** |
| | | * Constructor of the exception. |
| | | * @param message the message associated with the exception. |
| | | */ |
| | | public ReferralLimitExceededException(Message message) |
| | | { |
| | | super(message.toString()); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.browser; |
| | | |
| | | /** |
| | | * The exception used by the NodeRefresher when the refresh process is |
| | | * cancelled, interrupted or something failed. |
| | | * |
| | | */ |
| | | class SearchAbandonException extends Exception { |
| | | |
| | | private static final long serialVersionUID = 7768798649278383859L; |
| | | private NodeRefresher.State state; |
| | | private Exception x; |
| | | private Object arg; |
| | | |
| | | /** |
| | | * The constructor for the class. |
| | | * @param state the state in which the refresher is. |
| | | * @param x the exception. |
| | | * @param arg the argument for the exception. |
| | | */ |
| | | SearchAbandonException(NodeRefresher.State state, Exception x, Object arg) { |
| | | this.state = state; |
| | | this.x = x; |
| | | this.arg = arg; |
| | | } |
| | | |
| | | /** |
| | | * Returns the state the refresher was when the exception occurred. |
| | | * @return the state the refresher was when the exception occurred. |
| | | */ |
| | | NodeRefresher.State getState() { |
| | | return state; |
| | | } |
| | | |
| | | /** |
| | | * Returns the exception. |
| | | * @return the exception. |
| | | */ |
| | | Exception getException() { |
| | | return x; |
| | | } |
| | | |
| | | /** |
| | | * Returns the argument of the exception. |
| | | * @return the argument of the exception. |
| | | */ |
| | | Object getArg() { |
| | | return arg; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | |
| | | |
| | | /** |
| | | * Defines the main classes that are you used by the entry browser of the |
| | | * Control Panel. This includes the main browser class (BrowserController), |
| | | * the connection pool (LDAPConnectionPool), specific exceptions, etc. |
| | | * */ |
| | | package org.opends.guitools.controlpanel.browser; |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | /** |
| | | * Abstract class used to describe the configuration of an index. |
| | | * |
| | | */ |
| | | public abstract class AbstractIndexDescriptor implements Comparable |
| | | { |
| | | private String name; |
| | | private BackendDescriptor backend; |
| | | /** |
| | | * Constructor. |
| | | * @param name the name of the index. |
| | | * @param backend the backend where the index is defined. |
| | | */ |
| | | protected AbstractIndexDescriptor(String name, BackendDescriptor backend) |
| | | { |
| | | this.name = name; |
| | | this.backend = backend; |
| | | } |
| | | |
| | | /** |
| | | * Returns the name of the index. |
| | | * @return the name of the index. |
| | | */ |
| | | public String getName() |
| | | { |
| | | return name; |
| | | } |
| | | |
| | | /** |
| | | * Returns the backend where the index is defined. |
| | | * @return the backend where the index is defined. |
| | | */ |
| | | public BackendDescriptor getBackend() |
| | | { |
| | | return backend; |
| | | } |
| | | |
| | | /** |
| | | * Sets which is the backend where the index is defined. |
| | | * @param backend the backend where the index is defined. |
| | | */ |
| | | public void setBackend(BackendDescriptor backend) |
| | | { |
| | | this.backend = backend; |
| | | recalculateHashCode(); |
| | | } |
| | | |
| | | /** |
| | | * Method used to minimize the times the hashcode is calculated. |
| | | * |
| | | */ |
| | | protected abstract void recalculateHashCode(); |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | import java.util.TreeSet; |
| | | |
| | | import org.opends.messages.AdminToolMessages; |
| | | import org.opends.messages.Message; |
| | | |
| | | /** |
| | | * Table Model used to store information about indexes. It is used basically |
| | | * by the tables that appear on the right side of the 'Manage Indexes...' |
| | | * dialog when the user clicks on 'Indexes' or 'VLV Indexes'. |
| | | * |
| | | */ |
| | | public abstract class AbstractIndexTableModel extends SortableTableModel |
| | | implements Comparator<AbstractIndexDescriptor> |
| | | { |
| | | private Set<AbstractIndexDescriptor> data = |
| | | new HashSet<AbstractIndexDescriptor>(); |
| | | private ArrayList<String[]> dataArray = |
| | | new ArrayList<String[]>(); |
| | | private ArrayList<AbstractIndexDescriptor> indexArray = |
| | | new ArrayList<AbstractIndexDescriptor>(); |
| | | private final String[] COLUMN_NAMES = getColumnNames(); |
| | | /** |
| | | * The sort column of the table. |
| | | */ |
| | | protected int sortColumn = 0; |
| | | /** |
| | | * Whether the sorting is ascending or descending. |
| | | */ |
| | | protected boolean sortAscending = true; |
| | | private ControlPanelInfo info; |
| | | |
| | | |
| | | /** |
| | | * Sets the data for this table model. |
| | | * @param newData the data for this table model. |
| | | * @param info the control panel info. |
| | | */ |
| | | public void setData(Set<AbstractIndexDescriptor> newData, |
| | | ControlPanelInfo info) |
| | | { |
| | | this.info = info; |
| | | if (!newData.equals(data)) |
| | | { |
| | | data.clear(); |
| | | data.addAll(newData); |
| | | updateDataArray(); |
| | | fireTableDataChanged(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Updates the table model contents and sorts its contents depending on the |
| | | * sort options set by the user. |
| | | */ |
| | | public void forceResort() |
| | | { |
| | | updateDataArray(); |
| | | fireTableDataChanged(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int getColumnCount() |
| | | { |
| | | return COLUMN_NAMES.length; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int getRowCount() |
| | | { |
| | | return dataArray.size(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Object getValueAt(int row, int col) |
| | | { |
| | | return dataArray.get(row)[col]; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public String getColumnName(int col) { |
| | | return COLUMN_NAMES[col]; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns whether the sort is ascending or descending. |
| | | * @return <CODE>true</CODE> if the sort is ascending and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public boolean isSortAscending() |
| | | { |
| | | return sortAscending; |
| | | } |
| | | |
| | | /** |
| | | * Sets whether to sort ascending of descending. |
| | | * @param sortAscending whether to sort ascending or descending. |
| | | */ |
| | | public void setSortAscending(boolean sortAscending) |
| | | { |
| | | this.sortAscending = sortAscending; |
| | | } |
| | | |
| | | /** |
| | | * Returns the column index used to sort. |
| | | * @return the column index used to sort. |
| | | */ |
| | | public int getSortColumn() |
| | | { |
| | | return sortColumn; |
| | | } |
| | | |
| | | /** |
| | | * Sets the column index used to sort. |
| | | * @param sortColumn column index used to sort.. |
| | | */ |
| | | public void setSortColumn(int sortColumn) |
| | | { |
| | | this.sortColumn = sortColumn; |
| | | } |
| | | |
| | | /** |
| | | * Returns the index in the specified row. |
| | | * @param row the row. |
| | | * @return the index in the specified row. |
| | | */ |
| | | public AbstractIndexDescriptor getIndexAt(int row) |
| | | { |
| | | return indexArray.get(row); |
| | | } |
| | | |
| | | /** |
| | | * Returns the message to be displayed in the cell if an index must be |
| | | * rebuilt. |
| | | * @param index the index to be analyzed. |
| | | * @return the message to be displayed in the cell if an index must be |
| | | * rebuilt. |
| | | */ |
| | | protected Message getRebuildRequiredString(AbstractIndexDescriptor index) |
| | | { |
| | | if (info.mustReindex(index)) |
| | | { |
| | | return AdminToolMessages.INFO_INDEX_MUST_BE_REBUILT_CELL_VALUE.get(); |
| | | } |
| | | else |
| | | { |
| | | return AdminToolMessages.INFO_INDEX_MUST_NOT_BE_REBUILT_CELL_VALUE.get(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Compares the names of the two indexes. |
| | | * @param i1 the first index. |
| | | * @param i2 the second index. |
| | | * @return the alphabetical comparison of the names of both indexes. |
| | | */ |
| | | protected int compareNames(AbstractIndexDescriptor i1, |
| | | AbstractIndexDescriptor i2) |
| | | { |
| | | return i1.getName().compareTo(i2.getName()); |
| | | } |
| | | |
| | | /** |
| | | * Compares the rebuild messages for the two indexes. |
| | | * @param i1 the first index. |
| | | * @param i2 the second index. |
| | | * @return the alphabetical comparison of the rebuild required message of both |
| | | * indexes. |
| | | */ |
| | | protected int compareRebuildRequired(AbstractIndexDescriptor i1, |
| | | AbstractIndexDescriptor i2) |
| | | { |
| | | return getRebuildRequiredString(i1).compareTo(getRebuildRequiredString(i2)); |
| | | } |
| | | |
| | | /** |
| | | * Updates the array data. This includes resorting it. |
| | | */ |
| | | private void updateDataArray() |
| | | { |
| | | TreeSet<AbstractIndexDescriptor> sortedSet = |
| | | new TreeSet<AbstractIndexDescriptor>(this); |
| | | sortedSet.addAll(data); |
| | | dataArray.clear(); |
| | | indexArray.clear(); |
| | | for (AbstractIndexDescriptor index : sortedSet) |
| | | { |
| | | String[] s = getLine(index); |
| | | dataArray.add(s); |
| | | indexArray.add(index); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the column names of the table. |
| | | * @return the column names of the table. |
| | | */ |
| | | protected abstract String[] getColumnNames(); |
| | | /** |
| | | * Returns the different cell values for a given index in a String array. |
| | | * @param index the index. |
| | | * @return the different cell values for a given index in a String array. |
| | | */ |
| | | protected abstract String[] getLine(AbstractIndexDescriptor index); |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import org.opends.guitools.controlpanel.ui.StatusGenericPanel; |
| | | import org.opends.messages.Message; |
| | | |
| | | /** |
| | | * The class that is used by the different action buttons on the left side of |
| | | * the main ControlPanel dialog. |
| | | * |
| | | */ |
| | | public class Action |
| | | { |
| | | private Message name; |
| | | |
| | | private Class<? extends StatusGenericPanel> associatedPanel; |
| | | |
| | | /** |
| | | * Returns the name of the action. |
| | | * @return the name of the action. |
| | | */ |
| | | public Message getName() |
| | | { |
| | | return name; |
| | | } |
| | | |
| | | /** |
| | | * Sets the name of the action. |
| | | * @param name the name of the action. |
| | | */ |
| | | public void setName(Message name) |
| | | { |
| | | this.name = name; |
| | | } |
| | | |
| | | /** |
| | | * Returns the class of the panel that is associated with this action |
| | | * (for instance the NewBaseDNPanel class is associated with the 'New |
| | | * Base DN' action. |
| | | * @return the class of the panel that is associated with this action. |
| | | */ |
| | | public Class<? extends StatusGenericPanel> getAssociatedPanelClass() |
| | | { |
| | | return associatedPanel; |
| | | } |
| | | |
| | | /** |
| | | * Sets the class of the panel that is associated with this action. |
| | | * @param associatedPanel the class of the panel that is associated with this |
| | | * action. |
| | | */ |
| | | public void setAssociatedPanel( |
| | | Class<? extends StatusGenericPanel> associatedPanel) |
| | | { |
| | | this.associatedPanel = associatedPanel; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.Set; |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | | |
| | | import org.opends.admin.ads.ADSContext; |
| | | |
| | | /** |
| | | * The class that describes the backend configuration. |
| | | * |
| | | */ |
| | | public class BackendDescriptor |
| | | { |
| | | private String backendID; |
| | | private SortedSet<BaseDNDescriptor> baseDns = new TreeSet<BaseDNDescriptor>(); |
| | | private SortedSet<IndexDescriptor> indexes = new TreeSet<IndexDescriptor>(); |
| | | private SortedSet<VLVIndexDescriptor> vlvIndexes = |
| | | new TreeSet<VLVIndexDescriptor>(); |
| | | private int entries; |
| | | private boolean isConfigBackend; |
| | | private boolean isEnabled; |
| | | private Type type; |
| | | private int hashCode; |
| | | |
| | | /** |
| | | * An enumeration describing the type of backend. |
| | | */ |
| | | public enum Type |
| | | { |
| | | /** |
| | | * The backend is a local backend. |
| | | */ |
| | | LOCAL_DB, |
| | | /** |
| | | * The backend is a LDIF backend. |
| | | */ |
| | | LDIF, |
| | | /** |
| | | * The backend is a memory backend. |
| | | */ |
| | | MEMORY, |
| | | /** |
| | | * The backend is a backup backend. |
| | | */ |
| | | BACKUP, |
| | | /** |
| | | * The backend is a monitor backend. |
| | | */ |
| | | MONITOR, |
| | | /** |
| | | * The backend is a task backend. |
| | | */ |
| | | TASK, |
| | | /** |
| | | * The backend is another type of backend (for instance user defined). |
| | | */ |
| | | OTHER |
| | | }; |
| | | |
| | | /** |
| | | * Constructor for this class. |
| | | * @param backendID the backend ID of the Backend. |
| | | * @param baseDns the base DNs associated with the Backend. |
| | | * @param indexes the indexes defined in the backend. |
| | | * @param vlvIndexes the VLV indexes defined in the backend. |
| | | * @param entries the number of entries in the Backend. |
| | | * @param isEnabled whether the backend is enabled or not. |
| | | * @param type the type of the backend. |
| | | */ |
| | | public BackendDescriptor(String backendID, |
| | | Set<BaseDNDescriptor> baseDns, |
| | | Set<IndexDescriptor> indexes, |
| | | Set<VLVIndexDescriptor> vlvIndexes, |
| | | int entries, boolean isEnabled, Type type) |
| | | { |
| | | this.backendID = backendID; |
| | | this.baseDns.addAll(baseDns); |
| | | this.indexes.addAll(indexes); |
| | | this.vlvIndexes.addAll(vlvIndexes); |
| | | this.entries = entries; |
| | | isConfigBackend = isConfigBackend(backendID); |
| | | this.type = type; |
| | | this.isEnabled = isEnabled; |
| | | updateBaseDnsAndIndexes(); |
| | | recalculateHashCode(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the ID of the Backend. |
| | | * @return the ID of the Backend. |
| | | */ |
| | | public String getBackendID() |
| | | { |
| | | return backendID; |
| | | } |
| | | |
| | | /** |
| | | * Returns the Base DN objects associated with the backend. |
| | | * @return the Base DN objects associated with the backend. |
| | | */ |
| | | public SortedSet<BaseDNDescriptor> getBaseDns() |
| | | { |
| | | return Collections.unmodifiableSortedSet(baseDns); |
| | | } |
| | | |
| | | /** |
| | | * Returns the vlv index objects associated with the backend. |
| | | * @return the vlv index objects associated with the backend. |
| | | */ |
| | | public SortedSet<VLVIndexDescriptor> getVLVIndexes() |
| | | { |
| | | return Collections.unmodifiableSortedSet(vlvIndexes); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns the index objects associated with the backend. |
| | | * @return the index objects associated with the backend. |
| | | */ |
| | | public SortedSet<IndexDescriptor> getIndexes() |
| | | { |
| | | return Collections.unmodifiableSortedSet(indexes); |
| | | } |
| | | |
| | | /** |
| | | * Return the number of entries in the backend. |
| | | * -1 indicates that the number of entries could not be found. |
| | | * @return the number of entries in the backend. |
| | | */ |
| | | public int getEntries() |
| | | { |
| | | return entries; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean equals(Object v) |
| | | { |
| | | boolean equals = false; |
| | | if (this != v) |
| | | { |
| | | if (v instanceof BackendDescriptor) |
| | | { |
| | | BackendDescriptor desc = (BackendDescriptor)v; |
| | | equals = getBackendID().equals(desc.getBackendID()) && |
| | | (getEntries() == desc.getEntries()); |
| | | |
| | | if (equals) |
| | | { |
| | | equals = desc.getBaseDns().equals(getBaseDns()); |
| | | } |
| | | |
| | | if (equals) |
| | | { |
| | | equals = desc.getIndexes().equals(getIndexes()); |
| | | } |
| | | |
| | | if (equals) |
| | | { |
| | | equals = desc.getVLVIndexes().equals(getVLVIndexes()); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | equals = true; |
| | | } |
| | | return equals; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int hashCode() |
| | | { |
| | | return hashCode; |
| | | } |
| | | |
| | | /** |
| | | * Method called when one of the elements that affect the value of the |
| | | * hashcode is modified. It is used to minimize the time spent calculating |
| | | * hashCode. |
| | | * |
| | | */ |
| | | private void recalculateHashCode() |
| | | { |
| | | hashCode = 0; |
| | | for (BaseDNDescriptor rep: getBaseDns()) |
| | | { |
| | | hashCode += rep.hashCode(); |
| | | } |
| | | hashCode += entries; |
| | | for (IndexDescriptor index : indexes) |
| | | { |
| | | hashCode += index.hashCode(); |
| | | } |
| | | for (VLVIndexDescriptor index : vlvIndexes) |
| | | { |
| | | hashCode += index.hashCode(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Updates the base DNs and indexes contained in this backend so that they |
| | | * have a reference to this backend. |
| | | * |
| | | */ |
| | | private void updateBaseDnsAndIndexes() |
| | | { |
| | | for (BaseDNDescriptor baseDN : baseDns) |
| | | { |
| | | baseDN.setBackend(this); |
| | | } |
| | | for (AbstractIndexDescriptor index : indexes) |
| | | { |
| | | index.setBackend(this); |
| | | } |
| | | for (AbstractIndexDescriptor index : vlvIndexes) |
| | | { |
| | | index.setBackend(this); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * An convenience method to know if the provided ID corresponds to a |
| | | * configuration backend or not. |
| | | * @param id the backend ID to analyze |
| | | * @return <CODE>true</CODE> if the the id corresponds to a configuration |
| | | * backend and <CODE>false</CODE> otherwise. |
| | | */ |
| | | private boolean isConfigBackend(String id) |
| | | { |
| | | return "tasks".equalsIgnoreCase(id) || |
| | | "schema".equalsIgnoreCase(id) || |
| | | "config".equalsIgnoreCase(id) || |
| | | "monitor".equalsIgnoreCase(id) || |
| | | "backup".equalsIgnoreCase(id) || |
| | | ADSContext.getDefaultBackendName().equalsIgnoreCase(id) || |
| | | "ads-truststore".equalsIgnoreCase(id) || |
| | | "replicationchanges".equalsIgnoreCase(id); |
| | | } |
| | | |
| | | /** |
| | | * Tells whether this is a configuration backend or not. |
| | | * @return <CODE>true</CODE> if this is a configuration backend and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean isConfigBackend() |
| | | { |
| | | return isConfigBackend; |
| | | } |
| | | |
| | | /** |
| | | * Sets the number of entries contained in this backend. |
| | | * @param entries the number of entries contained in this backend. |
| | | */ |
| | | public void setEntries(int entries) |
| | | { |
| | | this.entries = entries; |
| | | |
| | | // Recalculate hashCode |
| | | recalculateHashCode(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the type of the backend. |
| | | * @return the type of the backend. |
| | | */ |
| | | public Type getType() |
| | | { |
| | | return type; |
| | | } |
| | | |
| | | /** |
| | | * Tells whether this backend is enabled or not. |
| | | * @return <CODE>true</CODE> if this is backend is enabled |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean isEnabled() |
| | | { |
| | | return isEnabled; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import java.io.File; |
| | | import java.util.Date; |
| | | |
| | | import org.opends.server.types.BackupInfo; |
| | | |
| | | /** |
| | | * Class used to describe a backup. |
| | | */ |
| | | public class BackupDescriptor |
| | | { |
| | | /** |
| | | * The different types of backups. |
| | | * |
| | | */ |
| | | public enum Type |
| | | { |
| | | /** |
| | | * Full backup. |
| | | */ |
| | | FULL, |
| | | /** |
| | | * Incremental backup. |
| | | */ |
| | | INCREMENTAL |
| | | }; |
| | | private Type type; |
| | | private Date creationDate; |
| | | private File path; |
| | | private String id; |
| | | private BackupInfo info; |
| | | |
| | | /** |
| | | * The BackupDescriptor constructor. |
| | | * @param path the directory where the backup is located. |
| | | * @param creationDate the date of creation of the backup. |
| | | * @param type the type of backup. |
| | | * @param id the backup id. |
| | | */ |
| | | public BackupDescriptor(File path, Date creationDate, Type type, String id) |
| | | { |
| | | this.path = path; |
| | | this.creationDate = creationDate; |
| | | this.type = type; |
| | | this.id = id; |
| | | } |
| | | |
| | | /** |
| | | * The BackupDescriptor generated using a BackupInfo object. |
| | | * @param info the BackupInfo object that contains all the information about |
| | | * the backup. |
| | | */ |
| | | public BackupDescriptor(BackupInfo info) |
| | | { |
| | | this.path = new File(info.getBackupDirectory().getPath()); |
| | | this.creationDate = info.getBackupDate(); |
| | | this.type = info.isIncremental() ? Type.INCREMENTAL : Type.FULL; |
| | | this.id = info.getBackupID(); |
| | | this.info = info; |
| | | } |
| | | |
| | | /** |
| | | * Returns the creation date of the backup. |
| | | * @return the creation date of the backup. |
| | | */ |
| | | public Date getCreationDate() |
| | | { |
| | | return creationDate; |
| | | } |
| | | |
| | | /** |
| | | * Returns the directory where the backup is located. |
| | | * @return the directory where the backup is located. |
| | | */ |
| | | public File getPath() |
| | | { |
| | | return path; |
| | | } |
| | | |
| | | /** |
| | | * Returns the type of the backup. |
| | | * @return the type of the backup. |
| | | */ |
| | | public Type getType() |
| | | { |
| | | return type; |
| | | } |
| | | |
| | | /** |
| | | * Returns the backup ID. |
| | | * @return the backup ID. |
| | | */ |
| | | public String getID() |
| | | { |
| | | return id; |
| | | } |
| | | |
| | | /** |
| | | * Returns the BackupInfo object associated with this backup. It might be |
| | | * <CODE>null</CODE>. |
| | | * @return the BackupInfo object associated with this backup. |
| | | */ |
| | | public BackupInfo getBackupInfo() |
| | | { |
| | | return info; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import java.util.ArrayList; |
| | | |
| | | import javax.swing.table.AbstractTableModel; |
| | | |
| | | /** |
| | | * The table used to display the backups. |
| | | * |
| | | */ |
| | | public class BackupTableModel extends AbstractTableModel |
| | | { |
| | | private static final long serialVersionUID = -3511425157550147124L; |
| | | private ArrayList<BackupDescriptor> backups = |
| | | new ArrayList<BackupDescriptor>(); |
| | | /** |
| | | * Clears the contents ot the table model. |
| | | * |
| | | */ |
| | | public void clear() |
| | | { |
| | | backups.clear(); |
| | | } |
| | | |
| | | /** |
| | | * Adds a backup to the model. |
| | | * @param backup the backup to be added. |
| | | */ |
| | | public void add(BackupDescriptor backup) |
| | | { |
| | | backups.add(backup); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Object getValueAt(int row, int column) |
| | | { |
| | | switch (column) |
| | | { |
| | | case 0: |
| | | return get(row).getID(); |
| | | case 1: |
| | | return get(row).getPath(); |
| | | case 2: |
| | | return get(row).getCreationDate(); |
| | | case 3: |
| | | return get(row).getType(); |
| | | default: |
| | | throw new IllegalArgumentException("Invalid column: "+column); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns the row count. |
| | | * @return the row count. |
| | | */ |
| | | public int getRowCount() |
| | | { |
| | | return backups.size(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the column count. |
| | | * @return the column count. |
| | | */ |
| | | public int getColumnCount() |
| | | { |
| | | return 4; |
| | | } |
| | | |
| | | /** |
| | | * Gets the BackupDescriptor in a given row. |
| | | * @param row the row. |
| | | * @return the BackupDescriptor in a given row. |
| | | */ |
| | | public BackupDescriptor get(int row) |
| | | { |
| | | return backups.get(row); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import org.opends.server.types.DN; |
| | | |
| | | |
| | | /** |
| | | * This class is used to represent a Base DN / Replica and is aimed to be |
| | | * used by the classes in the BackendTableModel class. |
| | | * |
| | | */ |
| | | public class BaseDNDescriptor implements Comparable |
| | | { |
| | | /** |
| | | * An enumeration describing the type of base DN for a given backend. |
| | | */ |
| | | public enum Type |
| | | { |
| | | /** |
| | | * The base DN is not replicated. |
| | | */ |
| | | NOT_REPLICATED, |
| | | /** |
| | | * The base DN is replicated. |
| | | */ |
| | | REPLICATED |
| | | }; |
| | | |
| | | private int nEntries; |
| | | private int missingChanges; |
| | | private BackendDescriptor backend; |
| | | private long ageOfOldestMissingChange; |
| | | private Type type; |
| | | private DN baseDn; |
| | | private int replicaID = -1; |
| | | |
| | | private int hashCode; |
| | | |
| | | /** |
| | | * Constructor for this class. |
| | | * @param type the type of replication. |
| | | * @param baseDn the base DN associated with the Replication. |
| | | * @param backend the backend containing this base DN. |
| | | * @param nEntries the number of entries for the base DN. |
| | | * @param ageOfOldestMissingChange the number of missing changes. |
| | | * @param missingChanges the number of missing changes. |
| | | */ |
| | | public BaseDNDescriptor(Type type, DN baseDn, BackendDescriptor backend, |
| | | int nEntries, long ageOfOldestMissingChange, int missingChanges) |
| | | { |
| | | this.baseDn = baseDn; |
| | | this.backend = backend; |
| | | this.type = type; |
| | | this.nEntries = nEntries; |
| | | this.ageOfOldestMissingChange = ageOfOldestMissingChange; |
| | | this.missingChanges = missingChanges; |
| | | |
| | | if (backend != null) |
| | | { |
| | | recalculateHashCode(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Return the String DN associated with the base DN.. |
| | | * @return the String DN associated with the base DN. |
| | | */ |
| | | public DN getDn() |
| | | { |
| | | return baseDn; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean equals(Object v) |
| | | { |
| | | boolean equals = false; |
| | | if (this != v) |
| | | { |
| | | if (v instanceof BaseDNDescriptor) |
| | | { |
| | | BaseDNDescriptor desc = (BaseDNDescriptor)v; |
| | | equals = (getType() == desc.getType()) && |
| | | getDn().equals(desc.getDn()) && |
| | | (getAgeOfOldestMissingChange() == desc.getAgeOfOldestMissingChange()) && |
| | | (getMissingChanges() == desc.getMissingChanges()) && |
| | | getBackend().getBackendID().equals( |
| | | desc.getBackend().getBackendID()) && |
| | | (getEntries() == desc.getEntries()); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | equals = true; |
| | | } |
| | | return equals; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int hashCode() |
| | | { |
| | | return hashCode; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int compareTo(Object o) |
| | | { |
| | | int returnValue = -1; |
| | | if (o instanceof BaseDNDescriptor) |
| | | { |
| | | BaseDNDescriptor desc = (BaseDNDescriptor)o; |
| | | returnValue = desc.getDn().compareTo(getDn()); |
| | | } |
| | | return returnValue; |
| | | } |
| | | |
| | | /** |
| | | * Returns the number of entries in the backend for this base DN. |
| | | * @return the number of entries in the backend for this base DN. |
| | | */ |
| | | public int getEntries() |
| | | { |
| | | return nEntries; |
| | | } |
| | | |
| | | /** |
| | | * Returns the number of missing changes in the replication topology for |
| | | * this base DN. |
| | | * @return the number of missing changes in the replication topology for |
| | | * this base DN. |
| | | */ |
| | | public int getMissingChanges() |
| | | { |
| | | return missingChanges; |
| | | } |
| | | |
| | | /** |
| | | * Sets the number of missing changes in the replication topology for |
| | | * this base DN. |
| | | * @param missingChanges the missing changes. |
| | | */ |
| | | public void setMissingChanges(int missingChanges) |
| | | { |
| | | this.missingChanges = missingChanges; |
| | | recalculateHashCode(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the age of the oldest missing change in seconds in the |
| | | * replication topology for this base DN. |
| | | * @return the age of the oldest missing change in seconds in the |
| | | * replication topology for this base DN. |
| | | */ |
| | | public long getAgeOfOldestMissingChange() |
| | | { |
| | | return ageOfOldestMissingChange; |
| | | } |
| | | |
| | | /** |
| | | * Sets the age of the oldest missing change in seconds in the |
| | | * replication topology for this base DN. |
| | | * @param ageOfOldestMissingChange the age of the oldest missing change in |
| | | * seconds in the replication topology for this base DN. |
| | | */ |
| | | public void setAgeOfOldestMissingChange(long ageOfOldestMissingChange) |
| | | { |
| | | this.ageOfOldestMissingChange = ageOfOldestMissingChange; |
| | | recalculateHashCode(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the type for this base DN. |
| | | * @return the type for this base DN. |
| | | */ |
| | | public Type getType() |
| | | { |
| | | return type; |
| | | } |
| | | |
| | | /** |
| | | * Returns the backend where this base DN is defined. |
| | | * @return the backend where this base DN is defined. |
| | | */ |
| | | public BackendDescriptor getBackend() |
| | | { |
| | | return backend; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Sets the backend of this base DN. |
| | | * @param backend the backend for this base DN. |
| | | */ |
| | | public void setBackend(BackendDescriptor backend) |
| | | { |
| | | this.backend = backend; |
| | | recalculateHashCode(); |
| | | } |
| | | |
| | | /** |
| | | * Sets the type of this base DN. |
| | | * @param type the new type for this base DN. |
| | | */ |
| | | public void setType(Type type) |
| | | { |
| | | this.type = type; |
| | | recalculateHashCode(); |
| | | } |
| | | |
| | | /** |
| | | * Sets the number of entries for this base DN in this database. |
| | | * @param nEntries the number of entries. |
| | | */ |
| | | public void setEntries(int nEntries) |
| | | { |
| | | this.nEntries = nEntries; |
| | | recalculateHashCode(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the ID of the replication domain associated with this base DN. -1 |
| | | * if this base DN is not replicated. |
| | | * @return the ID of the replication domain associated with this base DN. |
| | | */ |
| | | public int getReplicaID() |
| | | { |
| | | return replicaID; |
| | | } |
| | | |
| | | /** |
| | | * Sets the ID of the replication domain associated with this base DN. |
| | | * @param replicaID the ID of the replication domain associated with this base |
| | | * DN. |
| | | */ |
| | | public void setReplicaID(int replicaID) |
| | | { |
| | | this.replicaID = replicaID; |
| | | recalculateHashCode(); |
| | | } |
| | | |
| | | /** |
| | | * Method called when one of the elements that affect the value of the |
| | | * hashcode is modified. It is used to minimize the time spent calculating |
| | | * hashCode. |
| | | * |
| | | */ |
| | | private void recalculateHashCode() |
| | | { |
| | | hashCode = (getType().toString() + getAgeOfOldestMissingChange() + |
| | | getDn() + |
| | | getBackend().getBackendID() + getMissingChanges()).hashCode(); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | import java.util.TreeSet; |
| | | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.messages.Message; |
| | | |
| | | /** |
| | | * The table model used to display all the base DNs. |
| | | * |
| | | */ |
| | | public class BaseDNTableModel extends SortableTableModel |
| | | implements Comparator<BaseDNDescriptor> |
| | | { |
| | | private static final long serialVersionUID = -5650762484071136983L; |
| | | private HashSet<BaseDNDescriptor> data = new HashSet<BaseDNDescriptor>(); |
| | | private ServerDescriptor.ServerStatus serverStatus; |
| | | private boolean isAuthenticated; |
| | | |
| | | private ArrayList<String[]> dataArray = |
| | | new ArrayList<String[]>(); |
| | | private String[] COLUMN_NAMES; |
| | | private int sortColumn = 0; |
| | | private boolean sortAscending = true; |
| | | private boolean displayReplicationInformation; |
| | | |
| | | /** |
| | | * Key value to identify the case of a value not available because the server |
| | | * is down. |
| | | */ |
| | | public static String NOT_AVAILABLE_SERVER_DOWN = "NOT_AVAILABLE_SERVER_DOWN"; |
| | | |
| | | /** |
| | | * Key value to identify the case of a value not available because |
| | | * authentication is required. |
| | | */ |
| | | public static String NOT_AVAILABLE_AUTHENTICATION_REQUIRED = |
| | | "NOT_AVAILABLE_AUTHENTICATION_REQUIRED"; |
| | | |
| | | /** |
| | | * Key value to identify the case of a value not available. |
| | | */ |
| | | public static String NOT_AVAILABLE = "NOT_AVAILABLE"; |
| | | |
| | | /** |
| | | * Constructor for this table model. |
| | | * @param displayReplicationInformation whether to display replication. |
| | | * monitoring information or not. |
| | | */ |
| | | public BaseDNTableModel(boolean displayReplicationInformation) |
| | | { |
| | | this(displayReplicationInformation, true); |
| | | } |
| | | |
| | | /** |
| | | * Constructor for this table model. |
| | | * @param displayReplicationInformation whether to display replication. |
| | | * @param wrapHeader whether to wrap the headers or not. |
| | | * monitoring information or not. |
| | | */ |
| | | public BaseDNTableModel(boolean displayReplicationInformation, |
| | | boolean wrapHeader) |
| | | { |
| | | this.displayReplicationInformation = displayReplicationInformation; |
| | | if (wrapHeader) |
| | | { |
| | | COLUMN_NAMES = new String[] { |
| | | getHeader(INFO_BASEDN_COLUMN.get()), |
| | | getHeader(INFO_BACKENDID_COLUMN.get()), |
| | | getHeader(INFO_NUMBER_ENTRIES_COLUMN.get()), |
| | | getHeader(INFO_REPLICATED_COLUMN.get()), |
| | | getHeader(INFO_MISSING_CHANGES_COLUMN.get()), |
| | | getHeader(INFO_AGE_OF_OLDEST_MISSING_CHANGE_COLUMN.get()) |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | COLUMN_NAMES = new String[] { |
| | | INFO_BASEDN_COLUMN.get().toString(), |
| | | INFO_BACKENDID_COLUMN.get().toString(), |
| | | INFO_NUMBER_ENTRIES_COLUMN.get().toString(), |
| | | INFO_REPLICATED_COLUMN.get().toString(), |
| | | INFO_MISSING_CHANGES_COLUMN.get().toString(), |
| | | INFO_AGE_OF_OLDEST_MISSING_CHANGE_COLUMN.get().toString() |
| | | }; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Sets the data for this table model. |
| | | * @param newData the data for this table model. |
| | | * @param status the server status. |
| | | * @param isAuthenticated whether the user provided authentication or not. |
| | | */ |
| | | public void setData(Set<BaseDNDescriptor> newData, |
| | | ServerDescriptor.ServerStatus status, boolean isAuthenticated) |
| | | { |
| | | if (!newData.equals(data) || (serverStatus != status) || |
| | | (this.isAuthenticated != isAuthenticated)) |
| | | { |
| | | serverStatus = status; |
| | | this.isAuthenticated = isAuthenticated; |
| | | data.clear(); |
| | | data.addAll(newData); |
| | | updateDataArray(); |
| | | fireTableDataChanged(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Updates the table model contents and sorts its contents depending on the |
| | | * sort options set by the user. |
| | | */ |
| | | public void forceResort() |
| | | { |
| | | updateDataArray(); |
| | | fireTableDataChanged(); |
| | | } |
| | | |
| | | /** |
| | | * Comparable implementation. |
| | | * @param desc1 the first replica descriptor to compare. |
| | | * @param desc2 the second replica descriptor to compare. |
| | | * @return 1 if according to the sorting options set by the user the first |
| | | * base DN descriptor must be put before the second descriptor, 0 if they |
| | | * are equivalent in terms of sorting and -1 if the second descriptor must |
| | | * be put before the first descriptor. |
| | | */ |
| | | public int compare(BaseDNDescriptor desc1, BaseDNDescriptor desc2) |
| | | { |
| | | int result = 0; |
| | | if (sortColumn == 0) |
| | | { |
| | | result = compareDns(desc1, desc2); |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareBackendIDs(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareEntries(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareRepl(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareMissingChanges(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareAgeOfOldestMissingChange(desc1, desc2); |
| | | } |
| | | } |
| | | |
| | | if (sortColumn == 1) |
| | | { |
| | | result = compareBackendIDs(desc1, desc2); |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareDns(desc1, desc2); |
| | | |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareEntries(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareRepl(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareMissingChanges(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareAgeOfOldestMissingChange(desc1, desc2); |
| | | } |
| | | } |
| | | else if (sortColumn == 2) |
| | | { |
| | | result = compareEntries(desc1, desc2); |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareBackendIDs(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareDns(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareRepl(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareMissingChanges(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareAgeOfOldestMissingChange(desc1, desc2); |
| | | } |
| | | } |
| | | else if (sortColumn == 3) |
| | | { |
| | | result = compareRepl(desc1, desc2); |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareBackendIDs(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareDns(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareEntries(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareMissingChanges(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareAgeOfOldestMissingChange(desc1, desc2); |
| | | } |
| | | } |
| | | else if (sortColumn == 4) |
| | | { |
| | | result = compareMissingChanges(desc1, desc2); |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareBackendIDs(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareDns(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareEntries(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareRepl(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareAgeOfOldestMissingChange(desc1, desc2); |
| | | } |
| | | } |
| | | else if (sortColumn == 5) |
| | | { |
| | | result = compareAgeOfOldestMissingChange(desc1, desc2); |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareBackendIDs(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareDns(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareEntries(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareRepl(desc1, desc2); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = compareMissingChanges(desc1, desc2); |
| | | } |
| | | } |
| | | |
| | | if (!sortAscending) |
| | | { |
| | | result = -result; |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int getColumnCount() |
| | | { |
| | | return displayReplicationInformation ? 6 : 4; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int getRowCount() |
| | | { |
| | | return dataArray.size(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Object getValueAt(int row, int col) |
| | | { |
| | | return dataArray.get(row)[col]; |
| | | } |
| | | |
| | | /** |
| | | * Updates the array data. This includes resorting it. |
| | | */ |
| | | private void updateDataArray() |
| | | { |
| | | TreeSet<BaseDNDescriptor> sortedSet = new TreeSet<BaseDNDescriptor>(this); |
| | | sortedSet.addAll(data); |
| | | dataArray.clear(); |
| | | for (BaseDNDescriptor desc : sortedSet) |
| | | { |
| | | String[] s = new String[6]; |
| | | |
| | | s[0] = Utilities.unescapeUtf8(desc.getDn().toString()); |
| | | |
| | | s[1] = desc.getBackend().getBackendID(); |
| | | |
| | | s[2] = getValueForEntries(desc); |
| | | |
| | | s[3] = getStringForReplState(desc); |
| | | |
| | | s[4] = getValueForMissingChanges(desc); |
| | | |
| | | s[5] = getValueForOldestMissingChange(desc); |
| | | |
| | | dataArray.add(s); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public String getColumnName(int col) { |
| | | return COLUMN_NAMES[col]; |
| | | } |
| | | |
| | | /** |
| | | * Returns whether the sort is ascending or descending. |
| | | * @return <CODE>true</CODE> if the sort is ascending and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public boolean isSortAscending() |
| | | { |
| | | return sortAscending; |
| | | } |
| | | |
| | | /** |
| | | * Sets whether to sort ascending of descending. |
| | | * @param sortAscending whether to sort ascending or descending. |
| | | */ |
| | | public void setSortAscending(boolean sortAscending) |
| | | { |
| | | this.sortAscending = sortAscending; |
| | | } |
| | | |
| | | /** |
| | | * Returns the column index used to sort. |
| | | * @return the column index used to sort. |
| | | */ |
| | | public int getSortColumn() |
| | | { |
| | | return sortColumn; |
| | | } |
| | | |
| | | /** |
| | | * Sets the column index used to sort. |
| | | * @param sortColumn column index used to sort.. |
| | | */ |
| | | public void setSortColumn(int sortColumn) |
| | | { |
| | | this.sortColumn = sortColumn; |
| | | } |
| | | |
| | | /* |
| | | * Several comparison methods to be able to sort the table model. |
| | | */ |
| | | private int compareBackendIDs(BaseDNDescriptor desc1, BaseDNDescriptor desc2) |
| | | { |
| | | return desc1.getBackend().getBackendID().compareTo( |
| | | desc2.getBackend().getBackendID()); |
| | | } |
| | | |
| | | private int compareEntries(BaseDNDescriptor desc1, BaseDNDescriptor desc2) |
| | | { |
| | | int n1 = desc1.getEntries(); |
| | | int n2 = desc2.getEntries(); |
| | | return compareIntegers(n1, n2); |
| | | } |
| | | |
| | | private int compareIntegers(int n1, int n2) |
| | | { |
| | | if (n1 == n2) |
| | | { |
| | | return 0; |
| | | } |
| | | if (n1 > n2) |
| | | { |
| | | return 1; |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | private int compareLongs(long n1, long n2) |
| | | { |
| | | if (n1 == n2) |
| | | { |
| | | return 0; |
| | | } |
| | | if (n1 > n2) |
| | | { |
| | | return 1; |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | private int compareDns(BaseDNDescriptor desc1, BaseDNDescriptor desc2) |
| | | { |
| | | return Utilities.unescapeUtf8(desc1.getDn().toString()).compareTo( |
| | | Utilities.unescapeUtf8(desc2.getDn().toString())); |
| | | } |
| | | |
| | | private int compareRepl(BaseDNDescriptor desc1, BaseDNDescriptor desc2) |
| | | { |
| | | return (String.valueOf(desc1.getType()).compareTo( |
| | | String.valueOf(desc2.getType()))); |
| | | } |
| | | |
| | | private int compareMissingChanges(BaseDNDescriptor desc1, |
| | | BaseDNDescriptor desc2) |
| | | { |
| | | return compareIntegers(desc1.getMissingChanges(), |
| | | desc2.getMissingChanges()); |
| | | } |
| | | |
| | | private int compareAgeOfOldestMissingChange(BaseDNDescriptor desc1, |
| | | BaseDNDescriptor desc2) |
| | | { |
| | | return compareLongs(desc1.getAgeOfOldestMissingChange(), |
| | | desc2.getAgeOfOldestMissingChange()); |
| | | } |
| | | |
| | | /** |
| | | * Returns the Object describing the number of entries of a given Base DN. |
| | | * The Object will be an Integer. |
| | | * @param rep the Base DN object to handle. |
| | | * @return the Object describing the number of entries of a given Base DN. |
| | | */ |
| | | private String getValueForEntries(BaseDNDescriptor rep) |
| | | { |
| | | String returnValue; |
| | | if (serverStatus != ServerDescriptor.ServerStatus.STARTED) |
| | | { |
| | | returnValue = NOT_AVAILABLE_SERVER_DOWN; |
| | | } |
| | | else if (!isAuthenticated) |
| | | { |
| | | returnValue = NOT_AVAILABLE_AUTHENTICATION_REQUIRED; |
| | | } |
| | | else |
| | | { |
| | | if (rep.getEntries() < 0) |
| | | { |
| | | returnValue = NOT_AVAILABLE; |
| | | } |
| | | else |
| | | { |
| | | returnValue = String.valueOf(rep.getEntries()); |
| | | } |
| | | } |
| | | return returnValue; |
| | | } |
| | | |
| | | /** |
| | | * Returns the Object describing the number of missing changes of a given Base |
| | | * DN. The Object will be a String unless the base DN is |
| | | * replicated and we could not find a valid value (in this case we return |
| | | * an Integer with the invalid value). |
| | | * @param rep the Base DN object to handle. |
| | | * @return the Object describing the number of missing changes of |
| | | * a given Base DN. |
| | | */ |
| | | private String getValueForMissingChanges(BaseDNDescriptor rep) |
| | | { |
| | | String returnValue; |
| | | if (rep.getType() == BaseDNDescriptor.Type.REPLICATED) |
| | | { |
| | | if (serverStatus != ServerDescriptor.ServerStatus.STARTED) |
| | | { |
| | | returnValue = NOT_AVAILABLE_SERVER_DOWN; |
| | | } |
| | | else if (!isAuthenticated) |
| | | { |
| | | returnValue = NOT_AVAILABLE_AUTHENTICATION_REQUIRED; |
| | | } |
| | | else |
| | | { |
| | | if (rep.getMissingChanges() < 0) |
| | | { |
| | | returnValue = NOT_AVAILABLE; |
| | | } |
| | | else |
| | | { |
| | | returnValue = String.valueOf(rep.getMissingChanges()); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | returnValue = INFO_NOT_APPLICABLE_LABEL.get().toString(); |
| | | } |
| | | return returnValue; |
| | | } |
| | | |
| | | /** |
| | | * Returns the Object describing the age of oldest missing change of |
| | | * a given Base DN. The Object will be a String unless the base DN is |
| | | * replicated and we could not find a valid value (in this case we return |
| | | * an Integer with the invalid value). |
| | | * @param rep the Base DN object to handle. |
| | | * @return the Object describing the age of oldest missing change of |
| | | * a given Base DN. |
| | | */ |
| | | private String getValueForOldestMissingChange(BaseDNDescriptor rep) |
| | | { |
| | | String returnValue; |
| | | if (rep.getType() == BaseDNDescriptor.Type.REPLICATED) |
| | | { |
| | | if (serverStatus != ServerDescriptor.ServerStatus.STARTED) |
| | | { |
| | | returnValue = NOT_AVAILABLE_SERVER_DOWN; |
| | | } |
| | | else if (!isAuthenticated) |
| | | { |
| | | returnValue = NOT_AVAILABLE_AUTHENTICATION_REQUIRED; |
| | | } |
| | | else |
| | | { |
| | | long age = rep.getAgeOfOldestMissingChange(); |
| | | if (age > 0) |
| | | { |
| | | Date date = new Date(age); |
| | | returnValue = date.toString(); |
| | | } |
| | | else |
| | | { |
| | | // Not available |
| | | returnValue = NOT_AVAILABLE; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | returnValue = INFO_NOT_APPLICABLE_LABEL.get().toString(); |
| | | } |
| | | return returnValue; |
| | | } |
| | | |
| | | /** |
| | | * Returns the localized String describing the replication state of |
| | | * a given Base DN. |
| | | * @param rep the Base DN object to handle. |
| | | * @return the localized String describing the replication state of |
| | | * a given Base DN. |
| | | */ |
| | | private String getStringForReplState(BaseDNDescriptor rep) |
| | | { |
| | | Message s; |
| | | if (rep.getType() == BaseDNDescriptor.Type.REPLICATED) |
| | | { |
| | | s = INFO_BASEDN_REPLICATED_LABEL.get(); |
| | | } |
| | | else |
| | | { |
| | | s = INFO_BASEDN_NOT_REPLICATED_LABEL.get(); |
| | | } |
| | | return s.toString(); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import java.io.File; |
| | | import java.text.ParseException; |
| | | |
| | | import org.opends.server.util.Base64; |
| | | |
| | | /** |
| | | * Class used to represent Binary Values. This is required in particular |
| | | * when the user wants to use the value in a file. To be able to reflect |
| | | * this this object is used: it contains the binary itself, the base 64 |
| | | * representation and the file that has been used. |
| | | * |
| | | */ |
| | | public class BinaryValue |
| | | { |
| | | private Type type; |
| | | private String base64; |
| | | private byte[] bytes; |
| | | private File file; |
| | | private int hashCode; |
| | | |
| | | /** |
| | | * The type of the binary value. |
| | | * |
| | | */ |
| | | public enum Type |
| | | { |
| | | /** |
| | | * The binary value is provided as Base 64 string. |
| | | */ |
| | | BASE64_STRING, |
| | | /** |
| | | * The binary value is provided as a byte array. |
| | | */ |
| | | BYTE_ARRAY |
| | | } |
| | | |
| | | /** |
| | | * This is done to force the use of the factory methods (createBase64 and |
| | | * createFromFile). |
| | | * |
| | | */ |
| | | private BinaryValue() |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * Creates a binary value using a base64 string. |
| | | * @param base64 the base64 representation of the binary. |
| | | * @return the binary value. |
| | | * @throws ParseException if there is an error decoding the provided base64 |
| | | * string. |
| | | */ |
| | | public static BinaryValue createBase64(String base64) throws ParseException |
| | | { |
| | | BinaryValue value = new BinaryValue(); |
| | | value.type = Type.BASE64_STRING; |
| | | value.base64 = base64; |
| | | value.bytes = value.getBytes(); |
| | | value.hashCode = base64.hashCode(); |
| | | return value; |
| | | } |
| | | |
| | | /** |
| | | * Creates a binary value using an array of bytes. |
| | | * @param bytes the byte array. |
| | | * @return the binary value. |
| | | */ |
| | | public static BinaryValue createBase64(byte[] bytes) |
| | | { |
| | | BinaryValue value = new BinaryValue(); |
| | | value.type = Type.BASE64_STRING; |
| | | value.bytes = bytes; |
| | | value.base64 = value.getBase64(); |
| | | value.hashCode = value.base64.hashCode(); |
| | | return value; |
| | | } |
| | | |
| | | /** |
| | | * Creates a binary value using an array of bytes and a file. |
| | | * @param bytes the bytes in the file. |
| | | * @param file the file the bytes were read from. |
| | | * @return the binary value. |
| | | */ |
| | | public static BinaryValue createFromFile(byte[] bytes, File file) |
| | | { |
| | | BinaryValue value = new BinaryValue(); |
| | | value.type = Type.BYTE_ARRAY; |
| | | value.bytes = bytes; |
| | | value.base64 = value.getBase64(); |
| | | value.hashCode = value.base64.hashCode(); |
| | | value.file = file; |
| | | return value; |
| | | } |
| | | |
| | | /** |
| | | * Returns the base64 representation of the binary value. |
| | | * @return the base64 representation of the binary value. |
| | | */ |
| | | public String getBase64() |
| | | { |
| | | if (base64 == null) |
| | | { |
| | | if (bytes != null) |
| | | { |
| | | base64 = Base64.encode(bytes); |
| | | } |
| | | } |
| | | return base64; |
| | | } |
| | | |
| | | /** |
| | | * Returns the byte array of the binary value. |
| | | * @return the byte array of the binary value. |
| | | * @throws ParseException if this object was created using a base64 string |
| | | * and there was an error parsing it. |
| | | */ |
| | | public byte[] getBytes() throws ParseException |
| | | { |
| | | if (bytes == null) |
| | | { |
| | | if (base64 != null) |
| | | { |
| | | bytes = Base64.decode(base64); |
| | | } |
| | | } |
| | | return bytes; |
| | | } |
| | | |
| | | /** |
| | | * Return the type of the binary value. |
| | | * @return the type of the binary value. |
| | | */ |
| | | public Type getType() |
| | | { |
| | | return type; |
| | | } |
| | | |
| | | /** |
| | | * Return the file that was used to read the binary value. |
| | | * @return the file that was used to read the binary value. |
| | | */ |
| | | public File getFile() |
| | | { |
| | | return file; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean equals(Object o) |
| | | { |
| | | boolean equals = false; |
| | | if (o != null) |
| | | { |
| | | equals = this == o; |
| | | if (!equals) |
| | | { |
| | | equals = o instanceof BinaryValue; |
| | | if (equals) |
| | | { |
| | | BinaryValue candidate = (BinaryValue)o; |
| | | equals = candidate.getType() == getType(); |
| | | if (equals) |
| | | { |
| | | if (file == null) |
| | | { |
| | | equals = candidate.getFile() == null; |
| | | } |
| | | else if (candidate.getFile() != null) |
| | | { |
| | | equals = file.equals(candidate.getFile()); |
| | | } |
| | | else |
| | | { |
| | | equals = false; |
| | | } |
| | | } |
| | | if (equals) |
| | | { |
| | | if (type == Type.BASE64_STRING) |
| | | { |
| | | equals = candidate.getBase64().equals(getBase64()); |
| | | } |
| | | else |
| | | { |
| | | try |
| | | { |
| | | equals = candidate.getBytes().length == getBytes().length; |
| | | for (int i=0; i<getBytes().length && equals; i++) |
| | | { |
| | | equals = bytes[i] == candidate.getBytes()[i]; |
| | | } |
| | | } |
| | | catch (ParseException pe) |
| | | { |
| | | throw new IllegalStateException( |
| | | "Unexpected error getting bytes: "+pe, pe); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return equals; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int hashCode() |
| | | { |
| | | return hashCode; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.types.OpenDsException; |
| | | |
| | | /** |
| | | * Exception that occurs when the user ask to make a modification that is not |
| | | * handled by ModifyEntryTask. |
| | | * @see <CODE>org.opends.guitools.controlpanel.task.ModifyEntryTask</CODE> |
| | | */ |
| | | public class CannotRenameException extends OpenDsException |
| | | { |
| | | private static final long serialVersionUID = 6445729932279305687L; |
| | | |
| | | /** |
| | | * Constructor. |
| | | * @param msg the message describing why the entry cannot be renamed. |
| | | */ |
| | | public CannotRenameException(Message msg) |
| | | { |
| | | super(msg); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | /** |
| | | * Class used in the combo box models. It is used to have special rendering in |
| | | * the combo boxes. |
| | | */ |
| | | public class CategorizedComboBoxElement |
| | | { |
| | | private Object value; |
| | | private Type type; |
| | | private int hashCode; |
| | | |
| | | /** |
| | | * The type of the element. |
| | | * |
| | | */ |
| | | public enum Type |
| | | { |
| | | /** |
| | | * Category type (in a combo box containing base DNs the backends are of |
| | | * type category, for instance). |
| | | */ |
| | | CATEGORY, |
| | | /** |
| | | * Regular type. |
| | | */ |
| | | REGULAR |
| | | }; |
| | | |
| | | /** |
| | | * Constructor. |
| | | * @param value the value of the element. |
| | | * @param type the type of the element. |
| | | */ |
| | | public CategorizedComboBoxElement(Object value, Type type) |
| | | { |
| | | this.value = value; |
| | | this.type = type; |
| | | this.hashCode = this.value.hashCode() + this.type.hashCode(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the value. |
| | | * @return the value. |
| | | */ |
| | | public Object getValue() |
| | | { |
| | | return value; |
| | | } |
| | | |
| | | /** |
| | | * Returns the type of the element. |
| | | * @return the type of the element. |
| | | */ |
| | | public Type getType() |
| | | { |
| | | return type; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean equals(Object o) |
| | | { |
| | | boolean equals = false; |
| | | if (o != null) |
| | | { |
| | | if (o instanceof CategorizedComboBoxElement) |
| | | { |
| | | CategorizedComboBoxElement desc = (CategorizedComboBoxElement)o; |
| | | equals = (desc.getType() == getType()) && |
| | | (getValue().equals(desc.getValue())); |
| | | } |
| | | } |
| | | return equals; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int hashCode() |
| | | { |
| | | return hashCode; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import java.util.ArrayList; |
| | | |
| | | import org.opends.messages.Message; |
| | | |
| | | /** |
| | | * Class containing the different actions for a given category. For instance |
| | | * for the Category 'Indexes' the Actions are 'Manage Indexes...', 'Verify |
| | | * Indexes...' etc. |
| | | * |
| | | */ |
| | | public class Category |
| | | { |
| | | private Message name; |
| | | private ArrayList<Action> actions = new ArrayList<Action>(); |
| | | |
| | | /** |
| | | * Returns the name of the category. |
| | | * @return the name of the category. |
| | | */ |
| | | public Message getName() |
| | | { |
| | | return name; |
| | | } |
| | | |
| | | /** |
| | | * Sets the name of the category. |
| | | * @param name the name of the category. |
| | | */ |
| | | public void setName(Message name) |
| | | { |
| | | this.name = name; |
| | | } |
| | | |
| | | /** |
| | | * Returns the actions associated with this category. |
| | | * @return the actions associated with this category. |
| | | */ |
| | | public ArrayList<Action> getActions() |
| | | { |
| | | return actions; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.types.OpenDsException; |
| | | |
| | | /** |
| | | * The exception that occurs when the user is editing an entry and some of the |
| | | * provided data is not valid. |
| | | * |
| | | */ |
| | | public class CheckEntrySyntaxException extends OpenDsException |
| | | { |
| | | private static final long serialVersionUID = 8145911071581212822L; |
| | | private List<Message> errors; |
| | | /** |
| | | * Constructor of the exception. |
| | | * @param errors the list of error description that were found. |
| | | */ |
| | | public CheckEntrySyntaxException(List<Message> errors) |
| | | { |
| | | super(getMessage(errors)); |
| | | this.errors = Collections.unmodifiableList(errors); |
| | | } |
| | | |
| | | /** |
| | | * Returns the list of errors that were encountered. |
| | | * @return the list of errors that were encountered. |
| | | */ |
| | | public List<Message> getErrors() |
| | | { |
| | | return errors; |
| | | } |
| | | |
| | | /** |
| | | * Returns a single message using the provided messages. This method assumes |
| | | * that the messages have HTML format. |
| | | * @param errors the list of errors. |
| | | * @return a single message using the provided messages. |
| | | */ |
| | | private static Message getMessage(List<Message> errors) |
| | | { |
| | | ArrayList<String> s = new ArrayList<String>(); |
| | | for (Message error : errors) |
| | | { |
| | | s.add(error.toString()); |
| | | } |
| | | return Message.raw(Utilities.getStringFromCollection(s, "<br>")); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.types.OpenDsException; |
| | | |
| | | /** |
| | | * Exception that occurs reading the server configuration. |
| | | * |
| | | */ |
| | | public class ConfigReadException extends OpenDsException |
| | | { |
| | | private static final long serialVersionUID = 1266482779183126905L; |
| | | |
| | | /** |
| | | * Constructor for the exception. |
| | | * @param msg the localized message to be used. |
| | | */ |
| | | public ConfigReadException(Message msg) |
| | | { |
| | | super(msg); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.util.Collection; |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | | |
| | | import org.opends.messages.Message; |
| | | |
| | | /** |
| | | * This class is used to represent a Listener and is aimed to be used by the |
| | | * classes in the ListenersTableModel class. |
| | | */ |
| | | public class ConnectionHandlerDescriptor |
| | | { |
| | | /** |
| | | * Enumeration used to represent the state of the listener. |
| | | */ |
| | | public enum State |
| | | { |
| | | /** |
| | | * The listener is enabled. |
| | | */ |
| | | ENABLED, |
| | | /** |
| | | * The listener is disabled. |
| | | */ |
| | | DISABLED, |
| | | /** |
| | | * The state of the listener is unknown. |
| | | */ |
| | | UNKNOWN |
| | | }; |
| | | |
| | | /** |
| | | * Enumeration used to represent the Protocol of the listener. |
| | | * |
| | | */ |
| | | public enum Protocol |
| | | { |
| | | /** |
| | | * LDAP protocol. |
| | | */ |
| | | LDAP(INFO_CTRL_PANEL_CONN_HANDLER_LDAP.get()), |
| | | /** |
| | | * LDAP accepting Start TLS protocol. |
| | | */ |
| | | LDAP_STARTTLS(INFO_CTRL_PANEL_CONN_HANDLER_LDAP_STARTTLS.get()), |
| | | /** |
| | | * LDAP secure protocol. |
| | | */ |
| | | LDAPS(INFO_CTRL_PANEL_CONN_HANDLER_LDAPS.get()), |
| | | /** |
| | | * JMX protocol. |
| | | */ |
| | | JMX(INFO_CTRL_PANEL_CONN_HANDLER_JMX.get()), |
| | | /** |
| | | * JMX secure protocol. |
| | | */ |
| | | JMXS(INFO_CTRL_PANEL_CONN_HANDLER_JMXS.get()), |
| | | /** |
| | | * LDIF protocol. |
| | | */ |
| | | LDIF(INFO_CTRL_PANEL_CONN_HANDLER_LDIF.get()), |
| | | /** |
| | | * SNMP protocol. |
| | | */ |
| | | SNMP(INFO_CTRL_PANEL_CONN_HANDLER_SNMP.get()), |
| | | /** |
| | | * Replication protocol. Even if in the configuration is not considered |
| | | * as a listener, we display it on the table. |
| | | */ |
| | | REPLICATION(INFO_CTRL_PANEL_CONN_HANDLER_REPLICATION.get()), |
| | | /** |
| | | * Secure replication protocol. |
| | | */ |
| | | REPLICATION_SECURE(INFO_CTRL_PANEL_CONN_HANDLER_REPLICATION_SECURE.get()), |
| | | /** |
| | | * Admin connector protocol. |
| | | */ |
| | | ADMINISTRATION_CONNECTOR(INFO_CTRL_PANEL_CONN_HANDLER_ADMINISTRATION.get()), |
| | | /** |
| | | * Other protocol. |
| | | */ |
| | | OTHER(INFO_CTRL_PANEL_CONN_HANDLER_OTHER.get()); |
| | | |
| | | private Message displayMessage; |
| | | |
| | | private Protocol(Message displayMessage) |
| | | { |
| | | this.displayMessage = displayMessage; |
| | | } |
| | | |
| | | /** |
| | | * Returns the display Message to be used for the protocol. |
| | | * @return the display Message to be used for the protocol. |
| | | */ |
| | | public Message getDisplayMessage() |
| | | { |
| | | return displayMessage; |
| | | } |
| | | } |
| | | |
| | | private State state; |
| | | private SortedSet<InetAddress> addresses = new TreeSet<InetAddress>(); |
| | | private int port; |
| | | private Protocol protocol; |
| | | private String toString; |
| | | private String name; |
| | | |
| | | private int hashCode; |
| | | |
| | | /** |
| | | * Constructor for thid class. |
| | | * @param addresses the list of InetAdresses of the listener. |
| | | * @param port the port of the connection handler. |
| | | * @param protocol the protocol of the listener. |
| | | * @param state the state of the connection handler (enabled, disabled, etc.). |
| | | * @param name the name of the listener. |
| | | */ |
| | | public ConnectionHandlerDescriptor(Collection<InetAddress> addresses, |
| | | int port, Protocol protocol, State state, String name) |
| | | { |
| | | this.addresses.addAll(addresses); |
| | | this.port = port; |
| | | this.protocol = protocol; |
| | | this.state = state; |
| | | this.name = name; |
| | | |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.append(getProtocol() + " " + getState() + " "); |
| | | for (InetAddress address : addresses) |
| | | { |
| | | builder.append(address.toString()); |
| | | } |
| | | builder.append(" Port: "+port); |
| | | toString = builder.toString(); |
| | | hashCode = toString.hashCode(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the address port representation of the listener. |
| | | * @return the address port representation of the listener. |
| | | */ |
| | | public SortedSet<InetAddress> getAdresses() |
| | | { |
| | | return new TreeSet<InetAddress>(addresses); |
| | | } |
| | | |
| | | /** |
| | | * Returns the protocol of the listener. |
| | | * @return the protocol of the listener. |
| | | */ |
| | | public Protocol getProtocol() |
| | | { |
| | | return protocol; |
| | | } |
| | | |
| | | /** |
| | | * Returns the state of the listener. |
| | | * @return the state of the listener. |
| | | */ |
| | | public State getState() |
| | | { |
| | | return state; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int hashCode() |
| | | { |
| | | return hashCode; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public String toString() |
| | | { |
| | | return toString; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean equals(Object o) |
| | | { |
| | | boolean equals = false; |
| | | if (o == this) |
| | | { |
| | | equals = true; |
| | | } |
| | | else if (o instanceof ConnectionHandlerDescriptor) |
| | | { |
| | | equals = hashCode() == o.hashCode(); |
| | | } |
| | | return equals; |
| | | } |
| | | |
| | | /** |
| | | * Returns the port of the connection handler. |
| | | * @return the port of the connection handler. |
| | | */ |
| | | public int getPort() |
| | | { |
| | | return port; |
| | | } |
| | | |
| | | /** |
| | | * Returns the name of the connection handler. |
| | | * @return the name of the connection handler. |
| | | */ |
| | | public String getName() |
| | | { |
| | | return name; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | import java.util.TreeSet; |
| | | |
| | | /** |
| | | * The table model used by the table that displays the connection handlers. |
| | | * |
| | | */ |
| | | public class ConnectionHandlerTableModel extends SortableTableModel |
| | | implements Comparator<ConnectionHandlerDescriptor> |
| | | { |
| | | private static final long serialVersionUID = -1121308303480078376L; |
| | | private Set<ConnectionHandlerDescriptor> data = |
| | | new HashSet<ConnectionHandlerDescriptor>(); |
| | | private ArrayList<String[]> dataArray = |
| | | new ArrayList<String[]>(); |
| | | private String[] COLUMN_NAMES; |
| | | private int sortColumn = 0; |
| | | private boolean sortAscending = true; |
| | | |
| | | /** |
| | | * Constructor for this table model. |
| | | */ |
| | | public ConnectionHandlerTableModel() |
| | | { |
| | | this(true); |
| | | } |
| | | |
| | | /** |
| | | * Constructor for this table model. |
| | | * @param wrapHeader whether to wrap the headers or not. |
| | | * monitoring information or not. |
| | | */ |
| | | public ConnectionHandlerTableModel(boolean wrapHeader) |
| | | { |
| | | if (wrapHeader) |
| | | { |
| | | COLUMN_NAMES = new String[] { |
| | | getHeader(INFO_ADDRESS_PORT_COLUMN.get()), |
| | | getHeader(INFO_PROTOCOL_COLUMN.get()), |
| | | getHeader(INFO_STATE_COLUMN.get()) |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | COLUMN_NAMES = new String[] { |
| | | INFO_ADDRESS_PORT_COLUMN.get().toString(), |
| | | INFO_PROTOCOL_COLUMN.get().toString(), |
| | | INFO_STATE_COLUMN.get().toString() |
| | | }; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Sets the data for this table model. |
| | | * @param newData the data for this table model. |
| | | */ |
| | | public void setData(Set<ConnectionHandlerDescriptor> newData) |
| | | { |
| | | if (!newData.equals(data)) |
| | | { |
| | | data.clear(); |
| | | data.addAll(newData); |
| | | updateDataArray(); |
| | | fireTableDataChanged(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Updates the table model contents and sorts its contents depending on the |
| | | * sort options set by the user. |
| | | */ |
| | | public void forceResort() |
| | | { |
| | | updateDataArray(); |
| | | fireTableDataChanged(); |
| | | } |
| | | |
| | | /** |
| | | * Comparable implementation. |
| | | * @param desc1 the first listener descriptor to compare. |
| | | * @param desc2 the second listener descriptor to compare. |
| | | * @return 1 if according to the sorting options set by the user the first |
| | | * listener descriptor must be put before the second descriptor, 0 if they |
| | | * are equivalent in terms of sorting and -1 if the second descriptor must |
| | | * be put before the first descriptor. |
| | | */ |
| | | public int compare(ConnectionHandlerDescriptor desc1, |
| | | ConnectionHandlerDescriptor desc2) |
| | | { |
| | | int result = 0; |
| | | if (sortColumn == 0) |
| | | { |
| | | if (desc1.getAdresses().equals(desc2.getAdresses())) |
| | | { |
| | | Integer port1 = new Integer(desc1.getPort()); |
| | | Integer port2 = new Integer(desc2.getPort()); |
| | | result = port1.compareTo(port2); |
| | | } |
| | | else |
| | | { |
| | | result = getAddressPortString(desc1).compareTo( |
| | | getAddressPortString(desc2)); |
| | | } |
| | | if (result == 0) |
| | | { |
| | | result = getProtocolString(desc1).compareTo( |
| | | getProtocolString(desc2)); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = desc1.getState().compareTo(desc2.getState()); |
| | | } |
| | | } |
| | | else if (sortColumn == 1) |
| | | { |
| | | result = getProtocolString(desc1).compareTo( |
| | | getProtocolString(desc2)); |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = getAddressPortString(desc1).compareTo( |
| | | getAddressPortString(desc2)); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = desc1.getState().compareTo(desc2.getState()); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result = desc1.getState().compareTo(desc2.getState()); |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = getAddressPortString(desc1).compareTo( |
| | | getAddressPortString(desc2)); |
| | | } |
| | | |
| | | if (result == 0) |
| | | { |
| | | result = getProtocolString(desc1).compareTo( |
| | | getProtocolString(desc2)); |
| | | } |
| | | } |
| | | |
| | | if (!sortAscending) |
| | | { |
| | | result = -result; |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int getColumnCount() |
| | | { |
| | | return 3; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int getRowCount() |
| | | { |
| | | return dataArray.size(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Object getValueAt(int row, int col) |
| | | { |
| | | return dataArray.get(row)[col]; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public String getColumnName(int col) { |
| | | return COLUMN_NAMES[col]; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns whether the sort is ascending or descending. |
| | | * @return <CODE>true</CODE> if the sort is ascending and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public boolean isSortAscending() |
| | | { |
| | | return sortAscending; |
| | | } |
| | | |
| | | /** |
| | | * Sets whether to sort ascending of descending. |
| | | * @param sortAscending whether to sort ascending or descending. |
| | | */ |
| | | public void setSortAscending(boolean sortAscending) |
| | | { |
| | | this.sortAscending = sortAscending; |
| | | } |
| | | |
| | | /** |
| | | * Returns the column index used to sort. |
| | | * @return the column index used to sort. |
| | | */ |
| | | public int getSortColumn() |
| | | { |
| | | return sortColumn; |
| | | } |
| | | |
| | | /** |
| | | * Sets the column index used to sort. |
| | | * @param sortColumn column index used to sort.. |
| | | */ |
| | | public void setSortColumn(int sortColumn) |
| | | { |
| | | this.sortColumn = sortColumn; |
| | | } |
| | | |
| | | private String getAddressPortString(ConnectionHandlerDescriptor desc) |
| | | { |
| | | Set<InetAddress> addresses = desc.getAdresses(); |
| | | String returnValue; |
| | | if (addresses.size() == 0) |
| | | { |
| | | if (desc.getPort() > 0) |
| | | { |
| | | returnValue = "0.0.0.0:"+desc.getPort(); |
| | | } |
| | | else |
| | | { |
| | | returnValue = INFO_NOT_APPLICABLE_LABEL.get().toString(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | StringBuilder buf = new StringBuilder(); |
| | | buf.append("<html>"); |
| | | boolean added = false; |
| | | for (InetAddress address : addresses) |
| | | { |
| | | if (added) |
| | | { |
| | | buf.append("<br>"); |
| | | } |
| | | buf.append(address); |
| | | added = true; |
| | | if (desc.getPort() > 0) |
| | | { |
| | | buf.append(":"+desc.getPort()); |
| | | } |
| | | } |
| | | returnValue = buf.toString(); |
| | | } |
| | | return returnValue; |
| | | } |
| | | |
| | | private String getProtocolString(ConnectionHandlerDescriptor desc) |
| | | { |
| | | String returnValue; |
| | | switch (desc.getProtocol()) |
| | | { |
| | | case OTHER: |
| | | returnValue = desc.getName(); |
| | | break; |
| | | default: |
| | | returnValue = desc.getProtocol().getDisplayMessage().toString(); |
| | | break; |
| | | } |
| | | return returnValue; |
| | | } |
| | | |
| | | private void updateDataArray() |
| | | { |
| | | TreeSet<ConnectionHandlerDescriptor> sortedSet = |
| | | new TreeSet<ConnectionHandlerDescriptor>(this); |
| | | sortedSet.addAll(data); |
| | | dataArray.clear(); |
| | | for (ConnectionHandlerDescriptor desc : sortedSet) |
| | | { |
| | | String[] s = new String[3]; |
| | | s[0] = getAddressPortString(desc); |
| | | s[1] = getProtocolString(desc); |
| | | |
| | | switch (desc.getState()) |
| | | { |
| | | case ENABLED: |
| | | s[2] = INFO_ENABLED_LABEL.get().toString(); |
| | | break; |
| | | |
| | | case DISABLED: |
| | | s[2] = INFO_DISABLED_LABEL.get().toString(); |
| | | break; |
| | | |
| | | case UNKNOWN: |
| | | s[2] = INFO_UNKNOWN_LABEL.get().toString(); |
| | | break; |
| | | |
| | | default: |
| | | throw new IllegalStateException("Unknown state: "+desc.getState()); |
| | | } |
| | | dataArray.add(s); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | |
| | | /** |
| | | * Policy to follow to choose the protocol to be used. |
| | | * |
| | | * */ |
| | | public enum ConnectionProtocolPolicy |
| | | { |
| | | /** |
| | | * Force to use Start TLS. |
| | | */ |
| | | USE_STARTTLS, |
| | | /** |
| | | * Force to use LDAP. |
| | | */ |
| | | USE_LDAP, |
| | | /** |
| | | * Force to use LDAPs. |
| | | */ |
| | | USE_LDAPS, |
| | | /** |
| | | * Force to use the Administration Connector. |
| | | */ |
| | | USE_ADMIN, |
| | | /** |
| | | * Use the most secure available (LDAPs, StartTLS and finally LDAP). |
| | | */ |
| | | USE_MOST_SECURE_AVAILABLE, |
| | | /** |
| | | * Use the less secure available (LDAP, and then LDAPs). |
| | | */ |
| | | USE_LESS_SECURE_AVAILABLE; |
| | | |
| | | /** |
| | | * Returns the ConnectionProtocolPolicy to be used with the parameters |
| | | * provided by the user. |
| | | * @param useSSL whether the user asked to use SSL or not. |
| | | * @param useStartTLS whether the user asked to use Start TLS or not. |
| | | * @return the ConnectionProtocolPolicy to be used with the parameters |
| | | * provided by the user. |
| | | */ |
| | | public static ConnectionProtocolPolicy getConnectionPolicy(boolean useSSL, |
| | | boolean useStartTLS) |
| | | { |
| | | ConnectionProtocolPolicy policy; |
| | | if (useStartTLS) |
| | | { |
| | | policy = ConnectionProtocolPolicy.USE_STARTTLS; |
| | | } |
| | | else if (useSSL) |
| | | { |
| | | policy = ConnectionProtocolPolicy.USE_LDAPS; |
| | | } |
| | | else |
| | | { |
| | | policy = ConnectionProtocolPolicy.USE_LESS_SECURE_AVAILABLE; |
| | | } |
| | | return policy; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.HashSet; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.Set; |
| | | import java.util.SortedSet; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | |
| | | import javax.naming.NamingException; |
| | | import javax.naming.ldap.InitialLdapContext; |
| | | |
| | | import org.opends.admin.ads.util.ApplicationTrustManager; |
| | | import org.opends.admin.ads.util.ConnectionUtils; |
| | | import org.opends.guitools.controlpanel.browser.IconPool; |
| | | import org.opends.guitools.controlpanel.browser.LDAPConnectionPool; |
| | | import org.opends.guitools.controlpanel.event.BackupCreatedEvent; |
| | | import org.opends.guitools.controlpanel.event.BackupCreatedListener; |
| | | import org.opends.guitools.controlpanel.event.ConfigChangeListener; |
| | | import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent; |
| | | import org.opends.guitools.controlpanel.event.IndexModifiedEvent; |
| | | import org.opends.guitools.controlpanel.event.IndexModifiedListener; |
| | | import org.opends.guitools.controlpanel.task.Task; |
| | | import org.opends.guitools.controlpanel.util.ConfigFromDirContext; |
| | | import org.opends.guitools.controlpanel.util.ConfigFromFile; |
| | | import org.opends.guitools.controlpanel.util.ConfigReader; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.quicksetup.util.UIKeyStore; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.tools.ConfigureWindowsService; |
| | | |
| | | /** |
| | | * This is the classes that is shared among all the different places in the |
| | | * Control Panel. It contains information about the server status and |
| | | * configuration and some objects that are shared everywhere. |
| | | * |
| | | */ |
| | | public class ControlPanelInfo |
| | | { |
| | | /** |
| | | * The default pooling time in miliseconds. |
| | | */ |
| | | public static final long DEFAULT_POOLING = 20000; |
| | | |
| | | private ServerDescriptor serverDesc; |
| | | private Set<Task> tasks = new HashSet<Task>(); |
| | | private InitialLdapContext ctx; |
| | | private InitialLdapContext userDataCtx; |
| | | private final LDAPConnectionPool connectionPool = new LDAPConnectionPool(); |
| | | // Used by the browsers |
| | | private final IconPool iconPool = new IconPool(); // Used by the browsers |
| | | private Thread poolingThread; |
| | | private boolean stopPooling; |
| | | private boolean pooling; |
| | | private ApplicationTrustManager trustManager; |
| | | private ConnectionProtocolPolicy connectionPolicy = |
| | | ConnectionProtocolPolicy.USE_MOST_SECURE_AVAILABLE; |
| | | private String ldapURL; |
| | | private String startTLSURL; |
| | | private String ldapsURL; |
| | | private String adminConnectorURL; |
| | | |
| | | private static boolean mustDeregisterConfig; |
| | | |
| | | private Set<AbstractIndexDescriptor> modifiedIndexes = |
| | | new HashSet<AbstractIndexDescriptor>(); |
| | | |
| | | private LinkedHashSet<ConfigChangeListener> configListeners = |
| | | new LinkedHashSet<ConfigChangeListener>(); |
| | | |
| | | |
| | | private LinkedHashSet<BackupCreatedListener> backupListeners = |
| | | new LinkedHashSet<BackupCreatedListener>(); |
| | | |
| | | private LinkedHashSet<IndexModifiedListener> indexListeners = |
| | | new LinkedHashSet<IndexModifiedListener>(); |
| | | |
| | | private static final Logger LOG = |
| | | Logger.getLogger(ControlPanelInfo.class.getName()); |
| | | |
| | | private static ControlPanelInfo instance; |
| | | |
| | | private ControlPanelInfo() |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * Returns a singleton for this instance. |
| | | * @return the control panel info. |
| | | */ |
| | | public static ControlPanelInfo getInstance() |
| | | { |
| | | if (instance == null) |
| | | { |
| | | instance = new ControlPanelInfo(); |
| | | try |
| | | { |
| | | instance.setTrustManager( |
| | | new ApplicationTrustManager(UIKeyStore.getInstance())); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | LOG.log(Level.WARNING, "Error retrieving UI key store: "+t, t); |
| | | instance.setTrustManager(new ApplicationTrustManager(null)); |
| | | } |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | /** |
| | | * Returns the last ServerDescriptor that has been retrieved. |
| | | * @return the last ServerDescriptor that has been retrieved. |
| | | */ |
| | | public ServerDescriptor getServerDescriptor() |
| | | { |
| | | return serverDesc; |
| | | } |
| | | |
| | | /** |
| | | * Returns the list of tasks. |
| | | * @return the list of tasks. |
| | | */ |
| | | public Set<Task> getTasks() |
| | | { |
| | | return Collections.unmodifiableSet(tasks); |
| | | } |
| | | |
| | | /** |
| | | * Registers a task. The Control Panel creates a task everytime an operation |
| | | * is made and they are stored here. |
| | | * @param task the task to be registered. |
| | | */ |
| | | public void registerTask(Task task) |
| | | { |
| | | tasks.add(task); |
| | | } |
| | | |
| | | /** |
| | | * Tells whether an index must be reindexed or not. |
| | | * @param index the index. |
| | | * @return <CODE>true</CODE> if the index must be reindexed and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean mustReindex(AbstractIndexDescriptor index) |
| | | { |
| | | boolean mustReindex = false; |
| | | for (AbstractIndexDescriptor i : modifiedIndexes) |
| | | { |
| | | if (i.getName().equals(index.getName()) && |
| | | i.getBackend().getBackendID().equals( |
| | | index.getBackend().getBackendID())) |
| | | { |
| | | mustReindex = true; |
| | | break; |
| | | } |
| | | } |
| | | return mustReindex; |
| | | } |
| | | |
| | | /** |
| | | * Registers an index as modified. This is used by the panels to be able |
| | | * to inform the user that a rebuild of the index is required. |
| | | * @param index the index. |
| | | */ |
| | | public void registerModifiedIndex(AbstractIndexDescriptor index) |
| | | { |
| | | modifiedIndexes.add(index); |
| | | indexModified(index); |
| | | } |
| | | |
| | | /** |
| | | * Unregisters a modified index. |
| | | * @param index the index. |
| | | * @return <CODE>true</CODE> if the index is found in the list of modified |
| | | * indexes and <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean unregisterModifiedIndex(AbstractIndexDescriptor index) |
| | | { |
| | | // We might have stored indexes whose configuration has changed, just remove |
| | | // them if they have the same name, are of the same type and are defined in |
| | | // the same backend. |
| | | Set<AbstractIndexDescriptor> toRemove = |
| | | new HashSet<AbstractIndexDescriptor>(); |
| | | for (AbstractIndexDescriptor i : modifiedIndexes) |
| | | { |
| | | if (i.getName().equalsIgnoreCase(index.getName()) && |
| | | i.getBackend().getBackendID().equalsIgnoreCase( |
| | | index.getBackend().getBackendID()) && |
| | | i.getClass().equals((index.getClass()))) |
| | | { |
| | | toRemove.add(i); |
| | | } |
| | | } |
| | | if (!toRemove.isEmpty()) |
| | | { |
| | | boolean returnValue = modifiedIndexes.removeAll(toRemove); |
| | | indexModified(toRemove.iterator().next()); |
| | | return returnValue; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Unregisters all the modified indexes on a given backend. |
| | | * @param backendName the name of the backend. |
| | | */ |
| | | public void unregisterModifiedIndexesInBackend(String backendName) |
| | | { |
| | | HashSet<AbstractIndexDescriptor> toDelete = |
| | | new HashSet<AbstractIndexDescriptor>(); |
| | | for (AbstractIndexDescriptor index : modifiedIndexes) |
| | | { |
| | | // Compare only the Backend ID, since the backend object attached to |
| | | // the registered index might have changed (for instance the number of |
| | | // entries). Relying on the backend ID to identify the backend is |
| | | // safe. |
| | | if (index.getBackend().getBackendID().equalsIgnoreCase(backendName)) |
| | | { |
| | | toDelete.add(index); |
| | | } |
| | | } |
| | | modifiedIndexes.removeAll(toDelete); |
| | | for (BackendDescriptor backend : getServerDescriptor().getBackends()) |
| | | { |
| | | if (backend.getBackendID().equals(backendName)) |
| | | { |
| | | IndexModifiedEvent ev = new IndexModifiedEvent(backend); |
| | | for (IndexModifiedListener listener : indexListeners) |
| | | { |
| | | listener.backendIndexesModified(ev); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns a collection with all the modified indexes. |
| | | * @return a collection with all the modified indexes. |
| | | */ |
| | | public Collection<AbstractIndexDescriptor> getModifiedIndexes() |
| | | { |
| | | return Collections.unmodifiableCollection(modifiedIndexes); |
| | | } |
| | | |
| | | /** |
| | | * Sets the dir context to be used by the ControlPanelInfo to retrieve |
| | | * monitoring and configuration information. |
| | | * @param ctx the connection. |
| | | */ |
| | | public void setDirContext(InitialLdapContext ctx) |
| | | { |
| | | this.ctx = ctx; |
| | | } |
| | | |
| | | /** |
| | | * Returns the dir context to be used by the ControlPanelInfo to retrieve |
| | | * monitoring and configuration information. |
| | | * @return the dir context to be used by the ControlPanelInfo to retrieve |
| | | * monitoring and configuration information. |
| | | */ |
| | | public InitialLdapContext getDirContext() |
| | | { |
| | | return ctx; |
| | | } |
| | | |
| | | /** |
| | | * Sets the dir context to be used by the ControlPanelInfo to retrieve |
| | | * user data. |
| | | * @param ctx the connection. |
| | | * @throws NamingException if there is a problem updating the connection pool. |
| | | */ |
| | | public void setUserDataDirContext(InitialLdapContext ctx) |
| | | throws NamingException |
| | | { |
| | | if (userDataCtx != null) |
| | | { |
| | | if (connectionPool.isConnectionRegistered(userDataCtx)) |
| | | { |
| | | try |
| | | { |
| | | connectionPool.unregisterConnection(userDataCtx); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | } |
| | | } |
| | | } |
| | | this.userDataCtx = ctx; |
| | | if (ctx != null) |
| | | { |
| | | InitialLdapContext cloneLdc = |
| | | ConnectionUtils.cloneInitialLdapContext(userDataCtx, |
| | | ConnectionUtils.getDefaultLDAPTimeout(), |
| | | getTrustManager(), null); |
| | | connectionPool.registerConnection(cloneLdc); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns the dir context to be used by the ControlPanelInfo to retrieve |
| | | * user data. |
| | | * @return the dir context to be used by the ControlPanelInfo to retrieve |
| | | * user data. |
| | | */ |
| | | public InitialLdapContext getUserDataDirContext() |
| | | { |
| | | return userDataCtx; |
| | | } |
| | | |
| | | /** |
| | | * Informs that a backup has been created. The method will notify to all |
| | | * the backup listeners that a backup has been created. |
| | | * @param newBackup the new created backup. |
| | | */ |
| | | public void backupCreated(BackupDescriptor newBackup) |
| | | { |
| | | BackupCreatedEvent ev = new BackupCreatedEvent(newBackup); |
| | | for (BackupCreatedListener listener : backupListeners) |
| | | { |
| | | listener.backupCreated(ev); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Informs that an index has been modified. The method will notify to all |
| | | * the index listeners that an index has been modified. |
| | | * @param modifiedIndex the modified index. |
| | | */ |
| | | public void indexModified(AbstractIndexDescriptor modifiedIndex) |
| | | { |
| | | IndexModifiedEvent ev = new IndexModifiedEvent(modifiedIndex); |
| | | for (IndexModifiedListener listener : indexListeners) |
| | | { |
| | | listener.indexModified(ev); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Regenerates the last found ServerDescriptor object. |
| | | * |
| | | */ |
| | | public synchronized void regenerateDescriptor() |
| | | { |
| | | ServerDescriptor desc = new ServerDescriptor(); |
| | | InitialLdapContext ctx = getDirContext(); |
| | | desc.setInstallPath(Utilities.getServerRootDirectory()); |
| | | boolean windowsServiceEnabled = false; |
| | | if (Utilities.isWindows()) |
| | | { |
| | | int result = ConfigureWindowsService.serviceState(null, null); |
| | | windowsServiceEnabled = |
| | | result == ConfigureWindowsService.SERVICE_STATE_ENABLED; |
| | | } |
| | | desc.setWindowsServiceEnabled(windowsServiceEnabled); |
| | | desc.setOpenDSVersion( |
| | | org.opends.server.util.DynamicConstants.FULL_VERSION_STRING); |
| | | ConfigReader reader; |
| | | |
| | | ServerDescriptor.ServerStatus status = null; |
| | | for (Task task : getTasks()) |
| | | { |
| | | if ((task.getType() == Task.Type.START_SERVER) && |
| | | task.getState() == Task.State.RUNNING) |
| | | { |
| | | status = ServerDescriptor.ServerStatus.STARTING; |
| | | } |
| | | else if ((task.getType() == Task.Type.STOP_SERVER) && |
| | | task.getState() == Task.State.RUNNING) |
| | | { |
| | | status = ServerDescriptor.ServerStatus.STOPPING; |
| | | } |
| | | } |
| | | if (status != null) |
| | | { |
| | | desc.setStatus(status); |
| | | if (status == ServerDescriptor.ServerStatus.STOPPING) |
| | | { |
| | | if (ctx != null) |
| | | { |
| | | try |
| | | { |
| | | ctx.close(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | } |
| | | this.ctx = null; |
| | | } |
| | | if (userDataCtx != null) |
| | | { |
| | | if (connectionPool.isConnectionRegistered(userDataCtx)) |
| | | { |
| | | try |
| | | { |
| | | connectionPool.unregisterConnection(userDataCtx); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | } |
| | | } |
| | | try |
| | | { |
| | | userDataCtx.close(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | } |
| | | userDataCtx = null; |
| | | } |
| | | } |
| | | reader = new ConfigFromFile(); |
| | | ((ConfigFromFile)reader).readConfiguration(); |
| | | desc.setAuthenticated(false); |
| | | } |
| | | else if (Utilities.isServerRunning( |
| | | Utilities.getInstanceRootDirectory( |
| | | desc.getInstallPath().getAbsolutePath()))) |
| | | { |
| | | desc.setStatus(ServerDescriptor.ServerStatus.STARTED); |
| | | if (ctx == null) |
| | | { |
| | | reader = new ConfigFromFile(); |
| | | ((ConfigFromFile)reader).readConfiguration(); |
| | | } |
| | | else |
| | | { |
| | | reader = new ConfigFromDirContext(); |
| | | ((ConfigFromDirContext)reader).readConfiguration(ctx); |
| | | if (reader.getExceptions().size() > 0) |
| | | { |
| | | // Check the connection |
| | | boolean connectionWorks = false; |
| | | int nMaxErrors = 5; |
| | | for (int i=0; i< nMaxErrors && !connectionWorks; i++) |
| | | { |
| | | try |
| | | { |
| | | Utilities.pingDirContext(ctx); |
| | | connectionWorks = true; |
| | | } |
| | | catch (NamingException ne) |
| | | { |
| | | } |
| | | } |
| | | if (!connectionWorks) |
| | | { |
| | | // Try with offline info |
| | | reader = new ConfigFromFile(); |
| | | ((ConfigFromFile)reader).readConfiguration(); |
| | | try |
| | | { |
| | | ctx.close(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | } |
| | | this.ctx = null; |
| | | if (connectionPool.isConnectionRegistered(userDataCtx)) |
| | | { |
| | | try |
| | | { |
| | | connectionPool.unregisterConnection(userDataCtx); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | } |
| | | } |
| | | try |
| | | { |
| | | userDataCtx.close(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | } |
| | | userDataCtx = null; |
| | | } |
| | | } |
| | | } |
| | | desc.setAuthenticated(reader instanceof ConfigFromDirContext); |
| | | desc.setJavaVersion(reader.getJavaVersion()); |
| | | desc.setOpenConnections(reader.getOpenConnections()); |
| | | } |
| | | else |
| | | { |
| | | desc.setStatus(ServerDescriptor.ServerStatus.STOPPED); |
| | | desc.setAuthenticated(false); |
| | | reader = new ConfigFromFile(); |
| | | ((ConfigFromFile)reader).readConfiguration(); |
| | | } |
| | | desc.setExceptions(reader.getExceptions()); |
| | | desc.setAdministrativeUsers(reader.getAdministrativeUsers()); |
| | | desc.setBackends(reader.getBackends()); |
| | | desc.setConnectionHandlers(reader.getConnectionHandlers()); |
| | | desc.setAdminConnector(reader.getAdminConnector()); |
| | | desc.setSchema(reader.getSchema()); |
| | | desc.setSchemaEnabled(reader.isSchemaEnabled()); |
| | | |
| | | if ((serverDesc == null) || !serverDesc.equals(desc)) |
| | | { |
| | | serverDesc = desc; |
| | | // Update the schema: so that when we call the server code the latest |
| | | // schema read is used. |
| | | if (serverDesc.getSchema() != null) |
| | | { |
| | | if (!ServerDescriptor.areSchemasEqual(serverDesc.getSchema(), |
| | | DirectoryServer.getSchema())) |
| | | { |
| | | DirectoryServer.setSchema(desc.getSchema()); |
| | | } |
| | | } |
| | | ldapURL = getURL(serverDesc, ConnectionHandlerDescriptor.Protocol.LDAP); |
| | | ldapsURL = getURL(serverDesc, ConnectionHandlerDescriptor.Protocol.LDAPS); |
| | | adminConnectorURL = getAdminConnectorURL(serverDesc); |
| | | startTLSURL = getURL(serverDesc, |
| | | ConnectionHandlerDescriptor.Protocol.LDAP_STARTTLS); |
| | | ConfigurationChangeEvent ev = new ConfigurationChangeEvent(this, desc); |
| | | for (ConfigChangeListener listener : configListeners) |
| | | { |
| | | listener.configurationChanged(ev); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Adds a configuration change listener. |
| | | * @param listener the listener. |
| | | */ |
| | | public void addConfigChangeListener(ConfigChangeListener listener) |
| | | { |
| | | configListeners.add(listener); |
| | | } |
| | | |
| | | /** |
| | | * Removes a configuration change listener. |
| | | * @param listener the listener. |
| | | * @return <CODE>true</CODE> if the listener is found and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public boolean removeConfigChangeListener(ConfigChangeListener listener) |
| | | { |
| | | return configListeners.remove(listener); |
| | | } |
| | | |
| | | /** |
| | | * Adds a backup creation listener. |
| | | * @param listener the listener. |
| | | */ |
| | | public void addBackupCreatedListener(BackupCreatedListener listener) |
| | | { |
| | | backupListeners.add(listener); |
| | | } |
| | | |
| | | /** |
| | | * Removes a backup creation listener. |
| | | * @param listener the listener. |
| | | * @return <CODE>true</CODE> if the listener is found and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public boolean removeBackupCreatedListener(BackupCreatedListener listener) |
| | | { |
| | | return backupListeners.remove(listener); |
| | | } |
| | | |
| | | /** |
| | | * Adds an index modification listener. |
| | | * @param listener the listener. |
| | | */ |
| | | public void addIndexModifiedListener(IndexModifiedListener listener) |
| | | { |
| | | indexListeners.add(listener); |
| | | } |
| | | |
| | | /** |
| | | * Removes an index modification listener. |
| | | * @param listener the listener. |
| | | * @return <CODE>true</CODE> if the listener is found and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public boolean removeIndexModifiedListener(IndexModifiedListener listener) |
| | | { |
| | | return indexListeners.remove(listener); |
| | | } |
| | | |
| | | /** |
| | | * Starts pooling the server configuration. The period of the pooling is |
| | | * specified as a parameter. This method is asynchronous and it will start |
| | | * the pooling in another thread. |
| | | * @param period the pooling in miliseconds of the pooling. |
| | | */ |
| | | public synchronized void startPooling(final long period) |
| | | { |
| | | if (poolingThread != null) |
| | | { |
| | | return; |
| | | } |
| | | pooling = true; |
| | | stopPooling = false; |
| | | |
| | | poolingThread = new Thread(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | try |
| | | { |
| | | while (!stopPooling) |
| | | { |
| | | regenerateDescriptor(); |
| | | Thread.sleep(period); |
| | | } |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | } |
| | | pooling = false; |
| | | } |
| | | }); |
| | | poolingThread.start(); |
| | | } |
| | | |
| | | /** |
| | | * Stops pooling the server. This method is synchronous, it does not return |
| | | * until the pooling is actually stopped. |
| | | * |
| | | */ |
| | | public synchronized void stopPooling() |
| | | { |
| | | stopPooling = true; |
| | | while ((poolingThread != null) && pooling) |
| | | { |
| | | try |
| | | { |
| | | poolingThread.interrupt(); |
| | | Thread.sleep(100); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | // do nothing; |
| | | } |
| | | } |
| | | poolingThread = null; |
| | | pooling = false; |
| | | } |
| | | |
| | | /** |
| | | * Returns the trust manager to be used by this ControlPanelInfo (and in |
| | | * general by the control panel). |
| | | * @return the trust manager to be used by this ControlPanelInfo. |
| | | */ |
| | | public ApplicationTrustManager getTrustManager() |
| | | { |
| | | return trustManager; |
| | | } |
| | | |
| | | /** |
| | | * Sets the trust manager to be used by this ControlPanelInfo (and in |
| | | * general by the control panel). |
| | | * @param trustManager the trust manager to be used by this ControlPanelInfo. |
| | | */ |
| | | public void setTrustManager(ApplicationTrustManager trustManager) |
| | | { |
| | | this.trustManager = trustManager; |
| | | connectionPool.setTrustManager(trustManager); |
| | | } |
| | | |
| | | /** |
| | | * Returns the connection policy to be used by this ControlPanelInfo (and in |
| | | * general by the control panel). |
| | | * @return the connection policy to be used by this ControlPanelInfo. |
| | | */ |
| | | public ConnectionProtocolPolicy getConnectionPolicy() |
| | | { |
| | | return connectionPolicy; |
| | | } |
| | | |
| | | /** |
| | | * Sets the connection policy to be used by this ControlPanelInfo (and in |
| | | * general by the control panel). |
| | | * @param connectionPolicy the connection policy to be used by this |
| | | * ControlPanelInfo. |
| | | */ |
| | | public void setConnectionPolicy(ConnectionProtocolPolicy connectionPolicy) |
| | | { |
| | | this.connectionPolicy = connectionPolicy; |
| | | } |
| | | |
| | | /** |
| | | * Gets the LDAPS URL based in what is read in the configuration. It |
| | | * returns <CODE>null</CODE> if no LDAPS URL was found. |
| | | * @return the LDAPS URL to be used to connect to the server. |
| | | */ |
| | | public String getLDAPSURL() |
| | | { |
| | | return ldapsURL; |
| | | } |
| | | |
| | | /** |
| | | * Gets the Administration Connector URL based in what is read in the |
| | | * configuration. It returns <CODE>null</CODE> if no Administration |
| | | * Connector URL was found. |
| | | * @return the Administration Connector URL to be used to connect |
| | | * to the server. |
| | | */ |
| | | public String getAdminConnectorURL() |
| | | { |
| | | return adminConnectorURL; |
| | | } |
| | | |
| | | /** |
| | | * Gets the LDAP URL based in what is read in the configuration. It |
| | | * returns <CODE>null</CODE> if no LDAP URL was found. |
| | | * @return the LDAP URL to be used to connect to the server. |
| | | */ |
| | | public String getLDAPURL() |
| | | { |
| | | return ldapURL; |
| | | } |
| | | |
| | | /** |
| | | * Gets the Start TLS URL based in what is read in the configuration. It |
| | | * returns <CODE>null</CODE> if no Start TLS URL is found. |
| | | * @return the Start TLS URL to be used to connect to the server. |
| | | */ |
| | | public String getStartTLSURL() |
| | | { |
| | | return startTLSURL; |
| | | } |
| | | |
| | | /** |
| | | * Returns the LDAP URL to be used to connect to a given ServerDescriptor |
| | | * using a certain protocol. It returns <CODE>null</CODE> if URL for the |
| | | * protocol is not found. |
| | | * @param server the server descriptor. |
| | | * @param protocol the protocol to be used. |
| | | * @return the LDAP URL to be used to connect to a given ServerDescriptor |
| | | * using a certain protocol. |
| | | */ |
| | | private static String getURL(ServerDescriptor server, |
| | | ConnectionHandlerDescriptor.Protocol protocol) |
| | | { |
| | | String url = null; |
| | | |
| | | String sProtocol = null; |
| | | switch (protocol) |
| | | { |
| | | case LDAP: |
| | | sProtocol = "ldap"; |
| | | break; |
| | | case LDAPS: |
| | | sProtocol = "ldaps"; |
| | | break; |
| | | case LDAP_STARTTLS: |
| | | sProtocol = "ldap"; |
| | | break; |
| | | case JMX: |
| | | sProtocol = "jmx"; |
| | | break; |
| | | case JMXS: |
| | | sProtocol = "jmxs"; |
| | | break; |
| | | } |
| | | |
| | | for (ConnectionHandlerDescriptor desc : server.getConnectionHandlers()) |
| | | { |
| | | if ((desc.getState() == ConnectionHandlerDescriptor.State.ENABLED) && |
| | | (desc.getProtocol() == protocol)) |
| | | { |
| | | int port = desc.getPort(); |
| | | SortedSet<InetAddress> addresses = desc.getAdresses(); |
| | | if (addresses.size() == 0) |
| | | { |
| | | if (port > 0) |
| | | { |
| | | url = sProtocol +"://"+ |
| | | ConnectionUtils.getHostNameForLdapUrl( |
| | | server.getHostname())+":"+port; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (port > 0) |
| | | { |
| | | InetAddress address = addresses.first(); |
| | | url = sProtocol +"://"+ |
| | | ConnectionUtils.getHostNameForLdapUrl(address.toString())+":"+ |
| | | port; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return url; |
| | | } |
| | | |
| | | /** |
| | | * Returns the Administration Connector URL. |
| | | * It returns <CODE>null</CODE> if URL for the |
| | | * protocol is not found. |
| | | * @param server the server descriptor. |
| | | * @return the Administration Connector URL. |
| | | */ |
| | | private static String getAdminConnectorURL(ServerDescriptor server) { |
| | | String url = null; |
| | | |
| | | ConnectionHandlerDescriptor desc = server.getAdminConnector(); |
| | | int port = desc.getPort(); |
| | | SortedSet<InetAddress> addresses = desc.getAdresses(); |
| | | if (addresses.size() == 0) { |
| | | if (port > 0) { |
| | | url = "ldaps://" + |
| | | ConnectionUtils.getHostNameForLdapUrl( |
| | | server.getHostname()) + ":" + port; |
| | | } |
| | | } else { |
| | | if (port > 0) { |
| | | InetAddress address = addresses.first(); |
| | | url = "ldaps://" + |
| | | ConnectionUtils.getHostNameForLdapUrl(address.toString()) + ":" + |
| | | port; |
| | | } |
| | | } |
| | | return url; |
| | | } |
| | | |
| | | /** |
| | | * Tells whether we must connect to the server using Start TLS. |
| | | * @return <CODE>true</CODE> if we must connect to the server using Start TLS |
| | | * and <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean connectUsingStartTLS() |
| | | { |
| | | boolean connectUsingStartTLS = false; |
| | | if (getStartTLSURL() != null) |
| | | { |
| | | connectUsingStartTLS = getStartTLSURL().equals(getURLToConnect()); |
| | | } |
| | | return connectUsingStartTLS; |
| | | } |
| | | |
| | | /** |
| | | * Tells whether we must connect to the server using LDAPS. |
| | | * @return <CODE>true</CODE> if we must connect to the server using LDAPS |
| | | * and <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean connectUsingLDAPS() |
| | | { |
| | | boolean connectUsingLDAPS = false; |
| | | if (getLDAPSURL() != null) |
| | | { |
| | | connectUsingLDAPS = getLDAPSURL().equals(getURLToConnect()); |
| | | } |
| | | return connectUsingLDAPS; |
| | | } |
| | | |
| | | /** |
| | | * Returns the URL that must be used to connect to the server based on the |
| | | * available enabled connection handlers in the server and the connection |
| | | * policy. |
| | | * @return the URL that must be used to connect to the server. |
| | | */ |
| | | public String getURLToConnect() |
| | | { |
| | | String url; |
| | | switch (getConnectionPolicy()) |
| | | { |
| | | case USE_STARTTLS: |
| | | url = getStartTLSURL(); |
| | | break; |
| | | case USE_LDAP: |
| | | url = getLDAPURL(); |
| | | break; |
| | | case USE_LDAPS: |
| | | url = getLDAPSURL(); |
| | | break; |
| | | case USE_ADMIN: |
| | | url = getAdminConnectorURL(); |
| | | break; |
| | | case USE_MOST_SECURE_AVAILABLE: |
| | | url = getLDAPSURL(); |
| | | if (url == null) |
| | | { |
| | | url = getStartTLSURL(); |
| | | } |
| | | if (url == null) |
| | | { |
| | | url = getLDAPURL(); |
| | | } |
| | | break; |
| | | case USE_LESS_SECURE_AVAILABLE: |
| | | url = getLDAPURL(); |
| | | if (url == null) |
| | | { |
| | | url = getStartTLSURL(); |
| | | } |
| | | if (url == null) |
| | | { |
| | | url = getLDAPSURL(); |
| | | } |
| | | break; |
| | | default: |
| | | throw new IllegalStateException("Unknown policy: "+getConnectionPolicy()); |
| | | } |
| | | return url; |
| | | } |
| | | |
| | | /** |
| | | * Returns <CODE>true</CODE> if the configuration must be deregistered and |
| | | * <CODE>false</CODE> otherwise. |
| | | * This is required when we use the ConfigFileHandler to update the |
| | | * configuration, in these cases cn=config must the deregistered from the |
| | | * ConfigFileHandler and after that register again. |
| | | * @return <CODE>true</CODE> if the configuration must be deregistered and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean mustDeregisterConfig() |
| | | { |
| | | return mustDeregisterConfig; |
| | | } |
| | | |
| | | /** |
| | | * Sets whether the configuration must be deregistered or not. |
| | | * @param mustDeregisterConfig whether the configuration must be deregistered |
| | | * or not. |
| | | */ |
| | | public void setMustDeregisterConfig(boolean mustDeregisterConfig) |
| | | { |
| | | ControlPanelInfo.mustDeregisterConfig = mustDeregisterConfig; |
| | | } |
| | | |
| | | /** |
| | | * Returns the connection pool to be used by the LDAP entry browsers. |
| | | * @return the connection pool to be used by the LDAP entry browsers. |
| | | */ |
| | | public LDAPConnectionPool getConnectionPool() |
| | | { |
| | | return connectionPool; |
| | | } |
| | | |
| | | /** |
| | | * Returns the icon pool to be used by the LDAP entry browsers. |
| | | * @return the icon pool to be used by the LDAP entry browsers. |
| | | */ |
| | | public IconPool getIconPool() |
| | | { |
| | | return iconPool; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | | |
| | | import javax.naming.CompositeName; |
| | | import javax.naming.Name; |
| | | import javax.naming.NamingEnumeration; |
| | | import javax.naming.NamingException; |
| | | import javax.naming.directory.Attribute; |
| | | import javax.naming.directory.Attributes; |
| | | import javax.naming.directory.SearchResult; |
| | | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | |
| | | /** |
| | | * This is a commodity class used to wrap the SearchResult class of JNDI. |
| | | * Basically it retrieves all the attributes and values on the SearchResult and |
| | | * calculates its DN. Using it we avoid having to handle the NamingException |
| | | * exceptions that most of the methods in SearchResult throw. |
| | | * |
| | | */ |
| | | public class CustomSearchResult implements Comparable { |
| | | private Name name; |
| | | private String dn; |
| | | private Map<String, Set<Object>> attributes; |
| | | private SortedSet<String> attrNames; |
| | | |
| | | /** |
| | | * Constructor of an empty search result. This constructor is used by the |
| | | * LDAP entry editor which 'build' their own CustomSearchResult. The entry |
| | | * editors use some methods that require CustomSearchResult. |
| | | * @param dn the dn of the entry. |
| | | */ |
| | | public CustomSearchResult(String dn) |
| | | { |
| | | this.dn = dn; |
| | | attributes = new HashMap<String, Set<Object>>(); |
| | | attrNames = new TreeSet<String>(); |
| | | } |
| | | |
| | | /** |
| | | * Constructor of a search result using a SearchResult as basis. |
| | | * @param sr the SearchResult. |
| | | * @param baseDN the base DN of the search that returned the SearchResult. |
| | | * @throws NamingException if there is an error retrieving the attribute |
| | | * values. |
| | | */ |
| | | public CustomSearchResult(SearchResult sr, String baseDN) |
| | | throws NamingException |
| | | { |
| | | String sName = sr.getName(); |
| | | if ((baseDN != null) && (baseDN.length() > 0)) |
| | | { |
| | | if ((sName != null) && (sName.length() > 0)) |
| | | { |
| | | name = new CompositeName(sName); |
| | | name.add(baseDN); |
| | | |
| | | } |
| | | else { |
| | | name = Utilities.getJNDIName(baseDN); |
| | | } |
| | | } |
| | | else { |
| | | name = new CompositeName(sName); |
| | | } |
| | | StringBuilder buf = new StringBuilder(); |
| | | for (int i=0; i<name.size(); i++) |
| | | { |
| | | String n = name.get(i); |
| | | if ((buf.length() != 0) && (n != null) && (n.length() > 0)) |
| | | { |
| | | buf.append(","); |
| | | } |
| | | if ((n != null) && (n.length() > 0)) |
| | | { |
| | | buf.append(n); |
| | | } |
| | | } |
| | | dn = buf.toString(); |
| | | |
| | | attributes = new HashMap<String, Set<Object>>(); |
| | | attrNames = new TreeSet<String>(); |
| | | Attributes attrs = sr.getAttributes(); |
| | | if (attrs != null) |
| | | { |
| | | NamingEnumeration en = attrs.getAll(); |
| | | while (en.hasMore()) { |
| | | Attribute attr = (Attribute)en.next(); |
| | | String name = attr.getID(); |
| | | attrNames.add(name); |
| | | Set<Object> values = new HashSet<Object>(); |
| | | for (int i=0; i<attr.size(); i++) |
| | | { |
| | | Object v = attr.get(i); |
| | | if (!"".equals(v.toString())) |
| | | { |
| | | values.add(v); |
| | | } |
| | | } |
| | | attributes.put(name.toLowerCase(), values); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns the DN of the entry. |
| | | * @return the DN of the entry. |
| | | */ |
| | | public String getDN() { |
| | | return dn; |
| | | } |
| | | |
| | | /** |
| | | * Returns the values for a given attribute. It returns an empty Set if |
| | | * the attribute is not defined. |
| | | * @param name the name of the attribute. |
| | | * @return the values for a given attribute. It returns an empty Set if |
| | | * the attribute is not defined. |
| | | */ |
| | | public Set<Object> getAttributeValues(String name) { |
| | | Set<Object> values = attributes.get(name.toLowerCase()); |
| | | if (values == null) |
| | | { |
| | | values = Collections.emptySet(); |
| | | } |
| | | return values; |
| | | } |
| | | |
| | | /** |
| | | * Returns all the attribute names of the entry. |
| | | * @return the attribute names of the entry. |
| | | */ |
| | | public SortedSet<String> getAttributeNames() { |
| | | return attrNames; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int compareTo(Object o) { |
| | | return this.getDN().compareTo(((CustomSearchResult)o).getDN()); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public String toString() { |
| | | return "dn: "+dn+"\nattributes: "+attributes; |
| | | } |
| | | |
| | | /** |
| | | * Sets the values for a given attribute name. |
| | | * @param attrName the name of the attribute. |
| | | * @param values the values for the attribute. |
| | | */ |
| | | public void set(String attrName, Set<Object> values) |
| | | { |
| | | attrNames.add(attrName); |
| | | attrName = attrName.toLowerCase(); |
| | | attributes.put(attrName, values); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | | |
| | | import org.opends.server.admin.std.meta.LocalDBIndexCfgDefn.IndexType; |
| | | import org.opends.server.types.AttributeType; |
| | | |
| | | /** |
| | | * The class used to describe the index configuration (the normal index: the |
| | | * one used to improve search performance on a given attribute). |
| | | * |
| | | */ |
| | | public class IndexDescriptor extends AbstractIndexDescriptor |
| | | { |
| | | |
| | | private SortedSet<IndexType> types = new TreeSet<IndexType>(); |
| | | private boolean isDatabaseIndex; |
| | | private int entryLimit; |
| | | private AttributeType attr; |
| | | private int hashCode; |
| | | |
| | | /** |
| | | * Constructor of the index. |
| | | * @param name name of the index. |
| | | * @param attr the attribute type associated with the index attribute. |
| | | * @param backend the backend where the index is defined. |
| | | * @param types the type of indexes (equality, substring, etc.). |
| | | * @param entryLimit the entry limit for the index. |
| | | */ |
| | | public IndexDescriptor(String name, AttributeType attr, |
| | | BackendDescriptor backend, |
| | | SortedSet<IndexType> types, int entryLimit) |
| | | { |
| | | super(name, backend); |
| | | this.attr = attr; |
| | | this.types.addAll(types); |
| | | isDatabaseIndex = isDatabaseIndex(name); |
| | | this.entryLimit = entryLimit; |
| | | recalculateHashCode(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the attribute type associated with the index attribute. |
| | | * @return the attribute type associated with the index attribute. |
| | | */ |
| | | public AttributeType getAttributeType() |
| | | { |
| | | return attr; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int compareTo(Object o) |
| | | { |
| | | int returnValue = -1; |
| | | if (o instanceof AbstractIndexDescriptor) |
| | | { |
| | | AbstractIndexDescriptor index = (AbstractIndexDescriptor)o; |
| | | returnValue = getName().compareTo(index.getName()); |
| | | } |
| | | return returnValue; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int hashCode() |
| | | { |
| | | return hashCode; |
| | | } |
| | | |
| | | /** |
| | | * Returns the type of indexes (equality, substring, etc.). |
| | | * @return the type of indexes (equality, substring, etc.). |
| | | */ |
| | | public SortedSet<IndexType> getTypes() |
| | | { |
| | | return new TreeSet<IndexType>(types); |
| | | } |
| | | |
| | | /** |
| | | * Tells whether this is a database index or not. Database indexes are not |
| | | * modifiable and for internal use only. |
| | | * @return <CODE>true</CODE> if this is a database index and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean isDatabaseIndex() |
| | | { |
| | | return isDatabaseIndex; |
| | | } |
| | | |
| | | /** |
| | | * Tells whether the provide index name corresponds to a database index or |
| | | * not. Database indexes are not modifiable and for internal use only. |
| | | * @return <CODE>true</CODE> if the provide index name corresponds to a |
| | | * database index and <CODE>false</CODE> otherwise. |
| | | */ |
| | | private boolean isDatabaseIndex(String name) |
| | | { |
| | | return name.equalsIgnoreCase("dn2id") || |
| | | name.equalsIgnoreCase("id2children") || |
| | | name.equalsIgnoreCase("id2subtree"); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean equals(Object o) |
| | | { |
| | | boolean equals = o == this; |
| | | if (!equals) |
| | | { |
| | | equals = o instanceof IndexDescriptor; |
| | | if (equals) |
| | | { |
| | | IndexDescriptor index = (IndexDescriptor)o; |
| | | equals = index.getName().equalsIgnoreCase(getName()) && |
| | | index.isDatabaseIndex() == isDatabaseIndex() && |
| | | index.getTypes().equals(getTypes()) && |
| | | index.getEntryLimit() == getEntryLimit(); |
| | | |
| | | if (equals) |
| | | { |
| | | if ((getBackend() != null) && (index.getBackend() != null)) |
| | | { |
| | | // Only compare the backend IDs. In this context is enough |
| | | equals = getBackend().getBackendID().equals( |
| | | index.getBackend().getBackendID()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return equals; |
| | | } |
| | | |
| | | /** |
| | | * Returns the entry limit of the index. |
| | | * @return the entry limit of the index. |
| | | */ |
| | | public int getEntryLimit() |
| | | { |
| | | return entryLimit; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected void recalculateHashCode() |
| | | { |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (IndexType t : types) |
| | | { |
| | | sb.append(t+","); |
| | | } |
| | | if (getBackend() != null) |
| | | { |
| | | sb.append(getBackend().getBackendID()); |
| | | } |
| | | hashCode = (getName()+sb+entryLimit).hashCode(); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.admin.std.meta.LocalDBIndexCfgDefn.IndexType; |
| | | |
| | | /** |
| | | * The table model for the indexes. This is the table model used by the table |
| | | * that appears on the right side of the Manage Index dialog when the user |
| | | * clicks on the node "Index" and it gives a global view of the indexes |
| | | * defined on a given backend. |
| | | * |
| | | */ |
| | | public class IndexTableModel extends AbstractIndexTableModel |
| | | { |
| | | |
| | | private static final long serialVersionUID = 6979651281772979301L; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected String[] getColumnNames() |
| | | { |
| | | return new String[] { |
| | | getHeader(INFO_CTRL_PANEL_INDEXES_HEADER_ATTRIBUTE.get(), 30), |
| | | getHeader(INFO_CTRL_PANEL_INDEXES_HEADER_ENTRY_LIMIT.get(), 30), |
| | | getHeader(INFO_CTRL_PANEL_INDEXES_HEADER_INDEX_TYPES.get(), 30), |
| | | getHeader(INFO_CTRL_PANEL_INDEXES_HEADER_REQUIRES_REBUILD.get(), 30) |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * Comparable implementation. |
| | | * @param index1 the first index descriptor to compare. |
| | | * @param index2 the second index descriptor to compare. |
| | | * @return 1 if according to the sorting options set by the user the first |
| | | * index descriptor must be put before the second descriptor, 0 if they |
| | | * are equivalent in terms of sorting and -1 if the second descriptor must |
| | | * be put before the first descriptor. |
| | | */ |
| | | public int compare(AbstractIndexDescriptor index1, |
| | | AbstractIndexDescriptor index2) |
| | | { |
| | | int result; |
| | | IndexDescriptor i1 = (IndexDescriptor)index1; |
| | | IndexDescriptor i2 = (IndexDescriptor)index2; |
| | | |
| | | int[] possibleResults = {compareNames(i1, i2), compareEntryLimits(i1, i2), |
| | | compareTypes(i1, i2), compareRebuildRequired(i1, i2)}; |
| | | result = possibleResults[sortColumn]; |
| | | if (result == 0) |
| | | { |
| | | for (int i : possibleResults) |
| | | { |
| | | if (i != 0) |
| | | { |
| | | result = i; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if (!sortAscending) |
| | | { |
| | | result = -result; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected String[] getLine(AbstractIndexDescriptor index) |
| | | { |
| | | IndexDescriptor i = (IndexDescriptor)index; |
| | | return new String[] { |
| | | i.getName(), getEntryLimitValue(i), getIndexTypeString(i), |
| | | getRebuildRequiredString(i).toString() |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * Returns the String representing the entry limit value of the index. |
| | | * @return the String representing the entry limit value of the index. |
| | | */ |
| | | private String getEntryLimitValue(IndexDescriptor i) |
| | | { |
| | | if (i.getEntryLimit() >= 0) |
| | | { |
| | | return String.valueOf(i.getEntryLimit()); |
| | | } |
| | | else |
| | | { |
| | | return INFO_NOT_APPLICABLE_LABEL.get().toString(); |
| | | } |
| | | } |
| | | |
| | | // Comparison methods. |
| | | |
| | | private int compareNames(IndexDescriptor i1, IndexDescriptor i2) |
| | | { |
| | | return i1.getName().compareTo(i2.getName()); |
| | | } |
| | | |
| | | private int compareEntryLimits(IndexDescriptor i1, IndexDescriptor i2) |
| | | { |
| | | return getEntryLimitValue(i1).compareTo(getEntryLimitValue(i2)); |
| | | } |
| | | |
| | | private int compareTypes(IndexDescriptor i1, IndexDescriptor i2) |
| | | { |
| | | return getIndexTypeString(i1).compareTo(getIndexTypeString(i2)); |
| | | } |
| | | |
| | | /** |
| | | * Returns the String representation of the index type for the index. |
| | | * @param index the index. |
| | | * @return the String representation of the index type for the index. |
| | | */ |
| | | private String getIndexTypeString(IndexDescriptor index) |
| | | { |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (IndexType type : index.getTypes()) |
| | | { |
| | | Message v; |
| | | switch (type) |
| | | { |
| | | case SUBSTRING: |
| | | v = INFO_CTRL_PANEL_INDEX_SUBSTRING.get(); |
| | | break; |
| | | case ORDERING: |
| | | v = INFO_CTRL_PANEL_INDEX_ORDERING.get(); |
| | | break; |
| | | case PRESENCE: |
| | | v = INFO_CTRL_PANEL_INDEX_PRESENCE.get(); |
| | | break; |
| | | case EQUALITY: |
| | | v = INFO_CTRL_PANEL_INDEX_EQUALITY.get(); |
| | | break; |
| | | case APPROXIMATE: |
| | | v = INFO_CTRL_PANEL_INDEX_APPROXIMATE.get(); |
| | | break; |
| | | default: |
| | | throw new IllegalStateException("Unknown index type: "+type); |
| | | } |
| | | if (sb.length() > 0) |
| | | { |
| | | sb.append(", "); |
| | | } |
| | | sb.append(v); |
| | | } |
| | | if (sb.length() == 0) |
| | | { |
| | | sb.append(INFO_NOT_APPLICABLE_LABEL.get().toString()); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import java.util.Set; |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | | |
| | | /** |
| | | * This class represent all the objectclass values for a given entry. It is |
| | | * used by the entry editors (SimplifiedEntryView and TableEntryView) to edit |
| | | * and display the objectclass. |
| | | * |
| | | */ |
| | | public class ObjectClassValue |
| | | { |
| | | private String structural; |
| | | private SortedSet<String> auxiliary = new TreeSet<String>(); |
| | | private int hashCode; |
| | | |
| | | /** |
| | | * Constructor of the object class value. |
| | | * @param structural the name of the structural objectclass. |
| | | * @param auxiliary the auxiliary objectclasses. |
| | | */ |
| | | public ObjectClassValue(String structural, Set<String> auxiliary) |
| | | { |
| | | this.structural = structural; |
| | | this.auxiliary.addAll(auxiliary); |
| | | hashCode = structural.hashCode(); |
| | | for (String oc : auxiliary) |
| | | { |
| | | hashCode += oc.hashCode(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns the names of the auxiliary objectclasses. |
| | | * @return the names of the auxiliary objectclasses. |
| | | */ |
| | | public SortedSet<String> getAuxiliary() |
| | | { |
| | | return auxiliary; |
| | | } |
| | | |
| | | /** |
| | | * Returns the name of the structural objectclass. |
| | | * @return the name of the structural objectclass. |
| | | */ |
| | | public String getStructural() |
| | | { |
| | | return structural; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int hashCode() |
| | | { |
| | | return hashCode; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean equals(Object o) |
| | | { |
| | | boolean equals; |
| | | if (o != this) |
| | | { |
| | | if (o != null) |
| | | { |
| | | if (o instanceof ObjectClassValue) |
| | | { |
| | | ObjectClassValue oc = (ObjectClassValue)o; |
| | | if (structural != null) |
| | | { |
| | | equals = structural.equals(oc.getStructural()); |
| | | } |
| | | else |
| | | { |
| | | equals = oc.getStructural() == null; |
| | | } |
| | | if (equals) |
| | | { |
| | | equals = auxiliary.equals(oc.getAuxiliary()); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | equals = false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | equals = false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | equals = true; |
| | | } |
| | | return equals; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.ObjectClass; |
| | | import org.opends.server.types.OpenDsException; |
| | | import org.opends.server.types.Schema; |
| | | |
| | | /** |
| | | * This is just a class used to provide a data model describing what the |
| | | * StatusPanelDialog will show to the user. |
| | | */ |
| | | public class ServerDescriptor |
| | | { |
| | | private ServerStatus status; |
| | | private int openConnections; |
| | | private Set<BackendDescriptor> backends = new HashSet<BackendDescriptor>(); |
| | | private Set<ConnectionHandlerDescriptor> listeners = |
| | | new HashSet<ConnectionHandlerDescriptor>(); |
| | | private ConnectionHandlerDescriptor adminConnector; |
| | | private Set<DN> administrativeUsers = new HashSet<DN>(); |
| | | private File installPath; |
| | | private String openDSVersion; |
| | | private String javaVersion; |
| | | private ArrayList<OpenDsException> exceptions = |
| | | new ArrayList<OpenDsException>(); |
| | | private boolean isWindowsServiceEnabled; |
| | | private boolean isSchemaEnabled; |
| | | private Schema schema; |
| | | |
| | | private boolean isAuthenticated; |
| | | |
| | | private static String hostName = "locahost"; |
| | | static |
| | | { |
| | | try |
| | | { |
| | | hostName = java.net.InetAddress.getLocalHost().getHostName(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * Enumeration indicating the status of the server. |
| | | * |
| | | */ |
| | | public enum ServerStatus |
| | | { |
| | | /** |
| | | * Server Started. |
| | | */ |
| | | STARTED, |
| | | /** |
| | | * Server Stopped. |
| | | */ |
| | | STOPPED, |
| | | /** |
| | | * Server Starting. |
| | | */ |
| | | STARTING, |
| | | /** |
| | | * Server Stopping. |
| | | */ |
| | | STOPPING, |
| | | /** |
| | | * Status Unknown. |
| | | */ |
| | | UNKNOWN |
| | | } |
| | | |
| | | /** |
| | | * Default constructor. |
| | | */ |
| | | public ServerDescriptor() |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * Return the administrative users. |
| | | * @return the administrative users. |
| | | */ |
| | | public Set<DN> getAdministrativeUsers() |
| | | { |
| | | return Collections.unmodifiableSet(administrativeUsers); |
| | | } |
| | | |
| | | /** |
| | | * Set the administrative users. |
| | | * @param administrativeUsers the administrative users to set |
| | | */ |
| | | public void setAdministrativeUsers(Set<DN> administrativeUsers) |
| | | { |
| | | this.administrativeUsers.clear(); |
| | | this.administrativeUsers.addAll(administrativeUsers); |
| | | } |
| | | |
| | | /** |
| | | * Returns whether the schema is enabled or not. |
| | | * @return <CODE>true</CODE> if the schema is enabled and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public boolean isSchemaEnabled() |
| | | { |
| | | return isSchemaEnabled; |
| | | } |
| | | |
| | | /** |
| | | * Sets whether the schema is enabled or not. |
| | | * @param isSchemaEnabled <CODE>true</CODE> if the schema is enabled and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | public void setSchemaEnabled(boolean isSchemaEnabled) |
| | | { |
| | | this.isSchemaEnabled = isSchemaEnabled; |
| | | } |
| | | |
| | | /** |
| | | * Return the install path where the server is installed. |
| | | * @return the install path where the server is installed. |
| | | */ |
| | | public File getInstallPath() |
| | | { |
| | | return installPath; |
| | | } |
| | | |
| | | /** |
| | | * Sets the install path where the server is installed. |
| | | * @param installPath the install path where the server is installed. |
| | | */ |
| | | public void setInstallPath(File installPath) |
| | | { |
| | | this.installPath = installPath; |
| | | } |
| | | |
| | | /** |
| | | * Return the java version used to run the server. |
| | | * @return the java version used to run the server. |
| | | */ |
| | | public String getJavaVersion() |
| | | { |
| | | return javaVersion; |
| | | } |
| | | |
| | | /** |
| | | * Set the java version used to run the server. |
| | | * @param javaVersion the java version used to run the server. |
| | | */ |
| | | public void setJavaVersion(String javaVersion) |
| | | { |
| | | this.javaVersion = javaVersion; |
| | | } |
| | | |
| | | /** |
| | | * Returns the number of open connection in the server. |
| | | * @return the number of open connection in the server. |
| | | */ |
| | | public int getOpenConnections() |
| | | { |
| | | return openConnections; |
| | | } |
| | | |
| | | /** |
| | | * Set the number of open connections. |
| | | * @param openConnections the number of open connections. |
| | | */ |
| | | public void setOpenConnections(int openConnections) |
| | | { |
| | | this.openConnections = openConnections; |
| | | } |
| | | |
| | | /** |
| | | * Returns the version of the server. |
| | | * @return the version of the server. |
| | | */ |
| | | public String getOpenDSVersion() |
| | | { |
| | | return openDSVersion; |
| | | } |
| | | |
| | | /** |
| | | * Sets the version of the server. |
| | | * @param openDSVersion the version of the server. |
| | | */ |
| | | public void setOpenDSVersion(String openDSVersion) |
| | | { |
| | | this.openDSVersion = openDSVersion; |
| | | } |
| | | |
| | | /** |
| | | * Returns the status of the server. |
| | | * @return the status of the server. |
| | | */ |
| | | public ServerStatus getStatus() |
| | | { |
| | | return status; |
| | | } |
| | | |
| | | /** |
| | | * Sets the status of the server. |
| | | * @param status the status of the server. |
| | | */ |
| | | public void setStatus(ServerStatus status) |
| | | { |
| | | this.status = status; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean equals(Object o) |
| | | { |
| | | boolean equals = false; |
| | | if (this != o) |
| | | { |
| | | if (o instanceof ServerDescriptor) |
| | | { |
| | | ServerDescriptor desc = (ServerDescriptor)o; |
| | | equals = desc.getStatus() == getStatus(); |
| | | |
| | | if (equals) |
| | | { |
| | | equals = desc.isAuthenticated() == isAuthenticated(); |
| | | } |
| | | |
| | | if (equals) |
| | | { |
| | | equals = desc.getOpenConnections() == getOpenConnections(); |
| | | } |
| | | |
| | | if (equals) |
| | | { |
| | | equals = desc.getInstallPath().equals(getInstallPath()); |
| | | } |
| | | |
| | | if (equals) |
| | | { |
| | | if (desc.getJavaVersion() == null) |
| | | { |
| | | equals = getJavaVersion() == null; |
| | | } |
| | | else |
| | | { |
| | | equals = desc.getJavaVersion().equals(getJavaVersion()); |
| | | } |
| | | } |
| | | |
| | | if (equals) |
| | | { |
| | | equals = desc.getOpenDSVersion().equals(getOpenDSVersion()); |
| | | } |
| | | |
| | | if (equals) |
| | | { |
| | | equals = desc.getAdministrativeUsers().equals( |
| | | getAdministrativeUsers()); |
| | | } |
| | | |
| | | if (equals) |
| | | { |
| | | equals = desc.getConnectionHandlers().equals(getConnectionHandlers()); |
| | | } |
| | | |
| | | if (equals) |
| | | { |
| | | equals = desc.getBackends().equals(getBackends()); |
| | | } |
| | | |
| | | if (equals) |
| | | { |
| | | equals = desc.getExceptions().equals(getExceptions()); |
| | | } |
| | | |
| | | if (equals) |
| | | { |
| | | equals = desc.isSchemaEnabled() == isSchemaEnabled(); |
| | | } |
| | | |
| | | if (equals) |
| | | { |
| | | if (desc.getSchema() == null) |
| | | { |
| | | equals = getSchema() != null; |
| | | } |
| | | else if (getSchema() == null) |
| | | { |
| | | equals = false; |
| | | } |
| | | else |
| | | { |
| | | equals = areSchemasEqual(schema, desc.getSchema()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | equals = true; |
| | | } |
| | | return equals; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int hashCode() |
| | | { |
| | | return status.hashCode() + openConnections + |
| | | (String.valueOf( |
| | | installPath+openDSVersion+javaVersion+isAuthenticated)). |
| | | hashCode(); |
| | | } |
| | | |
| | | /** |
| | | * Return whether we were authenticated when retrieving the information of |
| | | * this ServerStatusDescriptor. |
| | | * @return <CODE>true</CODE> if we were authenticated when retrieving the |
| | | * information of this ServerStatusDescriptor and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public boolean isAuthenticated() |
| | | { |
| | | return isAuthenticated; |
| | | } |
| | | |
| | | /** |
| | | * Sets whether we were authenticated when retrieving the information of |
| | | * this ServerStatusDescriptor. |
| | | * @param isAuthenticated whether we were authenticated when retrieving the |
| | | * information of this ServerStatusDescriptor. |
| | | */ |
| | | public void setAuthenticated(boolean isAuthenticated) |
| | | { |
| | | this.isAuthenticated = isAuthenticated; |
| | | } |
| | | |
| | | /** |
| | | * Returns the backend descriptors of the server. |
| | | * @return the backend descriptors of the server. |
| | | */ |
| | | public Set<BackendDescriptor> getBackends() |
| | | { |
| | | return Collections.unmodifiableSet(backends); |
| | | } |
| | | |
| | | /** |
| | | * Sets the backend descriptors of the server. |
| | | * @param backends the database descriptors to set. |
| | | */ |
| | | public void setBackends(Set<BackendDescriptor> backends) |
| | | { |
| | | this.backends.clear(); |
| | | this.backends.addAll(backends); |
| | | } |
| | | |
| | | /** |
| | | * Returns the listener descriptors of the server. |
| | | * @return the listener descriptors of the server. |
| | | */ |
| | | public Set<ConnectionHandlerDescriptor> getConnectionHandlers() |
| | | { |
| | | return Collections.unmodifiableSet(listeners); |
| | | } |
| | | |
| | | /** |
| | | * Sets the listener descriptors of the server. |
| | | * @param listeners the listener descriptors to set. |
| | | */ |
| | | public void setConnectionHandlers(Set<ConnectionHandlerDescriptor> listeners) |
| | | { |
| | | this.listeners.clear(); |
| | | this.listeners.addAll(listeners); |
| | | } |
| | | |
| | | /** |
| | | * Sets the schema of the server. |
| | | * @param schema the schema of the server. |
| | | */ |
| | | public void setSchema(Schema schema) |
| | | { |
| | | this.schema = schema; |
| | | } |
| | | |
| | | /** |
| | | * Returns the schema of the server. |
| | | * @return the schema of the server. |
| | | */ |
| | | public Schema getSchema() |
| | | { |
| | | return schema; |
| | | } |
| | | |
| | | /** |
| | | * Returns the host name of the server. |
| | | * @return the host name of the server. |
| | | */ |
| | | public String getHostname() |
| | | { |
| | | return hostName; |
| | | } |
| | | |
| | | /** |
| | | * Returns the exceptions that occurred while reading the configuration. |
| | | * @return the exceptions that occurred while reading the configuration. |
| | | */ |
| | | public List<OpenDsException> getExceptions() |
| | | { |
| | | return Collections.unmodifiableList(exceptions); |
| | | } |
| | | |
| | | /** |
| | | * Sets the exceptions that occurred while reading the configuration. |
| | | * @param exceptions exceptions that occurred while reading the |
| | | * configuration. |
| | | */ |
| | | public void setExceptions(Collection<OpenDsException> exceptions) |
| | | { |
| | | this.exceptions.clear(); |
| | | this.exceptions.addAll(exceptions); |
| | | } |
| | | |
| | | /** |
| | | * Tells whether the windows service is enabled or not. |
| | | * @return <CODE>true</CODE> if the windows service is enabled and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean isWindowsServiceEnabled() |
| | | { |
| | | return isWindowsServiceEnabled; |
| | | } |
| | | |
| | | /** |
| | | * Sets whether the windows service is enabled or not. |
| | | * @param isWindowsServiceEnabled <CODE>true</CODE> if the windows service is |
| | | * enabled and <CODE>false</CODE> otherwise. |
| | | */ |
| | | public void setWindowsServiceEnabled(boolean isWindowsServiceEnabled) |
| | | { |
| | | this.isWindowsServiceEnabled = isWindowsServiceEnabled; |
| | | } |
| | | |
| | | /** |
| | | * Method used to compare schemas. |
| | | * Returns <CODE>true</CODE> if the two schemas are equal and |
| | | * <CODE>false</CODE> otherwise. |
| | | * @param schema1 the first schema. |
| | | * @param schema2 the second schema. |
| | | * @return <CODE>true</CODE> if the two schemas are equal and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | public static boolean areSchemasEqual(Schema schema1, Schema schema2) |
| | | { |
| | | boolean areEqual = schema1 == schema2; |
| | | |
| | | if (!areEqual && (schema1 != null) && (schema2 != null)) |
| | | { |
| | | areEqual = true; |
| | | |
| | | // Just compare exhaustively objectclasses and attributes. |
| | | Map<String, AttributeType> attrs1 = schema1.getAttributeTypes(); |
| | | Map<String, AttributeType> attrs2 = schema2.getAttributeTypes(); |
| | | areEqual = attrs1.size() == attrs2.size(); |
| | | for (String name : attrs1.keySet()) |
| | | { |
| | | if (!areEqual) |
| | | { |
| | | break; |
| | | } |
| | | |
| | | AttributeType attr1 = attrs1.get(name); |
| | | AttributeType attr2 = attrs2.get(name); |
| | | if (attr2 != null) |
| | | { |
| | | areEqual = areAttributesEqual(attr1, attr2); |
| | | } |
| | | else |
| | | { |
| | | areEqual = false; |
| | | } |
| | | } |
| | | if (areEqual) |
| | | { |
| | | Map<String, ObjectClass> ocs1 = schema1.getObjectClasses(); |
| | | Map<String, ObjectClass> ocs2 = schema2.getObjectClasses(); |
| | | areEqual = ocs1.size() == ocs2.size(); |
| | | for (String name : ocs1.keySet()) |
| | | { |
| | | if (!areEqual) |
| | | { |
| | | break; |
| | | } |
| | | |
| | | ObjectClass oc1 = ocs1.get(name); |
| | | ObjectClass oc2 = ocs2.get(name); |
| | | if (oc2 != null) |
| | | { |
| | | areEqual = areObjectClassesEqual(oc1, oc2); |
| | | } |
| | | else |
| | | { |
| | | areEqual = false; |
| | | } |
| | | } |
| | | } |
| | | if (areEqual) |
| | | { |
| | | areEqual = schema1.getMatchingRules().equals( |
| | | schema2.getMatchingRules()); |
| | | } |
| | | if (areEqual) |
| | | { |
| | | areEqual = schema1.getSyntaxes().equals(schema2.getSyntaxes()); |
| | | } |
| | | } |
| | | return areEqual; |
| | | } |
| | | |
| | | /** |
| | | * Method used to compare attributes defined in the schema. |
| | | * Returns <CODE>true</CODE> if the two schema attributes are equal and |
| | | * <CODE>false</CODE> otherwise. |
| | | * @param schema1 the first schema attribute. |
| | | * @param schema2 the second schema attribute. |
| | | * @return <CODE>true</CODE> if the two schema attributes are equal and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | private static final boolean areAttributesEqual(AttributeType attr1, |
| | | AttributeType attr2) |
| | | { |
| | | boolean areEqual = attr1.getOID().equals(attr2.getOID()) && |
| | | attr1.isCollective() == attr2.isCollective() && |
| | | attr1.isNoUserModification() == attr2.isNoUserModification() && |
| | | attr1.isObjectClassType() == attr2.isObjectClassType() && |
| | | attr1.isObsolete() == attr2.isObsolete() && |
| | | attr1.isOperational() == attr2.isOperational() && |
| | | attr1.isSingleValue() == attr2.isSingleValue(); |
| | | |
| | | if (areEqual) |
| | | { |
| | | Object[] compareWithEqual = {attr1.getApproximateMatchingRule(), |
| | | attr2.getApproximateMatchingRule(), |
| | | attr1.getDefinitionWithFileName(), attr2.getDefinitionWithFileName(), |
| | | attr1.getDescription(), attr2.getDescription(), |
| | | attr1.getEqualityMatchingRule(), attr2.getEqualityMatchingRule(), |
| | | attr1.getOrderingMatchingRule(), attr2.getOrderingMatchingRule(), |
| | | attr1.getSubstringMatchingRule(), attr2.getSubstringMatchingRule(), |
| | | attr1.getSuperiorType(), attr2.getSuperiorType(), |
| | | attr1.getSyntax(), attr2.getSyntax(), |
| | | attr1.getSyntaxOID(), attr2.getSyntaxOID() |
| | | }; |
| | | |
| | | for (int i=0; i<compareWithEqual.length && areEqual; i++) |
| | | { |
| | | areEqual = areEqual(compareWithEqual[i], compareWithEqual[i+1]); |
| | | i ++; |
| | | } |
| | | |
| | | |
| | | if (areEqual) |
| | | { |
| | | Iterable[] iterables = {attr1.getExtraPropertyNames(), |
| | | attr2.getExtraPropertyNames(), |
| | | attr1.getNormalizedNames(), attr2.getNormalizedNames(), |
| | | attr1.getUserDefinedNames(), attr2.getUserDefinedNames()}; |
| | | for (int i=0; i<iterables.length && areEqual; i++) |
| | | { |
| | | Set<Object> set1 = new HashSet<Object>(); |
| | | Set<Object> set2 = new HashSet<Object>(); |
| | | for (Object o : iterables[i]) |
| | | { |
| | | set1.add(o); |
| | | } |
| | | for (Object o : iterables[i+1]) |
| | | { |
| | | set2.add(o); |
| | | } |
| | | areEqual = set1.equals(set2); |
| | | i ++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return areEqual; |
| | | } |
| | | |
| | | /** |
| | | * Method used to compare objectclasses defined in the schema. |
| | | * Returns <CODE>true</CODE> if the two schema objectclasses are equal and |
| | | * <CODE>false</CODE> otherwise. |
| | | * @param schema1 the first schema objectclass. |
| | | * @param schema2 the second schema objectclass. |
| | | * @return <CODE>true</CODE> if the two schema objectclasses are equal and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | private static final boolean areObjectClassesEqual(ObjectClass oc1, |
| | | ObjectClass oc2) |
| | | { |
| | | boolean areEqual = oc1.getOID().equals(oc2.getOID()) && |
| | | oc1.isExtensibleObject() == oc2.isExtensibleObject(); |
| | | if (areEqual) |
| | | { |
| | | Object[] compareWithEqual = { |
| | | oc1.getDefinitionWithFileName(), oc2.getDefinitionWithFileName(), |
| | | oc1.getDescription(), oc2.getDescription(), |
| | | oc1.getObjectClassType(), oc2.getObjectClassType(), |
| | | oc1.getOptionalAttributes(), oc2.getOptionalAttributes(), |
| | | oc1.getRequiredAttributes(), oc2.getRequiredAttributes(), |
| | | oc1.getSuperiorClass(), oc2.getSuperiorClass() |
| | | }; |
| | | |
| | | for (int i=0; i<compareWithEqual.length && areEqual; i++) |
| | | { |
| | | areEqual = areEqual(compareWithEqual[i], compareWithEqual[i+1]); |
| | | i ++; |
| | | } |
| | | } |
| | | |
| | | if (areEqual) |
| | | { |
| | | Iterable[] iterables = { |
| | | oc1.getExtraPropertyNames(), oc2.getExtraPropertyNames(), |
| | | oc1.getNormalizedNames(), oc2.getNormalizedNames(), |
| | | oc1.getUserDefinedNames(), oc2.getUserDefinedNames()}; |
| | | for (int i=0; i<iterables.length && areEqual; i++) |
| | | { |
| | | Set<Object> set1 = new HashSet<Object>(); |
| | | Set<Object> set2 = new HashSet<Object>(); |
| | | for (Object o : iterables[i]) |
| | | { |
| | | set1.add(o); |
| | | } |
| | | for (Object o : iterables[i+1]) |
| | | { |
| | | set2.add(o); |
| | | } |
| | | areEqual = set1.equals(set2); |
| | | i ++; |
| | | } |
| | | } |
| | | |
| | | return areEqual; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Commodity method used to compare two objects that might be |
| | | * <CODE>null</CODE>. |
| | | * @param o1 the first object. |
| | | * @param o2 the second object. |
| | | * @return if both objects are <CODE>null</CODE> returns true. If not returns |
| | | * <CODE>true</CODE> if both objects are equal according to the Object.equal |
| | | * method and <CODE>false</CODE> otherwise. |
| | | */ |
| | | private static boolean areEqual(Object o1, Object o2) |
| | | { |
| | | boolean areEqual = false; |
| | | if (o1 != null) |
| | | { |
| | | if (o2 != null) |
| | | { |
| | | areEqual = o1.equals(o2); |
| | | } |
| | | else |
| | | { |
| | | areEqual = false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | areEqual = o2 == null; |
| | | } |
| | | return areEqual; |
| | | } |
| | | |
| | | /** |
| | | * Returns the admin connector. |
| | | * @return the admin connector. |
| | | */ |
| | | public ConnectionHandlerDescriptor getAdminConnector() |
| | | { |
| | | return adminConnector; |
| | | } |
| | | |
| | | /** |
| | | * Sets the admin connector. |
| | | * @param adminConnector the admin connector. |
| | | */ |
| | | public void setAdminConnector(ConnectionHandlerDescriptor adminConnector) |
| | | { |
| | | this.adminConnector = adminConnector; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.Comparator; |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | | |
| | | import javax.swing.AbstractListModel; |
| | | |
| | | /** |
| | | * Note: this implementation does not call automatically fireContentsChanged, |
| | | * its up to the caller of the different methods of this implementation to |
| | | * call it explicitly. This is done because in general there is a series |
| | | * of calls to the add/remove methods and a single call to notify that |
| | | * things have changed is enough. |
| | | * |
| | | * @param <T> |
| | | */ |
| | | public class SortableListModel<T> extends AbstractListModel |
| | | { |
| | | private static final long serialVersionUID = 3241258779190228463L; |
| | | private SortedSet<T> data = new TreeSet<T>(); |
| | | |
| | | /** |
| | | * Returns the size of the list model. |
| | | * @return the size of the list model. |
| | | */ |
| | | public int getSize() |
| | | { |
| | | return data.size(); |
| | | } |
| | | |
| | | /** |
| | | * Sets the comparator to be used to sort the list. |
| | | * @param comp the comparator. |
| | | */ |
| | | public void setComparator(Comparator<T> comp) |
| | | { |
| | | SortedSet<T> copy = data; |
| | | data = new TreeSet<T>(comp); |
| | | data.addAll(copy); |
| | | } |
| | | |
| | | /** |
| | | * Returns the element at the specified index. |
| | | * @param i the index of the element. |
| | | * @return the element at the specified index. |
| | | */ |
| | | public T getElementAt(int i) |
| | | { |
| | | int index = 0; |
| | | for (T element : data) |
| | | { |
| | | if (index == i) |
| | | { |
| | | return element; |
| | | } |
| | | index++; |
| | | } |
| | | throw new ArrayIndexOutOfBoundsException( |
| | | "The index "+i+" is bigger than the maximum size: "+getSize()); |
| | | } |
| | | |
| | | /** |
| | | * Adds a value to the list model. |
| | | * @param value the value to be added. |
| | | */ |
| | | public void add(T value) |
| | | { |
| | | data.add(value); |
| | | } |
| | | |
| | | /** |
| | | * Removes a value from the list model. |
| | | * @param value the value to be removed. |
| | | * @return <CODE>true</CODE> if the element was on the list and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean remove(T value) |
| | | { |
| | | return data.remove(value); |
| | | } |
| | | |
| | | /** |
| | | * Clears the list model. |
| | | * |
| | | */ |
| | | public void clear() |
| | | { |
| | | data.clear(); |
| | | } |
| | | |
| | | /** |
| | | * Adds all the elements in the collection to the list model. |
| | | * @param newData the collection containing the elements to be added. |
| | | */ |
| | | public void addAll(Collection<T> newData) |
| | | { |
| | | data.addAll(newData); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void fireContentsChanged(Object source, int index0, int index1) |
| | | { |
| | | super.fireContentsChanged(source, index0, index1); |
| | | } |
| | | |
| | | /** |
| | | * Returns the data in this list model ordered. |
| | | * @return the data in this list model ordered. |
| | | */ |
| | | public SortedSet<T> getData() |
| | | { |
| | | return new TreeSet<T>(data); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import javax.swing.table.AbstractTableModel; |
| | | |
| | | import org.opends.guitools.controlpanel.ui.ColorAndFontConstants; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.util.ServerConstants; |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | | /** |
| | | * A generic interface that must implement table models that are sortable. |
| | | */ |
| | | public abstract class SortableTableModel extends AbstractTableModel |
| | | { |
| | | /** |
| | | * Returns whether the sort is ascending or descending. |
| | | * @return <CODE>true</CODE> if the sort is ascending and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public abstract boolean isSortAscending(); |
| | | |
| | | /** |
| | | * Sets whether to sort ascending of descending. |
| | | * @param sortAscending whether to sort ascending or descending. |
| | | */ |
| | | public abstract void setSortAscending(boolean sortAscending); |
| | | |
| | | /** |
| | | * Returns the column index used to sort. |
| | | * @return the column index used to sort. |
| | | */ |
| | | public abstract int getSortColumn(); |
| | | |
| | | /** |
| | | * Sets the column index used to sort. |
| | | * @param sortColumn column index used to sort.. |
| | | */ |
| | | public abstract void setSortColumn(int sortColumn); |
| | | |
| | | /** |
| | | * Updates the table model contents and sorts its contents depending on the |
| | | * sort options set by the user. |
| | | */ |
| | | public abstract void forceResort(); |
| | | |
| | | |
| | | /** |
| | | * Returns the header wrapped with the default line width. |
| | | * @param msg the header message value (with no HTML formatting). |
| | | * @return the header wrapped with the default line width. |
| | | */ |
| | | protected String getHeader(Message msg) |
| | | { |
| | | return getHeader(msg, 15); |
| | | } |
| | | |
| | | /** |
| | | * Returns the header wrapped with a certain line width. |
| | | * @param msg the header message value (with no HTML formatting). |
| | | * @param wrap the maximum line width before wrapping. |
| | | * @return the header wrapped with the specified line width. |
| | | */ |
| | | protected String getHeader(Message msg, int wrap) |
| | | { |
| | | String text = msg.toString(); |
| | | String wrappedText = StaticUtils.wrapText(text, wrap); |
| | | wrappedText = wrappedText.replaceAll(ServerConstants.EOL, "<br>"); |
| | | return "<html>"+Utilities.applyFont(wrappedText, |
| | | ColorAndFontConstants.headerFont); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.admin.std.meta.LocalDBVLVIndexCfgDefn.Scope; |
| | | import org.opends.server.types.DN; |
| | | |
| | | /** |
| | | * The class used to describe the VLV index configuration. |
| | | * |
| | | */ |
| | | public class VLVIndexDescriptor extends AbstractIndexDescriptor |
| | | { |
| | | private DN baseDN; |
| | | private Scope scope; |
| | | private String filter; |
| | | private List<VLVSortOrder> sortOrder = new ArrayList<VLVSortOrder>(); |
| | | private int maxBlockSize; |
| | | private int hashCode; |
| | | |
| | | /** |
| | | * Constructor for the VLVIndexDescriptor. |
| | | * @param name the name of the index. |
| | | * @param backend the backend where the index is defined. |
| | | * @param baseDN the baseDN of the search indexed by the VLV index. |
| | | * @param scope the scope of the search indexed by the VLV index. |
| | | * @param filter the filter or the search indexed by the VLV index. |
| | | * @param sortOrder the sort order list of the VLV index. |
| | | * @param maxBlockSize the maximum block size of the VLV index. |
| | | */ |
| | | public VLVIndexDescriptor(String name, BackendDescriptor backend, DN baseDN, |
| | | Scope scope, String filter, List<VLVSortOrder> sortOrder, |
| | | int maxBlockSize) |
| | | { |
| | | super(name, backend); |
| | | this.baseDN = baseDN; |
| | | this.scope = scope; |
| | | this.filter = filter; |
| | | this.sortOrder.addAll(sortOrder); |
| | | this.maxBlockSize = maxBlockSize; |
| | | |
| | | recalculateHashCode(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int compareTo(Object o) |
| | | { |
| | | int returnValue = -1; |
| | | if (o instanceof AbstractIndexDescriptor) |
| | | { |
| | | AbstractIndexDescriptor index = (AbstractIndexDescriptor)o; |
| | | returnValue = getName().compareTo(index.getName()); |
| | | } |
| | | return returnValue; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int hashCode() |
| | | { |
| | | return hashCode; |
| | | } |
| | | |
| | | /** |
| | | * Returns the baseDN of the search indexed by the VLV index. |
| | | * @return the baseDN of the search indexed by the VLV index. |
| | | */ |
| | | public DN getBaseDN() |
| | | { |
| | | return baseDN; |
| | | } |
| | | |
| | | /** |
| | | * Returns the filter of the search indexed by the VLV index. |
| | | * @return the filter of the search indexed by the VLV index. |
| | | */ |
| | | public String getFilter() |
| | | { |
| | | return filter; |
| | | } |
| | | |
| | | /** |
| | | * Returns the scope of the search indexed by the VLV index. |
| | | * @return the scope of the search indexed by the VLV index. |
| | | */ |
| | | public Scope getScope() |
| | | { |
| | | return scope; |
| | | } |
| | | |
| | | /** |
| | | * Returns the sort order list of the VLV index. |
| | | * @return the sort order list of the VLV index. |
| | | */ |
| | | public List<VLVSortOrder> getSortOrder() |
| | | { |
| | | return Collections.unmodifiableList(sortOrder); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean equals(Object o) |
| | | { |
| | | boolean equals = o == this; |
| | | if (!equals) |
| | | { |
| | | equals = o instanceof VLVIndexDescriptor; |
| | | if (equals) |
| | | { |
| | | VLVIndexDescriptor index = (VLVIndexDescriptor)o; |
| | | equals = index.getName().equalsIgnoreCase(getName()) && |
| | | index.getBaseDN().equals(getBaseDN()) && |
| | | index.getFilter().equals(getFilter()) && |
| | | index.getScope() == getScope() && |
| | | index.getSortOrder().equals(getSortOrder()); |
| | | if (equals) |
| | | { |
| | | if ((getBackend() != null) && (index.getBackend() != null)) |
| | | { |
| | | // Only compare the backend IDs. In this context is better to |
| | | // do this since the backend object contains some state (like |
| | | // number entries) that can change. |
| | | equals = getBackend().getBackendID().equals( |
| | | index.getBackend().getBackendID()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return equals; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected void recalculateHashCode() |
| | | { |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (VLVSortOrder s : sortOrder) |
| | | { |
| | | sb.append(s.getAttributeName()+s.isAscending()+","); |
| | | } |
| | | if (getBackend() != null) |
| | | { |
| | | sb.append(getBackend().getBackendID()); |
| | | } |
| | | hashCode = (getName()+baseDN+scope+filter+sb+maxBlockSize).hashCode(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the maximum block size of the VLV index. |
| | | * @return the maximum block size of the VLV index. |
| | | */ |
| | | public int getMaxBlockSize() |
| | | { |
| | | return maxBlockSize; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | |
| | | /** |
| | | * The table model for the VLV indexes. This is the table model used by the |
| | | * table that appears on the right side of the Manage Index dialog when the user |
| | | * clicks on the node "VLV Indexes" and it gives a global view of the VLV |
| | | * indexes defined on a given backend. |
| | | * |
| | | */ |
| | | public class VLVIndexTableModel extends AbstractIndexTableModel |
| | | { |
| | | private static final long serialVersionUID = 897379916278218775L; |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected String[] getColumnNames() |
| | | { |
| | | return new String[] { |
| | | getHeader(INFO_CTRL_PANEL_VLV_INDEXES_HEADER_NAME.get()), |
| | | getHeader(INFO_CTRL_PANEL_VLV_INDEXES_HEADER_BASE_DN.get(), 30), |
| | | getHeader(INFO_CTRL_PANEL_VLV_INDEXES_HEADER_SCOPE.get()), |
| | | getHeader(INFO_CTRL_PANEL_VLV_INDEXES_HEADER_FILTER.get()), |
| | | getHeader(INFO_CTRL_PANEL_VLV_INDEXES_HEADER_SORT_ORDER.get(), 30), |
| | | getHeader(INFO_CTRL_PANEL_VLV_INDEXES_HEADER_REQUIRES_REBUILD.get(), 30) |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * Comparable implementation. |
| | | * @param index1 the first VLV index descriptor to compare. |
| | | * @param index2 the second VLV index descriptor to compare. |
| | | * @return 1 if according to the sorting options set by the user the first |
| | | * index descriptor must be put before the second descriptor, 0 if they |
| | | * are equivalent in terms of sorting and -1 if the second descriptor must |
| | | * be put before the first descriptor. |
| | | */ |
| | | public int compare(AbstractIndexDescriptor index1, |
| | | AbstractIndexDescriptor index2) |
| | | { |
| | | int result; |
| | | VLVIndexDescriptor i1 = (VLVIndexDescriptor)index1; |
| | | VLVIndexDescriptor i2 = (VLVIndexDescriptor)index2; |
| | | |
| | | int[] possibleResults = {compareNames(i1, i2), compareBaseDNs(i1, i2), |
| | | compareScopes(i1, i2), compareFilters(i1, i2), |
| | | compareSortOrders(i1, i2), compareRebuildRequired(i1, i2)}; |
| | | result = possibleResults[sortColumn]; |
| | | if (result == 0) |
| | | { |
| | | for (int i : possibleResults) |
| | | { |
| | | if (i != 0) |
| | | { |
| | | result = i; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if (!sortAscending) |
| | | { |
| | | result = -result; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected String[] getLine(AbstractIndexDescriptor index) |
| | | { |
| | | VLVIndexDescriptor i = (VLVIndexDescriptor)index; |
| | | return new String[] { |
| | | i.getName(), getDNValue(i), getScopeDisplayValue(i), i.getFilter(), |
| | | getSortOrderDisplayValue(i), getRebuildRequiredString(i).toString() |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * Returns the VLV index DN value in String format. |
| | | * @param i the VLV index. |
| | | * @return the VLV index DN value in String format. |
| | | */ |
| | | private String getDNValue(VLVIndexDescriptor i) |
| | | { |
| | | return Utilities.unescapeUtf8(i.getBaseDN().toString()); |
| | | } |
| | | |
| | | /** |
| | | * Returns the VLV index scope value in String format. This is the value used |
| | | * to make String comparisons. |
| | | * @param i the VLV index. |
| | | * @return the VLV index scope value in String format. |
| | | */ |
| | | private String getScopeStringValue(VLVIndexDescriptor i) |
| | | { |
| | | String s; |
| | | switch (i.getScope()) |
| | | { |
| | | case BASE_OBJECT: |
| | | s = "Base Object"; |
| | | break; |
| | | case SINGLE_LEVEL: |
| | | s = "Single Level"; |
| | | break; |
| | | case WHOLE_SUBTREE: |
| | | s = "Whole Subtree"; |
| | | break; |
| | | case SUBORDINATE_SUBTREE: |
| | | s = "Subordinate Subtree"; |
| | | break; |
| | | default: |
| | | throw new IllegalStateException("Unknow scope: "+i.getScope()); |
| | | } |
| | | return s; |
| | | } |
| | | |
| | | /** |
| | | * Returns the VLV index scope display value in String format. This is the |
| | | * value to be stored in the table model. |
| | | * @param i the VLV index. |
| | | * @return the VLV index DN value in String format. |
| | | */ |
| | | private String getScopeDisplayValue(VLVIndexDescriptor i) |
| | | { |
| | | return "<html>"+getScopeStringValue(i); |
| | | } |
| | | |
| | | /** |
| | | * Returns the VLV index sort order value in String format. This is the value |
| | | * used to make String comparisons. |
| | | * @param i the VLV index. |
| | | * @return the VLV index DN value in String format. |
| | | */ |
| | | private String getSortOrderStringValue(VLVIndexDescriptor i) |
| | | { |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (VLVSortOrder sortOrder : i.getSortOrder()) |
| | | { |
| | | if (sb.length() > 0) |
| | | { |
| | | sb.append(", "); |
| | | } |
| | | sb.append(sortOrder.getAttributeName()); |
| | | if (sortOrder.isAscending()) |
| | | { |
| | | sb.append(" (ascending)"); |
| | | } |
| | | else |
| | | { |
| | | sb.append(" (descending)"); |
| | | } |
| | | } |
| | | if (sb.length() == 0) |
| | | { |
| | | sb.append(INFO_NOT_APPLICABLE_LABEL.get().toString()); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the VLV index sort order value in String format. This is the value |
| | | * stored in the table model. |
| | | * @param i the VLV index. |
| | | * @return the VLV index sort order value in String format. |
| | | */ |
| | | private String getSortOrderDisplayValue(VLVIndexDescriptor i) |
| | | { |
| | | return "<html>"+getSortOrderStringValue(i).replaceAll(", ",",<br>"); |
| | | } |
| | | |
| | | //Comparison methods. |
| | | |
| | | private int compareBaseDNs(VLVIndexDescriptor i1, VLVIndexDescriptor i2) |
| | | { |
| | | return getDNValue(i1).compareTo(getDNValue(i2)); |
| | | } |
| | | |
| | | private int compareScopes(VLVIndexDescriptor i1, VLVIndexDescriptor i2) |
| | | { |
| | | return getScopeStringValue(i1).compareTo(getScopeStringValue(i2)); |
| | | } |
| | | |
| | | private int compareFilters(VLVIndexDescriptor i1, VLVIndexDescriptor i2) |
| | | { |
| | | return i1.getFilter().compareTo(i2.getFilter()); |
| | | } |
| | | |
| | | private int compareSortOrders(VLVIndexDescriptor i1, VLVIndexDescriptor i2) |
| | | { |
| | | return getSortOrderStringValue(i1).compareTo(getSortOrderStringValue(i2)); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | | |
| | | /** |
| | | * Class that describes the VLV sort order. |
| | | */ |
| | | public class VLVSortOrder |
| | | { |
| | | private String attributeName; |
| | | private boolean isAscending; |
| | | private int hashCode; |
| | | |
| | | /** |
| | | * Constructor of the VLVSortOrder. |
| | | * @param attributeName the attribute name to be used to sort. |
| | | * @param isAscending whether the sorting is ascending or descending. |
| | | */ |
| | | public VLVSortOrder(String attributeName, boolean isAscending) |
| | | { |
| | | this.attributeName = attributeName; |
| | | this.isAscending = isAscending; |
| | | hashCode = ("vlvsortorder"+attributeName+isAscending).hashCode(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the name of the attribute. |
| | | * @return the name of the attribute. |
| | | */ |
| | | public String getAttributeName() |
| | | { |
| | | return attributeName; |
| | | } |
| | | |
| | | /** |
| | | * Returns whether the sorting is ascending or descending. |
| | | * @return <CODE>true</CODE> if the sorting is ascending and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | public boolean isAscending() |
| | | { |
| | | return isAscending; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int hashCode() |
| | | { |
| | | return hashCode; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean equals(Object o) |
| | | { |
| | | boolean equals = o == this; |
| | | if (!equals) |
| | | { |
| | | equals = o instanceof VLVSortOrder; |
| | | if (equals) |
| | | { |
| | | VLVSortOrder sortOrder = (VLVSortOrder)o; |
| | | equals = sortOrder.getAttributeName().equalsIgnoreCase(attributeName) && |
| | | sortOrder.isAscending() == isAscending; |
| | | } |
| | | } |
| | | return equals; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | |
| | | |
| | | /** |
| | | * Defines the data structures that are used in the control panel. This |
| | | * includes table models, some exceptions, the classes used to represent the |
| | | * configuration (like ServerDescriptor), etc. |
| | | * |
| | | **/ |
| | | package org.opends.guitools.controlpanel.datamodel; |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | import org.opends.guitools.controlpanel.datamodel.BackupDescriptor; |
| | | |
| | | /** |
| | | * The event used to notify that a backup has been created. |
| | | * |
| | | */ |
| | | public class BackupCreatedEvent |
| | | { |
| | | private BackupDescriptor newBackup; |
| | | |
| | | /** |
| | | * The constructor of the event. |
| | | * @param newBackup the created backup. |
| | | */ |
| | | public BackupCreatedEvent(BackupDescriptor newBackup) |
| | | { |
| | | this.newBackup = newBackup; |
| | | } |
| | | |
| | | /** |
| | | * Returns the backup descriptor. |
| | | * @return the backup descriptor. |
| | | */ |
| | | public BackupDescriptor getBackupDescriptor() |
| | | { |
| | | return newBackup; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | /** |
| | | * The listeners that receive notifications when a backup is created. |
| | | * |
| | | */ |
| | | public interface BackupCreatedListener |
| | | { |
| | | /** |
| | | * Method called when a backup is created. |
| | | * @param ev the event notifying that the backup was created. |
| | | */ |
| | | public void backupCreated(BackupCreatedEvent ev); |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | |
| | | import java.awt.Component; |
| | | import java.awt.event.ActionEvent; |
| | | import java.awt.event.ActionListener; |
| | | import java.io.File; |
| | | |
| | | import javax.swing.JFileChooser; |
| | | import javax.swing.text.JTextComponent; |
| | | |
| | | import org.opends.quicksetup.util.ExtensionFileFilter; |
| | | |
| | | /** |
| | | * This is a class that automates the update of a text field with what the user |
| | | * selects in a file chooser. The class is not in charge of creating the |
| | | * components or of updating the layout, it simply adds the required listeners |
| | | * in the buttons and text fields so that a file chooser will be displayed |
| | | * when the user clicks on the button and if the user chooses a file or a |
| | | * directory the text field will be updated accordingly. |
| | | * |
| | | */ |
| | | public class BrowseActionListener implements ActionListener |
| | | { |
| | | private JFileChooser fc; |
| | | |
| | | private JTextComponent field; |
| | | |
| | | private Component parent; |
| | | |
| | | private BrowseType type; |
| | | |
| | | /** |
| | | * Enumeration used to specify which kind of file browser dialog must be |
| | | * displayed. |
| | | * |
| | | */ |
| | | public enum BrowseType |
| | | { |
| | | /** |
| | | * The Browser is used to retrieve a directory. |
| | | */ |
| | | LOCATION_DIRECTORY, |
| | | /** |
| | | * The Browser is used to retrieve an LDIF file. |
| | | */ |
| | | OPEN_LDIF_FILE, |
| | | /** |
| | | * The Browser is used to retrieve a .zip file. |
| | | */ |
| | | OPEN_ZIP_FILE, |
| | | /** |
| | | * The Browser is used to retrieve a generic file. |
| | | */ |
| | | OPEN_GENERIC_FILE, |
| | | /** |
| | | * The Browser is used to create a generic file. |
| | | */ |
| | | CREATE_GENERIC_FILE, |
| | | /** |
| | | * The Browser is used to create an LDIF file. |
| | | */ |
| | | CREATE_LDIF_FILE, |
| | | /** |
| | | * The Browser is used to create a generic directory. |
| | | */ |
| | | CREATE_DIRECTORY |
| | | } |
| | | |
| | | /** |
| | | * Constructor for the BrowseActionListener. |
| | | * |
| | | * @param field |
| | | * the text component that will be updated when the user selects |
| | | * something in the file browser dialog. |
| | | * @param type |
| | | * the type of file browse dialog that will be displayed. |
| | | * @param parent |
| | | * component that will be used as reference to display the file |
| | | * browse dialog. |
| | | */ |
| | | public BrowseActionListener(JTextComponent field, BrowseType type, |
| | | Component parent) |
| | | { |
| | | this.field = field; |
| | | this.type = type; |
| | | this.parent = parent; |
| | | |
| | | fc = new JFileChooser(); |
| | | switch (type) |
| | | { |
| | | case LOCATION_DIRECTORY: |
| | | fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); |
| | | fc.setDialogType(JFileChooser.OPEN_DIALOG); |
| | | fc.setDialogTitle("Choose Directory"); |
| | | break; |
| | | |
| | | case CREATE_DIRECTORY: |
| | | fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); |
| | | fc.setDialogType(JFileChooser.SAVE_DIALOG); |
| | | fc.setDialogTitle("Choose Directory"); |
| | | break; |
| | | |
| | | case OPEN_LDIF_FILE: |
| | | fc.setFileSelectionMode(JFileChooser.FILES_ONLY); |
| | | fc.setDialogType(JFileChooser.OPEN_DIALOG); |
| | | fc.setDialogTitle(INFO_OPEN_LDIF_FILE_DIALOG_TITLE.get().toString()); |
| | | ExtensionFileFilter ldifFiles = |
| | | new ExtensionFileFilter("ldif", |
| | | INFO_LDIF_FILES_DESCRIPTION.get().toString()); |
| | | |
| | | fc.addChoosableFileFilter(ldifFiles); |
| | | fc.setFileFilter(ldifFiles); |
| | | break; |
| | | |
| | | case CREATE_LDIF_FILE: |
| | | fc.setFileSelectionMode(JFileChooser.FILES_ONLY); |
| | | fc.setDialogType(JFileChooser.SAVE_DIALOG); |
| | | fc.setDialogTitle(INFO_OPEN_LDIF_FILE_DIALOG_TITLE.get().toString()); |
| | | ldifFiles = new ExtensionFileFilter("ldif", |
| | | INFO_LDIF_FILES_DESCRIPTION.get().toString()); |
| | | |
| | | fc.addChoosableFileFilter(ldifFiles); |
| | | fc.setFileFilter(ldifFiles); |
| | | break; |
| | | |
| | | case OPEN_ZIP_FILE: |
| | | fc.setFileSelectionMode(JFileChooser.FILES_ONLY); |
| | | fc.setDialogType(JFileChooser.OPEN_DIALOG); |
| | | fc.setDialogTitle(INFO_OPEN_ZIP_FILE_DIALOG_TITLE.get().toString()); |
| | | ExtensionFileFilter zipFiles = |
| | | new ExtensionFileFilter("zip", |
| | | INFO_ZIP_FILES_DESCRIPTION.get().toString()); |
| | | |
| | | fc.addChoosableFileFilter(zipFiles); |
| | | fc.setFileFilter(zipFiles); |
| | | break; |
| | | |
| | | case OPEN_GENERIC_FILE: |
| | | fc.setFileSelectionMode(JFileChooser.FILES_ONLY); |
| | | fc.setDialogType(JFileChooser.OPEN_DIALOG); |
| | | fc.setDialogTitle(INFO_OPEN_GENERIC_FILE_DIALOG_TITLE.get().toString()); |
| | | |
| | | break; |
| | | |
| | | case CREATE_GENERIC_FILE: |
| | | fc.setFileSelectionMode(JFileChooser.FILES_ONLY); |
| | | fc.setDialogType(JFileChooser.SAVE_DIALOG); |
| | | fc.setDialogTitle(INFO_OPEN_GENERIC_FILE_DIALOG_TITLE.get().toString()); |
| | | break; |
| | | |
| | | default: |
| | | throw new IllegalArgumentException("Unknown BrowseType: " + type); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ActionListener implementation. It will display a file browser dialog and |
| | | * then will update the text component if the user selects something on the |
| | | * dialog. |
| | | * |
| | | * @param e the ActionEvent we receive. |
| | | * |
| | | */ |
| | | public void actionPerformed(ActionEvent e) |
| | | { |
| | | int returnVal; |
| | | |
| | | /* If we can get the current field parent directory set to it */ |
| | | String path = field.getText(); |
| | | if (path != null) |
| | | { |
| | | if (path.trim().length() > 0) |
| | | { |
| | | File f = new File(path); |
| | | while ((f != null) && !f.isDirectory()) |
| | | { |
| | | f = f.getParentFile(); |
| | | } |
| | | if (f != null) |
| | | { |
| | | fc.setCurrentDirectory(f); |
| | | } |
| | | } |
| | | } |
| | | |
| | | switch (type) |
| | | { |
| | | case LOCATION_DIRECTORY: |
| | | returnVal = fc.showOpenDialog(parent); |
| | | break; |
| | | |
| | | case OPEN_LDIF_FILE: |
| | | returnVal = fc.showOpenDialog(parent); |
| | | break; |
| | | |
| | | case OPEN_ZIP_FILE: |
| | | returnVal = fc.showOpenDialog(parent); |
| | | break; |
| | | |
| | | case OPEN_GENERIC_FILE: |
| | | returnVal = fc.showOpenDialog(parent); |
| | | break; |
| | | case CREATE_GENERIC_FILE: |
| | | returnVal = fc.showSaveDialog(parent); |
| | | break; |
| | | |
| | | case CREATE_LDIF_FILE: |
| | | returnVal = fc.showSaveDialog(parent); |
| | | break; |
| | | |
| | | case CREATE_DIRECTORY: |
| | | returnVal = fc.showSaveDialog(parent); |
| | | break; |
| | | |
| | | default: |
| | | throw new IllegalStateException("Unknown type: " + type); |
| | | } |
| | | |
| | | if (returnVal == JFileChooser.APPROVE_OPTION) |
| | | { |
| | | File file = fc.getSelectedFile(); |
| | | field.setText(file.getAbsolutePath()); |
| | | field.requestFocusInWindow(); |
| | | field.selectAll(); |
| | | fieldUpdated(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * The method that is called after the text field is updated. |
| | | * |
| | | */ |
| | | protected void fieldUpdated() |
| | | { |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | import java.util.EventObject; |
| | | |
| | | /** |
| | | * This class defines an event for the browser. It basically it is used to |
| | | * communicate between the BrowserController and the NodeRefresher classes. |
| | | * @author jvergara |
| | | * |
| | | */ |
| | | public class BrowserEvent extends EventObject |
| | | { |
| | | private static final long serialVersionUID = 6476274376887062526L; |
| | | |
| | | /** |
| | | * The different types of events that we can have. |
| | | * |
| | | */ |
| | | public enum Type |
| | | { |
| | | /** |
| | | * Update of the entry started. |
| | | */ |
| | | UPDATE_START, |
| | | /** |
| | | * Update of the entry ended. |
| | | */ |
| | | UPDATE_END, |
| | | /** |
| | | * Insert of children started. |
| | | */ |
| | | INSERT_CHILDREN_START, |
| | | /** |
| | | * Insert of children ended. |
| | | */ |
| | | INSERT_CHILDREN_END, |
| | | /** |
| | | * The specified size limit (max number of children to be returned) in the |
| | | * BrowserController was reached. |
| | | */ |
| | | SIZE_LIMIT_REACHED |
| | | |
| | | }; |
| | | |
| | | private Type type; |
| | | |
| | | /** |
| | | * Constructor of the event. |
| | | * @param source the Object that generated this event. |
| | | * @param id the type of the event. |
| | | */ |
| | | public BrowserEvent(Object source, Type id) { |
| | | super(source); |
| | | this.type = id; |
| | | } |
| | | |
| | | /** |
| | | * Returns the type of event. |
| | | * @return the type of event. |
| | | */ |
| | | public Type getType() { |
| | | return type; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | /** |
| | | * Interface that must be implemented by the objects that want to receive |
| | | * browse events. |
| | | * |
| | | */ |
| | | public interface BrowserEventListener extends java.util.EventListener { |
| | | |
| | | /** |
| | | * The method that is called to notify that a new browser event has been |
| | | * generated. |
| | | * @param e the browser event. |
| | | */ |
| | | public void processBrowserEvent(BrowserEvent e); |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | /** |
| | | * Interface that must be implemented by the objects that want to receive |
| | | * configuration change notifications. |
| | | * |
| | | */ |
| | | public interface ConfigChangeListener |
| | | { |
| | | /** |
| | | * Method that is called when a change in the configuration occurred. |
| | | * @param ev the configuration change event. |
| | | */ |
| | | public void configurationChanged(ConfigurationChangeEvent ev); |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | import org.opends.guitools.controlpanel.datamodel.ServerDescriptor; |
| | | |
| | | /** |
| | | * The event that describes a change in the configuration. It will be created |
| | | * in ControlCenterInfo when the configuration is read and there has been a |
| | | * modification between the newly read configuration and the configuration we |
| | | * read previously. |
| | | * |
| | | */ |
| | | public class ConfigurationChangeEvent |
| | | { |
| | | private Object source; |
| | | private ServerDescriptor newDescriptor; |
| | | |
| | | /** |
| | | * Constructor for the event. |
| | | * @param source the source of this event. |
| | | * @param newDescriptor the object describing the new configuration. |
| | | */ |
| | | public ConfigurationChangeEvent(Object source, ServerDescriptor newDescriptor) |
| | | { |
| | | this.source = source; |
| | | this.newDescriptor = newDescriptor; |
| | | } |
| | | |
| | | /** |
| | | * Returns the object describing the new configuration. |
| | | * @return the object describing the new configuration. |
| | | */ |
| | | public ServerDescriptor getNewDescriptor() |
| | | { |
| | | return newDescriptor; |
| | | } |
| | | |
| | | /** |
| | | * Returns the source of the event. |
| | | * @return the source of the event. |
| | | */ |
| | | public Object getSource() |
| | | { |
| | | return source; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | /** |
| | | * The event used to notify that a new configuration element was created. It |
| | | * is used by index and schema editors to notify changes of the index |
| | | * configuration and in the schema. |
| | | * |
| | | */ |
| | | public class ConfigurationElementCreatedEvent |
| | | { |
| | | private Object source; |
| | | private Object configurationObject; |
| | | |
| | | /** |
| | | * Constructor of the event. |
| | | * @param source the source of the event. |
| | | * @param configurationObject the newly created configuration object. |
| | | */ |
| | | public ConfigurationElementCreatedEvent(Object source, |
| | | Object configurationObject) |
| | | { |
| | | this.source = source; |
| | | this.configurationObject = configurationObject; |
| | | } |
| | | |
| | | /** |
| | | * Returns the newly created configuration object. |
| | | * @return the newly created configuration object. |
| | | */ |
| | | public Object getConfigurationObject() |
| | | { |
| | | return configurationObject; |
| | | } |
| | | |
| | | /** |
| | | * Returns the source of the event. |
| | | * @return the source of the event. |
| | | */ |
| | | public Object getSource() |
| | | { |
| | | return source; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | /** |
| | | * Interface that must be implemented by the objects that want to receive |
| | | * notifications when new configuration elements are created (like new indexes |
| | | * or schema elements). |
| | | * |
| | | */ |
| | | public interface ConfigurationElementCreatedListener |
| | | { |
| | | /** |
| | | * Method that is called when a new configuration element was created. |
| | | * @param ev the configuration change event. |
| | | */ |
| | | public void elementCreated(ConfigurationElementCreatedEvent ev); |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | //Note: in terms of synchronization, this implementation assumes that the |
| | | //interrupt method is only called in the event thread (this class is used |
| | | //when the user selects a node in the LDAP entry browser). |
| | | /** |
| | | * The event that is create when there is an error reading an entry. It is |
| | | * used in the LDAP entry browser to notify of this kind of errors. |
| | | */ |
| | | public class EntryReadErrorEvent |
| | | { |
| | | private Object source; |
| | | private Throwable t; |
| | | private String dn; |
| | | |
| | | /** |
| | | * Constructor for the event. |
| | | * @param source the source of this event. |
| | | * @param dn the DN of the entry we were searching. |
| | | * @param t the throwable that we got as error. |
| | | */ |
| | | public EntryReadErrorEvent(Object source, String dn, Throwable t) |
| | | { |
| | | this.source = source; |
| | | this.t = t; |
| | | this.dn = dn; |
| | | } |
| | | |
| | | /** |
| | | * Returns the source of the event. |
| | | * @return the source of the event. |
| | | */ |
| | | public Object getSource() |
| | | { |
| | | return source; |
| | | } |
| | | |
| | | /** |
| | | * Returns the throwable that we got as error. |
| | | * @return the throwable that we got as error. |
| | | */ |
| | | public Throwable getError() |
| | | { |
| | | return t; |
| | | } |
| | | |
| | | /** |
| | | * Returns the DN of the entry we were searching. |
| | | * @return the DN of the entry we were searching. |
| | | */ |
| | | public String getDN() |
| | | { |
| | | return dn; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | import org.opends.guitools.controlpanel.datamodel.CustomSearchResult; |
| | | |
| | | /** |
| | | * The class used to notify that a new entry has been successfully read. Used |
| | | * in the LDAP entry browser. |
| | | * |
| | | */ |
| | | public class EntryReadEvent |
| | | { |
| | | private Object source; |
| | | private CustomSearchResult sr; |
| | | |
| | | /** |
| | | * The event constructor. |
| | | * @param source the source of the event. |
| | | * @param sr the search result containing the entry that was read. |
| | | */ |
| | | public EntryReadEvent(Object source, CustomSearchResult sr) |
| | | { |
| | | this.source = source; |
| | | this.sr = sr; |
| | | } |
| | | |
| | | /** |
| | | * Returns the source of the event. |
| | | * @return the source of the event. |
| | | */ |
| | | public Object getSource() |
| | | { |
| | | return source; |
| | | } |
| | | |
| | | /** |
| | | * Returns the search result containing the entry that was read. |
| | | * @return the search result containing the entry that was read. |
| | | */ |
| | | public CustomSearchResult getSearchResult() |
| | | { |
| | | return sr; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | /** |
| | | * Interface that must be implemented by the objects that want to receive |
| | | * notifications when an entry was successfully read or when there was an |
| | | * error reading an entry. This is used by the LDAP entry browser. |
| | | * |
| | | */ |
| | | public interface EntryReadListener |
| | | { |
| | | /** |
| | | * Notifies that an entry was successfully read. |
| | | * @param ev the event containing the search result. |
| | | */ |
| | | public void entryRead(EntryReadEvent ev); |
| | | /** |
| | | * Notifies that an error reading an entry. |
| | | * @param ev the event describing the error. |
| | | */ |
| | | public void entryReadError(EntryReadErrorEvent ev); |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | |
| | | import org.opends.guitools.controlpanel.datamodel.AbstractIndexDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.BackendDescriptor; |
| | | |
| | | /** |
| | | * The event that describes a modification of the index. |
| | | * |
| | | */ |
| | | public class IndexModifiedEvent |
| | | { |
| | | private Set<AbstractIndexDescriptor> modifiedIndexes = |
| | | new HashSet<AbstractIndexDescriptor>(); |
| | | |
| | | /** |
| | | * The constructor of the event. |
| | | * @param modifiedIndex the modified indexes. |
| | | */ |
| | | public IndexModifiedEvent(AbstractIndexDescriptor modifiedIndex) |
| | | { |
| | | this.modifiedIndexes.add(modifiedIndex); |
| | | } |
| | | |
| | | /** |
| | | * The event will contain all the indexes in a given backend. |
| | | * @param backend the backend whose indexes have been modified. |
| | | */ |
| | | public IndexModifiedEvent(BackendDescriptor backend) |
| | | { |
| | | this.modifiedIndexes.addAll(backend.getIndexes()); |
| | | this.modifiedIndexes.addAll(backend.getVLVIndexes()); |
| | | } |
| | | |
| | | /** |
| | | * Returns list of indexes that have been modified. |
| | | * @return list of indexes that have been modified. |
| | | */ |
| | | public Set<AbstractIndexDescriptor> getIndexDescriptor() |
| | | { |
| | | return modifiedIndexes; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | /** |
| | | * Interface that must be implemented by the objects that want to receive |
| | | * notifications when an index has been modified. |
| | | * |
| | | */ |
| | | public interface IndexModifiedListener |
| | | { |
| | | /** |
| | | * Notification that an index has been modified. |
| | | * @param ev the index event. |
| | | */ |
| | | public void indexModified(IndexModifiedEvent ev); |
| | | |
| | | /** |
| | | * Notification that the indexes in a backend have been modified. |
| | | * @param ev the index event. |
| | | */ |
| | | public void backendIndexesModified(IndexModifiedEvent ev); |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | import org.opends.guitools.controlpanel.datamodel.AbstractIndexDescriptor; |
| | | |
| | | /** |
| | | * The event that describes that an index has been selected. This is used |
| | | * in the dialog 'Manage Index' to notify that a new index is selected on the |
| | | * tree. |
| | | * |
| | | */ |
| | | public class IndexSelectionEvent |
| | | { |
| | | private Object source; |
| | | private AbstractIndexDescriptor index; |
| | | |
| | | /** |
| | | * Constructor of the event. |
| | | * @param source the source of the event. |
| | | * @param index the index that has been selected. |
| | | */ |
| | | public IndexSelectionEvent(Object source, AbstractIndexDescriptor index) |
| | | { |
| | | this.source = source; |
| | | this.index = index; |
| | | } |
| | | |
| | | /** |
| | | * Returns the index that has been selected. |
| | | * @return the index that has been selected. |
| | | */ |
| | | public AbstractIndexDescriptor getIndex() |
| | | { |
| | | return index; |
| | | } |
| | | |
| | | /** |
| | | * Returns the source of the event. |
| | | * @return the source of the event. |
| | | */ |
| | | public Object getSource() |
| | | { |
| | | return source; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | /** |
| | | * Interface that must be implemented by the objects that want to receive |
| | | * notifications when an index has been selected. This is used in the dialog |
| | | * 'Manage Index' to notify that a new index is selected on the tree. |
| | | * |
| | | */ |
| | | public interface IndexSelectionListener |
| | | { |
| | | /** |
| | | * Notification that an index has been selected. |
| | | * @param ev the index selection event. |
| | | */ |
| | | public void indexSelected(IndexSelectionEvent ev); |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | import org.opends.server.types.Entry; |
| | | |
| | | /** |
| | | * Method that describes that an entry has changed. This is used by the LDAP |
| | | * entry editors. |
| | | * |
| | | */ |
| | | public class LDAPEntryChangedEvent |
| | | { |
| | | private Object source; |
| | | private Entry entry; |
| | | |
| | | /** |
| | | * Constructor of the event. |
| | | * @param source the source of the event. |
| | | * @param entry the entry that has been modified (the object contains the new |
| | | * values of the entry). |
| | | */ |
| | | public LDAPEntryChangedEvent(Object source, Entry entry) |
| | | { |
| | | this.source = source; |
| | | this.entry = entry; |
| | | } |
| | | |
| | | /** |
| | | * Returns the entry that has been modified (the object contains the new |
| | | * values of the entry). |
| | | * @return the entry that has been modified. |
| | | */ |
| | | public Entry getEntry() |
| | | { |
| | | return entry; |
| | | } |
| | | |
| | | /** |
| | | * Returns the source of the event. |
| | | * @return the source of the event. |
| | | */ |
| | | public Object getSource() |
| | | { |
| | | return source; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | |
| | | /** |
| | | * Interface that must be implemented by the objects that want to receive |
| | | * notifications when a LDAP Entry has been modified. This is used by the LDAP |
| | | * entry editors. |
| | | * |
| | | */ |
| | | public interface LDAPEntryChangedListener |
| | | { |
| | | /** |
| | | * Notification that an LDAP entry has been modified. |
| | | * @param ev the event. |
| | | */ |
| | | public void entryChanged(LDAPEntryChangedEvent ev); |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | import org.opends.guitools.controlpanel.ui.nodes.BrowserNodeInfo; |
| | | |
| | | /** |
| | | * The event that is throw when an entry is moved in the LDAP |
| | | * entry browser. For the time being it is not used but it can be used in the |
| | | * future when the move of the entries is implemented. |
| | | * |
| | | */ |
| | | public class MoveEvent |
| | | { |
| | | private BrowserNodeInfo newParent; |
| | | private BrowserNodeInfo[] nodes; |
| | | |
| | | /** |
| | | * The constructor of the move event. |
| | | * @param newParent the new parent of the nodes that are being moved. |
| | | * @param nodes the nodes that are being moved. |
| | | */ |
| | | public MoveEvent(BrowserNodeInfo newParent, BrowserNodeInfo[] nodes) { |
| | | this.newParent = newParent; |
| | | this.nodes = nodes; |
| | | } |
| | | |
| | | /** |
| | | * Return the new parent of the nodes that are being moved. |
| | | * @return the new parent of the nodes that are being moved. |
| | | */ |
| | | public BrowserNodeInfo getNewParent() { |
| | | return newParent; |
| | | } |
| | | |
| | | /** |
| | | * Return the nodes that are being moved. |
| | | * @return the nodes that are being moved. |
| | | */ |
| | | public BrowserNodeInfo[] getNodes() { |
| | | return nodes; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | /** |
| | | * Interface that must be implemented by the objects that want to receive |
| | | * notifications when an entry is being moved (for instance using drag and |
| | | * drop). |
| | | * For the time being it is not used but it can be used in the future when the |
| | | * move of the entries is implemented. |
| | | * |
| | | */ |
| | | public interface MoveListener |
| | | { |
| | | /** |
| | | * Notification that the entry is being moved. |
| | | * @param ev the event. |
| | | */ |
| | | public void processMoveEvent(MoveEvent ev); |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | /** |
| | | * This is a listener used by the progress dialogs and the tasks to be notified |
| | | * when something is written to a PrintStream. This is used for instance to |
| | | * be able to redirect the output logs of operations launched in a separate |
| | | * process (like start-ds, import-ldif, etc.). It is used mainly in the |
| | | * progress dialog and in the task. |
| | | * |
| | | */ |
| | | public interface PrintStreamListener |
| | | { |
| | | /** |
| | | * Notification that a new line has been written in a PrintStream. |
| | | * @param line the new line. |
| | | */ |
| | | public void newLine(String line); |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | /** |
| | | * Interface that must be implemented by the objects that want to receive |
| | | * notifications when the authentication to be used to handle referrals in the |
| | | * LDAP entries browser. |
| | | * For the time being it is not used but it can be used in the future when some |
| | | * UI to specify authentication for referrals is implemented. |
| | | * |
| | | */ |
| | | public interface ReferralAuthenticationListener { |
| | | /** |
| | | * Notification that some authentication changed. |
| | | * |
| | | */ |
| | | public void notifyAuthDataChanged(); |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | /** |
| | | * The event that describes that an element of the schema has been selected. |
| | | * This is used in the dialog 'Manage Schema' to notify that a new schema |
| | | * element is selected on the tree. |
| | | * |
| | | */ |
| | | public class SchemaElementSelectionEvent |
| | | { |
| | | private Object source; |
| | | private Object schemaElement; |
| | | |
| | | /** |
| | | * Constructor of the event. |
| | | * @param source the source of the event. |
| | | * @param schemaElement the schema element that has been selected. |
| | | */ |
| | | public SchemaElementSelectionEvent(Object source, Object schemaElement) |
| | | { |
| | | this.source = source; |
| | | this.schemaElement = schemaElement; |
| | | } |
| | | |
| | | /** |
| | | * Returns the schema element that has been selected. |
| | | * @return the schema element that has been selected. |
| | | */ |
| | | public Object getSchemaElement() |
| | | { |
| | | return schemaElement; |
| | | } |
| | | |
| | | /** |
| | | * Returns the source of the event. |
| | | * @return the source of the event. |
| | | */ |
| | | public Object getSource() |
| | | { |
| | | return source; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | /** |
| | | * Interface that must be implemented by the objects that want to receive |
| | | * notifications when a schema element has been selected. This is used in the |
| | | * dialog 'Manage Schema' to notify that a new schema element is selected on the |
| | | * tree. |
| | | * |
| | | */ |
| | | public interface SchemaElementSelectionListener |
| | | { |
| | | /** |
| | | * Notification that a schema element has been selected. |
| | | * @param ev the schema element selection event. |
| | | */ |
| | | public void schemaElementSelected(SchemaElementSelectionEvent ev); |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | import java.awt.event.ComponentAdapter; |
| | | import java.awt.event.ComponentEvent; |
| | | |
| | | import javax.swing.BorderFactory; |
| | | import javax.swing.JScrollPane; |
| | | import javax.swing.border.Border; |
| | | import javax.swing.border.EmptyBorder; |
| | | |
| | | import org.opends.guitools.controlpanel.ui.ColorAndFontConstants; |
| | | |
| | | /** |
| | | * This is a listener that is basically used to update dynamically the border |
| | | * of a scroll bar. This is used when we do not want to display the borders of |
| | | * the scrollpane if no scrollbars are visible. So the code basically adds |
| | | * a component listener to the scroll pane and depending on whether the scroll |
| | | * bars are displayed or not some border to the scroll pane is added (or not). |
| | | * |
| | | */ |
| | | public class ScrollPaneBorderListener extends ComponentAdapter |
| | | { |
| | | private JScrollPane scroll; |
| | | private Border emptyBorder = new EmptyBorder(0, 0, 0, 0); |
| | | private Border etchedBorder = BorderFactory.createMatteBorder(0, 0, 1, 0, |
| | | ColorAndFontConstants.defaultBorderColor); |
| | | |
| | | |
| | | /** |
| | | * The constructor of the listener. |
| | | * @param scroll the scroll pane to update. |
| | | * @param addTopBorder whether we want to add a top border or only a bottom |
| | | * border when the border must be displayed. |
| | | */ |
| | | public ScrollPaneBorderListener(JScrollPane scroll, boolean addTopBorder) |
| | | { |
| | | this.scroll = scroll; |
| | | scroll.getHorizontalScrollBar().addComponentListener(this); |
| | | scroll.getVerticalScrollBar().addComponentListener(this); |
| | | if (addTopBorder) |
| | | { |
| | | etchedBorder = BorderFactory.createMatteBorder(1, 0, 1, 0, |
| | | ColorAndFontConstants.defaultBorderColor); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * The constructor of the listener. |
| | | * @param scroll the scroll pane to update. |
| | | */ |
| | | public ScrollPaneBorderListener(JScrollPane scroll) |
| | | { |
| | | this(scroll, false); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void componentShown(ComponentEvent ev) |
| | | { |
| | | updateBorder(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void componentHidden(ComponentEvent ev) |
| | | { |
| | | updateBorder(); |
| | | } |
| | | |
| | | /** |
| | | * Updates the border depending on whether the scroll bars are visible or not. |
| | | * |
| | | */ |
| | | public void updateBorder() |
| | | { |
| | | boolean displayBorder = scroll.getVerticalScrollBar().isVisible() || |
| | | scroll.getHorizontalScrollBar().isVisible(); |
| | | |
| | | if (displayBorder) |
| | | { |
| | | scroll.setBorder(etchedBorder); |
| | | } |
| | | else |
| | | { |
| | | scroll.setBorder(emptyBorder); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | | |
| | | import java.awt.event.FocusEvent; |
| | | import java.awt.event.FocusListener; |
| | | |
| | | import javax.swing.text.JTextComponent; |
| | | |
| | | /** |
| | | * A class used to be able to select the contents of the text field when |
| | | * it gets the focus. |
| | | * |
| | | */ |
| | | public class TextComponentFocusListener implements FocusListener |
| | | { |
| | | private JTextComponent tf; |
| | | |
| | | /** |
| | | * The constructor for this listener. |
| | | * @param tf the text field associated with this listener. |
| | | */ |
| | | public TextComponentFocusListener(JTextComponent tf) |
| | | { |
| | | this.tf = tf; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void focusGained(FocusEvent e) |
| | | { |
| | | if ((tf.getText() == null) || "".equals(tf.getText())) |
| | | { |
| | | tf.setText(" "); |
| | | tf.selectAll(); |
| | | tf.setText(""); |
| | | } |
| | | else |
| | | { |
| | | tf.selectAll(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void focusLost(FocusEvent e) |
| | | { |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | |
| | | |
| | | /** |
| | | * Defines some of the events and listeners used in the Control Panel. |
| | | * |
| | | */ |
| | | package org.opends.guitools.controlpanel.event; |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | |
| | | |
| | | /** |
| | | * Contains the different images (in gif and png format) that are used by the |
| | | * control panel. |
| | | */ |
| | | package org.opends.guitools.controlpanel.images; |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | |
| | | |
| | | /** |
| | | * Defines the main classes that are you used by the control-panel to launch the |
| | | * command line. This includes the command line launcher and the ControlPanel |
| | | * class which creates the main dialog of the control panel. |
| | | * */ |
| | | package org.opends.guitools.controlpanel; |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.HashSet; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.Set; |
| | | import java.util.TreeSet; |
| | | |
| | | import javax.naming.NamingEnumeration; |
| | | import javax.naming.NamingException; |
| | | import javax.naming.directory.Attribute; |
| | | import javax.naming.directory.BasicAttribute; |
| | | import javax.naming.directory.DirContext; |
| | | import javax.naming.directory.ModificationItem; |
| | | import javax.naming.directory.SearchControls; |
| | | import javax.naming.directory.SearchResult; |
| | | import javax.swing.SwingUtilities; |
| | | |
| | | import org.opends.admin.ads.util.ConnectionUtils; |
| | | import org.opends.guitools.controlpanel.browser.BrowserController; |
| | | import org.opends.guitools.controlpanel.datamodel.BackendDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.BaseDNDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo; |
| | | import org.opends.guitools.controlpanel.ui.ColorAndFontConstants; |
| | | import org.opends.guitools.controlpanel.ui.ProgressDialog; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.messages.AdminToolMessages; |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.util.ServerConstants; |
| | | |
| | | /** |
| | | * The class that is in charge of adding a set of entries to a set of static |
| | | * groups. |
| | | */ |
| | | public class AddToGroupTask extends Task |
| | | { |
| | | private Set<String> backendSet; |
| | | private LinkedHashSet<DN> dns = new LinkedHashSet<DN>(); |
| | | private LinkedHashSet<DN> groupDns = new LinkedHashSet<DN>(); |
| | | |
| | | /** |
| | | * Constructor of the task. |
| | | * @param info the control panel information. |
| | | * @param dlg the progress dialog where the task progress will be displayed. |
| | | * @param dns the DNs of the entries we want to add to the groups. |
| | | * @param groupDns the groups that we want to modify. |
| | | */ |
| | | public AddToGroupTask(ControlPanelInfo info, ProgressDialog dlg, |
| | | Set<DN> dns, Set<DN> groupDns) |
| | | { |
| | | super(info, dlg); |
| | | backendSet = new HashSet<String>(); |
| | | this.dns.addAll(dns); |
| | | this.groupDns.addAll(groupDns); |
| | | for (DN groupDn : groupDns) |
| | | { |
| | | for (BackendDescriptor backend : |
| | | info.getServerDescriptor().getBackends()) |
| | | { |
| | | for (BaseDNDescriptor baseDN : backend.getBaseDns()) |
| | | { |
| | | if (groupDn.isDescendantOf(baseDN.getDn())) |
| | | { |
| | | backendSet.add(backend.getBackendID()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Type getType() |
| | | { |
| | | return Type.MODIFY_ENTRY; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Message getTaskDescription() |
| | | { |
| | | return |
| | | AdminToolMessages.INFO_CTRL_PANEL_ADD_TO_GROUP_TASK_DESCRIPTION.get(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected String getCommandLinePath() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | { |
| | | return new ArrayList<String>(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<Message> incompatibilityReasons) |
| | | { |
| | | boolean canLaunch = true; |
| | | if (!isServerRunning()) |
| | | { |
| | | if (state == State.RUNNING) |
| | | { |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. This is a short operation so the limitation |
| | | // has not a lot of impact. |
| | | Set<String> backends = |
| | | new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, |
| | | taskToBeLaunched)); |
| | | canLaunch = false; |
| | | } |
| | | } |
| | | } |
| | | return canLaunch; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean regenerateDescriptor() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void runTask() |
| | | { |
| | | state = State.RUNNING; |
| | | lastException = null; |
| | | |
| | | try |
| | | { |
| | | for (final DN groupDn : groupDns) |
| | | { |
| | | final Collection<ModificationItem> modifications = |
| | | getModifications(groupDn, dns); |
| | | if (modifications.size() > 0) |
| | | { |
| | | ModificationItem[] mods = |
| | | new ModificationItem[modifications.size()]; |
| | | modifications.toArray(mods); |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | printEquivalentCommandToModify(groupDn, modifications); |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressWithPoints( |
| | | INFO_CTRL_PANEL_ADDING_TO_GROUP.get(groupDn.toString()), |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | |
| | | getInfo().getDirContext().modifyAttributes( |
| | | Utilities.getJNDIName(groupDn.toString()), mods); |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressDone( |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | state = State.FINISHED_SUCCESSFULLY; |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | lastException = t; |
| | | state = State.FINISHED_WITH_ERROR; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns the modifications that must be made to the provided group. |
| | | * @param groupDn the DN of the static group that must be updated. |
| | | * @param dns the list of entry DNs that must be added to the group. |
| | | * @return the list of modifications (in form of ModificationItem) that |
| | | * must be made to the provided group. |
| | | * @throws NamingException if an error occurs. |
| | | */ |
| | | private Collection<ModificationItem> getModifications(DN groupDn, |
| | | Set<DN> dns) throws NamingException |
| | | { |
| | | ArrayList<ModificationItem> modifications = |
| | | new ArrayList<ModificationItem>(); |
| | | // Search for the group entry |
| | | |
| | | SearchControls ctls = new SearchControls(); |
| | | ctls.setSearchScope(SearchControls.OBJECT_SCOPE); |
| | | ctls.setReturningAttributes( |
| | | new String[] { |
| | | ServerConstants.ATTR_UNIQUE_MEMBER |
| | | }); |
| | | String filter = BrowserController.ALL_OBJECTS_FILTER; |
| | | NamingEnumeration<SearchResult> result = |
| | | getInfo().getDirContext().search( |
| | | Utilities.getJNDIName(groupDn.toString()), |
| | | filter, ctls); |
| | | |
| | | while (result.hasMore()) |
| | | { |
| | | SearchResult sr = result.next(); |
| | | Set<String> values = |
| | | ConnectionUtils.getValues(sr, ServerConstants.ATTR_UNIQUE_MEMBER); |
| | | Set<String> dnsToAdd = new LinkedHashSet<String>(); |
| | | if (values != null) |
| | | { |
| | | for (DN newDn : dns) |
| | | { |
| | | boolean found = false; |
| | | for (String dn : values) |
| | | { |
| | | if (Utilities.areDnsEqual(dn, newDn.toString())) |
| | | { |
| | | found = true; |
| | | break; |
| | | } |
| | | } |
| | | if (!found) |
| | | { |
| | | dnsToAdd.add(newDn.toString()); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (DN newDn : dns) |
| | | { |
| | | dnsToAdd.add(newDn.toString()); |
| | | } |
| | | } |
| | | if (dnsToAdd.size() > 0) |
| | | { |
| | | Attribute attribute = |
| | | new BasicAttribute(ServerConstants.ATTR_UNIQUE_MEMBER); |
| | | for (String dn : dnsToAdd) |
| | | { |
| | | attribute.add(dn); |
| | | } |
| | | modifications.add(new ModificationItem( |
| | | DirContext.ADD_ATTRIBUTE, |
| | | attribute)); |
| | | } |
| | | } |
| | | return modifications; |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.LinkedList; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | | |
| | | import javax.naming.ldap.InitialLdapContext; |
| | | import javax.swing.SwingUtilities; |
| | | |
| | | import org.opends.guitools.controlpanel.datamodel.BackendDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.BaseDNDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo; |
| | | import org.opends.guitools.controlpanel.ui.ColorAndFontConstants; |
| | | import org.opends.guitools.controlpanel.ui.ProgressDialog; |
| | | import org.opends.guitools.controlpanel.util.ConfigReader; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.admin.client.ManagementContext; |
| | | import org.opends.server.admin.client.ldap.JNDIDirContextAdaptor; |
| | | import org.opends.server.admin.client.ldap.LDAPManagementContext; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | | import org.opends.server.admin.std.client.*; |
| | | import org.opends.server.admin.std.server.ReplicationDomainCfg; |
| | | import org.opends.server.admin.std.server.ReplicationSynchronizationProviderCfg; |
| | | import org.opends.server.admin.std.server.RootCfg; |
| | | import org.opends.server.config.ConfigConstants; |
| | | import org.opends.server.config.ConfigEntry; |
| | | import org.opends.server.config.DNConfigAttribute; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.OpenDsException; |
| | | import org.opends.server.util.cli.CommandBuilder; |
| | | |
| | | /** |
| | | * The task used to delete a set of base DNs or backends. |
| | | * |
| | | */ |
| | | public class DeleteBaseDNAndBackendTask extends Task |
| | | { |
| | | private Set<String> backendSet; |
| | | private Map<String, Set<BaseDNDescriptor>> baseDNsToDelete = |
| | | new HashMap<String, Set<BaseDNDescriptor>>(); |
| | | private ArrayList<BackendDescriptor> backendsToDelete = |
| | | new ArrayList<BackendDescriptor>(); |
| | | |
| | | /** |
| | | * Constructor of the task. |
| | | * @param info the control panel information. |
| | | * @param dlg the progress dialog where the task progress will be displayed. |
| | | * @param backendsToDelete the backends to delete. |
| | | * @param baseDNsToDelete the base DNs to delete. |
| | | */ |
| | | public DeleteBaseDNAndBackendTask(ControlPanelInfo info, ProgressDialog dlg, |
| | | Collection<BackendDescriptor> backendsToDelete, |
| | | Collection<BaseDNDescriptor> baseDNsToDelete) |
| | | { |
| | | super(info, dlg); |
| | | backendSet = new HashSet<String>(); |
| | | for (BackendDescriptor backend : backendsToDelete) |
| | | { |
| | | backendSet.add(backend.getBackendID()); |
| | | } |
| | | for (BaseDNDescriptor baseDN : baseDNsToDelete) |
| | | { |
| | | backendSet.add(baseDN.getBackend().getBackendID()); |
| | | } |
| | | for (BaseDNDescriptor baseDN : baseDNsToDelete) |
| | | { |
| | | String backendID = baseDN.getBackend().getBackendID(); |
| | | Set<BaseDNDescriptor> set = this.baseDNsToDelete.get(backendID); |
| | | if (set == null) |
| | | { |
| | | set = new HashSet<BaseDNDescriptor>(); |
| | | this.baseDNsToDelete.put(backendID, set); |
| | | } |
| | | set.add(baseDN); |
| | | } |
| | | ArrayList<String> indirectBackendsToDelete = new ArrayList<String>(); |
| | | for (Set<BaseDNDescriptor> set : this.baseDNsToDelete.values()) |
| | | { |
| | | BackendDescriptor backend = set.iterator().next().getBackend(); |
| | | if (set.size() == backend.getBaseDns().size()) |
| | | { |
| | | // All of the suffixes must be deleted. |
| | | indirectBackendsToDelete.add(backend.getBackendID()); |
| | | this.backendsToDelete.add(backend); |
| | | } |
| | | } |
| | | for (String backendID : indirectBackendsToDelete) |
| | | { |
| | | this.baseDNsToDelete.remove(backendID); |
| | | } |
| | | this.backendsToDelete.addAll(backendsToDelete); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Type getType() |
| | | { |
| | | if (baseDNsToDelete.size() > 0) |
| | | { |
| | | return Type.DELETE_BASEDN; |
| | | } |
| | | else |
| | | { |
| | | return Type.DELETE_BACKEND; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Message getTaskDescription() |
| | | { |
| | | StringBuilder sb = new StringBuilder(); |
| | | |
| | | if (baseDNsToDelete.size() > 0) |
| | | { |
| | | ArrayList<String> dns = new ArrayList<String>(); |
| | | for (Set<BaseDNDescriptor> set : baseDNsToDelete.values()) |
| | | { |
| | | for (BaseDNDescriptor baseDN : set) |
| | | { |
| | | dns.add(baseDN.getDn().toString()); |
| | | } |
| | | } |
| | | if (dns.size() == 1) |
| | | { |
| | | String dn = dns.iterator().next(); |
| | | sb.append(INFO_CTRL_PANEL_DELETE_BASE_DN_DESCRIPTION.get(dn)); |
| | | } |
| | | else |
| | | { |
| | | ArrayList<String> quotedDns = new ArrayList<String>(); |
| | | for (String dn : dns) |
| | | { |
| | | quotedDns.add("'"+dn+"'"); |
| | | } |
| | | sb.append(INFO_CTRL_PANEL_DELETE_BASE_DNS_DESCRIPTION.get( |
| | | Utilities.getStringFromCollection(quotedDns, ", "))); |
| | | } |
| | | } |
| | | |
| | | if (backendsToDelete.size() > 0) |
| | | { |
| | | if (sb.length() > 0) |
| | | { |
| | | sb.append(" "); |
| | | } |
| | | if (backendsToDelete.size() == 1) |
| | | { |
| | | sb.append(INFO_CTRL_PANEL_DELETE_BACKEND_DESCRIPTION.get( |
| | | backendsToDelete.iterator().next().getBackendID())); |
| | | } |
| | | else |
| | | { |
| | | ArrayList<String> ids = new ArrayList<String>(); |
| | | for (BackendDescriptor backend : backendsToDelete) |
| | | { |
| | | ids.add(backend.getBackendID()); |
| | | } |
| | | sb.append(INFO_CTRL_PANEL_DELETE_BACKENDS_DESCRIPTION.get( |
| | | Utilities.getStringFromCollection(ids, ", "))); |
| | | } |
| | | } |
| | | return Message.raw(sb.toString()); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<Message> incompatibilityReasons) |
| | | { |
| | | boolean canLaunch = true; |
| | | if (state == State.RUNNING) |
| | | { |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. This is a short operation so the limitation |
| | | // has not a lot of impact. |
| | | Set<String> backends = |
| | | new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | incompatibilityReasons.add( |
| | | getIncompatibilityMessage(this, taskToBeLaunched)); |
| | | canLaunch = false; |
| | | } |
| | | } |
| | | return canLaunch; |
| | | } |
| | | |
| | | /** |
| | | * Update the configuration in the server. |
| | | * @throws OpenDsException if an error occurs. |
| | | */ |
| | | private void updateConfiguration() throws OpenDsException |
| | | { |
| | | boolean configHandlerUpdated = false; |
| | | final int totalNumber = baseDNsToDelete.size() + backendsToDelete.size(); |
| | | int numberDeleted = 0; |
| | | try |
| | | { |
| | | if (!isServerRunning()) |
| | | { |
| | | configHandlerUpdated = true; |
| | | getInfo().stopPooling(); |
| | | if (getInfo().mustDeregisterConfig()) |
| | | { |
| | | DirectoryServer.deregisterBaseDN(DN.decode("cn=config")); |
| | | } |
| | | DirectoryServer.getInstance().initializeConfiguration( |
| | | org.opends.server.extensions.ConfigFileHandler.class.getName(), |
| | | ConfigReader.configFile); |
| | | getInfo().setMustDeregisterConfig(true); |
| | | } |
| | | boolean isFirst = true; |
| | | for (final Set<BaseDNDescriptor> baseDNs : baseDNsToDelete.values()) |
| | | { |
| | | if (!isFirst) |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | getProgressDialog().appendProgressHtml("<br><br>"); |
| | | } |
| | | }); |
| | | } |
| | | isFirst = false; |
| | | |
| | | for (BaseDNDescriptor baseDN : baseDNs) |
| | | { |
| | | disableReplicationIfRequired(baseDN); |
| | | } |
| | | |
| | | if (isServerRunning()) |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | StringBuilder sb = new StringBuilder(); |
| | | sb.append(getConfigCommandLinePath(baseDNs)); |
| | | Collection<String> args = |
| | | getObfuscatedCommandLineArguments( |
| | | getDSConfigCommandLineArguments(baseDNs)); |
| | | args.removeAll(getConfigCommandLineArguments()); |
| | | for (String arg : args) |
| | | { |
| | | sb.append(" "+CommandBuilder.escapeValue(arg)); |
| | | } |
| | | getProgressDialog().appendProgressHtml(Utilities.applyFont( |
| | | INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_DELETE_BASE_DN.get()+ |
| | | "<br><b>"+sb.toString()+"</b><br><br>", |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | } |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | if (baseDNs.size() == 1) |
| | | { |
| | | String dn = baseDNs.iterator().next().getDn().toString(); |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressWithPoints( |
| | | INFO_CTRL_PANEL_DELETING_BASE_DN.get(dn), |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | else |
| | | { |
| | | ArrayList<String> dns = new ArrayList<String>(); |
| | | for (BaseDNDescriptor baseDN : baseDNs) |
| | | { |
| | | dns.add("'"+baseDN.getDn().toString()+"'"); |
| | | } |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressWithPoints( |
| | | INFO_CTRL_PANEL_DELETING_BASE_DNS.get( |
| | | Utilities.getStringFromCollection(dns, ", ")), |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | } |
| | | }); |
| | | if (isServerRunning()) |
| | | { |
| | | deleteBaseDNs(getInfo().getDirContext(), baseDNs); |
| | | } |
| | | else |
| | | { |
| | | deleteBaseDNs(baseDNs); |
| | | } |
| | | numberDeleted ++; |
| | | final int fNumberDeleted = numberDeleted; |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | getProgressDialog().getProgressBar().setIndeterminate(false); |
| | | getProgressDialog().getProgressBar().setValue( |
| | | (fNumberDeleted * 100) / totalNumber); |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressDone(ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | } |
| | | for (final BackendDescriptor backend : backendsToDelete) |
| | | { |
| | | if (!isFirst) |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | getProgressDialog().appendProgressHtml("<br><br>"); |
| | | } |
| | | }); |
| | | } |
| | | for (BaseDNDescriptor baseDN : backend.getBaseDns()) |
| | | { |
| | | disableReplicationIfRequired(baseDN); |
| | | } |
| | | isFirst = false; |
| | | if (isServerRunning()) |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | StringBuilder sb = new StringBuilder(); |
| | | sb.append(getConfigCommandLinePath(backend)); |
| | | Collection<String> args = |
| | | getObfuscatedCommandLineArguments( |
| | | getDSConfigCommandLineArguments(backend)); |
| | | args.removeAll(getConfigCommandLineArguments()); |
| | | for (String arg : args) |
| | | { |
| | | sb.append(" "+CommandBuilder.escapeValue(arg)); |
| | | } |
| | | getProgressDialog().appendProgressHtml(Utilities.applyFont( |
| | | INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_DELETE_BACKEND.get()+ |
| | | "<br><b>"+sb.toString()+"</b><br><br>", |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | } |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressWithPoints( |
| | | INFO_CTRL_PANEL_DELETING_BACKEND.get( |
| | | backend.getBackendID()), |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | if (isServerRunning()) |
| | | { |
| | | deleteBackend(getInfo().getDirContext(), backend); |
| | | } |
| | | else |
| | | { |
| | | deleteBackend(backend); |
| | | } |
| | | numberDeleted ++; |
| | | final int fNumberDeleted = numberDeleted; |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | getProgressDialog().getProgressBar().setIndeterminate(false); |
| | | getProgressDialog().getProgressBar().setValue( |
| | | (fNumberDeleted * 100) / totalNumber); |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressDone(ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | finally |
| | | { |
| | | if (configHandlerUpdated) |
| | | { |
| | | DirectoryServer.getInstance().initializeConfiguration( |
| | | ConfigReader.configClassName, ConfigReader.configFile); |
| | | getInfo().startPooling(ControlPanelInfo.DEFAULT_POOLING); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns the DN in the configuration for a given backend. |
| | | * @param backend the backend. |
| | | * @return the backend configuration entry DN. |
| | | */ |
| | | private String getDN(BackendDescriptor backend) |
| | | { |
| | | return Utilities.getRDNString("ds-cfg-backend-id", |
| | | backend.getBackendID())+",cn=Backends,cn=config"; |
| | | } |
| | | |
| | | /** |
| | | * Deletes a set of base DNs. The code assumes that the server is not running |
| | | * and that the configuration file can be edited. |
| | | * @param baseDNs the list of base DNs. |
| | | * @throws OpenDsException if an error occurs. |
| | | */ |
| | | private void deleteBaseDNs(Set<BaseDNDescriptor> baseDNs) |
| | | throws OpenDsException |
| | | { |
| | | BackendDescriptor backend = baseDNs.iterator().next().getBackend(); |
| | | |
| | | SortedSet<DN> oldBaseDNs = new TreeSet<DN>(); |
| | | for (BaseDNDescriptor baseDN : backend.getBaseDns()) |
| | | { |
| | | oldBaseDNs.add(baseDN.getDn()); |
| | | } |
| | | LinkedList<DN> newBaseDNs = new LinkedList<DN>(); |
| | | newBaseDNs.addAll(oldBaseDNs); |
| | | ArrayList<DN> dnsToRemove = new ArrayList<DN>(); |
| | | for (BaseDNDescriptor baseDN : baseDNs) |
| | | { |
| | | dnsToRemove.add(baseDN.getDn()); |
| | | } |
| | | newBaseDNs.removeAll(dnsToRemove); |
| | | |
| | | String backendName = backend.getBackendID(); |
| | | String dn = Utilities.getRDNString("ds-cfg-backend-id", backendName)+ |
| | | ",cn=Backends,cn=config"; |
| | | ConfigEntry configEntry = |
| | | DirectoryServer.getConfigHandler().getConfigEntry(DN.decode(dn)); |
| | | |
| | | DNConfigAttribute baseDNAttr = |
| | | new DNConfigAttribute( |
| | | ConfigConstants.ATTR_BACKEND_BASE_DN, |
| | | INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_BASE_DNS.get(), |
| | | true, true, false, newBaseDNs); |
| | | configEntry.putConfigAttribute(baseDNAttr); |
| | | DirectoryServer.getConfigHandler().writeUpdatedConfig(); |
| | | } |
| | | |
| | | /** |
| | | * Deletes a set of base DNs. The code assumes that the server is running |
| | | * and that the provided connection is active. |
| | | * @param baseDNs the list of base DNs. |
| | | * @param ctx the connection to the server. |
| | | * @throws OpenDsException if an error occurs. |
| | | */ |
| | | private void deleteBaseDNs(InitialLdapContext ctx, |
| | | Set<BaseDNDescriptor> baseDNs) throws OpenDsException |
| | | { |
| | | ManagementContext mCtx = LDAPManagementContext.createFromContext( |
| | | JNDIDirContextAdaptor.adapt(ctx)); |
| | | RootCfgClient root = mCtx.getRootConfiguration(); |
| | | LocalDBBackendCfgClient backend = |
| | | (LocalDBBackendCfgClient)root.getBackend( |
| | | baseDNs.iterator().next().getBackend().getBackendID()); |
| | | SortedSet<DN> oldBaseDNs = backend.getBaseDN(); |
| | | SortedSet<DN> newBaseDNs = new TreeSet<DN>(); |
| | | newBaseDNs.addAll(oldBaseDNs); |
| | | ArrayList<DN> dnsToRemove = new ArrayList<DN>(); |
| | | for (BaseDNDescriptor baseDN : baseDNs) |
| | | { |
| | | dnsToRemove.add(baseDN.getDn()); |
| | | } |
| | | newBaseDNs.removeAll(dnsToRemove); |
| | | backend.setBaseDN(newBaseDNs); |
| | | backend.commit(); |
| | | } |
| | | |
| | | /** |
| | | * Deletes a backend. The code assumes that the server is not running |
| | | * and that the configuration file can be edited. |
| | | * @param backend the backend to be deleted. |
| | | * @throws OpenDsException if an error occurs. |
| | | */ |
| | | private void deleteBackend(BackendDescriptor backend) throws OpenDsException |
| | | { |
| | | String dn = getDN(backend); |
| | | Utilities.deleteConfigSubtree( |
| | | DirectoryServer.getConfigHandler(), DN.decode(dn)); |
| | | } |
| | | |
| | | /** |
| | | * Deletes a backend. The code assumes that the server is running |
| | | * and that the provided connection is active. |
| | | * @param backend the backend to be deleted. |
| | | * @param ctx the connection to the server. |
| | | * @throws OpenDsException if an error occurs. |
| | | */ |
| | | private void deleteBackend(InitialLdapContext ctx, |
| | | BackendDescriptor backend) throws OpenDsException |
| | | { |
| | | ManagementContext mCtx = LDAPManagementContext.createFromContext( |
| | | JNDIDirContextAdaptor.adapt(ctx)); |
| | | RootCfgClient root = mCtx.getRootConfiguration(); |
| | | root.removeBackend(backend.getBackendID()); |
| | | root.commit(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected String getCommandLinePath() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | { |
| | | return new ArrayList<String>(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the path of the command line to be used to delete the specified |
| | | * backend. |
| | | * @param backend the backend to be deleted. |
| | | * @return the path of the command line to be used to delete the specified |
| | | * backend. |
| | | */ |
| | | private String getConfigCommandLinePath(BackendDescriptor backend) |
| | | { |
| | | if (isServerRunning()) |
| | | { |
| | | return getCommandLinePath("dsconfig"); |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns the path of the command line to be used to delete the specified |
| | | * base DNs. |
| | | * @param baseDNs the base DNs to be deleted. |
| | | * @return the path of the command line to be used to delete the specified |
| | | * base DNs. |
| | | */ |
| | | private String getConfigCommandLinePath(Set<BaseDNDescriptor> baseDNs) |
| | | { |
| | | if (isServerRunning()) |
| | | { |
| | | return getCommandLinePath("dsconfig"); |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void runTask() |
| | | { |
| | | state = State.RUNNING; |
| | | lastException = null; |
| | | |
| | | try |
| | | { |
| | | updateConfiguration(); |
| | | state = State.FINISHED_SUCCESSFULLY; |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | lastException = t; |
| | | state = State.FINISHED_WITH_ERROR; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Return the dsconfig arguments required to delete a set of base DNs. |
| | | * @param baseDNs the base DNs to be deleted. |
| | | * @return the dsconfig arguments required to delete a set of base DNs. |
| | | */ |
| | | private ArrayList<String> getDSConfigCommandLineArguments( |
| | | Set<BaseDNDescriptor> baseDNs) |
| | | { |
| | | ArrayList<String> args = new ArrayList<String>(); |
| | | if (isServerRunning()) |
| | | { |
| | | args.add("set-backend-prop"); |
| | | args.add("--backend-name"); |
| | | args.add(baseDNs.iterator().next().getBackend().getBackendID()); |
| | | args.add("--remove"); |
| | | for (BaseDNDescriptor baseDN : baseDNs) |
| | | { |
| | | args.add("base-dn:"+baseDN.getDn().toString()); |
| | | } |
| | | args.addAll(getConnectionCommandLineArguments()); |
| | | args.add("--no-prompt"); |
| | | } |
| | | return args; |
| | | } |
| | | |
| | | /** |
| | | * Return the dsconfig arguments required to delete a backend. |
| | | * @param backend the backend to be deleted. |
| | | * @return the dsconfig arguments required to delete a backend. |
| | | */ |
| | | private ArrayList<String> getDSConfigCommandLineArguments( |
| | | BackendDescriptor backend) |
| | | { |
| | | ArrayList<String> args = new ArrayList<String>(); |
| | | args.add("delete-backend"); |
| | | args.add("--backend-name"); |
| | | args.add(backend.getBackendID()); |
| | | |
| | | args.addAll(getConnectionCommandLineArguments()); |
| | | args.add("--no-prompt"); |
| | | return args; |
| | | } |
| | | |
| | | /** |
| | | * Disables replication if required: if the deleted base DN is replicated, |
| | | * update the replication configuration to remove any reference to it. |
| | | * @param baseDN the base DN that is going to be removed. |
| | | * @throws OpenDsException if an error occurs. |
| | | */ |
| | | private void disableReplicationIfRequired(final BaseDNDescriptor baseDN) |
| | | throws OpenDsException |
| | | { |
| | | if (baseDN.getType() == BaseDNDescriptor.Type.REPLICATED) |
| | | { |
| | | final String[] domainName = {null}; |
| | | |
| | | try |
| | | { |
| | | if (isServerRunning()) |
| | | { |
| | | InitialLdapContext ctx = getInfo().getDirContext(); |
| | | ManagementContext mCtx = LDAPManagementContext.createFromContext( |
| | | JNDIDirContextAdaptor.adapt(ctx)); |
| | | RootCfgClient root = mCtx.getRootConfiguration(); |
| | | ReplicationSynchronizationProviderCfgClient sync = null; |
| | | try |
| | | { |
| | | sync = (ReplicationSynchronizationProviderCfgClient) |
| | | root.getSynchronizationProvider("Multimaster Synchronization"); |
| | | } |
| | | catch (OpenDsException oe) |
| | | { |
| | | // Ignore this one |
| | | } |
| | | if (sync != null) |
| | | { |
| | | String[] domains = sync.listReplicationDomains(); |
| | | if (domains != null) |
| | | { |
| | | for (int i=0; i<domains.length; i++) |
| | | { |
| | | ReplicationDomainCfgClient domain = |
| | | sync.getReplicationDomain(domains[i]); |
| | | DN dn = domain.getBaseDN(); |
| | | if (dn.equals(baseDN.getDn())) |
| | | { |
| | | domainName[0] = domains[i]; |
| | | sync.removeReplicationDomain(domains[i]); |
| | | sync.commit(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | RootCfg root = |
| | | ServerManagementContext.getInstance().getRootConfiguration(); |
| | | ReplicationSynchronizationProviderCfg sync = null; |
| | | try |
| | | { |
| | | sync = (ReplicationSynchronizationProviderCfg) |
| | | root.getSynchronizationProvider("Multimaster Synchronization"); |
| | | } |
| | | catch (OpenDsException oe) |
| | | { |
| | | // Ignore this one |
| | | } |
| | | if (sync != null) |
| | | { |
| | | String[] domains = sync.listReplicationDomains(); |
| | | if (domains != null) |
| | | { |
| | | for (int i=0; i<domains.length; i++) |
| | | { |
| | | ReplicationDomainCfg domain = |
| | | sync.getReplicationDomain(domains[i]); |
| | | DN dn = domain.getBaseDN(); |
| | | if (dn.equals(baseDN.getDn())) |
| | | { |
| | | domainName[0] = domains[i]; |
| | | DN entryDN = domain.dn(); |
| | | Utilities.deleteConfigSubtree( |
| | | DirectoryServer.getConfigHandler(), entryDN); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | finally |
| | | { |
| | | // This is not super clean, but this way we calculate the domain name |
| | | // only once. |
| | | if (isServerRunning() && (domainName[0] != null)) |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | StringBuilder sb = new StringBuilder(); |
| | | sb.append(getConfigCommandLinePath(baseDN.getBackend())); |
| | | Collection<String> args = |
| | | getObfuscatedCommandLineArguments( |
| | | getCommandLineArgumentsToDisableReplication(domainName[0])); |
| | | args.removeAll(getConfigCommandLineArguments()); |
| | | for (String arg : args) |
| | | { |
| | | sb.append(" "+CommandBuilder.escapeValue(arg)); |
| | | } |
| | | getProgressDialog().appendProgressHtml(Utilities.applyFont( |
| | | INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_DELETE_DOMAIN.get( |
| | | baseDN.getDn().toString())+"<br><b>"+ |
| | | sb.toString()+"</b><br><br>", |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | } |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressWithPoints( |
| | | INFO_CTRL_PANEL_DELETING_DOMAIN.get( |
| | | baseDN.getDn().toString()), |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | } |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressDone(ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Return the dsconfig arguments required to delete a replication domain. |
| | | * @param domainName the name of the domain to be deleted. |
| | | * @return the dsconfig arguments required to delete a replication domain. |
| | | */ |
| | | private ArrayList<String> getCommandLineArgumentsToDisableReplication( |
| | | String domainName) |
| | | { |
| | | ArrayList<String> args = new ArrayList<String>(); |
| | | args.add("delete-replication-domain"); |
| | | args.add("--provider-name"); |
| | | args.add("Multimaster Synchronization"); |
| | | args.add("--domain-name"); |
| | | args.add(domainName); |
| | | args.addAll(getConnectionCommandLineArguments()); |
| | | args.add("--no-prompt"); |
| | | return args; |
| | | } |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | | |
| | | import javax.naming.NameNotFoundException; |
| | | import javax.naming.NamingException; |
| | | import javax.naming.ldap.InitialLdapContext; |
| | | import javax.swing.SwingUtilities; |
| | | import javax.swing.tree.TreePath; |
| | | |
| | | import org.opends.guitools.controlpanel.browser.BrowserController; |
| | | import org.opends.guitools.controlpanel.datamodel.BackendDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.BaseDNDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo; |
| | | import org.opends.guitools.controlpanel.ui.ColorAndFontConstants; |
| | | import org.opends.guitools.controlpanel.ui.ProgressDialog; |
| | | import org.opends.guitools.controlpanel.ui.nodes.BasicNode; |
| | | import org.opends.guitools.controlpanel.ui.nodes.BrowserNodeInfo; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.util.cli.CommandBuilder; |
| | | |
| | | /** |
| | | * The task that is launched when an entry must be deleted. |
| | | */ |
| | | public class DeleteEntryTask extends Task |
| | | { |
| | | private Set<String> backendSet; |
| | | private DN lastDn; |
| | | private int nDeleted = 0; |
| | | private int nToDelete = -1; |
| | | private BrowserController controller; |
| | | private TreePath[] paths; |
| | | |
| | | /** |
| | | * Constructor of the task. |
| | | * @param info the control panel information. |
| | | * @param dlg the progress dialog where the task progress will be displayed. |
| | | * @param paths the tree paths of the entries that must be deleted. |
| | | * @param controller the Browser Controller. |
| | | */ |
| | | public DeleteEntryTask(ControlPanelInfo info, ProgressDialog dlg, |
| | | TreePath[] paths, BrowserController controller) |
| | | { |
| | | super(info, dlg); |
| | | backendSet = new HashSet<String>(); |
| | | this.controller = controller; |
| | | this.paths = paths; |
| | | SortedSet<DN> entries = new TreeSet<DN>(); |
| | | boolean canPrecalculateNumberOfEntries = true; |
| | | nToDelete = paths.length; |
| | | for (TreePath path : paths) |
| | | { |
| | | BasicNode node = (BasicNode)path.getLastPathComponent(); |
| | | /* |
| | | if (node.getNumSubOrdinates() != -1) |
| | | { |
| | | nToDelete += node.getNumSubOrdinates(); |
| | | } |
| | | else if (node.isLeaf()) |
| | | { |
| | | canPrecalculateNumberOfEntries = false; |
| | | } |
| | | */ |
| | | try |
| | | { |
| | | DN dn = DN.decode(node.getDN()); |
| | | entries.add(dn); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | throw new IllegalStateException("Unexpected error parsing dn: "+ |
| | | node.getDN(), de); |
| | | } |
| | | } |
| | | for (BackendDescriptor backend : info.getServerDescriptor().getBackends()) |
| | | { |
| | | for (BaseDNDescriptor baseDN : backend.getBaseDns()) |
| | | { |
| | | for (DN dn : entries) |
| | | { |
| | | if (dn.isDescendantOf(baseDN.getDn())) |
| | | { |
| | | backendSet.add(backend.getBackendID()); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (!canPrecalculateNumberOfEntries) |
| | | { |
| | | nToDelete = -1; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Type getType() |
| | | { |
| | | return Type.DELETE_ENTRY; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Message getTaskDescription() |
| | | { |
| | | return INFO_CTRL_PANEL_DELETE_ENTRY_TASK_DESCRIPTION.get(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected String getCommandLinePath() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | { |
| | | return new ArrayList<String>(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<Message> incompatibilityReasons) |
| | | { |
| | | boolean canLaunch = true; |
| | | if (!isServerRunning()) |
| | | { |
| | | if (state == State.RUNNING) |
| | | { |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. This is a short operation so the limitation |
| | | // has not a lot of impact. |
| | | Set<String> backends = |
| | | new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, |
| | | taskToBeLaunched)); |
| | | canLaunch = false; |
| | | } |
| | | } |
| | | } |
| | | return canLaunch; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean regenerateDescriptor() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void runTask() |
| | | { |
| | | state = State.RUNNING; |
| | | lastException = null; |
| | | |
| | | ArrayList<DN> alreadyDeleted = new ArrayList<DN>(); |
| | | final ArrayList<BrowserNodeInfo> toNotify = |
| | | new ArrayList<BrowserNodeInfo>(); |
| | | int deletedSinceLastNotify = 0; |
| | | try |
| | | { |
| | | for (TreePath path : paths) |
| | | { |
| | | BasicNode node = (BasicNode)path.getLastPathComponent(); |
| | | try |
| | | { |
| | | DN dn = DN.decode(node.getDN()); |
| | | boolean isDnDeleted = false; |
| | | for (DN deletedDn : alreadyDeleted) |
| | | { |
| | | if (dn.isDescendantOf(deletedDn)) |
| | | { |
| | | isDnDeleted = true; |
| | | break; |
| | | } |
| | | } |
| | | if (!isDnDeleted) |
| | | { |
| | | InitialLdapContext ctx = |
| | | controller.findConnectionForDisplayedEntry(node); |
| | | deleteSubtree(ctx, dn); |
| | | alreadyDeleted.add(dn); |
| | | toNotify.add(controller.getNodeInfoFromPath(path)); |
| | | deletedSinceLastNotify = nDeleted - deletedSinceLastNotify; |
| | | if (deletedSinceLastNotify >= 10) |
| | | { |
| | | SwingUtilities.invokeAndWait(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | notifyEntriesDeleted(toNotify); |
| | | toNotify.clear(); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | throw new IllegalStateException("Unexpected error parsing dn: "+ |
| | | node.getDN(), de); |
| | | } |
| | | } |
| | | if (toNotify.size() > 0) |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | notifyEntriesDeleted(toNotify); |
| | | toNotify.clear(); |
| | | } |
| | | }); |
| | | } |
| | | state = State.FINISHED_SUCCESSFULLY; |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | lastException = t; |
| | | state = State.FINISHED_WITH_ERROR; |
| | | } |
| | | if (nDeleted > 1) |
| | | { |
| | | getProgressDialog().appendProgressHtml(Utilities.applyFont( |
| | | "<br>"+INFO_CTRL_PANEL_ENTRIES_DELETED.get(nDeleted), |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Notifies that some entries have been deleted. This will basically update |
| | | * the browser controller so that the tree reflects the changes that have |
| | | * been made. |
| | | * @param deleteNodes the nodes that have been deleted. |
| | | */ |
| | | private void notifyEntriesDeleted(Collection<BrowserNodeInfo> deleteNodes) |
| | | { |
| | | TreePath pathToSelect = null; |
| | | for (BrowserNodeInfo nodeInfo : deleteNodes) |
| | | { |
| | | TreePath parentPath = controller.notifyEntryDeleted(nodeInfo); |
| | | if (pathToSelect != null) |
| | | { |
| | | if (parentPath.getPathCount() < pathToSelect.getPathCount()) |
| | | { |
| | | pathToSelect = parentPath; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pathToSelect = parentPath; |
| | | } |
| | | } |
| | | if (pathToSelect != null) |
| | | { |
| | | TreePath selectedPath = controller.getTree().getSelectionPath(); |
| | | if (selectedPath == null) |
| | | { |
| | | controller.getTree().setSelectionPath(pathToSelect); |
| | | } |
| | | else if (!selectedPath.equals(pathToSelect) && |
| | | (pathToSelect.getPathCount() < selectedPath.getPathCount())) |
| | | { |
| | | controller.getTree().setSelectionPath(pathToSelect); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Deletes a subtree. |
| | | * @param ctx the connection to the server. |
| | | * @param dnToRemove the DN of the subtree to delete. |
| | | * @throws NamingException if an error occurs deleting the subtree. |
| | | */ |
| | | private void deleteSubtree(InitialLdapContext ctx, DN dnToRemove) |
| | | throws NamingException |
| | | { |
| | | lastDn = dnToRemove; |
| | | try |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | printEquivalentCommandToDelete(lastDn); |
| | | getProgressDialog().setSummary( |
| | | Message.raw( |
| | | Utilities.applyFont( |
| | | INFO_CTRL_PANEL_DELETING_ENTRY_SUMMARY.get( |
| | | lastDn.toString()).toString(), |
| | | ColorAndFontConstants.defaultFont))); |
| | | } |
| | | }); |
| | | Utilities.deleteSubtree(ctx, dnToRemove); |
| | | nDeleted ++; |
| | | if ((nToDelete > 0) && (nToDelete > nDeleted)) |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | getProgressDialog().getProgressBar().setIndeterminate(false); |
| | | getProgressDialog().getProgressBar().setValue( |
| | | (100 * nDeleted) / nToDelete); |
| | | } |
| | | }); |
| | | } |
| | | } catch (NameNotFoundException nnfe) { |
| | | // The entry is not there: it has been removed |
| | | } |
| | | } |
| | | |
| | | /* |
| | | private void deleteSubtree(DirContext ctx, DN dnToRemove) |
| | | throws NamingException, DirectoryException |
| | | { |
| | | lastDn = dnToRemove; |
| | | |
| | | try { |
| | | SearchControls ctls = new SearchControls(); |
| | | ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE); |
| | | String filter = |
| | | "(|(objectClass=*)(objectclass=ldapsubentry))"; |
| | | ctls.setReturningAttributes(new String[] {"dn"}); |
| | | NamingEnumeration<SearchResult> entryDNs = |
| | | ctx.search(Utilities.getJNDIName(dnToRemove.toString()), filter, ctls); |
| | | |
| | | DN entryDNFound = dnToRemove; |
| | | while (entryDNs.hasMore()) |
| | | { |
| | | SearchResult sr = entryDNs.next(); |
| | | if (!sr.getName().equals("")) |
| | | { |
| | | CustomSearchResult res = |
| | | new CustomSearchResult(sr, dnToRemove.toString()); |
| | | entryDNFound = DN.decode(res.getDN()); |
| | | deleteSubtree(ctx,entryDNFound); |
| | | } |
| | | } |
| | | |
| | | } catch (NameNotFoundException nnfe) { |
| | | // The entry is not there: it has been removed |
| | | } |
| | | |
| | | try |
| | | { |
| | | if (((nDeleted % 10) == 0) || (nDeleted == 0)) |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | getProgressDialog().setSummary( |
| | | Utilities.applyFont("Deleting entry '"+lastDn+"'...", |
| | | ColorAndFontConstants.defaultFont)); |
| | | if (nDeleted == 0) |
| | | { |
| | | // Just give an example |
| | | printEquivalentCommandToDelete(lastDn); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | ctx.destroySubcontext(Utilities.getJNDIName(dnToRemove.toString())); |
| | | nDeleted ++; |
| | | if (((nDeleted % 10) == 0) && (nToDelete > 0) && (nToDelete > nDeleted)) |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | getProgressDialog().getProgressBar().setIndeterminate(false); |
| | | getProgressDialog().getProgressBar().setValue( |
| | | (100 * nDeleted) / nToDelete); |
| | | } |
| | | }); |
| | | } |
| | | } catch (NameNotFoundException nnfe) { |
| | | // The entry is not there: it has been removed |
| | | } |
| | | } |
| | | |
| | | private void printEquivalentCommandToDelete(DN dn) |
| | | { |
| | | ArrayList<String> args = new ArrayList<String>(); |
| | | args.add(getCommandLineName("ldapdelete")); |
| | | args.addAll(getObfuscatedCommandLineArguments( |
| | | getConnectionCommandLineArguments())); |
| | | args.add(dn.toString()); |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (String arg : args) |
| | | { |
| | | sb.append(" "+CommandBuilder.escapeValue(arg)); |
| | | } |
| | | |
| | | getProgressDialog().appendProgressHtml(Utilities.applyFont( |
| | | "Equivalent command line to delete entry '"+dn+"':<br><b>"+ |
| | | sb.toString()+"</b><br><br>", |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | */ |
| | | /** |
| | | * Prints in the progress dialog the equivalent command-line to delete a |
| | | * subtree. |
| | | * @param dn the DN of the subtree to be deleted. |
| | | */ |
| | | private void printEquivalentCommandToDelete(DN dn) |
| | | { |
| | | ArrayList<String> args = new ArrayList<String>(); |
| | | args.add(getCommandLinePath("ldapdelete")); |
| | | args.addAll(getObfuscatedCommandLineArguments( |
| | | getConnectionCommandLineArguments())); |
| | | args.add("-J"); |
| | | args.add(Utilities.SUBTREE_CTRL_OID); |
| | | args.add(dn.toString()); |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (String arg : args) |
| | | { |
| | | sb.append(" "+CommandBuilder.escapeValue(arg)); |
| | | } |
| | | |
| | | getProgressDialog().appendProgressHtml(Utilities.applyFont( |
| | | INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_DELETE_ENTRY.get(dn.toString())+ |
| | | "<br><b>"+ |
| | | sb.toString()+"</b><br><br>", |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | import java.util.TreeSet; |
| | | |
| | | import javax.naming.ldap.InitialLdapContext; |
| | | import javax.swing.SwingUtilities; |
| | | |
| | | import org.opends.guitools.controlpanel.datamodel.AbstractIndexDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo; |
| | | import org.opends.guitools.controlpanel.datamodel.VLVIndexDescriptor; |
| | | import org.opends.guitools.controlpanel.ui.ColorAndFontConstants; |
| | | import org.opends.guitools.controlpanel.ui.ProgressDialog; |
| | | import org.opends.guitools.controlpanel.util.ConfigReader; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.admin.client.ManagementContext; |
| | | import org.opends.server.admin.client.ldap.JNDIDirContextAdaptor; |
| | | import org.opends.server.admin.client.ldap.LDAPManagementContext; |
| | | import org.opends.server.admin.std.client.LocalDBBackendCfgClient; |
| | | import org.opends.server.admin.std.client.RootCfgClient; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.OpenDsException; |
| | | import org.opends.server.util.cli.CommandBuilder; |
| | | |
| | | /** |
| | | * The task that is launched when an index must be deleted. |
| | | */ |
| | | public class DeleteIndexTask extends Task |
| | | { |
| | | private Set<String> backendSet; |
| | | private ArrayList<AbstractIndexDescriptor> indexesToDelete = |
| | | new ArrayList<AbstractIndexDescriptor>(); |
| | | private ArrayList<AbstractIndexDescriptor> deletedIndexes = |
| | | new ArrayList<AbstractIndexDescriptor>(); |
| | | |
| | | /** |
| | | * Constructor of the task. |
| | | * @param info the control panel information. |
| | | * @param dlg the progress dialog where the task progress will be displayed. |
| | | * @param indexesToDelete the indexes that must be deleted. |
| | | */ |
| | | public DeleteIndexTask(ControlPanelInfo info, ProgressDialog dlg, |
| | | ArrayList<AbstractIndexDescriptor> indexesToDelete) |
| | | { |
| | | super(info, dlg); |
| | | backendSet = new HashSet<String>(); |
| | | for (AbstractIndexDescriptor index : indexesToDelete) |
| | | { |
| | | backendSet.add(index.getBackend().getBackendID()); |
| | | } |
| | | this.indexesToDelete.addAll(indexesToDelete); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Type getType() |
| | | { |
| | | return Type.DELETE_INDEX; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Message getTaskDescription() |
| | | { |
| | | if (backendSet.size() == 1) |
| | | { |
| | | return INFO_CTRL_PANEL_DELETE_INDEX_TASK_DESCRIPTION.get( |
| | | Utilities.getStringFromCollection(backendSet, ", ")); |
| | | } |
| | | else |
| | | { |
| | | return INFO_CTRL_PANEL_DELETE_INDEX_IN_BACKENDS_TASK_DESCRIPTION.get( |
| | | Utilities.getStringFromCollection(backendSet, ", ")); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<Message> incompatibilityReasons) |
| | | { |
| | | boolean canLaunch = true; |
| | | if (state == State.RUNNING) |
| | | { |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. This is a short operation so the limitation |
| | | // has not a lot of impact. |
| | | Set<String> backends = |
| | | new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, |
| | | taskToBeLaunched)); |
| | | canLaunch = false; |
| | | } |
| | | } |
| | | return canLaunch; |
| | | } |
| | | |
| | | /** |
| | | * Update the configuration in the server. |
| | | * @throws OpenDsException if an error occurs. |
| | | */ |
| | | private void updateConfiguration() throws OpenDsException |
| | | { |
| | | boolean configHandlerUpdated = false; |
| | | final int totalNumber = indexesToDelete.size(); |
| | | int numberDeleted = 0; |
| | | try |
| | | { |
| | | if (!isServerRunning()) |
| | | { |
| | | configHandlerUpdated = true; |
| | | getInfo().stopPooling(); |
| | | if (getInfo().mustDeregisterConfig()) |
| | | { |
| | | DirectoryServer.deregisterBaseDN(DN.decode("cn=config")); |
| | | } |
| | | DirectoryServer.getInstance().initializeConfiguration( |
| | | org.opends.server.extensions.ConfigFileHandler.class.getName(), |
| | | ConfigReader.configFile); |
| | | getInfo().setMustDeregisterConfig(true); |
| | | } |
| | | boolean isFirst = true; |
| | | for (final AbstractIndexDescriptor index : indexesToDelete) |
| | | { |
| | | if (!isFirst) |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | getProgressDialog().appendProgressHtml("<br><br>"); |
| | | } |
| | | }); |
| | | } |
| | | isFirst = false; |
| | | if (isServerRunning()) |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | StringBuilder sb = new StringBuilder(); |
| | | sb.append(getConfigCommandLineName(index)); |
| | | Collection<String> args = |
| | | getObfuscatedCommandLineArguments( |
| | | getDSConfigCommandLineArguments(index)); |
| | | args.removeAll(getConfigCommandLineArguments()); |
| | | for (String arg : args) |
| | | { |
| | | sb.append(" "+CommandBuilder.escapeValue(arg)); |
| | | } |
| | | getProgressDialog().appendProgressHtml(Utilities.applyFont( |
| | | INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_DELETE_INDEX.get()+ |
| | | "<br><b>"+sb.toString()+"</b><br><br>", |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | } |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | if (isVLVIndex(index)) |
| | | { |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressWithPoints( |
| | | INFO_CTRL_PANEL_DELETING_VLV_INDEX.get( |
| | | index.getName()), |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | else |
| | | { |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressWithPoints( |
| | | INFO_CTRL_PANEL_DELETING_INDEX.get( |
| | | index.getName()), |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | } |
| | | }); |
| | | if (isServerRunning()) |
| | | { |
| | | deleteIndex(getInfo().getDirContext(), index); |
| | | } |
| | | else |
| | | { |
| | | deleteIndex(index); |
| | | } |
| | | numberDeleted ++; |
| | | final int fNumberDeleted = numberDeleted; |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | getProgressDialog().getProgressBar().setIndeterminate(false); |
| | | getProgressDialog().getProgressBar().setValue( |
| | | (fNumberDeleted * 100) / totalNumber); |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressDone(ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | deletedIndexes.add(index); |
| | | } |
| | | } |
| | | finally |
| | | { |
| | | if (configHandlerUpdated) |
| | | { |
| | | DirectoryServer.getInstance().initializeConfiguration( |
| | | ConfigReader.configClassName, ConfigReader.configFile); |
| | | getInfo().startPooling(ControlPanelInfo.DEFAULT_POOLING); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns <CODE>true</CODE> if the index is a VLV index and |
| | | * <CODE>false</CODE> otherwise. |
| | | * @param index the index. |
| | | * @return <CODE>true</CODE> if the index is a VLV index and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | private boolean isVLVIndex(AbstractIndexDescriptor index) |
| | | { |
| | | return index instanceof VLVIndexDescriptor; |
| | | } |
| | | |
| | | /** |
| | | * Deletes an index. The code assumes that the server is not running |
| | | * and that the configuration file can be edited. |
| | | * @param index the index to be deleted. |
| | | * @throws OpenDsException if an error occurs. |
| | | */ |
| | | private void deleteIndex(AbstractIndexDescriptor index) throws OpenDsException |
| | | { |
| | | if (isVLVIndex(index)) |
| | | { |
| | | String dn = Utilities.getRDNString("ds-cfg-name", index.getName())+ |
| | | ",cn=VLV Index,"+Utilities.getRDNString("ds-cfg-backend-id", |
| | | index.getBackend().getBackendID())+",cn=Backends,cn=config"; |
| | | DirectoryServer.getConfigHandler().deleteEntry(DN.decode(dn), null); |
| | | } |
| | | else |
| | | { |
| | | String dn = Utilities.getRDNString("ds-cfg-attribute", index.getName())+ |
| | | ",cn=Index,"+Utilities.getRDNString("ds-cfg-backend-id", |
| | | index.getBackend().getBackendID())+",cn=Backends,cn=config"; |
| | | DirectoryServer.getConfigHandler().deleteEntry(DN.decode(dn), null); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Deletes an index. The code assumes that the server is running |
| | | * and that the provided connection is active. |
| | | * @param index the index to be deleted. |
| | | * @param ctx the connection to the server. |
| | | * @throws OpenDsException if an error occurs. |
| | | */ |
| | | private void deleteIndex(InitialLdapContext ctx, |
| | | AbstractIndexDescriptor index) throws OpenDsException |
| | | { |
| | | ManagementContext mCtx = LDAPManagementContext.createFromContext( |
| | | JNDIDirContextAdaptor.adapt(ctx)); |
| | | RootCfgClient root = mCtx.getRootConfiguration(); |
| | | LocalDBBackendCfgClient backend = |
| | | (LocalDBBackendCfgClient)root.getBackend( |
| | | index.getBackend().getBackendID()); |
| | | if (isVLVIndex(index)) |
| | | { |
| | | backend.removeLocalDBVLVIndex(index.getName()); |
| | | } |
| | | else |
| | | { |
| | | backend.removeLocalDBIndex(index.getName()); |
| | | } |
| | | backend.commit(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected String getCommandLinePath() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | { |
| | | return new ArrayList<String>(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the path of the command line to be used to delete the specified |
| | | * index. |
| | | * @param index the index to be deleted. |
| | | * @return the path of the command line to be used to delete the specified |
| | | * index. |
| | | */ |
| | | private String getConfigCommandLineName(AbstractIndexDescriptor index) |
| | | { |
| | | if (isServerRunning()) |
| | | { |
| | | return getCommandLinePath("dsconfig"); |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void runTask() |
| | | { |
| | | state = State.RUNNING; |
| | | lastException = null; |
| | | |
| | | try |
| | | { |
| | | updateConfiguration(); |
| | | state = State.FINISHED_SUCCESSFULLY; |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | lastException = t; |
| | | state = State.FINISHED_WITH_ERROR; |
| | | } |
| | | finally |
| | | { |
| | | for (AbstractIndexDescriptor index : deletedIndexes) |
| | | { |
| | | getInfo().unregisterModifiedIndex(index); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Return the dsconfig arguments required to delete an index. |
| | | * @param index the index to be deleted. |
| | | * @return the dsconfig arguments required to delete an index. |
| | | */ |
| | | private ArrayList<String> getDSConfigCommandLineArguments( |
| | | AbstractIndexDescriptor index) |
| | | { |
| | | ArrayList<String> args = new ArrayList<String>(); |
| | | if (isVLVIndex(index)) |
| | | { |
| | | args.add("delete-local-db-vlv-index"); |
| | | } |
| | | else |
| | | { |
| | | args.add("delete-local-db-index"); |
| | | } |
| | | args.add("--backend-name"); |
| | | args.add(index.getBackend().getBackendID()); |
| | | |
| | | args.add("--index-name"); |
| | | args.add(index.getName()); |
| | | |
| | | args.addAll(getConnectionCommandLineArguments()); |
| | | args.add("--no-prompt"); |
| | | return args; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import javax.naming.NamingException; |
| | | import javax.naming.directory.BasicAttribute; |
| | | import javax.naming.directory.DirContext; |
| | | import javax.naming.directory.ModificationItem; |
| | | import javax.swing.SwingUtilities; |
| | | |
| | | import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo; |
| | | import org.opends.guitools.controlpanel.ui.ColorAndFontConstants; |
| | | import org.opends.guitools.controlpanel.ui.ProgressDialog; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.config.ConfigConstants; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.Attributes; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.CommonSchemaElements; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.ExistingFileBehavior; |
| | | import org.opends.server.types.LDIFExportConfig; |
| | | import org.opends.server.types.LDIFImportConfig; |
| | | import org.opends.server.types.Modification; |
| | | import org.opends.server.types.ModificationType; |
| | | import org.opends.server.types.ObjectClass; |
| | | import org.opends.server.types.OpenDsException; |
| | | import org.opends.server.types.SchemaFileElement; |
| | | import org.opends.server.util.LDIFReader; |
| | | import org.opends.server.util.LDIFWriter; |
| | | import org.opends.server.util.cli.CommandBuilder; |
| | | |
| | | /** |
| | | * The task that is launched when a schema element must be deleted. |
| | | */ |
| | | public class DeleteSchemaElementsTask extends Task |
| | | { |
| | | ArrayList<ObjectClass> ocsToDelete = new ArrayList<ObjectClass>(); |
| | | ArrayList<AttributeType> attrsToDelete = new ArrayList<AttributeType>(); |
| | | private Set<String> backendSet; |
| | | |
| | | /** |
| | | * Constructor of the task. |
| | | * @param info the control panel information. |
| | | * @param dlg the progress dialog where the task progress will be displayed. |
| | | * @param ocsToDelete the object classes that must be deleted. |
| | | * @param attrsToDelete the attributes that must be deleted. |
| | | */ |
| | | public DeleteSchemaElementsTask(ControlPanelInfo info, ProgressDialog dlg, |
| | | List<ObjectClass> ocsToDelete, List<AttributeType> attrsToDelete) |
| | | { |
| | | super(info, dlg); |
| | | this.ocsToDelete.addAll(ocsToDelete); |
| | | this.attrsToDelete.addAll(attrsToDelete); |
| | | backendSet = new HashSet<String>(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<Message> incompatibilityReasons) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Type getType() |
| | | { |
| | | if (attrsToDelete.isEmpty()) |
| | | { |
| | | return Type.DELETE_OBJECTCLASS; |
| | | } |
| | | else if (ocsToDelete.isEmpty()) |
| | | { |
| | | return Type.DELETE_ATTRIBUTE; |
| | | } |
| | | else |
| | | { |
| | | return Type.DELETE_OBJECTCLASS; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void runTask() |
| | | { |
| | | state = State.RUNNING; |
| | | lastException = null; |
| | | |
| | | try |
| | | { |
| | | updateSchema(); |
| | | state = State.FINISHED_SUCCESSFULLY; |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | lastException = t; |
| | | state = State.FINISHED_WITH_ERROR; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected String getCommandLinePath() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | { |
| | | return new ArrayList<String>(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Message getTaskDescription() |
| | | { |
| | | return INFO_CTRL_PANEL_DELETE_SCHEMA_ELEMENT_TASK_DESCRIPTION.get(); |
| | | } |
| | | |
| | | /** |
| | | * Updates the schema. |
| | | * @throws OpenDsException if an error occurs. |
| | | */ |
| | | private void updateSchema() throws OpenDsException |
| | | { |
| | | final boolean[] isFirst = {true}; |
| | | final int totalNumber = ocsToDelete.size() + attrsToDelete.size(); |
| | | int numberDeleted = 0; |
| | | for (final ObjectClass objectClass : ocsToDelete) |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | if (!isFirst[0]) |
| | | { |
| | | getProgressDialog().appendProgressHtml("<br><br>"); |
| | | } |
| | | isFirst[0] = false; |
| | | printEquivalentCommandToDelete(objectClass); |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressWithPoints( |
| | | INFO_CTRL_PANEL_DELETING_OBJECTCLASS.get( |
| | | objectClass.getNameOrOID()), |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | |
| | | if (isServerRunning()) |
| | | { |
| | | try |
| | | { |
| | | BasicAttribute attr = new BasicAttribute( |
| | | getSchemaFileAttributeName(objectClass)); |
| | | attr.add(getSchemaFileAttributeValue(objectClass)); |
| | | ModificationItem mod = |
| | | new ModificationItem(DirContext.REMOVE_ATTRIBUTE, attr); |
| | | getInfo().getDirContext().modifyAttributes( |
| | | ConfigConstants.DN_DEFAULT_SCHEMA_ROOT, |
| | | new ModificationItem[] { mod }); |
| | | } |
| | | catch (NamingException ne) |
| | | { |
| | | throw new OnlineUpdateException( |
| | | ERR_CTRL_PANEL_ERROR_UPDATING_SCHEMA.get(ne.toString()), ne); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | updateSchemaFile(objectClass); |
| | | } |
| | | numberDeleted ++; |
| | | final int fNumberDeleted = numberDeleted; |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | getProgressDialog().getProgressBar().setIndeterminate(false); |
| | | getProgressDialog().getProgressBar().setValue( |
| | | (fNumberDeleted * 100) / totalNumber); |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressDone(ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | for (final AttributeType attribute : attrsToDelete) |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | if (!isFirst[0]) |
| | | { |
| | | getProgressDialog().appendProgressHtml("<br><br>"); |
| | | } |
| | | isFirst[0] = false; |
| | | printEquivalentCommandToDelete(attribute); |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressWithPoints( |
| | | INFO_CTRL_PANEL_DELETING_ATTRIBUTE.get( |
| | | attribute.getNameOrOID()), |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | |
| | | if (isServerRunning()) |
| | | { |
| | | try |
| | | { |
| | | BasicAttribute attr = new BasicAttribute( |
| | | getSchemaFileAttributeName(attribute)); |
| | | attr.add(getSchemaFileAttributeValue(attribute)); |
| | | ModificationItem mod = new ModificationItem( |
| | | DirContext.REMOVE_ATTRIBUTE, |
| | | attr); |
| | | getInfo().getDirContext().modifyAttributes( |
| | | ConfigConstants.DN_DEFAULT_SCHEMA_ROOT, |
| | | new ModificationItem[] { mod }); |
| | | } |
| | | catch (NamingException ne) |
| | | { |
| | | throw new OnlineUpdateException( |
| | | ERR_CTRL_PANEL_ERROR_UPDATING_SCHEMA.get(ne.toString()), ne); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | updateSchemaFile(attribute); |
| | | } |
| | | |
| | | numberDeleted ++; |
| | | final int fNumberDeleted = numberDeleted; |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | getProgressDialog().getProgressBar().setIndeterminate(false); |
| | | getProgressDialog().getProgressBar().setValue( |
| | | (fNumberDeleted * 100) / totalNumber); |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressDone(ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Updates the schema file by deleting the provided schema element. |
| | | * @param schemaElement the schema element to be deleted. |
| | | * @throws OpenDsException if an error occurs. |
| | | */ |
| | | private void updateSchemaFile(CommonSchemaElements schemaElement) |
| | | throws OpenDsException |
| | | { |
| | | String schemaFile = getSchemaFile((SchemaFileElement)schemaElement); |
| | | LDIFExportConfig exportConfig = |
| | | new LDIFExportConfig(schemaFile, |
| | | ExistingFileBehavior.OVERWRITE); |
| | | LDIFReader reader = null; |
| | | Entry schemaEntry = null; |
| | | try |
| | | { |
| | | reader = new LDIFReader(new LDIFImportConfig(schemaFile)); |
| | | schemaEntry = reader.readEntry(); |
| | | |
| | | Modification mod = new Modification(ModificationType.DELETE, |
| | | Attributes.create( |
| | | getSchemaFileAttributeName(schemaElement).toLowerCase(), |
| | | getSchemaFileAttributeValue(schemaElement))); |
| | | schemaEntry.applyModification(mod); |
| | | LDIFWriter writer = new LDIFWriter(exportConfig); |
| | | writer.writeEntry(schemaEntry); |
| | | exportConfig.getWriter().newLine(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | } |
| | | finally |
| | | { |
| | | if (reader != null) |
| | | { |
| | | try |
| | | { |
| | | reader.close(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | } |
| | | } |
| | | if (exportConfig != null) |
| | | { |
| | | try |
| | | { |
| | | exportConfig.close(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns the schema file for a given schema element. |
| | | * @param element the schema element. |
| | | * @return the schema file for a given schema element. |
| | | */ |
| | | private String getSchemaFile(SchemaFileElement element) |
| | | { |
| | | String schemaFile = element.getSchemaFile(); |
| | | if (schemaFile == null) |
| | | { |
| | | schemaFile = ConfigConstants.FILE_USER_SCHEMA_ELEMENTS; |
| | | } |
| | | File f = new File(schemaFile); |
| | | if (!f.isAbsolute()) |
| | | { |
| | | f = new File( |
| | | DirectoryServer.getEnvironmentConfig().getSchemaDirectory(), |
| | | schemaFile); |
| | | } |
| | | schemaFile = f.getAbsolutePath(); |
| | | return schemaFile; |
| | | } |
| | | |
| | | /** |
| | | * Returns the attribute name in the schema entry that corresponds to the |
| | | * profived schema element. |
| | | * @param element the schema element. |
| | | * @return the attribute name in the schema entry that corresponds to the |
| | | * profived schema element. |
| | | */ |
| | | private String getSchemaFileAttributeName(CommonSchemaElements element) |
| | | { |
| | | if (element instanceof AttributeType) |
| | | { |
| | | return "attributeTypes"; |
| | | } |
| | | else |
| | | { |
| | | return "objectClasses"; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns the value in the schema file for the provided element. |
| | | * @param element the schema element. |
| | | * @return the value in the schema file for the provided element. |
| | | */ |
| | | private String getSchemaFileAttributeValue(CommonSchemaElements element) |
| | | { |
| | | if (element instanceof AttributeType) |
| | | { |
| | | return ((AttributeType)element).getDefinition(); |
| | | } |
| | | else |
| | | { |
| | | return ((ObjectClass)element).getDefinition(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Prints the equivalent command-line to delete the schema element in the |
| | | * progress dialog. |
| | | * @param element the schema element to be deleted. |
| | | */ |
| | | private void printEquivalentCommandToDelete(CommonSchemaElements element) |
| | | { |
| | | String schemaFile = getSchemaFile((SchemaFileElement)element); |
| | | String attrName = getSchemaFileAttributeName(element); |
| | | String attrValue = getSchemaFileAttributeValue(element); |
| | | if (!isServerRunning()) |
| | | { |
| | | getProgressDialog().appendProgressHtml(Utilities.applyFont( |
| | | INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_DELETE_SCHEMA_ELEMENT_OFFLINE.get( |
| | | schemaFile)+"<br><b>"+ |
| | | attrName+": "+attrValue+"</b><br><br>", |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | else |
| | | { |
| | | ArrayList<String> args = new ArrayList<String>(); |
| | | args.add(getCommandLinePath("ldapmodify")); |
| | | args.add("-a"); |
| | | args.addAll(getObfuscatedCommandLineArguments( |
| | | getConnectionCommandLineArguments())); |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (String arg : args) |
| | | { |
| | | sb.append(" "+CommandBuilder.escapeValue(arg)); |
| | | } |
| | | sb.append("<br>"); |
| | | sb.append("dn: cn=schema<br>"); |
| | | sb.append("changetype: modify<br>"); |
| | | sb.append("delete: "+attrName+"<br>"); |
| | | sb.append(attrName+": "+attrValue); |
| | | getProgressDialog().appendProgressHtml(Utilities.applyFont( |
| | | INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_DELETE_SCHEMA_ELEMENT_ONLINE.get()+ |
| | | "<br><b>"+sb.toString()+"</b><br><br>", |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | import java.util.TreeSet; |
| | | |
| | | import org.opends.guitools.controlpanel.datamodel.BackendDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.BaseDNDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo; |
| | | import org.opends.guitools.controlpanel.ui.ProgressDialog; |
| | | import org.opends.server.types.DN; |
| | | |
| | | /** |
| | | * Abstract task used to factorize some code shared by different tasks involving |
| | | * indexes. |
| | | * |
| | | */ |
| | | public abstract class IndexTask extends Task |
| | | { |
| | | /** |
| | | * The set of backends that are affected by this task. |
| | | */ |
| | | protected Set<String> backendSet; |
| | | /** |
| | | * The set of base DNs that are affected by this task. |
| | | */ |
| | | protected Set<String> baseDNs; |
| | | |
| | | /** |
| | | * Constructor of the task. |
| | | * @param info the control panel information. |
| | | * @param dlg the progress dialog where the task progress will be displayed. |
| | | * @param baseDN the base DN where the indexes are defined. |
| | | */ |
| | | protected IndexTask(ControlPanelInfo info, ProgressDialog dlg, |
| | | String baseDN) |
| | | { |
| | | super(info, dlg); |
| | | baseDNs = new HashSet<String>(); |
| | | baseDNs.add(baseDN); |
| | | initializeBackendSet(); |
| | | } |
| | | |
| | | /** |
| | | * Constructor of the task. |
| | | * @param info the control panel information. |
| | | * @param dlg the progress dialog where the task progress will be displayed. |
| | | * @param baseDNs the list of base DNs where the indexes are defined. |
| | | */ |
| | | protected IndexTask(ControlPanelInfo info, ProgressDialog dlg, |
| | | Collection<String> baseDNs) |
| | | { |
| | | super(info, dlg); |
| | | backendSet = new HashSet<String>(); |
| | | this.baseDNs = new TreeSet<String>(); |
| | | this.baseDNs.addAll(baseDNs); |
| | | initializeBackendSet(); |
| | | } |
| | | |
| | | /** |
| | | * Initialize the list of backends that are affected by this task. |
| | | * |
| | | */ |
| | | private void initializeBackendSet() |
| | | { |
| | | backendSet = new TreeSet<String>(); |
| | | DN theDN = null; |
| | | for (String baseDN : baseDNs) |
| | | { |
| | | try |
| | | { |
| | | theDN = DN.decode(baseDN); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | throw new IllegalArgumentException("Could not decode dn "+ |
| | | baseDN, t); |
| | | } |
| | | for (BackendDescriptor backend : |
| | | getInfo().getServerDescriptor().getBackends()) |
| | | { |
| | | for (BaseDNDescriptor b : backend.getBaseDns()) |
| | | { |
| | | if (b.getDn().equals(theDN)) |
| | | { |
| | | backendSet.add(backend.getBackendID()); |
| | | break; |
| | | } |
| | | } |
| | | if (backendSet.size() > 0) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.HashSet; |
| | | import java.util.Iterator; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.TreeSet; |
| | | |
| | | import javax.naming.NamingException; |
| | | import javax.naming.directory.Attribute; |
| | | import javax.naming.directory.BasicAttribute; |
| | | import javax.naming.directory.DirContext; |
| | | import javax.naming.directory.ModificationItem; |
| | | import javax.naming.ldap.InitialLdapContext; |
| | | import javax.swing.SwingUtilities; |
| | | import javax.swing.tree.TreePath; |
| | | |
| | | import org.opends.guitools.controlpanel.browser.BrowserController; |
| | | import org.opends.guitools.controlpanel.datamodel.BackendDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.BaseDNDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.CannotRenameException; |
| | | import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo; |
| | | import org.opends.guitools.controlpanel.datamodel.CustomSearchResult; |
| | | import org.opends.guitools.controlpanel.ui.ColorAndFontConstants; |
| | | import org.opends.guitools.controlpanel.ui.ProgressDialog; |
| | | import org.opends.guitools.controlpanel.ui.ViewEntryPanel; |
| | | import org.opends.guitools.controlpanel.ui.nodes.BasicNode; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.messages.AdminToolMessages; |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.config.ConfigConstants; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.AttributeValue; |
| | | import org.opends.server.types.ByteString; |
| | | import org.opends.server.types.ByteStringFactory; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.OpenDsException; |
| | | import org.opends.server.types.RDN; |
| | | import org.opends.server.types.Schema; |
| | | |
| | | /** |
| | | * The task that is called when we must modify an entry. |
| | | * |
| | | */ |
| | | public class ModifyEntryTask extends Task |
| | | { |
| | | private Set<String> backendSet; |
| | | private boolean mustRename; |
| | | private boolean hasModifications; |
| | | private CustomSearchResult oldEntry; |
| | | private DN oldDn; |
| | | private ArrayList<ModificationItem> modifications; |
| | | private Entry newEntry; |
| | | private BrowserController controller; |
| | | private TreePath treePath; |
| | | |
| | | /** |
| | | * Constructor of the task. |
| | | * @param info the control panel information. |
| | | * @param dlg the progress dialog where the task progress will be displayed. |
| | | * @param newEntry the entry containing the new values. |
| | | * @param oldEntry the old entry as we retrieved using JNDI. |
| | | * @param controller the BrowserController. |
| | | * @param path the TreePath corresponding to the node in the tree that we |
| | | * want to modify. |
| | | */ |
| | | public ModifyEntryTask(ControlPanelInfo info, ProgressDialog dlg, |
| | | Entry newEntry, CustomSearchResult oldEntry, |
| | | BrowserController controller, TreePath path) |
| | | { |
| | | super(info, dlg); |
| | | backendSet = new HashSet<String>(); |
| | | this.oldEntry = oldEntry; |
| | | this.newEntry = newEntry; |
| | | this.controller = controller; |
| | | this.treePath = path; |
| | | DN newDn = newEntry.getDN(); |
| | | try |
| | | { |
| | | oldDn = DN.decode(oldEntry.getDN()); |
| | | for (BackendDescriptor backend : info.getServerDescriptor().getBackends()) |
| | | { |
| | | for (BaseDNDescriptor baseDN : backend.getBaseDns()) |
| | | { |
| | | if (newDn.isDescendantOf(baseDN.getDn()) || |
| | | oldDn.isDescendantOf(baseDN.getDn())) |
| | | { |
| | | backendSet.add(backend.getBackendID()); |
| | | } |
| | | } |
| | | } |
| | | mustRename = !newDn.equals(oldDn); |
| | | } |
| | | catch (OpenDsException ode) |
| | | { |
| | | throw new IllegalStateException("Could not parse DN: "+oldEntry.getDN(), |
| | | ode); |
| | | } |
| | | modifications = getModifications(newEntry, oldEntry, getInfo()); |
| | | hasModifications = modifications.size() > 0 || |
| | | !oldDn.equals(newEntry.getDN()); |
| | | } |
| | | |
| | | /** |
| | | * Tells whether there actually modifications on the entry. |
| | | * @return <CODE>true</CODE> if there are modifications and <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | public boolean hasModifications() |
| | | { |
| | | return hasModifications; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Type getType() |
| | | { |
| | | return Type.MODIFY_ENTRY; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Message getTaskDescription() |
| | | { |
| | | return INFO_CTRL_PANEL_MODIFY_ENTRY_TASK_DESCRIPTION.get(oldEntry.getDN()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected String getCommandLinePath() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | { |
| | | return new ArrayList<String>(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<Message> incompatibilityReasons) |
| | | { |
| | | boolean canLaunch = true; |
| | | if (!isServerRunning()) |
| | | { |
| | | if (state == State.RUNNING) |
| | | { |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. This is a short operation so the limitation |
| | | // has not a lot of impact. |
| | | Set<String> backends = |
| | | new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, |
| | | taskToBeLaunched)); |
| | | canLaunch = false; |
| | | } |
| | | } |
| | | } |
| | | return canLaunch; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean regenerateDescriptor() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void runTask() |
| | | { |
| | | state = State.RUNNING; |
| | | lastException = null; |
| | | |
| | | try |
| | | { |
| | | BasicNode node = (BasicNode)treePath.getLastPathComponent(); |
| | | InitialLdapContext ctx = controller.findConnectionForDisplayedEntry(node); |
| | | if (!mustRename) |
| | | { |
| | | if (modifications.size() > 0) { |
| | | ModificationItem[] mods = |
| | | new ModificationItem[modifications.size()]; |
| | | modifications.toArray(mods); |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | printEquivalentCommandToModify(newEntry.getDN(), modifications); |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressWithPoints( |
| | | INFO_CTRL_PANEL_MODIFYING_ENTRY.get(oldEntry.getDN()), |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | |
| | | ctx.modifyAttributes(Utilities.getJNDIName(oldEntry.getDN()), mods); |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressDone( |
| | | ColorAndFontConstants.progressFont)); |
| | | controller.notifyEntryChanged( |
| | | controller.getNodeInfoFromPath(treePath)); |
| | | controller.getTree().removeSelectionPath(treePath); |
| | | controller.getTree().setSelectionPath(treePath); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | modifyAndRename(ctx, oldDn, oldEntry, newEntry, modifications); |
| | | } |
| | | state = State.FINISHED_SUCCESSFULLY; |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | lastException = t; |
| | | state = State.FINISHED_WITH_ERROR; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Modifies and renames the entry. |
| | | * @param ctx the connection to the server. |
| | | * @param oldDN the oldDN of the entry. |
| | | * @param originalEntry the original entry. |
| | | * @param newEntry the new entry. |
| | | * @param originalMods the original modifications (these are required since |
| | | * we might want to update them). |
| | | * @throws CannotRenameException if we cannot perform the modification. |
| | | * @throws NamingException if an error performing the modification occurs. |
| | | */ |
| | | private void modifyAndRename(DirContext ctx, final DN oldDN, |
| | | CustomSearchResult originalEntry, final Entry newEntry, |
| | | final ArrayList<ModificationItem> originalMods) |
| | | throws CannotRenameException, NamingException |
| | | { |
| | | RDN oldRDN = oldDN.getRDN(); |
| | | RDN newRDN = newEntry.getDN().getRDN(); |
| | | |
| | | boolean rdnTypeChanged = |
| | | newRDN.getNumValues() != oldRDN.getNumValues(); |
| | | |
| | | for (int i=0; (i<newRDN.getNumValues()) && !rdnTypeChanged; i++) { |
| | | boolean found = false; |
| | | for (int j=0; |
| | | (j<oldRDN.getNumValues()) && !found; j++) { |
| | | found = newRDN.getAttributeName(i).equalsIgnoreCase( |
| | | oldRDN.getAttributeName(j)); |
| | | } |
| | | rdnTypeChanged = !found; |
| | | } |
| | | |
| | | if (rdnTypeChanged) { |
| | | /* Check if user changed the objectclass...*/ |
| | | boolean changedOc = false; |
| | | for (ModificationItem mod : originalMods) |
| | | { |
| | | Attribute attr = mod.getAttribute(); |
| | | changedOc = attr.getID().equalsIgnoreCase( |
| | | ConfigConstants.ATTR_OBJECTCLASS); |
| | | if (changedOc) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (changedOc) |
| | | { |
| | | /* See if the original entry contains the new |
| | | naming attribute(s) if it does we will be able |
| | | to perform the renaming and then the |
| | | modifications without problem */ |
| | | boolean entryContainsRdnTypes = true; |
| | | for (int i=0; (i<newRDN.getNumValues()) && entryContainsRdnTypes; i++) |
| | | { |
| | | Set<Object> values = originalEntry.getAttributeValues( |
| | | newRDN.getAttributeName(i)); |
| | | entryContainsRdnTypes = !values.isEmpty(); |
| | | } |
| | | |
| | | if (!entryContainsRdnTypes) |
| | | { |
| | | throw new CannotRenameException( |
| | | AdminToolMessages.ERR_CANNOT_MODIFY_OBJECTCLASS_AND_RENAME.get()); |
| | | } |
| | | } |
| | | } |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | printEquivalentRenameCommand(oldDN, newEntry.getDN()); |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressWithPoints( |
| | | INFO_CTRL_PANEL_RENAMING_ENTRY.get(oldDN.toString(), |
| | | newEntry.getDN().toString()), |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | |
| | | ctx.rename(Utilities.getJNDIName(oldDn.toString()), |
| | | Utilities.getJNDIName(newEntry.getDN().toString())); |
| | | |
| | | final TreePath[] newPath = {null}; |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressDone(ColorAndFontConstants.progressFont)); |
| | | getProgressDialog().appendProgressHtml("<br>"); |
| | | TreePath parentPath = controller.notifyEntryDeleted( |
| | | controller.getNodeInfoFromPath(treePath)); |
| | | newPath[0] = controller.notifyEntryAdded( |
| | | controller.getNodeInfoFromPath(parentPath), |
| | | newEntry.getDN().toString()); |
| | | } |
| | | }); |
| | | |
| | | |
| | | ModificationItem[] mods = new ModificationItem[originalMods.size()]; |
| | | originalMods.toArray(mods); |
| | | if (mods.length > 0) |
| | | { |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | DN dn = newEntry.getDN(); |
| | | printEquivalentCommandToModify(dn, originalMods); |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressWithPoints( |
| | | INFO_CTRL_PANEL_MODIFYING_ENTRY.get(dn.toString()), |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | |
| | | ctx.modifyAttributes(Utilities.getJNDIName(newEntry.getDN().toString()), |
| | | mods); |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressDone(ColorAndFontConstants.progressFont)); |
| | | if (newPath[0] != null) |
| | | { |
| | | controller.getTree().setSelectionPath(newPath[0]); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Gets the modifications to apply between two entries. |
| | | * @param newEntry the new entry. |
| | | * @param oldEntry the old entry. |
| | | * @param info the ControlPanelInfo, used to retrieve the schema for instance. |
| | | * @return the modifications to apply between two entries. |
| | | */ |
| | | public static ArrayList<ModificationItem> getModifications(Entry newEntry, |
| | | CustomSearchResult oldEntry, ControlPanelInfo info) { |
| | | ArrayList<ModificationItem> modifications = |
| | | new ArrayList<ModificationItem>(); |
| | | Schema schema = info.getServerDescriptor().getSchema(); |
| | | |
| | | List<org.opends.server.types.Attribute> newAttrs = newEntry.getAttributes(); |
| | | newAttrs.add(newEntry.getObjectClassAttribute()); |
| | | for (org.opends.server.types.Attribute attr : newAttrs) |
| | | { |
| | | String attrName = attr.getNameWithOptions(); |
| | | if (!ViewEntryPanel.isEditable(attrName, schema)) |
| | | { |
| | | continue; |
| | | } |
| | | AttributeType attrType = schema.getAttributeType( |
| | | attr.getName().toLowerCase()); |
| | | Set<AttributeValue> newValues = new LinkedHashSet<AttributeValue>(); |
| | | Iterator<AttributeValue> it = attr.iterator(); |
| | | while (it.hasNext()) |
| | | { |
| | | newValues.add(it.next()); |
| | | } |
| | | Set<Object> oldValues = oldEntry.getAttributeValues(attrName); |
| | | |
| | | boolean isAttributeInNewRdn = false; |
| | | AttributeValue rdnValue = null; |
| | | RDN rdn = newEntry.getDN().getRDN(); |
| | | for (int i=0; i<rdn.getNumValues() && !isAttributeInNewRdn; i++) |
| | | { |
| | | isAttributeInNewRdn = |
| | | rdn.getAttributeName(i).equalsIgnoreCase(attrName); |
| | | rdnValue = rdn.getAttributeValue(i); |
| | | } |
| | | |
| | | /* Check the attributes of the old DN. If we are renaming them they |
| | | * will be deleted. Check that they are on the new entry but not in |
| | | * the new RDN. If it is the case we must add them after the renaming. |
| | | */ |
| | | AttributeValue oldRdnValueToAdd = null; |
| | | /* Check the value in the RDN that will be deleted. If the value was |
| | | * on the previous RDN but not in the new entry it will be deleted. So |
| | | * we must avoid to include it as a delete modification in the |
| | | * modifications. |
| | | */ |
| | | AttributeValue oldRdnValueDeleted = null; |
| | | RDN oldRDN = null; |
| | | try |
| | | { |
| | | oldRDN = DN.decode(oldEntry.getDN()).getRDN(); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | throw new IllegalStateException("Unexpected error parsing DN: "+ |
| | | oldEntry.getDN(), de); |
| | | } |
| | | for (int i=0; i<oldRDN.getNumValues(); i++) |
| | | { |
| | | if (oldRDN.getAttributeName(i).equalsIgnoreCase(attrName)) |
| | | { |
| | | AttributeValue value = oldRDN.getAttributeValue(i); |
| | | boolean containsValue = false; |
| | | it = attr.iterator(); |
| | | while (it.hasNext()) |
| | | { |
| | | if (value.equals(it.next())) |
| | | { |
| | | containsValue = true; |
| | | break; |
| | | } |
| | | } |
| | | if (containsValue) |
| | | { |
| | | if ((rdnValue == null) || !rdnValue.equals(value)) |
| | | { |
| | | oldRdnValueToAdd = value; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | oldRdnValueDeleted = value; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | if (oldValues == null) |
| | | { |
| | | Set<AttributeValue> vs = new HashSet<AttributeValue>(); |
| | | vs.addAll(newValues); |
| | | if (rdnValue != null) |
| | | { |
| | | vs.remove(rdnValue); |
| | | } |
| | | if (vs.size() > 0) |
| | | { |
| | | modifications.add(new ModificationItem( |
| | | DirContext.ADD_ATTRIBUTE, |
| | | createAttribute(attrName, newValues))); |
| | | } |
| | | } else { |
| | | Set<AttributeValue> toDelete = getValuesToDelete(oldValues, newValues, |
| | | attrType); |
| | | if (oldRdnValueDeleted != null) |
| | | { |
| | | toDelete.remove(oldRdnValueDeleted); |
| | | } |
| | | Set<AttributeValue> toAdd = getValuesToAdd(oldValues, newValues, |
| | | attrType); |
| | | if (oldRdnValueToAdd != null) |
| | | { |
| | | toAdd.add(oldRdnValueToAdd); |
| | | } |
| | | if ((toDelete.size() + toAdd.size() >= newValues.size()) && |
| | | !isAttributeInNewRdn) |
| | | { |
| | | modifications.add(new ModificationItem( |
| | | DirContext.REPLACE_ATTRIBUTE, |
| | | createAttribute(attrName, newValues))); |
| | | } |
| | | else |
| | | { |
| | | if (toDelete.size() > 0) |
| | | { |
| | | modifications.add(new ModificationItem( |
| | | DirContext.REMOVE_ATTRIBUTE, |
| | | createAttribute(attrName, toDelete))); |
| | | } |
| | | if (toAdd.size() > 0) |
| | | { |
| | | Set<AttributeValue> vs = new HashSet<AttributeValue>(); |
| | | vs.addAll(toAdd); |
| | | if (rdnValue != null) |
| | | { |
| | | vs.remove(rdnValue); |
| | | } |
| | | if (vs.size() > 0) |
| | | { |
| | | modifications.add(new ModificationItem( |
| | | DirContext.ADD_ATTRIBUTE, |
| | | createAttribute(attrName, vs))); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /* Check if there are attributes to delete */ |
| | | for (String attrName : oldEntry.getAttributeNames()) |
| | | { |
| | | if (!ViewEntryPanel.isEditable(attrName, schema)) |
| | | { |
| | | continue; |
| | | } |
| | | Set<Object> oldValues = oldEntry.getAttributeValues(attrName); |
| | | String attrNoOptions = |
| | | Utilities.getAttributeNameWithoutOptions(attrName).toLowerCase(); |
| | | |
| | | List<org.opends.server.types.Attribute> attrs = |
| | | newEntry.getAttribute(attrNoOptions); |
| | | boolean found = false; |
| | | if (attrs != null) |
| | | { |
| | | for (org.opends.server.types.Attribute attr : attrs) |
| | | { |
| | | if (attr.getNameWithOptions().equalsIgnoreCase(attrName)) |
| | | { |
| | | found = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if (!found && (oldValues.size() > 0)) |
| | | { |
| | | modifications.add(new ModificationItem( |
| | | DirContext.REMOVE_ATTRIBUTE, |
| | | new BasicAttribute(attrName))); |
| | | } |
| | | } |
| | | return modifications; |
| | | } |
| | | |
| | | /** |
| | | * Creates a JNDI attribute using an attribute name and a set of values. |
| | | * @param attrName the attribute name. |
| | | * @param values the values. |
| | | * @return a JNDI attribute using an attribute name and a set of values. |
| | | */ |
| | | private static Attribute createAttribute(String attrName, |
| | | Set<AttributeValue> values) { |
| | | Attribute attribute = new BasicAttribute(attrName); |
| | | for (AttributeValue value : values) |
| | | { |
| | | attribute.add(value.getValue().value()); |
| | | } |
| | | return attribute; |
| | | } |
| | | |
| | | /** |
| | | * Creates an AttributeValue for an attribute and a value (the one we got |
| | | * using JNDI). |
| | | * @param attrType the attribute type. |
| | | * @param value the value found using JNDI. |
| | | * @return an AttributeValue object. |
| | | */ |
| | | private static AttributeValue createAttributeValue(AttributeType attrType, |
| | | Object value) |
| | | { |
| | | ByteString v; |
| | | if (value instanceof String) |
| | | { |
| | | v = ByteStringFactory.create((String)value); |
| | | } |
| | | else if (value instanceof byte[]) |
| | | { |
| | | v = ByteStringFactory.create((byte[])value); |
| | | } |
| | | else |
| | | { |
| | | v = ByteStringFactory.create(String.valueOf(value)); |
| | | } |
| | | return new AttributeValue(attrType, v); |
| | | } |
| | | |
| | | /** |
| | | * Returns the set of AttributeValue that must be deleted. |
| | | * @param oldValues the old values of the entry. |
| | | * @param newValues the new values of the entry. |
| | | * @param attrType the attribute type. |
| | | * @return the set of AttributeValue that must be deleted. |
| | | */ |
| | | private static Set<AttributeValue> getValuesToDelete(Set<Object> oldValues, |
| | | Set<AttributeValue> newValues, AttributeType attrType) |
| | | { |
| | | Set<AttributeValue> valuesToDelete = new HashSet<AttributeValue>(); |
| | | for (Object o : oldValues) |
| | | { |
| | | AttributeValue oldValue = createAttributeValue(attrType, o); |
| | | if (!newValues.contains(oldValue)) |
| | | { |
| | | valuesToDelete.add(oldValue); |
| | | } |
| | | } |
| | | return valuesToDelete; |
| | | } |
| | | |
| | | /** |
| | | * Returns the set of AttributeValue that must be added. |
| | | * @param oldValues the old values of the entry. |
| | | * @param newValues the new values of the entry. |
| | | * @param attrType the attribute type. |
| | | * @return the set of AttributeValue that must be added. |
| | | */ |
| | | private static Set<AttributeValue> getValuesToAdd(Set<Object> oldValues, |
| | | Set<AttributeValue> newValues, AttributeType attrType) |
| | | { |
| | | Set<AttributeValue> valuesToAdd = new HashSet<AttributeValue>(); |
| | | for (AttributeValue newValue : newValues) |
| | | { |
| | | boolean found = false; |
| | | for (Object o : oldValues) |
| | | { |
| | | found = newValue.equals(createAttributeValue(attrType, o)); |
| | | if (found) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | if (!found) |
| | | { |
| | | valuesToAdd.add(newValue); |
| | | } |
| | | } |
| | | return valuesToAdd; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.HashSet; |
| | | import java.util.Iterator; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.Set; |
| | | import java.util.TreeSet; |
| | | |
| | | import javax.naming.directory.BasicAttribute; |
| | | import javax.naming.directory.BasicAttributes; |
| | | import javax.naming.ldap.InitialLdapContext; |
| | | import javax.swing.SwingUtilities; |
| | | import javax.swing.tree.TreePath; |
| | | |
| | | import org.opends.guitools.controlpanel.browser.BrowserController; |
| | | import org.opends.guitools.controlpanel.datamodel.BackendDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.BaseDNDescriptor; |
| | | import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo; |
| | | import org.opends.guitools.controlpanel.ui.ColorAndFontConstants; |
| | | import org.opends.guitools.controlpanel.ui.ProgressDialog; |
| | | import org.opends.guitools.controlpanel.ui.nodes.BasicNode; |
| | | import org.opends.guitools.controlpanel.ui.nodes.BrowserNodeInfo; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.config.ConfigConstants; |
| | | import org.opends.server.types.AttributeValue; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.util.cli.CommandBuilder; |
| | | |
| | | /** |
| | | * The task launched when we must create an entry. |
| | | * |
| | | */ |
| | | public class NewEntryTask extends Task |
| | | { |
| | | private Entry newEntry; |
| | | private String ldif; |
| | | private Set<String> backendSet; |
| | | private BasicNode parentNode; |
| | | private BrowserController controller; |
| | | private DN dn; |
| | | |
| | | /** |
| | | * Constructor of the task. |
| | | * @param info the control panel information. |
| | | * @param dlg the progress dialog where the task progress will be displayed. |
| | | * @param newEntry the entry containing the new values. |
| | | * @param ldif the LDIF representation of the new entry. |
| | | * @param controller the BrowserController. |
| | | * @param parentNode the parent node in the tree of the entry that we want |
| | | * to create. |
| | | */ |
| | | public NewEntryTask(ControlPanelInfo info, ProgressDialog dlg, |
| | | Entry newEntry, String ldif, |
| | | BasicNode parentNode, BrowserController controller) |
| | | { |
| | | super(info, dlg); |
| | | backendSet = new HashSet<String>(); |
| | | this.newEntry = newEntry; |
| | | this.ldif = ldif; |
| | | this.parentNode = parentNode; |
| | | this.controller = controller; |
| | | dn = newEntry.getDN(); |
| | | for (BackendDescriptor backend : info.getServerDescriptor().getBackends()) |
| | | { |
| | | for (BaseDNDescriptor baseDN : backend.getBaseDns()) |
| | | { |
| | | if (dn.isDescendantOf(baseDN.getDn())) |
| | | { |
| | | backendSet.add(backend.getBackendID()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Type getType() |
| | | { |
| | | return Type.NEW_ENTRY; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Set<String> getBackends() |
| | | { |
| | | return backendSet; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public Message getTaskDescription() |
| | | { |
| | | return INFO_CTRL_PANEL_NEW_ENTRY_TASK_DESCRIPTION.get(dn.toString()); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected String getCommandLinePath() |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | protected ArrayList<String> getCommandLineArguments() |
| | | { |
| | | return new ArrayList<String>(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<Message> incompatibilityReasons) |
| | | { |
| | | boolean canLaunch = true; |
| | | if (!isServerRunning()) |
| | | { |
| | | if (state == State.RUNNING) |
| | | { |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. This is a short operation so the limitation |
| | | // has not a lot of impact. |
| | | Set<String> backends = |
| | | new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, |
| | | taskToBeLaunched)); |
| | | canLaunch = false; |
| | | } |
| | | } |
| | | } |
| | | return canLaunch; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean regenerateDescriptor() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void runTask() |
| | | { |
| | | state = State.RUNNING; |
| | | lastException = null; |
| | | |
| | | try |
| | | { |
| | | InitialLdapContext ctx; |
| | | |
| | | if (parentNode != null) |
| | | { |
| | | ctx = controller.findConnectionForDisplayedEntry(parentNode); |
| | | } |
| | | else |
| | | { |
| | | ctx = getInfo().getDirContext(); |
| | | } |
| | | BasicAttributes attrs = new BasicAttributes(); |
| | | BasicAttribute objectclass = |
| | | new BasicAttribute(ConfigConstants.ATTR_OBJECTCLASS); |
| | | for (String oc : newEntry.getObjectClasses().values()) |
| | | { |
| | | objectclass.add(oc); |
| | | } |
| | | attrs.put(objectclass); |
| | | for (org.opends.server.types.Attribute attr : newEntry.getAttributes()) |
| | | { |
| | | String attrName = attr.getNameWithOptions(); |
| | | Set<AttributeValue> values = new LinkedHashSet<AttributeValue>(); |
| | | Iterator<AttributeValue> it = attr.iterator(); |
| | | while (it.hasNext()) |
| | | { |
| | | values.add(it.next()); |
| | | } |
| | | BasicAttribute a = new BasicAttribute(attrName); |
| | | for (AttributeValue value : values) |
| | | { |
| | | a.add(value.getValueBytes()); |
| | | } |
| | | attrs.put(a); |
| | | } |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | printEquivalentCommand(); |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressWithPoints( |
| | | INFO_CTRL_PANEL_CREATING_ENTRY.get(dn.toString()), |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | }); |
| | | |
| | | ctx.createSubcontext(Utilities.getJNDIName(newEntry.getDN().toString()), |
| | | attrs); |
| | | |
| | | SwingUtilities.invokeLater(new Runnable() |
| | | { |
| | | public void run() |
| | | { |
| | | getProgressDialog().appendProgressHtml( |
| | | Utilities.getProgressDone(ColorAndFontConstants.progressFont)); |
| | | if (parentNode != null) |
| | | { |
| | | TreePath parentPath = |
| | | new TreePath(controller.getTreeModel().getPathToRoot(parentNode)); |
| | | if (parentPath != null) |
| | | { |
| | | BrowserNodeInfo nodeInfo = |
| | | controller.getNodeInfoFromPath(parentPath); |
| | | if (nodeInfo != null) |
| | | { |
| | | TreePath newPath = controller.notifyEntryAdded( |
| | | controller.getNodeInfoFromPath(parentPath), |
| | | newEntry.getDN().toString()); |
| | | if (newPath != null) |
| | | { |
| | | controller.getTree().setSelectionPath(newPath); |
| | | controller.getTree().scrollPathToVisible(newPath); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | state = State.FINISHED_SUCCESSFULLY; |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | lastException = t; |
| | | state = State.FINISHED_WITH_ERROR; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Prints the equivalent command-line in the progress dialog. |
| | | * |
| | | */ |
| | | private void printEquivalentCommand() |
| | | { |
| | | ArrayList<String> args = new ArrayList<String>(); |
| | | args.add(getCommandLinePath("ldapmodify")); |
| | | args.addAll(getObfuscatedCommandLineArguments( |
| | | getConnectionCommandLineArguments())); |
| | | args.add("--defaultAdd"); |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (String arg : args) |
| | | { |
| | | sb.append(" "+CommandBuilder.escapeValue(arg)); |
| | | } |
| | | sb.append("<br>"); |
| | | String[] lines = ldif.split("\n"); |
| | | for (String line : lines) |
| | | { |
| | | sb.append(obfuscateLDIFLine(line)); |
| | | sb.append("<br>"); |
| | | } |
| | | getProgressDialog().appendProgressHtml(Utilities.applyFont( |
| | | INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_CREATE_ENTRY.get()+"<br><b>"+ |
| | | sb.toString()+"</b><br><br>", |
| | | ColorAndFontConstants.progressFont)); |
| | | } |
| | | } |
| | | |
| opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/task/OfflineUpdateException.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/task/OnlineUpdateException.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/task/RebuildIndexTask.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/task/ResetUserPasswordTask.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/task/RestartServerTask.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/task/SchemaTask.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/task/StartServerTask.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/task/StartStopTask.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/task/StopServerTask.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/task/Task.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/task/package-info.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/AbstractBackendIndexesPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/AbstractBrowseEntriesPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/AbstractIndexPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/AbstractNewEntryPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/AbstractVLVIndexPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/AddToGroupPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/AttributeSyntaxPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BackendIndexesPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BackendVLVIndexesPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BackupListPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BackupPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BaseDNPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BinaryAttributeEditorPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BinaryValuePanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseIndexPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/BrowseSchemaPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ConfigurationAttributePanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ConfigurationObjectClassPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ControlCenterMainPane.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/DeleteBackendPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/DeleteBaseDNPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ErrorPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ErrorSearchingEntryPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ExportLDIFPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/GenericDialog.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/GenericMenuBar.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/InclusionExclusionPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/IndexBrowserRightPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/IndexPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/LDAPEntryPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/LDAPEntrySelectionPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/LDIFViewEntryPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/LoginPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/MainActionsPane.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/MainMenuBar.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/MatchingRulePanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewAttributePanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewDomainPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewEntryFromLDIFPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewGroupPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewIndexPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewObjectClassPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewOrganizationPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewOrganizationalUnitPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewUserPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewVLVIndexPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/NoItemSelectedPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ObjectClassEditorPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ProgressDialog.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/RebuildIndexPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ResetUserPasswordPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/RestorePanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/SchemaBrowserRightPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/SchemaElementPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/StandardAttributePanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/StandardObjectClassPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/UnsavedChangesDialog.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/VLVIndexPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/VerifyIndexPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/WindowsServicePanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/border/AccordionElementBorder.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/border/SelectedCategoryBorder.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/border/package-info.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/ActionButton.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/AddRemovePanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/BasicExpander.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/BinaryCellPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/CategoryButton.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/CategoryPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/CellEditorButton.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/CustomTree.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/DoubleAddRemovePanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/FilterTextField.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/LabelWithHelpIcon.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/ObjectClassCellPanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/TitlePanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/TreePanel.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/components/package-info.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/nodes/AbstractIndexTreeNode.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/nodes/AttributeSyntaxTreeNode.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/nodes/BasicNode.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/nodes/BrowserNodeInfo.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/nodes/CategoryTreeNode.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/nodes/ConfigurationAttributeTreeNode.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/nodes/ConfigurationObjectClassTreeNode.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/nodes/CustomAttributeTreeNode.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/nodes/CustomObjectClassTreeNode.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/nodes/DndBrowserNodes.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/nodes/IndexTreeNode.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/nodes/MatchingRuleTreeNode.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/nodes/RootNode.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/nodes/SchemaElementTreeNode.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/nodes/StandardAttributeTreeNode.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/nodes/StandardObjectClassTreeNode.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/nodes/SuffixNode.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/nodes/VLVIndexTreeNode.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/nodes/package-info.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/package-info.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/renderer/AttributeCellEditor.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/renderer/BackupTableCellRenderer.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/renderer/BaseDNCellRenderer.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/renderer/BrowserCellRenderer.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/renderer/CustomCellRenderer.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/renderer/CustomListCellRenderer.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/renderer/IndexCellRenderer.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/renderer/IndexComboBoxCellRenderer.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/renderer/LDAPEntryTableCellRenderer.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/renderer/SchemaElementComboBoxCellRenderer.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/renderer/SelectableTableCellRenderer.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/renderer/TreeCellRenderer.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/renderer/VLVSortOrderRenderer.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/renderer/package-info.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/util/ApplicationPrintStream.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/util/BackgroundTask.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/util/BackgroundTaskThread.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/util/ConfigFromDirContext.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/util/ConfigFromFile.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/util/ConfigReader.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/util/ControlPanelLog.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/util/LDAPEntryReader.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/util/NumSubordinateHacker.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/util/ProcessReader.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/util/ReadOnlyConfigFileHandler.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/util/SchemaLoader.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/util/package-info.java
opendj-sdk/opends/src/guitools/org/opends/guitools/replicationcli/DisableReplicationUserData.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/replicationcli/EnableReplicationUserData.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/replicationcli/InitializeAllReplicationUserData.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/replicationcli/InitializeReplicationUserData.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/replicationcli/MonoServerReplicationUserData.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/replicationcli/PostExternalInitializationUserData.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/replicationcli/PreExternalInitializationUserData.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliArgumentParser.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliException.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliReturnCode.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationUserData.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/replicationcli/StatusReplicationUserData.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/replicationcli/package-info.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/BaseDNDescriptor.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigException.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromFile.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromLDAP.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConnectionProtocolPolicy.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/DatabaseDescriptor.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ListenerDescriptor.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ServerStatusDescriptor.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ServerStatusPooler.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/SplashScreen.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusCliArgumentParser.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusLog.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusPanelController.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusPanelLauncher.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/event/ServerStatusChangeEvent.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/event/ServerStatusChangeListener.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/event/StatusPanelButtonListener.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/event/package-info.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/package-info.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ui/DatabasesTableModel.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ui/ListenersTableModel.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ui/LoginDialog.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ui/StatusPanelDialog.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ui/package-info.java (deleted)
opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallUserData.java
opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallerArgumentParser.java
opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/ui/LoginDialog.java
opendj-sdk/opends/src/messages/messages/admin.properties
opendj-sdk/opends/src/messages/messages/admin_tool.properties
opendj-sdk/opends/src/messages/messages/core.properties
opendj-sdk/opends/src/messages/messages/dsconfig.properties
opendj-sdk/opends/src/messages/messages/extension.properties
opendj-sdk/opends/src/messages/messages/plugin.properties
opendj-sdk/opends/src/messages/messages/protocol.properties
opendj-sdk/opends/src/messages/messages/quicksetup.properties
opendj-sdk/opends/src/messages/messages/replication.properties
opendj-sdk/opends/src/messages/messages/servicetag.properties
opendj-sdk/opends/src/messages/messages/task.properties
opendj-sdk/opends/src/messages/messages/tools.properties
opendj-sdk/opends/src/messages/messages/utility.properties
opendj-sdk/opends/src/messages/src/org/opends/messages/Category.java
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Installation.java
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/UserData.java
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/DataReplicationOptions.java
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataReplicationPanel.java
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/ui/ServerSettingsPanel.java
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/FieldName.java
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
opendj-sdk/opends/src/server/org/opends/server/admin/AbstractManagedObjectDefinition.java
opendj-sdk/opends/src/server/org/opends/server/admin/AdministrationConnector.java
opendj-sdk/opends/src/server/org/opends/server/admin/ClassLoaderProvider.java
opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliParser.java
opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java
opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java
opendj-sdk/opends/src/server/org/opends/server/admin/client/ldap/JNDIDirContextAdaptor.java
opendj-sdk/opends/src/server/org/opends/server/api/AccessLogPublisher.java
opendj-sdk/opends/src/server/org/opends/server/api/AttributeSyntax.java
opendj-sdk/opends/src/server/org/opends/server/api/Backend.java
opendj-sdk/opends/src/server/org/opends/server/api/ClientConnection.java
opendj-sdk/opends/src/server/org/opends/server/api/SynchronizationProvider.java
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciEffectiveRights.java
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciHandler.java
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/AciList.java
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/GroupDN.java
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/PatternRDN.java
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/TargAttrFilters.java
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/UserAttr.java
opendj-sdk/opends/src/server/org/opends/server/authorization/dseecompat/UserDN.java
opendj-sdk/opends/src/server/org/opends/server/backends/BackupBackend.java
opendj-sdk/opends/src/server/org/opends/server/backends/LDIFBackend.java
opendj-sdk/opends/src/server/org/opends/server/backends/MemoryBackend.java
opendj-sdk/opends/src/server/org/opends/server/backends/MonitorBackend.java
opendj-sdk/opends/src/server/org/opends/server/backends/RootDSEBackend.java
opendj-sdk/opends/src/server/org/opends/server/backends/SchemaBackend.java
opendj-sdk/opends/src/server/org/opends/server/backends/TrustStoreBackend.java
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/ApproximateIndexer.java
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/DN2ID.java
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/DN2URI.java
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/EqualityIndexer.java
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/Index.java
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/JECompressedSchema.java
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/OrderingIndexer.java
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/SortValues.java
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/SubstringIndexer.java
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/VLVIndex.java
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/VerifyJob.java
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java
opendj-sdk/opends/src/server/org/opends/server/backends/task/RecurringTask.java
opendj-sdk/opends/src/server/org/opends/server/backends/task/Task.java
opendj-sdk/opends/src/server/org/opends/server/backends/task/TaskBackend.java
opendj-sdk/opends/src/server/org/opends/server/backends/task/TaskScheduler.java
opendj-sdk/opends/src/server/org/opends/server/config/BooleanConfigAttribute.java
opendj-sdk/opends/src/server/org/opends/server/config/ConfigAttribute.java
opendj-sdk/opends/src/server/org/opends/server/config/ConfigEntry.java
opendj-sdk/opends/src/server/org/opends/server/config/DNConfigAttribute.java
opendj-sdk/opends/src/server/org/opends/server/config/IntegerConfigAttribute.java
opendj-sdk/opends/src/server/org/opends/server/config/IntegerWithUnitConfigAttribute.java
opendj-sdk/opends/src/server/org/opends/server/config/JMXMBean.java
opendj-sdk/opends/src/server/org/opends/server/config/MultiChoiceConfigAttribute.java
opendj-sdk/opends/src/server/org/opends/server/config/ReadOnlyConfigAttribute.java
opendj-sdk/opends/src/server/org/opends/server/config/StringConfigAttribute.java
opendj-sdk/opends/src/server/org/opends/server/core/AddOperationBasis.java
opendj-sdk/opends/src/server/org/opends/server/core/BindOperationBasis.java
opendj-sdk/opends/src/server/org/opends/server/core/CompareOperationBasis.java
opendj-sdk/opends/src/server/org/opends/server/core/ConnectionHandlerConfigManager.java
opendj-sdk/opends/src/server/org/opends/server/core/DefaultCompressedSchema.java
opendj-sdk/opends/src/server/org/opends/server/core/DeleteOperationBasis.java
opendj-sdk/opends/src/server/org/opends/server/core/DirectoryServer.java
opendj-sdk/opends/src/server/org/opends/server/core/ModifyDNOperationBasis.java
opendj-sdk/opends/src/server/org/opends/server/core/ModifyOperationBasis.java
opendj-sdk/opends/src/server/org/opends/server/core/NetworkGroup.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/core/NetworkGroupConfigManager.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/core/NetworkGroupCriteria.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/core/NetworkGroupNamingContexts.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/core/NetworkGroupPolicy.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/core/PasswordPolicy.java
opendj-sdk/opends/src/server/org/opends/server/core/PasswordPolicyState.java
opendj-sdk/opends/src/server/org/opends/server/core/QueueingStrategy.java
opendj-sdk/opends/src/server/org/opends/server/core/RootDseWorkflowTopology.java
opendj-sdk/opends/src/server/org/opends/server/core/SchemaConfigManager.java
opendj-sdk/opends/src/server/org/opends/server/core/SearchOperationBasis.java
opendj-sdk/opends/src/server/org/opends/server/core/SynchronousStrategy.java
opendj-sdk/opends/src/server/org/opends/server/core/WorkQueueStrategy.java
opendj-sdk/opends/src/server/org/opends/server/core/WorkflowConfigManager.java
opendj-sdk/opends/src/server/org/opends/server/core/WorkflowImpl.java
opendj-sdk/opends/src/server/org/opends/server/core/WorkflowTopologyNode.java
opendj-sdk/opends/src/server/org/opends/server/core/networkgroups/AuthMethodCriteria.java
opendj-sdk/opends/src/server/org/opends/server/core/networkgroups/BindDnCriteria.java
opendj-sdk/opends/src/server/org/opends/server/core/networkgroups/IpFilterCriteria.java
opendj-sdk/opends/src/server/org/opends/server/core/networkgroups/NetworkGroup.java
opendj-sdk/opends/src/server/org/opends/server/core/networkgroups/NetworkGroupConfigManager.java
opendj-sdk/opends/src/server/org/opends/server/core/networkgroups/NetworkGroupCriteria.java
opendj-sdk/opends/src/server/org/opends/server/core/networkgroups/NetworkGroupCriterion.java
opendj-sdk/opends/src/server/org/opends/server/core/networkgroups/NetworkGroupNamingContexts.java
opendj-sdk/opends/src/server/org/opends/server/core/networkgroups/NetworkGroupPolicy.java
opendj-sdk/opends/src/server/org/opends/server/core/networkgroups/PortCriteria.java
opendj-sdk/opends/src/server/org/opends/server/core/networkgroups/RequestFilteringPolicy.java
opendj-sdk/opends/src/server/org/opends/server/core/networkgroups/ResourceLimits.java
opendj-sdk/opends/src/server/org/opends/server/core/networkgroups/SecurityCriteria.java
opendj-sdk/opends/src/server/org/opends/server/core/networkgroups/package-info.java
opendj-sdk/opends/src/server/org/opends/server/crypto/CryptoManagerImpl.java
opendj-sdk/opends/src/server/org/opends/server/extensions/AttributeValuePasswordValidator.java
opendj-sdk/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
opendj-sdk/opends/src/server/org/opends/server/extensions/DynamicGroup.java
opendj-sdk/opends/src/server/org/opends/server/extensions/EntryCacheCommon.java
opendj-sdk/opends/src/server/org/opends/server/extensions/ExternalSASLMechanismHandler.java
opendj-sdk/opends/src/server/org/opends/server/extensions/FileSystemEntryCache.java
opendj-sdk/opends/src/server/org/opends/server/extensions/PasswordModifyExtendedOperation.java
opendj-sdk/opends/src/server/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java
opendj-sdk/opends/src/server/org/opends/server/extensions/StaticGroup.java
opendj-sdk/opends/src/server/org/opends/server/extensions/UserAttributeNotificationMessageTemplateElement.java
opendj-sdk/opends/src/server/org/opends/server/extensions/VirtualStaticGroup.java
opendj-sdk/opends/src/server/org/opends/server/loggers/AccessLogger.java
opendj-sdk/opends/src/server/org/opends/server/loggers/TextAccessLogPublisher.java
opendj-sdk/opends/src/server/org/opends/server/loggers/TextAuditLogPublisher.java
opendj-sdk/opends/src/server/org/opends/server/monitors/BackendMonitor.java
opendj-sdk/opends/src/server/org/opends/server/monitors/ClientConnectionMonitorProvider.java
opendj-sdk/opends/src/server/org/opends/server/monitors/ConnectionHandlerMonitor.java
opendj-sdk/opends/src/server/org/opends/server/monitors/DatabaseEnvironmentMonitor.java
opendj-sdk/opends/src/server/org/opends/server/monitors/EntryCacheMonitorProvider.java
opendj-sdk/opends/src/server/org/opends/server/monitors/MemoryUsageMonitorProvider.java
opendj-sdk/opends/src/server/org/opends/server/monitors/StackTraceMonitorProvider.java
opendj-sdk/opends/src/server/org/opends/server/monitors/SystemInfoMonitorProvider.java
opendj-sdk/opends/src/server/org/opends/server/monitors/TraditionalWorkQueueMonitor.java
opendj-sdk/opends/src/server/org/opends/server/monitors/VersionMonitorProvider.java
opendj-sdk/opends/src/server/org/opends/server/plugins/ChangeNumberControlPlugin.java
opendj-sdk/opends/src/server/org/opends/server/plugins/EntryUUIDPlugin.java
opendj-sdk/opends/src/server/org/opends/server/plugins/LastModPlugin.java
opendj-sdk/opends/src/server/org/opends/server/plugins/NetworkGroupPlugin.java
opendj-sdk/opends/src/server/org/opends/server/plugins/PasswordPolicyImportPlugin.java
opendj-sdk/opends/src/server/org/opends/server/plugins/ReferentialIntegrityPlugin.java
opendj-sdk/opends/src/server/org/opends/server/plugins/SevenBitCleanPlugin.java
opendj-sdk/opends/src/server/org/opends/server/plugins/UniqueAttributePlugin.java
opendj-sdk/opends/src/server/org/opends/server/protocols/internal/InternalClientConnection.java
opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/JmxClientConnection.java
opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/JmxConnectionHandler.java
opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPAttribute.java
opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPFilter.java
opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/LDAPStatistics.java
opendj-sdk/opends/src/server/org/opends/server/protocols/ldap/SearchResultEntryProtocolOp.java
opendj-sdk/opends/src/server/org/opends/server/replication/common/AssuredMode.java
opendj-sdk/opends/src/server/org/opends/server/replication/common/ChangeNumber.java
opendj-sdk/opends/src/server/org/opends/server/replication/common/DSInfo.java
opendj-sdk/opends/src/server/org/opends/server/replication/common/RSInfo.java
opendj-sdk/opends/src/server/org/opends/server/replication/common/ServerState.java
opendj-sdk/opends/src/server/org/opends/server/replication/common/ServerStatus.java
opendj-sdk/opends/src/server/org/opends/server/replication/common/StatusMachine.java
opendj-sdk/opends/src/server/org/opends/server/replication/common/StatusMachineEvent.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/AttrInfoMultiple.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/AttrInfoSingle.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/AttributeInfo.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/FakeAddOperation.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/FakeModdnOperation.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/FakeModifyOperation.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/FakeOperation.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/GenerationIdChecksum.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/HistVal.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/Historical.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ListenerThread.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ModifyFakeOperation.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/PendingChange.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/PendingChanges.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/PersistentServerState.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/RemotePendingChanges.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplayThread.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationBroker.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationMonitor.java
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/UpdateToReplay.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/AckMessage.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/AckMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/AddContext.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/AddMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ChangeStatusMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/DeleteMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/DoneMessage.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/DoneMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/EntryMessage.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/EntryMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ErrorMessage.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ErrorMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/HeartbeatMessage.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/HeartbeatMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/HeartbeatThread.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/InitializeRequestMessage.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/InitializeRequestMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/InitializeTargetMessage.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/InitializeTargetMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ModifyDNMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ModifyMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/MonitorMessage.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/MonitorMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/MonitorRequestMessage.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/MonitorRequestMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/NotSupportedOldVersionPDUException.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ProtocolSession.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ProtocolVersion.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ReplServerInfoMessage.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ReplServerStartMessage.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ReplServerStartMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ReplSessionSecurity.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ReplicationMessage.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ReplicationMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ResetGenerationId.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ResetGenerationIdMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/RoutableMessage.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/RoutableMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ServerStartMessage.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ServerStartMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/SocketSession.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/StartMessage.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/StartMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/StartSessionMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/TLSSocketSession.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/TopologyMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/UpdateMessage.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/UpdateMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/WindowMessage.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/WindowMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/WindowProbe.java (deleted)
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/WindowProbeMsg.java
opendj-sdk/opends/src/server/org/opends/server/replication/server/DbHandler.java
opendj-sdk/opends/src/server/org/opends/server/replication/server/LightweightServerHandler.java
opendj-sdk/opends/src/server/org/opends/server/replication/server/MsgQueue.java
opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationBackend.java
opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationDB.java
opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationData.java
opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationDbEnv.java
opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationIterator.java
opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerHandler.java
opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerReader.java
opendj-sdk/opends/src/server/org/opends/server/replication/server/ServerWriter.java
opendj-sdk/opends/src/server/org/opends/server/replication/server/StatusAnalyzer.java
opendj-sdk/opends/src/server/org/opends/server/replication/server/UpdateComparator.java
opendj-sdk/opends/src/server/org/opends/server/schema/AbsoluteSubtreeSpecificationSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/AciSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/AttributeTypeSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/AuthPasswordSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/BinarySyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/BitStringSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/BooleanSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/CertificateListSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/CertificatePairSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/CertificateSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/CountryStringSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/DITContentRuleSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/DITStructureRuleSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/DeliveryMethodSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/DirectoryStringSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/DistinguishedNameSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/EnhancedGuideSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/FaxNumberSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/FaxSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/GeneralizedTimeSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/GuideSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/IA5StringSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/IntegerSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/JPEGSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/MatchingRuleSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/MatchingRuleUseSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/NameAndOptionalUIDSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/NameFormSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/NumericStringSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/OIDSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/ObjectClassSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/OctetStringSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/OtherMailboxSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/PostalAddressSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/PresentationAddressSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/PrintableStringSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/ProtocolInformationSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/RFC3672SubtreeSpecificationSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/RelativeSubtreeSpecificationSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/SubstringAssertionSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/SupportedAlgorithmSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/TelephoneNumberSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/TeletexTerminalIdentifierSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/TelexNumberSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/UTCTimeSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/UUIDSyntax.java
opendj-sdk/opends/src/server/org/opends/server/schema/UserPasswordSyntax.java
opendj-sdk/opends/src/server/org/opends/server/servicetag/Registry.java
opendj-sdk/opends/src/server/org/opends/server/servicetag/ServiceTag.java
opendj-sdk/opends/src/server/org/opends/server/servicetag/ServiceTagAlreadyExistsException.java
opendj-sdk/opends/src/server/org/opends/server/servicetag/ServiceTagDefinition.java
opendj-sdk/opends/src/server/org/opends/server/servicetag/ServiceTagDoesNotExistException.java
opendj-sdk/opends/src/server/org/opends/server/servicetag/ServiceTagException.java
opendj-sdk/opends/src/server/org/opends/server/servicetag/ServiceTagRegistration.java
opendj-sdk/opends/src/server/org/opends/server/servicetag/SwordFishIDParser.java
opendj-sdk/opends/src/server/org/opends/server/servicetag/SwordFishIdConfiguration.java
opendj-sdk/opends/src/server/org/opends/server/servicetag/SystemEnvironment.java
opendj-sdk/opends/src/server/org/opends/server/servicetag/Util.java
opendj-sdk/opends/src/server/org/opends/server/servicetag/package-info.java
opendj-sdk/opends/src/server/org/opends/server/tasks/AddSchemaFileTask.java
opendj-sdk/opends/src/server/org/opends/server/tasks/DisconnectClientTask.java
opendj-sdk/opends/src/server/org/opends/server/tasks/ImportTask.java
opendj-sdk/opends/src/server/org/opends/server/tasks/ShutdownTask.java
opendj-sdk/opends/src/server/org/opends/server/tasks/TaskUtils.java
opendj-sdk/opends/src/server/org/opends/server/tools/ConfigureDS.java
opendj-sdk/opends/src/server/org/opends/server/tools/InstallDS.java
opendj-sdk/opends/src/server/org/opends/server/tools/InstallDSArgumentParser.java
opendj-sdk/opends/src/server/org/opends/server/tools/LDAPModify.java
opendj-sdk/opends/src/server/org/opends/server/tools/LDIFDiff.java
opendj-sdk/opends/src/server/org/opends/server/tools/LDIFModify.java
opendj-sdk/opends/src/server/org/opends/server/tools/ManageAccount.java
opendj-sdk/opends/src/server/org/opends/server/tools/ManageTasks.java
opendj-sdk/opends/src/server/org/opends/server/tools/StopDS.java
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/DSConfig.java
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/LDAPManagementContextFactory.java
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java
opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/DisableReplicationUserData.java
opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/EnableReplicationUserData.java
opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/InitializeAllReplicationUserData.java
opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/InitializeReplicationUserData.java
opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/MonoServerReplicationUserData.java
opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/PostExternalInitializationUserData.java
opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/PreExternalInitializationUserData.java
opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliException.java
opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliReturnCode.java
opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationUserData.java
opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/StatusReplicationUserData.java
opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/package-info.java
opendj-sdk/opends/src/server/org/opends/server/tools/makeldif/Branch.java
opendj-sdk/opends/src/server/org/opends/server/tools/makeldif/TemplateEntry.java
opendj-sdk/opends/src/server/org/opends/server/tools/status/StatusCli.java
opendj-sdk/opends/src/server/org/opends/server/tools/status/StatusCliArgumentParser.java
opendj-sdk/opends/src/server/org/opends/server/tools/status/package-info.java
opendj-sdk/opends/src/server/org/opends/server/tools/tasks/TaskClient.java
opendj-sdk/opends/src/server/org/opends/server/tools/tasks/TaskEntry.java
opendj-sdk/opends/src/server/org/opends/server/tools/tasks/TaskTool.java
opendj-sdk/opends/src/server/org/opends/server/types/AbstractAttribute.java
opendj-sdk/opends/src/server/org/opends/server/types/Attribute.java
opendj-sdk/opends/src/server/org/opends/server/types/AttributeBuilder.java
opendj-sdk/opends/src/server/org/opends/server/types/AttributeType.java
opendj-sdk/opends/src/server/org/opends/server/types/AttributeValueIterable.java
opendj-sdk/opends/src/server/org/opends/server/types/Attributes.java
opendj-sdk/opends/src/server/org/opends/server/types/Entry.java
opendj-sdk/opends/src/server/org/opends/server/types/Modification.java
opendj-sdk/opends/src/server/org/opends/server/types/Schema.java
opendj-sdk/opends/src/server/org/opends/server/types/SearchFilter.java
opendj-sdk/opends/src/server/org/opends/server/types/VirtualAttribute.java
opendj-sdk/opends/src/server/org/opends/server/util/EmbeddedUtils.java
opendj-sdk/opends/src/server/org/opends/server/util/LDIFReader.java
opendj-sdk/opends/src/server/org/opends/server/util/LDIFWriter.java
opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java
opendj-sdk/opends/src/server/org/opends/server/util/SetupUtils.java
opendj-sdk/opends/src/server/org/opends/server/util/StaticUtils.java
opendj-sdk/opends/src/server/org/opends/server/util/args/LDAPConnectionArgumentParser.java
opendj-sdk/opends/src/server/org/opends/server/util/cli/CommandBuilder.java
opendj-sdk/opends/src/server/org/opends/server/util/cli/ConsoleApplication.java
opendj-sdk/opends/src/server/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java
opendj-sdk/opends/src/server/org/opends/server/workflowelement/WorkflowElement.java
opendj-sdk/opends/src/server/org/opends/server/workflowelement/WorkflowElementConfigManager.java
opendj-sdk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java
opendj-sdk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendBindOperation.java
opendj-sdk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendCompareOperation.java
opendj-sdk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendDeleteOperation.java
opendj-sdk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java
opendj-sdk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java
opendj-sdk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
opendj-sdk/opends/tests/staf-tests/functional-tests/config/replication/3server_topology.txt
opendj-sdk/opends/tests/staf-tests/functional-tests/config/replication/basic_topology.txt
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/aci/aci_bindtypes.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/aci/aci_cleanup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/aci/aci_compare_tests.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/aci/aci_effective_rights.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/aci/aci_proxy_auth.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/aci/aci_targattrfilter.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/aci/aci_target.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/aci/aci_targetattr.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/aci/aci_targetcontrol.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/aci/aci_targetfilter.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/aci/aci_targetscope.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/aci/multiple_aci_tests.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/backend_cleanup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/export.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/restore.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/clu/clu_cleanup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldapsearch_checkbehavior.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/clu/clu_manage-tasks_checkbehavior.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/clu/clu_rebuild-index_checkbehavior.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/clu/clu_status_checkbehavior.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/controls/core_ctrls_password_policy.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/core_cleanup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/core_entry_cache.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/core_search_sizelimit.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/core_search_timelimit.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/dsconfig/dsconfig_cleanup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/dsconfig/dsconfig_get.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/dsconfig/dsconfig_list.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/dsml/dsml_cleanup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/dsml/dsml_setup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/groups/group_cleanup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/i18n/i18n_8bit_createbackend.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/i18n/i18n_cleanup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/indexes/indexes.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/logging/logging_cleanup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/logging/logging_properties.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/logging/logging_retention.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/logging/logging_retention_properties.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/logging/logging_rotation.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/logging/logging_rotation_properties.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/logging/logging_writer.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/monitoring/monitoring_cleanup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/monitoring/monitoring_componant.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/monitoring/monitoring_provider.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/plugins/plugins_7bit.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/plugins/plugins_cleanup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/plugins/plugins_entryUUID.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/plugins/plugins_lastmod.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/plugins/plugins_refint.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/plugins/plugins_uniqueness.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/privileges/privileges_cleanup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/privileges/privileges_directory_manager.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/privileges/privileges_new_root_user.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/privileges/privileges_unindexed_searches.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/privileges/privileges_users.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/quickstart/quickstart.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication/binarycopy/binarycopy.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication/changelog/changelog.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication/failover/failover.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication/ldifimport/ldifimport.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication/replication_setup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication/resynchronization/resynchronization.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/replication/totalupdate/totalupdate.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/sample/sample.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/schema/schema_cleanup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/schema/schema_rfc_tests.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/account_activation/security_account_expiration.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/account_activation/security_test_account.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/bind_no_pwd/security_pwd_null.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/client_auth/client_auth_setup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/client_auth/client_auth_teardown.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/client_auth/equal_dn_mapper.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/client_auth/fingerprint_mapper.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/client_auth/subject_attribute_mapper.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/client_auth/subject_dn_mapper.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/jks/security_bob_custom_jks.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/jks/security_bob_jks.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/jks/security_setup_custom_jks.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/jks/security_setup_jks.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/jks/security_teardown_custom_jks.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/jks/security_teardown_jks.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pkcs12/security_bob_pkcs12.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pkcs12/security_setup_pkcs12.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pkcs12/security_teardown_pkcs12.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_policy/security_force_pwd_change.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_policy/security_force_pwd_change_all_users.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_policy/security_grace_login.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_policy/security_last_login.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_policy/security_lockout_duration.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_policy/security_lockout_fail_cnt.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_policy/security_min_pwd_age.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_policy/security_mult_pwd_policies.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_policy/security_preencoded_pwds.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_policy/security_user_pwd_policy.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_policy_root/security_root_auth.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_storage/security_deprecated_schemes.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_storage/security_multiple_schemes.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_storage/security_pwd_3DES.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_storage/security_pwd_AES.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_storage/security_pwd_BASE64.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_storage/security_pwd_CLEAR.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_storage/security_pwd_CRYPT.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_storage/security_pwd_MD5.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_storage/security_pwd_RC4.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_storage/security_pwd_SHA.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_storage/security_pwd_SMD5.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_storage/security_pwd_SSHA.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_storage/security_pwd_SSHA256.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_storage/security_pwd_SSHA384.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_storage/security_pwd_SSHA512.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_storage/security_pwd_blowfish.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_validator/security_attribute_value.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_validator/security_character_set.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_validator/security_dictionary.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_validator/security_history_based.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_validator/security_mult_validators.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_validator/security_pwd_length.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_validator/security_repeat_chars.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_validator/security_similarity_based.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_validator/security_skip_val_for_admins.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/pwd_validator/security_unique_chars.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/sasl/security_sasl_anon.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/sasl/security_sasl_cram-md5.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/sasl/security_sasl_digest-md5.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/sasl/security_sasl_new.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/sasl/security_sasl_plain.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/security_cleanup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/startTLS/security_bob_startTLS.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/startTLS/security_setup_startTLS.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/security/startTLS/security_teardown_startTLS.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/setup/directory_manager.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/setup/import.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/setup/misc.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/setup/ports.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/setup/security.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_cleanup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_registermbean.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_setup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_status.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_trap_customconf.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_v1_customconf.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_v2c_customconf.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_v3_customconf.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/tasks/allowed-tasks.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/tasks/backup_db.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/tasks/cleanup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/tasks/export-ldif.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/tasks/import-ldif.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/tasks/restart_db.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/tasks/restore_db.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/virtualAttributes/virtualAttributes_cleanup.xml
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/virtualAttributes/virtualAttributes_cos.xml
opendj-sdk/opends/tests/staf-tests/shared/ant/tests.xml
opendj-sdk/opends/tests/staf-tests/shared/functions/dsadm.xml
opendj-sdk/opends/tests/staf-tests/shared/functions/dsconfig.xml
opendj-sdk/opends/tests/staf-tests/shared/functions/security.xml
opendj-sdk/opends/tests/staf-tests/shared/functions/snmp.xml
opendj-sdk/opends/tests/staf-tests/shared/functions/tools.xml
opendj-sdk/opends/tests/staf-tests/shared/functions/topology.xml
opendj-sdk/opends/tests/staf-tests/shared/python/replication.py
opendj-sdk/opends/tests/staf-tests/shared/tests/config.py.stubs
opendj-sdk/opends/tests/staf-tests/stress-tests/config/replication/basic_topology.txt
opendj-sdk/opends/tests/unit-tests-testng/resource/config-changes.ldif
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/InstallationTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/client/cli/DsframeworkTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/client/ldap/MockLDAPConnection.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/server/AggregationServerTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/server/ConstraintTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/admin/server/DefaultBehaviorTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/AciTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/AlternateRootDN.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/ExtOpTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/GetEffectiveRightsTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/NestedGroupDNTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/ReferencesTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/TargetAttrTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/TargetControlTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/LDIFBackendTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/SchemaBackendTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestBackendImpl.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestImportJob.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestRebuildJob.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestVerifyJob.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/task/TaskBackendTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/AddOperationTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/BackendConfigManagerTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/BindOperationTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/GroupManagerTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/ModifyOperationTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/NetworkGroupTest.java (deleted)
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/PasswordPolicyTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/RejectUnauthReqTests.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestModifyDNOperation.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowConfigurationTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/NetworkGroupTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/RequestFilteringPolicyTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/ResourceLimitsTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/crypto/CryptoManagerTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/AttributeValuePasswordValidatorTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/CharacterSetPasswordValidatorTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/ConfigFileHandlerTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/DictionaryPasswordValidatorTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/EntryUUIDVirtualAttributeProviderTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/ExactMatchIdentityMapperTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/ExternalSASLMechanismHandlerTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FileSystemEntryCacheTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FingerprintCertificateMapperTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/HasSubordinatesVirtualAttributeProviderTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/LengthBasedPasswordValidatorTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/NumSubordinatesVirtualAttributeProviderTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/PasswordModifyExtendedOperationTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/PasswordStorageSchemeTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/RepeatedCharactersPasswordValidatorTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SimilarityBasedPasswordValidatorTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SubschemaSubentryVirtualAttributeProviderTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/TraditionalWorkQueueTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/UniqueCharactersPasswordValidatorTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/UserDefinedVirtualAttributeProviderTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/VirtualStaticGroupTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/EntryUUIDPluginTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/LDAPADListPluginTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/LastModPluginTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/PasswordPolicyImportPluginTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/ReferentialIntegrityPluginTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/UniqueAttributePluginTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/internal/InternalClientConnectionTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/jmx/JmxPrivilegeTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/jmx/JmxTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/LDAPBinaryOptionTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/LDAPv2TestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/LdapTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestLDAPConnectionHandler.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ChangeNumberControlPluginTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/DependencyTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/GenerationIdTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/InitOnLineTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ProtocolWindowTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReSyncTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/SchemaReplicationTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/StressTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/UpdateOperationTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/AttrInfoTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/ComputeBestServerTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/DomainFakeCfg.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/GenerationIdChecksumTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/GroupIdHandshakeTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/IsolationTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/ModifyConflictTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/PersistentServerStateTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/PersistentStateTest.java (deleted)
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/ReplicationRepairControlTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/ReplicationServerFailoverTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/StateMachineTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/TopologyViewTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/protocol/SynchronizationMsgTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/DbHandlerTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/MonitorTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ReplServerFakeConfiguration.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ReplicationServerDynamicConfTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ReplicationServerTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/UpdateComparatorTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/GenericSchemaTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/snmp/SNMPConnectionManager.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/tasks/AddSchemaFileTaskTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/tasks/AllowedTaskTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/tasks/DummyTask.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/tasks/LockdownModeTaskTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/ImportLDIFTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/ManageAccountTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/RebuildIndexTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/VerifyIndexTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/dsconfig/DsconfigLdapConnectionTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/types/AttributeBuilderTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/types/AttributesTest.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/types/EntrySchemaCheckingTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/types/PrivilegeTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/types/TestEntry.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/types/VirtualAttributeTestCase.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestAddChangeRecordEntry.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestLDIFReader.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestLDIFWriter.java
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestModifyChangeRecordEntry.java |