mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Ludovic Poitou
29.05.2012 2fe585593bd3b3ca68064e5df4e6ee6eb210a66a
Fix OPENDJ-508 - Searches that rely on searchable virtual attribute may be slow.
For those searchable virtual attributes that can be faster than indexing (like when always matching a single entry), we process them before indexes. For the others, we fall back to them when indexes are not enough.
Changes include a little bit of tidy up of comments and IDE warnings.
1 files added
34 files modified
534 ■■■■ changed files
opends/src/messages/messages/extension.properties 9 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/extension_de.properties 4 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/extension_es.properties 4 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/extension_fr.properties 4 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/extension_ja.properties 4 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/extension_ko.properties 6 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/extension_zh_CN.properties 4 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/extension_zh_TW.properties 6 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/api/VirtualAttributeProvider.java 8 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/EntryContainer.java 62 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/CollectiveAttributeSubentriesVirtualAttributeProvider.java 5 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/EntityTagVirtualAttributeProvider.java 11 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/EntryDNVirtualAttributeProvider.java 5 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/EntryUUIDVirtualAttributeProvider.java 15 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/GoverningStructureRuleVirtualAttributeProvider.java 17 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/HasSubordinatesVirtualAttributeProvider.java 15 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/IsMemberOfVirtualAttributeProvider.java 11 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/MemberVirtualAttributeProvider.java 7 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/NumSubordinatesVirtualAttributeProvider.java 15 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/PasswordExpirationTimeVirtualAttributeProvider.java 5 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/PasswordPolicySubentryVirtualAttributeProvider.java 5 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/StructuralObjectClassVirtualAttributeProvider.java 15 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/SubschemaSubentryVirtualAttributeProvider.java 15 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/UserDefinedVirtualAttributeProvider.java 4 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/common/ChangelogBaseDNVirtualAttributeProvider.java 12 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/common/FirstChangeNumberVirtualAttributeProvider.java 13 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/common/LastChangeNumberVirtualAttributeProvider.java 13 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/common/LastCookieVirtualProvider.java 13 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/EntityTagVirtualAttributeProviderTestCase.java 3 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java 9 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java 8 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/UserDefinedVirtualAttributeProviderTestCase.java 7 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/VirtualStaticGroupTestCase.java 7 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/types/TestDN.java 5 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/types/TestLDAPURL.java 188 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/extension.properties
@@ -1544,3 +1544,12 @@
 properly configured for these types of searches
MILD_ERR_FCM_SEARCH_FAILED_624=An internal failure occurred while \
 attempting to map the certificate with fingerprint %s to a user entry:  %s
MILD_ERR_FIRSTCHANGENUMBER_VATTR_NOT_SEARCHABLE_625=The %s attribute is not \
 searchable and should not be included in otherwise unindexed search filters
MILD_ERR_LASTCHANGENUMBER_VATTR_NOT_SEARCHABLE_626=The %s attribute is not \
 searchable and should not be included in otherwise unindexed search filters
MILD_ERR_LASTCOOKIE_VATTR_NOT_SEARCHABLE_627=The %s attribute is not \
 searchable and should not be included in otherwise unindexed search filters
MILD_ERR_CHANGELOGBASEDN_VATTR_NOT_SEARCHABLE_628=The %s attribute is not \
 searchable and should not be included in otherwise unindexed search filters
opends/src/messages/messages/extension_de.properties
@@ -529,3 +529,7 @@
INFO_GSSAPI_STOPPED_575=Der GSSAPI SASL-Mechanismus-Handler wurde angehalten
MILD_ERR_COLLECTIVEATTRIBUTESUBENTRIES_VATTR_NOT_SEARCHABLE_576=Das Attribut %s kann nicht durchsucht werden und darf nicht in ansonsten nicht indizierten Suchfiltern enthalten sein
MILD_ERR_PASSWORDPOLICYSUBENTRY_VATTR_NOT_SEARCHABLE_577=Das Attribut %s kann nicht durchsucht werden und darf nicht in ansonsten nicht indizierten Suchfiltern enthalten sein
MILD_ERR_FIRSTCHANGENUMBER_VATTR_NOT_SEARCHABLE_625=Das Attribut %s kann nicht durchsucht werden und darf nicht in ansonsten nicht indizierten Suchfiltern enthalten sein
MILD_ERR_LASTCHANGENUMBER_VATTR_NOT_SEARCHABLE_626=Das Attribut %s kann nicht durchsucht werden und darf nicht in ansonsten nicht indizierten Suchfiltern enthalten sein
MILD_ERR_LASTCOOKIE_VATTR_NOT_SEARCHABLE_627=Das Attribut %s kann nicht durchsucht werden und darf nicht in ansonsten nicht indizierten Suchfiltern enthalten sein
MILD_ERR_CHANGELOGBASEDN_VATTR_NOT_SEARCHABLE_628=Das Attribut %s kann nicht durchsucht werden und darf nicht in ansonsten nicht indizierten Suchfiltern enthalten sein
opends/src/messages/messages/extension_es.properties
@@ -515,4 +515,8 @@
MILD_ERR_COLLECTIVEATTRIBUTESUBENTRIES_VATTR_NOT_SEARCHABLE_576=El atributo %s no permite su b\u00fasqueda y no se deber\u00eda incluir en filtros de b\u00fasqueda no indizados
MILD_ERR_PASSWORDPOLICYSUBENTRY_VATTR_NOT_SEARCHABLE_577=El atributo %s no permite su b\u00fasqueda y no se deber\u00eda incluir en filtros de b\u00fasqueda no indizados
MILD_ERR_STATICMEMBERS_CANNOT_DECODE_DN_582=Se produjo un error al intentar analizar el ND del miembro %s del grupo est\u00e1tico %s:  %s
MILD_ERR_FIRSTCHANGENUMBER_VATTR_NOT_SEARCHABLE_625=El atributo %s no permite su b\u00fasqueda y no se deber\u00eda incluir en filtros de b\u00fasqueda no indizados
MILD_ERR_LASTCHANGENUMBER_VATTR_NOT_SEARCHABLE_626=El atributo %s no permite su b\u00fasqueda y no se deber\u00eda incluir en filtros de b\u00fasqueda no indizados
MILD_ERR_LASTCOOKIE_VATTR_NOT_SEARCHABLE_627=El atributo %s no permite su b\u00fasqueda y no se deber\u00eda incluir en filtros de b\u00fasqueda no indizados
MILD_ERR_CHANGELOGBASEDN_VATTR_NOT_SEARCHABLE_628=El atributo %s no permite su b\u00fasqueda y no se deber\u00eda incluir en filtros de b\u00fasqueda no indizados
opends/src/messages/messages/extension_fr.properties
@@ -516,3 +516,7 @@
MILD_ERR_PASSWORDPOLICYSUBENTRY_VATTR_NOT_SEARCHABLE_577=L'attribut %s ne peut pas faire l'objet d'une recherche et ne doit pas \u00eatre inclus dans des filtres de recherche non index\u00e9s
MILD_ERR_PWSCHEME_INVALID_BASE64_DECODED_STORED_PASSWORD_578=La valeur du mot de passe %s a \u00e9t\u00e9 d\u00e9cod\u00e9 en base64, mais est trop courte pour \u00eatre valide
MILD_ERR_STATICMEMBERS_CANNOT_DECODE_DN_582=Une erreur s'est produite lors du d\u00e9codage du DN %s, membre du groupe statique %s\u00a0: %s
MILD_ERR_FIRSTCHANGENUMBER_NOT_SEARCHABLE_625=L'attribut %s ne peut pas faire l'objet d'une recherche et ne doit pas \u00eatre inclus dans des filtres de recherche non index\u00e9s
MILD_ERR_LASTCHANGENUNBER_NOT_SEARCHABLE_626=L'attribut %s ne peut pas faire l'objet d'une recherche et ne doit pas \u00eatre inclus dans des filtres de recherche non index\u00e9s
MILD_ERR_LASTCOOKIE_NOT_SEARCHABLE_627=L'attribut %s ne peut pas faire l'objet d'une recherche et ne doit pas \u00eatre inclus dans des filtres de recherche non index\u00e9s
MILD_ERR_CHANGELOGBASEDN_NOT_SEARCHABLE_628=L'attribut %s ne peut pas faire l'objet d'une recherche et ne doit pas \u00eatre inclus dans des filtres de recherche non index\u00e9s
opends/src/messages/messages/extension_ja.properties
@@ -529,3 +529,7 @@
INFO_GSSAPI_STOPPED_575=GSSAPI SASL \u30e1\u30ab\u30cb\u30ba\u30e0\u30cf\u30f3\u30c9\u30e9\u304c\u505c\u6b62\u3057\u307e\u3057\u305f
MILD_ERR_COLLECTIVEATTRIBUTESUBENTRIES_VATTR_NOT_SEARCHABLE_576=%s \u5c5e\u6027\u306f\u691c\u7d22\u53ef\u80fd\u3067\u306a\u3044\u305f\u3081\u3001\u307b\u304b\u306e\u65b9\u6cd5\u3067\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u691c\u7d22\u30d5\u30a3\u30eb\u30bf\u306b\u306f\u542b\u3081\u306a\u3044\u3067\u304f\u3060\u3055\u3044
MILD_ERR_PASSWORDPOLICYSUBENTRY_VATTR_NOT_SEARCHABLE_577=%s \u5c5e\u6027\u306f\u691c\u7d22\u53ef\u80fd\u3067\u306a\u3044\u305f\u3081\u3001\u307b\u304b\u306e\u65b9\u6cd5\u3067\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u691c\u7d22\u30d5\u30a3\u30eb\u30bf\u306b\u306f\u542b\u3081\u306a\u3044\u3067\u304f\u3060\u3055\u3044
MILD_ERR_FIRSTCHANGENUMBER_VATTR_NOT_SEARCHABLE_625=%s \u5c5e\u6027\u306f\u691c\u7d22\u53ef\u80fd\u3067\u306a\u3044\u305f\u3081\u3001\u307b\u304b\u306e\u65b9\u6cd5\u3067\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u691c\u7d22\u30d5\u30a3\u30eb\u30bf\u306b\u306f\u542b\u3081\u306a\u3044\u3067\u304f\u3060\u3055\u3044
MILD_ERR_LASTCHANGENUMBER_VATTR_NOT_SEARCHABLE_626=%s \u5c5e\u6027\u306f\u691c\u7d22\u53ef\u80fd\u3067\u306a\u3044\u305f\u3081\u3001\u307b\u304b\u306e\u65b9\u6cd5\u3067\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u691c\u7d22\u30d5\u30a3\u30eb\u30bf\u306b\u306f\u542b\u3081\u306a\u3044\u3067\u304f\u3060\u3055\u3044
MILD_ERR_LASTCOOKIE_VATTR_NOT_SEARCHABLE_627=%s \u5c5e\u6027\u306f\u691c\u7d22\u53ef\u80fd\u3067\u306a\u3044\u305f\u3081\u3001\u307b\u304b\u306e\u65b9\u6cd5\u3067\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u691c\u7d22\u30d5\u30a3\u30eb\u30bf\u306b\u306f\u542b\u3081\u306a\u3044\u3067\u304f\u3060\u3055\u3044
MILD_ERR_CHANGELOGBASEDN_VATTR_NOT_SEARCHABLE_628=%s \u5c5e\u6027\u306f\u691c\u7d22\u53ef\u80fd\u3067\u306a\u3044\u305f\u3081\u3001\u307b\u304b\u306e\u65b9\u6cd5\u3067\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u691c\u7d22\u30d5\u30a3\u30eb\u30bf\u306b\u306f\u542b\u3081\u306a\u3044\u3067\u304f\u3060\u3055\u3044
opends/src/messages/messages/extension_ko.properties
@@ -521,3 +521,9 @@
SEVERE_ERR_FCM_ATTR_UNINDEXED_567=\uad6c\uc131 \ud56d\ubaa9 %1$s\uc5d0 \uc815\uc758\ub41c \uc9c0\ubb38 \uc778\uc99d\uc11c \ub9e4\ud37c\uac00 \ubc31\uc5d4\ub4dc %3$s\uc5d0 \ub3d9\uc77c \uc0c9\uc778\uc774 \uc815\uc758\ub418\uc5b4 \uc788\uc9c0 \uc54a\uc740 \uc18d\uc131 \uc720\ud615 %2$s\uc744(\ub97c) \ucc38\uc870\ud569\ub2c8\ub2e4.
SEVERE_WARN_SATUACM_ATTR_UNINDEXED_568=\uad6c\uc131 \ud56d\ubaa9 %1$s\uc5d0 \uc815\uc758\ub41c \uc8fc\uc81c \uc18d\uc131-\uc0ac\uc6a9\uc790 \uc18d\uc131 \uc778\uc99d\uc11c \ub9e4\ud37c\uac00 \ubc31\uc5d4\ub4dc %3$s\uc5d0 \ub3d9\uc77c \uc0c9\uc778\uc774 \uc815\uc758\ub418\uc5b4 \uc788\uc9c0 \uc54a\uc740 \uc18d\uc131 \uc720\ud615 %2$s\uc744(\ub97c) \ucc38\uc870\ud569\ub2c8\ub2e4.
SEVERE_ERR_SDTUACM_ATTR_UNINDEXED_569=\uad6c\uc131 \ud56d\ubaa9 %1$s\uc5d0 \uc815\uc758\ub41c \uc8fc\uc81c DN-\uc0ac\uc6a9\uc790 \uc18d\uc131 \uc778\uc99d\uc11c \ub9e4\ud37c\uac00 \ubc31\uc5d4\ub4dc %3$s\uc5d0 \ub3d9\uc77c \uc0c9\uc778\uc774 \uc815\uc758\ub418\uc5b4 \uc788\uc9c0 \uc54a\uc740 \uc18d\uc131 \uc720\ud615 %2$s\uc744(\ub97c) \ucc38\uc870\ud569\ub2c8\ub2e4.
MILD_ERR_COLLECTIVEATTRIBUTESUBENTRIES_VATTR_NOT_SEARCHABLE_576=%s \uc18d\uc131\uc740 \uac80\uc0c9\ud560 \uc218 \uc5c6\uc73c\uba70 \uc0c9\uc778\ud654\ub418\uc9c0 \uc54a\uc740 \uac80\uc0c9 \ud544\ud130\uc5d0 \ud3ec\ud568\ub418\uc5b4\uc11c\ub294 \uc548 \ub429\ub2c8\ub2e4.
MILD_ERR_PASSWORDPOLICYSUBENTRY_VATTR_NOT_SEARCHABLE_577=%s \uc18d\uc131\uc740 \uac80\uc0c9\ud560 \uc218 \uc5c6\uc73c\uba70 \uc0c9\uc778\ud654\ub418\uc9c0 \uc54a\uc740 \uac80\uc0c9 \ud544\ud130\uc5d0 \ud3ec\ud568\ub418\uc5b4\uc11c\ub294 \uc548 \ub429\ub2c8\ub2e4.
MILD_ERR_FIRSTCHANGENUMBER_VATTR_NOT_SEARCHABLE_625=%s \uc18d\uc131\uc740 \uac80\uc0c9\ud560 \uc218 \uc5c6\uc73c\uba70 \uc0c9\uc778\ud654\ub418\uc9c0 \uc54a\uc740 \uac80\uc0c9 \ud544\ud130\uc5d0 \ud3ec\ud568\ub418\uc5b4\uc11c\ub294 \uc548 \ub429\ub2c8\ub2e4.
MILD_ERR_LASTCHANGENUMBER_VATTR_NOT_SEARCHABLE_626=%s \uc18d\uc131\uc740 \uac80\uc0c9\ud560 \uc218 \uc5c6\uc73c\uba70 \uc0c9\uc778\ud654\ub418\uc9c0 \uc54a\uc740 \uac80\uc0c9 \ud544\ud130\uc5d0 \ud3ec\ud568\ub418\uc5b4\uc11c\ub294 \uc548 \ub429\ub2c8\ub2e4.
MILD_ERR_LASTCOOKIE_VATTR_NOT_SEARCHABLE_627=%s \uc18d\uc131\uc740 \uac80\uc0c9\ud560 \uc218 \uc5c6\uc73c\uba70 \uc0c9\uc778\ud654\ub418\uc9c0 \uc54a\uc740 \uac80\uc0c9 \ud544\ud130\uc5d0 \ud3ec\ud568\ub418\uc5b4\uc11c\ub294 \uc548 \ub429\ub2c8\ub2e4.
MILD_ERR_CHANGELOGBASEDN_VATTR_NOT_SEARCHABLE_628=%s \uc18d\uc131\uc740 \uac80\uc0c9\ud560 \uc218 \uc5c6\uc73c\uba70 \uc0c9\uc778\ud654\ub418\uc9c0 \uc54a\uc740 \uac80\uc0c9 \ud544\ud130\uc5d0 \ud3ec\ud568\ub418\uc5b4\uc11c\ub294 \uc548 \ub429\ub2c8\ub2e4.
opends/src/messages/messages/extension_zh_CN.properties
@@ -529,3 +529,7 @@
INFO_GSSAPI_STOPPED_575=GSSAPI SASL \u673a\u5236\u5904\u7406\u7a0b\u5e8f\u5df2\u505c\u6b62
MILD_ERR_COLLECTIVEATTRIBUTESUBENTRIES_VATTR_NOT_SEARCHABLE_576=\u65e0\u6cd5\u641c\u7d22 %s \u5c5e\u6027\uff0c\u5e76\u4e14\u4e0d\u5e94\u5c06\u5176\u5305\u542b\u5728\u5176\u4ed6\u672a\u7f16\u5165\u7d22\u5f15\u7684\u641c\u7d22\u8fc7\u6ee4\u5668\u4e2d
MILD_ERR_PASSWORDPOLICYSUBENTRY_VATTR_NOT_SEARCHABLE_577=\u65e0\u6cd5\u641c\u7d22 %s \u5c5e\u6027\uff0c\u5e76\u4e14\u4e0d\u5e94\u5c06\u5176\u5305\u542b\u5728\u5176\u4ed6\u672a\u7f16\u5165\u7d22\u5f15\u7684\u641c\u7d22\u8fc7\u6ee4\u5668\u4e2d
MILD_ERR_FIRSTCHANGENUMBER_VATTR_NOT_SEARCHABLE_625=\u65e0\u6cd5\u641c\u7d22 %s \u5c5e\u6027\uff0c\u5e76\u4e14\u4e0d\u5e94\u5c06\u5176\u5305\u542b\u5728\u5176\u4ed6\u672a\u7f16\u5165\u7d22\u5f15\u7684\u641c\u7d22\u8fc7\u6ee4\u5668\u4e2d
MILD_ERR_LASTCHANGENUMBER_VATTR_NOT_SEARCHABLE_626=\u65e0\u6cd5\u641c\u7d22 %s \u5c5e\u6027\uff0c\u5e76\u4e14\u4e0d\u5e94\u5c06\u5176\u5305\u542b\u5728\u5176\u4ed6\u672a\u7f16\u5165\u7d22\u5f15\u7684\u641c\u7d22\u8fc7\u6ee4\u5668\u4e2d
MILD_ERR_LASTCOOKIE_VATTR_NOT_SEARCHABLE_627=\u65e0\u6cd5\u641c\u7d22 %s \u5c5e\u6027\uff0c\u5e76\u4e14\u4e0d\u5e94\u5c06\u5176\u5305\u542b\u5728\u5176\u4ed6\u672a\u7f16\u5165\u7d22\u5f15\u7684\u641c\u7d22\u8fc7\u6ee4\u5668\u4e2d
MILD_ERR_CHANGELOGBASEDN_VATTR_NOT_SEARCHABLE_628=\u65e0\u6cd5\u641c\u7d22 %s \u5c5e\u6027\uff0c\u5e76\u4e14\u4e0d\u5e94\u5c06\u5176\u5305\u542b\u5728\u5176\u4ed6\u672a\u7f16\u5165\u7d22\u5f15\u7684\u641c\u7d22\u8fc7\u6ee4\u5668\u4e2d
opends/src/messages/messages/extension_zh_TW.properties
@@ -521,3 +521,9 @@
SEVERE_ERR_FCM_ATTR_UNINDEXED_567=\u914d\u7f6e\u9805\u76ee %s \u4e2d\u5b9a\u7fa9\u7684\u6307\u7d0b\u6191\u8b49\u5c0d\u6620\u5668\u53c3\u7167\u5c6c\u6027\u985e\u578b %s\uff0c\u800c\u6b64\u5c6c\u6027\u985e\u578b\u6c92\u6709\u5728\u5f8c\u7aef %s \u4e2d\u5b9a\u7fa9\u7684\u76f8\u7b49\u7d22\u5f15
SEVERE_WARN_SATUACM_ATTR_UNINDEXED_568=\u914d\u7f6e\u9805\u76ee %s \u4e2d\u5b9a\u7fa9\u4e4b\u4f7f\u7528\u8005\u5c6c\u6027\u6191\u8b49\u5c0d\u6620\u5668\u7684\u4e3b\u9ad4\u5c6c\u6027\u53c3\u7167\u5c6c\u6027\u985e\u578b %s\uff0c\u800c\u6b64\u5c6c\u6027\u985e\u578b\u6c92\u6709\u5728\u5f8c\u7aef %s \u4e2d\u5b9a\u7fa9\u7684\u76f8\u7b49\u7d22\u5f15
SEVERE_ERR_SDTUACM_ATTR_UNINDEXED_569=\u914d\u7f6e\u9805\u76ee %s \u4e2d\u5b9a\u7fa9\u4e4b\u4f7f\u7528\u8005\u5c6c\u6027\u6191\u8b49\u5c0d\u6620\u5668\u7684\u4e3b\u9ad4 DN \u53c3\u7167\u5c6c\u6027\u985e\u578b %s\uff0c\u800c\u6b64\u5c6c\u6027\u985e\u578b\u6c92\u6709\u5728\u5f8c\u7aef %s \u4e2d\u5b9a\u7fa9\u7684\u76f8\u7b49\u7d22\u5f15
MILD_ERR_COLLECTIVEATTRIBUTESUBENTRIES_VATTR_NOT_SEARCHABLE_576=%s \u5c6c\u6027\u7121\u6cd5\u9032\u884c\u641c\u5c0b\uff0c\u4e14\u4e0d\u8a72\u5305\u542b\u65bc\u672a\u7d22\u5f15\u7684\u641c\u5c0b\u7be9\u9078\u5668\u4e2d
MILD_ERR_PASSWORDPOLICYSUBENTRY_VATTR_NOT_SEARCHABLE_577=%s \u5c6c\u6027\u7121\u6cd5\u9032\u884c\u641c\u5c0b\uff0c\u4e14\u4e0d\u8a72\u5305\u542b\u65bc\u672a\u7d22\u5f15\u7684\u641c\u5c0b\u7be9\u9078\u5668\u4e2d
MILD_ERR_FIRSTCHANGENUMBER_VATTR_NOT_SEARCHABLE_625=%s \u5c6c\u6027\u7121\u6cd5\u9032\u884c\u641c\u5c0b\uff0c\u4e14\u4e0d\u8a72\u5305\u542b\u65bc\u672a\u7d22\u5f15\u7684\u641c\u5c0b\u7be9\u9078\u5668\u4e2d
MILD_ERR_LASTCHANGENUMBER_VATTR_NOT_SEARCHABLE_626=%s \u5c6c\u6027\u7121\u6cd5\u9032\u884c\u641c\u5c0b\uff0c\u4e14\u4e0d\u8a72\u5305\u542b\u65bc\u672a\u7d22\u5f15\u7684\u641c\u5c0b\u7be9\u9078\u5668\u4e2d
MILD_ERR_LASTCOOKIE_VATTR_NOT_SEARCHABLE_627=%s \u5c6c\u6027\u7121\u6cd5\u9032\u884c\u641c\u5c0b\uff0c\u4e14\u4e0d\u8a72\u5305\u542b\u65bc\u672a\u7d22\u5f15\u7684\u641c\u5c0b\u7be9\u9078\u5668\u4e2d
MILD_ERR_CHANGELOGBASEDN_VATTR_NOT_SEARCHABLE_628=%s \u5c6c\u6027\u7121\u6cd5\u9032\u884c\u641c\u5c0b\uff0c\u4e14\u4e0d\u8a72\u5305\u542b\u65bc\u672a\u7d22\u5f15\u7684\u641c\u5c0b\u7be9\u9078\u5668\u4e2d
opends/src/server/org/opends/server/api/VirtualAttributeProvider.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2012 ForgeRock AS
 */
package org.opends.server.api;
import org.opends.messages.Message;
@@ -638,13 +639,14 @@
   *                          attribute.
   * @param  searchOperation  The search operation for which to make
   *                          the determination.
   *
   * @param isPreIndexed     Indicates if we expect the search on the virtual
   *                         attribute to be faster than an index search.
   * @return  {@code true} if this attribute may be included in search
   *          filters, or {@code false} if not.
   */
  public abstract boolean isSearchable(VirtualAttributeRule rule,
                                       SearchOperation
                                            searchOperation);
                                       SearchOperation searchOperation,
                                       boolean isPreIndexed);
opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011 ForgeRock AS
 *      Portions Copyright 2011-2012 ForgeRock AS
 */
package org.opends.server.backends.jeb;
import org.opends.messages.Message;
@@ -890,7 +890,7 @@
  public void search(SearchOperation searchOperation)
  throws DirectoryException, DatabaseException, CanceledOperationException
  {
    DN baseDN = searchOperation.getBaseDN();
    DN aBaseDN = searchOperation.getBaseDN();
    SearchScope searchScope = searchOperation.getScope();
    PagedResultsControl pageRequest = searchOperation
@@ -949,7 +949,7 @@
      Entry baseEntry = null;
      try
      {
        baseEntry = getEntry(baseDN);
        baseEntry = getEntry(aBaseDN);
      }
      catch (Exception e)
      {
@@ -963,10 +963,10 @@
      if (baseEntry == null)
      {
        // Check for referral entries above the base entry.
        dn2uri.targetEntryReferrals(baseDN, searchScope);
        dn2uri.targetEntryReferrals(aBaseDN, searchScope);
        Message message = ERR_JEB_SEARCH_NO_SUCH_OBJECT.get(baseDN.toString());
        DN matchedDN = getMatchedDN(baseDN);
        Message message = ERR_JEB_SEARCH_NO_SUCH_OBJECT.get(aBaseDN.toString());
        DN matchedDN = getMatchedDN(aBaseDN);
        throw new DirectoryException(ResultCode.NO_SUCH_OBJECT,
            message, matchedDN, null);
      }
@@ -1036,6 +1036,16 @@
    if(entryIDList == null)
    {
      // See if we could use a virtual attribute rule to process the search.
      for (VirtualAttributeRule rule : DirectoryServer.getVirtualAttributes())
      {
        if (rule.getProvider().isSearchable(rule, searchOperation, true))
        {
          rule.getProvider().processSearch(rule, searchOperation);
          return;
        }
      }
      // Create an index filter to get the search result candidate entries.
      IndexFilter indexFilter =
        new IndexFilter(this, searchOperation, debugBuffer,
@@ -1049,12 +1059,12 @@
      if (entryIDList.size() > IndexFilter.FILTER_CANDIDATE_THRESHOLD)
      {
        // Read the ID from dn2id.
        EntryID baseID = dn2id.get(null, baseDN, LockMode.DEFAULT);
        EntryID baseID = dn2id.get(null, aBaseDN, LockMode.DEFAULT);
        if (baseID == null)
        {
          Message message =
            ERR_JEB_SEARCH_NO_SUCH_OBJECT.get(baseDN.toString());
          DN matchedDN = getMatchedDN(baseDN);
            ERR_JEB_SEARCH_NO_SUCH_OBJECT.get(aBaseDN.toString());
          DN matchedDN = getMatchedDN(aBaseDN);
          throw new DirectoryException(ResultCode.NO_SUCH_OBJECT,
              message, matchedDN, null);
        }
@@ -1172,7 +1182,7 @@
      // See if we could use a virtual attribute rule to process the search.
      for (VirtualAttributeRule rule : DirectoryServer.getVirtualAttributes())
      {
        if (rule.getProvider().isSearchable(rule, searchOperation))
        if (rule.getProvider().isSearchable(rule, searchOperation, false))
        {
          rule.getProvider().processSearch(rule, searchOperation);
          return;
@@ -1233,7 +1243,7 @@
  throws DirectoryException, CanceledOperationException
  {
    EntryCache<?> entryCache = DirectoryServer.getEntryCache();
    DN baseDN = searchOperation.getBaseDN();
    DN aBaseDN = searchOperation.getBaseDN();
    SearchScope searchScope = searchOperation.getScope();
    boolean manageDsaIT = isManageDsaITOperation(searchOperation);
@@ -1246,7 +1256,7 @@
      Entry baseEntry = null;
      try
      {
        baseEntry = getEntry(baseDN);
        baseEntry = getEntry(aBaseDN);
      }
      catch (Exception e)
      {
@@ -1260,10 +1270,10 @@
      if (baseEntry == null)
      {
        // Check for referral entries above the base entry.
        dn2uri.targetEntryReferrals(baseDN, searchScope);
        dn2uri.targetEntryReferrals(aBaseDN, searchScope);
        Message message = ERR_JEB_SEARCH_NO_SUCH_OBJECT.get(baseDN.toString());
        DN matchedDN = getMatchedDN(baseDN);
        Message message = ERR_JEB_SEARCH_NO_SUCH_OBJECT.get(aBaseDN.toString());
        DN matchedDN = getMatchedDN(aBaseDN);
        throw new DirectoryException(ResultCode.NO_SUCH_OBJECT,
            message, matchedDN, null);
      }
@@ -1309,7 +1319,7 @@
     * "cn=joe,ou=people,dc=example,dc=com" will appear after the entry
     * "ou=people,dc=example,dc=com".
     */
    byte[] baseDNKey = JebFormat.dnToDNKey(baseDN,
    byte[] baseDNKey = JebFormat.dnToDNKey(aBaseDN,
                                             this.baseDN.getNumComponents());
    byte[] suffix = Arrays.copyOf(baseDNKey, baseDNKey.length+1);
    suffix[suffix.length-1] = 0x00;
@@ -1515,7 +1525,7 @@
  {
    EntryCache<?> entryCache = DirectoryServer.getEntryCache();
    SearchScope searchScope = searchOperation.getScope();
    DN baseDN = searchOperation.getBaseDN();
    DN aBaseDN = searchOperation.getBaseDN();
    boolean manageDsaIT = isManageDsaITOperation(searchOperation);
    boolean continueSearch = true;
@@ -1616,15 +1626,15 @@
            {
              // Check if this entry is an immediate child.
              if ((entryDN.getNumComponents() ==
                baseDN.getNumComponents() + 1) &&
                entryDN.isDescendantOf(baseDN))
                aBaseDN.getNumComponents() + 1) &&
                entryDN.isDescendantOf(aBaseDN))
              {
                isInScope = true;
              }
            }
            else if (searchScope == SearchScope.WHOLE_SUBTREE)
            {
              if (entryDN.isDescendantOf(baseDN))
              if (entryDN.isDescendantOf(aBaseDN))
              {
                isInScope = true;
              }
@@ -1632,8 +1642,8 @@
            else if (searchScope == SearchScope.SUBORDINATE_SUBTREE)
            {
              if ((entryDN.getNumComponents() >
              baseDN.getNumComponents()) &&
              entryDN.isDescendantOf(baseDN))
              aBaseDN.getNumComponents()) &&
              entryDN.isDescendantOf(aBaseDN))
              {
                isInScope = true;
              }
@@ -1705,7 +1715,7 @@
      Entry baseEntry = null;
      try
      {
        baseEntry = getEntry(baseDN);
        baseEntry = getEntry(aBaseDN);
      }
      catch (Exception e)
      {
@@ -1719,10 +1729,10 @@
      if (baseEntry == null)
      {
        // Check for referral entries above the base entry.
        dn2uri.targetEntryReferrals(baseDN, searchScope);
        dn2uri.targetEntryReferrals(aBaseDN, searchScope);
        Message message = ERR_JEB_SEARCH_NO_SUCH_OBJECT.get(baseDN.toString());
        DN matchedDN = getMatchedDN(baseDN);
        Message message = ERR_JEB_SEARCH_NO_SUCH_OBJECT.get(aBaseDN.toString());
        DN matchedDN = getMatchedDN(aBaseDN);
        throw new DirectoryException(ResultCode.NO_SUCH_OBJECT,
            message, matchedDN, null);
      }
opends/src/server/org/opends/server/extensions/CollectiveAttributeSubentriesVirtualAttributeProvider.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011 ForgeRock AS
 *      Portions copyright 2011-2012 ForgeRock AS
 */
package org.opends.server.extensions;
@@ -152,7 +152,8 @@
   */
  @Override()
  public boolean isSearchable(VirtualAttributeRule rule,
                              SearchOperation searchOperation)
                              SearchOperation searchOperation,
                              boolean isPreIndexed)
  {
    return false;
  }
opends/src/server/org/opends/server/extensions/EntityTagVirtualAttributeProvider.java
@@ -7,14 +7,14 @@
 * 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.
 * trunk/opends/resource/legal-notices/CDDLv1_0.txt
 * or http://forgerock.org/license/CDDLv1.0.html.
 * 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,
 * trunk/opends/resource/legal-notices/CDDLv1_0.txt.  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]
@@ -216,11 +216,12 @@
  /**
   * {@inheritDoc}.
   * {@inheritDoc}
   */
  @Override()
  public boolean isSearchable(final VirtualAttributeRule rule,
      final SearchOperation searchOperation)
                              final SearchOperation searchOperation,
                              final boolean isPreIndexed)
  {
    // ETags cannot be searched since there is no way to determine which entry
    // is associated with a particular ETag.
opends/src/server/org/opends/server/extensions/EntryDNVirtualAttributeProvider.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2012 ForgeRock AS
 */
package org.opends.server.extensions;
@@ -235,10 +236,12 @@
   *   <LI>It is an OR filter in which all of the components are equality
   *       filters targeting the associated attribute type.</LI>
   * </UL>
   * This virtual attribute also can be optimized as pre-indexed.
   */
  @Override()
  public boolean isSearchable(VirtualAttributeRule rule,
                              SearchOperation searchOperation)
                              SearchOperation searchOperation,
                              boolean isPreIndexed)
  {
    return isSearchable(rule.getAttributeType(), searchOperation.getFilter(),
                        0);
opends/src/server/org/opends/server/extensions/EntryUUIDVirtualAttributeProvider.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2012 ForgeRock AS
 */
package org.opends.server.extensions;
@@ -218,20 +219,12 @@
  /**
   * {@inheritDoc}.  This virtual attribute will support search operations only
   * if one of the following is true about the search filter:
   * <UL>
   *   <LI>It is an equality filter targeting the associated attribute
   *       type.</LI>
   *   <LI>It is an AND filter in which at least one of the components is an
   *       equality filter targeting the associated attribute type.</LI>
   *   <LI>It is an OR filter in which all of the components are equality
   *       filters targeting the associated attribute type.</LI>
   * </UL>
   * {@inheritDoc}
   */
  @Override()
  public boolean isSearchable(VirtualAttributeRule rule,
                              SearchOperation searchOperation)
                              SearchOperation searchOperation,
                              boolean isPreIndexed)
  {
    return false;
  }
opends/src/server/org/opends/server/extensions/GoverningStructureRuleVirtualAttributeProvider.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions Copyright 2012 ForgeRock AS
 */
package org.opends.server.extensions;
@@ -181,22 +182,14 @@
  /**
   * {@inheritDoc}.  This virtual attribute will support search operations only
   * if one of the following is true about the search filter:
   * <UL>
   *   <LI>It is an equality filter targeting the associated attribute
   *       type.</LI>
   *   <LI>It is an AND filter in which at least one of the components is an
   *       equality filter targeting the associated attribute type.</LI>
   *   <LI>It is an OR filter in which all of the components are equality
   *       filters targeting the associated attribute type.</LI>
   * </UL>
   * {@inheritDoc}
   */
  @Override()
  public boolean isSearchable(VirtualAttributeRule rule,
                              SearchOperation searchOperation)
                              SearchOperation searchOperation,
                              boolean isPreIndexed)
  {
    //Non-searchable for unindexed searches.
    //Non-searchable.
    return false;
  }
opends/src/server/org/opends/server/extensions/HasSubordinatesVirtualAttributeProvider.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2012 ForgeRock AS
 */
package org.opends.server.extensions;
@@ -247,20 +248,12 @@
  /**
   * {@inheritDoc}.  This virtual attribute will support search operations only
   * if one of the following is true about the search filter:
   * <UL>
   *   <LI>It is an equality filter targeting the associated attribute
   *       type.</LI>
   *   <LI>It is an AND filter in which at least one of the components is an
   *       equality filter targeting the associated attribute type.</LI>
   *   <LI>It is an OR filter in which all of the components are equality
   *       filters targeting the associated attribute type.</LI>
   * </UL>
   * {@inheritDoc}
   */
  @Override()
  public boolean isSearchable(VirtualAttributeRule rule,
                              SearchOperation searchOperation)
                              SearchOperation searchOperation,
                              boolean isPreIndexed)
  {
    return false;
  }
opends/src/server/org/opends/server/extensions/IsMemberOfVirtualAttributeProvider.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Portions copyright 2011 ForgeRock AS
 *      Portions copyright 2011-2012 ForgeRock AS
 */
package org.opends.server.extensions;
@@ -304,11 +304,18 @@
   *   <LI>It is an AND filter in which at least one of the components is an
   *       equality filter targeting the associated attribute type.</LI>
   * </UL>
   * Searching for this virtual attribute cannot be pre-indexed and thus,
   * it should not be searchable when pre-indexed is required.
   */
  @Override()
  public boolean isSearchable(VirtualAttributeRule rule,
                              SearchOperation searchOperation)
                              SearchOperation searchOperation,
                              boolean isPreIndexed)
  {
    if (isPreIndexed)
    {
      return false;
    }
    return isSearchable(rule.getAttributeType(), searchOperation.getFilter(),
                        0);
  }
opends/src/server/org/opends/server/extensions/MemberVirtualAttributeProvider.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Portions copyright 2011 ForgeRock AS
 *      Portions copyright 2011-2012 ForgeRock AS
 */
package org.opends.server.extensions;
import org.opends.messages.Message;
@@ -334,11 +334,12 @@
  /**
   * {@inheritDoc}.
   * {@inheritDoc}
   */
  @Override()
  public boolean isSearchable(VirtualAttributeRule rule,
                              SearchOperation searchOperation)
                              SearchOperation searchOperation,
                              boolean isPreIndexed)
  {
    return false;
  }
opends/src/server/org/opends/server/extensions/NumSubordinatesVirtualAttributeProvider.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2012 ForgeRock AS
 */
package org.opends.server.extensions;
@@ -219,20 +220,12 @@
  /**
   * {@inheritDoc}.  This virtual attribute will support search operations only
   * if one of the following is true about the search filter:
   * <UL>
   *   <LI>It is an equality filter targeting the associated attribute
   *       type.</LI>
   *   <LI>It is an AND filter in which at least one of the components is an
   *       equality filter targeting the associated attribute type.</LI>
   *   <LI>It is an OR filter in which all of the components are equality
   *       filters targeting the associated attribute type.</LI>
   * </UL>
   * {@inheritDoc}
   */
  @Override()
  public boolean isSearchable(VirtualAttributeRule rule,
                              SearchOperation searchOperation)
                              SearchOperation searchOperation,
                              boolean isPreIndexed)
  {
    return false;
  }
opends/src/server/org/opends/server/extensions/PasswordExpirationTimeVirtualAttributeProvider.java
@@ -14,7 +14,7 @@
 *
 * 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,
 * trunk/opends/resource/legal-notices/CDDLv1_0.txt.  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]
@@ -119,7 +119,8 @@
   */
  @Override
  public boolean isSearchable(VirtualAttributeRule rule,
                              SearchOperation searchOperation)
                              SearchOperation searchOperation,
                              boolean isPreIndexed)
  {
    return false;
  }
opends/src/server/org/opends/server/extensions/PasswordPolicySubentryVirtualAttributeProvider.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions copyright 2011 ForgeRock AS.
 *      Portions copyright 2011-2012 ForgeRock AS.
 */
package org.opends.server.extensions;
@@ -170,7 +170,8 @@
   */
  @Override()
  public boolean isSearchable(VirtualAttributeRule rule,
                              SearchOperation searchOperation)
                              SearchOperation searchOperation,
                              boolean isPreIndexed)
  {
    return false;
  }
opends/src/server/org/opends/server/extensions/StructuralObjectClassVirtualAttributeProvider.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions Copyright 2012 ForgeRock AS
 */
package org.opends.server.extensions;
@@ -175,20 +176,12 @@
  /**
   * {@inheritDoc}.  This virtual attribute will support search operations only
   * if one of the following is true about the search filter:
   * <UL>
   *   <LI>It is an equality filter targeting the associated attribute
   *       type.</LI>
   *   <LI>It is an AND filter in which at least one of the components is an
   *       equality filter targeting the associated attribute type.</LI>
   *   <LI>It is an OR filter in which all of the components are equality
   *       filters targeting the associated attribute type.</LI>
   * </UL>
   * {@inheritDoc}
   */
  @Override()
  public boolean isSearchable(VirtualAttributeRule rule,
                              SearchOperation searchOperation)
                              SearchOperation searchOperation,
                              boolean isPreIndexed)
  {
    // This attribute is not searchable, since it will have the same value in
    // tons of entries.
opends/src/server/org/opends/server/extensions/SubschemaSubentryVirtualAttributeProvider.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2012 ForgeRock AS
 */
package org.opends.server.extensions;
@@ -168,20 +169,12 @@
  /**
   * {@inheritDoc}.  This virtual attribute will support search operations only
   * if one of the following is true about the search filter:
   * <UL>
   *   <LI>It is an equality filter targeting the associated attribute
   *       type.</LI>
   *   <LI>It is an AND filter in which at least one of the components is an
   *       equality filter targeting the associated attribute type.</LI>
   *   <LI>It is an OR filter in which all of the components are equality
   *       filters targeting the associated attribute type.</LI>
   * </UL>
   * {@inheritDoc}
   */
  @Override()
  public boolean isSearchable(VirtualAttributeRule rule,
                              SearchOperation searchOperation)
                              SearchOperation searchOperation,
                              boolean isPreIndexed)
  {
    // This attribute is not searchable, since it will have the same value in
    // tons of entries.
opends/src/server/org/opends/server/extensions/UserDefinedVirtualAttributeProvider.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2012 ForgeRock AS
 */
package org.opends.server.extensions;
import org.opends.messages.Message;
@@ -150,7 +151,8 @@
   */
  @Override()
  public boolean isSearchable(VirtualAttributeRule rule,
                              SearchOperation searchOperation)
                              SearchOperation searchOperation,
                              boolean isPreIndexed)
  {
    // We will not allow searches based only on user-defined virtual attributes.
    return false;
opends/src/server/org/opends/server/replication/common/ChangelogBaseDNVirtualAttributeProvider.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions Copyright 2011 ForgeRock AS
 *      Portions Copyright 2011-2012 ForgeRock AS
 */
package org.opends.server.replication.common;
@@ -31,6 +31,7 @@
import java.util.List;
import java.util.Set;
import static org.opends.messages.ExtensionMessages.*;
import org.opends.messages.Message;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.std.server.UserDefinedVirtualAttributeCfg;
@@ -133,9 +134,10 @@
   */
  @Override()
  public boolean isSearchable(VirtualAttributeRule rule,
                              SearchOperation searchOperation)
                              SearchOperation searchOperation,
                              boolean isPreIndexed)
  {
    // We will not allow searches based only on user-defined virtual attributes.
    // We do not allow search as it may be present is too many entries.
    return false;
  }
@@ -149,7 +151,9 @@
                            SearchOperation searchOperation)
  {
    searchOperation.setResultCode(ResultCode.UNWILLING_TO_PERFORM);
    return;
    final Message message = ERR_CHANGELOGBASEDN_VATTR_NOT_SEARCHABLE.get(
            rule.getAttributeType().getNameOrOID());
    searchOperation.appendErrorMessage(message);
  }
opends/src/server/org/opends/server/replication/common/FirstChangeNumberVirtualAttributeProvider.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions Copyright 2011 ForgeRock AS
 *      Portions Copyright 2011-2012 ForgeRock AS
 */
package org.opends.server.replication.common;
@@ -34,6 +34,7 @@
import java.util.List;
import java.util.Set;
import static org.opends.messages.ExtensionMessages.*;
import org.opends.messages.Message;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.std.server.UserDefinedVirtualAttributeCfg;
@@ -182,9 +183,11 @@
   */
  @Override()
  public boolean isSearchable(VirtualAttributeRule rule,
                              SearchOperation searchOperation)
                              SearchOperation searchOperation,
                              boolean isPreIndexed)
  {
    // We will not allow searches based only on user-defined virtual attributes.
    // We do not allow search for the firstChangeNumber. It's a read-only
    // attribute of the RootDSE.
    return false;
  }
@@ -198,7 +201,9 @@
                            SearchOperation searchOperation)
  {
    searchOperation.setResultCode(ResultCode.UNWILLING_TO_PERFORM);
    return;
    final Message message = ERR_FIRSTCHANGENUMBER_VATTR_NOT_SEARCHABLE.get(
            rule.getAttributeType().getNameOrOID());
    searchOperation.appendErrorMessage(message);
  }
opends/src/server/org/opends/server/replication/common/LastChangeNumberVirtualAttributeProvider.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions Copyright 2011 ForgeRock AS
 *      Portions Copyright 2011-2012 ForgeRock AS
 */
package org.opends.server.replication.common;
@@ -34,6 +34,7 @@
import java.util.List;
import java.util.Set;
import static org.opends.messages.ExtensionMessages.*;
import org.opends.messages.Message;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.std.server.UserDefinedVirtualAttributeCfg;
@@ -181,9 +182,11 @@
   */
  @Override()
  public boolean isSearchable(VirtualAttributeRule rule,
                              SearchOperation searchOperation)
                              SearchOperation searchOperation,
                              boolean isPreIndexed)
  {
    // We will not allow searches based only on user-defined virtual attributes.
    // We do not allow search for the lastChangeNumber. It's a read-only
    // attribute of the RootDSE.
    return false;
  }
@@ -197,7 +200,9 @@
                            SearchOperation searchOperation)
  {
    searchOperation.setResultCode(ResultCode.UNWILLING_TO_PERFORM);
    return;
    final Message message = ERR_LASTCHANGENUMBER_VATTR_NOT_SEARCHABLE.get(
            rule.getAttributeType().getNameOrOID());
    searchOperation.appendErrorMessage(message);
  }
opends/src/server/org/opends/server/replication/common/LastCookieVirtualProvider.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions Copyright 2011 ForgeRock AS
 *      Portions Copyright 2011-2012 ForgeRock AS
 */
package org.opends.server.replication.common;
@@ -34,6 +34,7 @@
import java.util.List;
import java.util.Set;
import static org.opends.messages.ExtensionMessages.*;
import org.opends.messages.Message;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.std.server.UserDefinedVirtualAttributeCfg;
@@ -164,9 +165,11 @@
   */
  @Override()
  public boolean isSearchable(VirtualAttributeRule rule,
                              SearchOperation searchOperation)
                              SearchOperation searchOperation,
                              boolean isPreIndexed)
  {
    // We will not allow searches based only on user-defined virtual attributes.
    // We do not allow search for the lastCookie. It's a read-only
    // attribute of the RootDSE.
    return false;
  }
@@ -180,7 +183,9 @@
                            SearchOperation searchOperation)
  {
    searchOperation.setResultCode(ResultCode.UNWILLING_TO_PERFORM);
    return;
    final Message message = ERR_LASTCOOKIE_VATTR_NOT_SEARCHABLE.get(
            rule.getAttributeType().getNameOrOID());
    searchOperation.appendErrorMessage(message);
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/EntityTagVirtualAttributeProviderTestCase.java
@@ -470,7 +470,8 @@
  @Test
  public void testIsSearchable()
  {
    assertFalse(provider.isSearchable(null, null));
    assertFalse(provider.isSearchable(null, null, false));
    assertFalse(provider.isSearchable(null, null, true));
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2011 ForgeRock AS
 *      Portions Copyright 2011-2012 ForgeRock AS
 */
package org.opends.server.extensions;
@@ -1025,8 +1025,11 @@
                                     SearchScope.WHOLE_SUBTREE,
                                     DereferencePolicy.NEVER_DEREF_ALIASES, 0,
                                     0, false, filter, null, null);
    assertEquals(provider.isSearchable(rule, searchOperation), isSearchable);
    // This attribute is searchable for either pre-indexed or not
    assertEquals(provider.isSearchable(rule, searchOperation, false),
                 isSearchable);
    assertEquals(provider.isSearchable(rule, searchOperation, true),
                 isSearchable);
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2011 ForgeRock AS
 *      Portions Copyright 2011-2012 ForgeRock AS
 */
package org.opends.server.extensions;
@@ -1127,7 +1127,11 @@
                                     DereferencePolicy.NEVER_DEREF_ALIASES, 0,
                                     0, false, filter, null, null);
    assertEquals(provider.isSearchable(rule, new LocalBackendSearchOperation(searchOperation)), isSearchable);
    assertEquals(provider.isSearchable(rule,
        new LocalBackendSearchOperation(searchOperation), false), isSearchable);
    // isMemberOf is not searchable with preIndexed set to true
    assertEquals(provider.isSearchable(rule,
        new LocalBackendSearchOperation(searchOperation), true), false);
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/UserDefinedVirtualAttributeProviderTestCase.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2012 ForgeRock AS
 */
package org.opends.server.extensions;
@@ -134,7 +135,8 @@
              (UserDefinedVirtualAttributeProvider) rule.getProvider();
          assertFalse(provider.isMultiValued());
          assertFalse(provider.isSearchable(rule, searchOperation));
          assertFalse(provider.isSearchable(rule, searchOperation, false));
          assertFalse(provider.isSearchable(rule, searchOperation, true));
          provider.processSearch(rule, searchOperation);
          assertEquals(searchOperation.getResultCode(),
@@ -201,7 +203,8 @@
              (UserDefinedVirtualAttributeProvider) rule.getProvider();
          assertTrue(provider.isMultiValued());
          assertFalse(provider.isSearchable(rule, searchOperation));
          assertFalse(provider.isSearchable(rule, searchOperation, false));
          assertFalse(provider.isSearchable(rule, searchOperation, true));
          provider.processSearch(rule, searchOperation);
          assertEquals(searchOperation.getResultCode(),
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/VirtualStaticGroupTestCase.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2012 ForgeRock AS
 */
package org.opends.server.extensions;
@@ -669,7 +670,8 @@
                  SearchFilter.createFilterFromString(
                       "(member=" + u1.toString() + ")"),
                  null, null);
    assertFalse(provider.isSearchable(rule, searchOperation));
    assertFalse(provider.isSearchable(rule, searchOperation, false));
    assertFalse(provider.isSearchable(rule, searchOperation, true));
    provider.processSearch(rule, searchOperation);
    assertFalse(searchOperation.getResultCode() == ResultCode.SUCCESS);
@@ -743,7 +745,8 @@
                  SearchFilter.createFilterFromString(
                       "(member=" + u1.toString() + ")"),
                  null, null);
    assertFalse(provider.isSearchable(rule, searchOperation));
    assertFalse(provider.isSearchable(rule, searchOperation, false));
    assertFalse(provider.isSearchable(rule, searchOperation, false));
    provider.processSearch(rule, searchOperation);
    assertFalse(searchOperation.getResultCode() == ResultCode.SUCCESS);
opends/tests/unit-tests-testng/src/server/org/opends/server/types/TestDN.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2012 ForgeRock AS
 */
package org.opends.server.types;
@@ -149,7 +150,9 @@
        { "cn=#a" }, { "cn=#ag" }, { "cn=#ga" }, { "cn=#abcdefgh" },
        { "cn=a\\b" }, { "cn=a\\bg" }, { "cn=\"hello" },
        {"cn=+mail=,dc=example,dc=com"},{"cn=xyz+sn=,dc=example,dc=com"},
        {"cn=,dc=example,dc=com"}};
        {"cn=,dc=example,dc=com"},
//        {"cn=a+cn=b,dc=example,dc=com"}
    };
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/types/TestLDAPURL.java
New file
@@ -0,0 +1,188 @@
/*
 * 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/CDDLv1_0.txt
 * or http://forgerock.org/license/CDDLv1.0.html.
 * 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 2012 ForgeRock AS
 */
package org.opends.server.types;
import static org.testng.Assert.*;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
import org.opends.server.util.Platform;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
public class TestLDAPURL extends TypesTestCase {
  /**
   * Set up the environment for performing the tests in this suite.
   *
   * @throws Exception
   *           If the environment could not be set up.
   */
  @BeforeClass
  public void setUp() throws Exception {
    // This test suite depends on having the schema available, so
    // we'll start the server.
    TestCaseUtils.startServer();
  }
  /**
   * Valid URLs test data provider.
   *
   * @return The array of valid test URL strings.
   */
  @DataProvider(name = "validURLs")
  public Object[][] createValidData() {
    return new Object[][] {
      { "ldap:///", "ldap:///", "ldap:///??base?(objectClass=*)" },
      { "http:///", "http:///", "http:///??base?(objectClass=*)" },
      { "ldap://host:389/", "ldap://host:389/",
        "ldap://host:389/??base?(objectClass=*)" },
      { "ldap://192.168.0.1/", "ldap://192.168.0.1:389/",
        "ldap://192.168.0.1:389/??base?(objectClass=*)" },
      { "ldap://192.168.0.2:1389/", "ldap://192.168.0.2:1389/",
        "ldap://192.168.0.2:1389/??base?(objectClass=*)" },
      // URLs with a baseDN
      { "ldap://host:389/cn=Foo,dc=example,dc=com",
        "ldap://host:389/cn=Foo,dc=example,dc=com",
        "ldap://host:389/cn=Foo,dc=example,dc=com??base?(objectClass=*)" },
      { "ldap:///cn=a,dc=example,dc=com", "ldap:///cn=a,dc=example,dc=com",
        "ldap:///cn=a,dc=example,dc=com??base?(objectClass=*)" },
      { "ldap:///cn=a\"a,dc=example,dc=com", "ldap:///cn=a%5C%22a,dc=example,dc=com",
        "ldap:///cn=a%5C%22a,dc=example,dc=com??base?(objectClass=*)" },
      { "ldap://localhost/cn=Foo,dc=a.com", "ldap://localhost:389/cn=Foo,dc=a.com",
        "ldap://localhost:389/cn=Foo,dc=a.com??base?(objectClass=*)" },
      { "ldap://host:1389/cn=Foo,dc=b.com?", "ldap://host:1389/cn=Foo,dc=b.com",
        "ldap://host:1389/cn=Foo,dc=b.com??base?(objectClass=*)" },
      // URLs with some attribute lists
      { "ldap://host:1389/cn=Foo,dc=b.com?,", "ldap://host:1389/cn=Foo,dc=b.com",
        "ldap://host:1389/cn=Foo,dc=b.com??base?(objectClass=*)" },
      { "ldap://host:1389/cn=Foo,dc=b.com?,,,?", "ldap://host:1389/cn=Foo,dc=b.com",
        "ldap://host:1389/cn=Foo,dc=b.com??base?(objectClass=*)" },
      { "ldap://host:1389/cn=Foo,dc=b.com?cn,sn", "ldap://host:1389/cn=Foo,dc=b.com",
        "ldap://host:1389/cn=Foo,dc=b.com?cn,sn?base?(objectClass=*)" },
      { "ldap://host:1389/cn=Foo,dc=b.com?sn,cn", "ldap://host:1389/cn=Foo,dc=b.com",
        "ldap://host:1389/cn=Foo,dc=b.com?sn,cn?base?(objectClass=*)" },
      { "ldap://host:1389/?cn", "ldap://host:1389/",
        "ldap://host:1389/?cn?base?(objectClass=*)" },
      // URLs with scope
      { "ldap://host:1389/cn=Foo,dc=b.com??", "ldap://host:1389/cn=Foo,dc=b.com",
        "ldap://host:1389/cn=Foo,dc=b.com??base?(objectClass=*)" },
      { "ldap://host:1389/cn=Foo,dc=b.com???", "ldap://host:1389/cn=Foo,dc=b.com",
        "ldap://host:1389/cn=Foo,dc=b.com??base?(objectClass=*)" },
      { "ldap://host:1389/cn=Foo,dc=b.com??base", "ldap://host:1389/cn=Foo,dc=b.com",
        "ldap://host:1389/cn=Foo,dc=b.com??base?(objectClass=*)" },
      { "ldap://host:1389/cn=Foo,dc=b.com??base?", "ldap://host:1389/cn=Foo,dc=b.com",
        "ldap://host:1389/cn=Foo,dc=b.com??base?(objectClass=*)" },
      { "ldap://host:1389/cn=Foo,dc=b.com??one", "ldap://host:1389/cn=Foo,dc=b.com",
        "ldap://host:1389/cn=Foo,dc=b.com??one?(objectClass=*)" },
      { "ldap://host:1389/cn=Foo,dc=b.com??sub", "ldap://host:1389/cn=Foo,dc=b.com",
        "ldap://host:1389/cn=Foo,dc=b.com??sub?(objectClass=*)" },
      { "ldap://host:1389/cn=Foo,dc=b.com??subord", "ldap://host:1389/cn=Foo,dc=b.com",
        "ldap://host:1389/cn=Foo,dc=b.com??subordinate?(objectClass=*)" },
      { "ldap://host:1389/cn=Foo,dc=b.com??subordinate", "ldap://host:1389/cn=Foo,dc=b.com",
        "ldap://host:1389/cn=Foo,dc=b.com??subordinate?(objectClass=*)" },
      // URLs with filters
      { "ldap://host:1389/cn=Foo,dc=b.com????", "ldap://host:1389/cn=Foo,dc=b.com",
        "ldap://host:1389/cn=Foo,dc=b.com??base?(objectClass=*)" },
      { "ldap://host:1389/cn=Foo,dc=b.com???(cn=Foo)?", "ldap://host:1389/cn=Foo,dc=b.com",
        "ldap://host:1389/cn=Foo,dc=b.com??base?(cn=Foo)" },
      { "ldap://host:1389/cn=Foo,dc=b.com???(cn=foo)", "ldap://host:1389/cn=Foo,dc=b.com",
        "ldap://host:1389/cn=Foo,dc=b.com??base?(cn=foo)" },
      { "ldap://host:1389/cn=Foo,dc=b.com???uid=user.0?", "ldap://host:1389/cn=Foo,dc=b.com",
        "ldap://host:1389/cn=Foo,dc=b.com??base?(uid=user.0)" },
      // Extensions are always returned, baseOnly or not.
      { "ldap://host:1389/cn=Foo,dc=b.com????x-password", "ldap://host:1389/cn=Foo,dc=b.com????x-password",
        "ldap://host:1389/cn=Foo,dc=b.com??base?(objectClass=*)?x-password" },
      { "ldap://host:1389/cn=Foo,dc=b.com????a,b,c", "ldap://host:1389/cn=Foo,dc=b.com????a,b,c",
        "ldap://host:1389/cn=Foo,dc=b.com??base?(objectClass=*)?a,b,c" },
      { "ldap://host:1389/cn=Foo,dc=b.com????,,,", "ldap://host:1389/cn=Foo,dc=b.com",
        "ldap://host:1389/cn=Foo,dc=b.com??base?(objectClass=*)" },
      // URLs with everything
      { "ldap://myhost.full.com:2389/cn=F oo,dc=full.com?cn,sn,userpassword?one?(cn=foo)?x-nothing",
        "ldap://myhost.full.com:2389/cn=F%20oo,dc=full.com????x-nothing",
        "ldap://myhost.full.com:2389/cn=F%20oo,dc=full.com?cn,sn,userpassword?one?(cn=foo)?x-nothing" },
    };
  }
  @Test(dataProvider = "validURLs")
  public void testDecodeString(String rawURL, String stringURL,
    String fullURL)
      throws Exception
  {
    LDAPURL url = LDAPURL.decode(rawURL, true);
    StringBuilder buffer = new StringBuilder();
    url.toString(buffer, true);
    assertEquals(stringURL, buffer.toString());
  }
  @Test(dataProvider = "validURLs")
  public void testDecodeStringFull(String rawURL, String stringURL,
    String fullURL) throws Exception
  {
    LDAPURL url = LDAPURL.decode(rawURL, true);
    StringBuilder buffer = new StringBuilder();
    url.toString(buffer, false);
    assertEquals(fullURL, buffer.toString());
  }
    /**
   * Illegal URLs test data provider.
   *
   * @return The array of illegal test URk strings.
   */
  @DataProvider(name = "illegalURLs")
  public Object[][] createIllegalData() {
    return new Object[][] { { "http:" }, { "://" }, { "ldap://:389" },
      { "ldap://localhost:"}, { "ldap://1.2.3.4:" }, { "ldap://host:-1" },
      { "ldap://host:65536" }, { "ldap://host:ldap" }, { "ldap://host:389:/" },
     // { "ldap://host:389/c=a\"a" },
      { "ldap://host:389/cn=a,a" },
      { "ldap://host:1389/cn=Foo,dc=b.com??suberror" },
      { "ldap://host:1389/cn=Foo,dc=b.com???(invalidFilter)" },
      { "ldap://host:1389/cn=Foo,dc=b.com???(&(cn=Foo)(cn=Bar" },
    };
  }
  /**
   * Test LDAPUrl string decoder against illegal strings.
   *
   * @param rawURL
   *          Illegal URL string representation.
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test(dataProvider = "illegalURLs", expectedExceptions = DirectoryException.class)
  public void testDecodeString(String rawURL) throws Exception
  {
    LDAPURL.decode(rawURL, true);
    fail("Expected exception for value \"" + rawURL + "\"");
  }
}