opends/src/server/org/opends/server/api/Backend.java
@@ -38,8 +38,6 @@ import org.opends.server.monitors.BackendMonitor; import org.opends.server.types.*; import static org.opends.messages.BackendMessages.*; /** * This class defines the set of methods and structures that must be * implemented for a Directory Server backend. @@ -65,7 +63,7 @@ * The set of backends that hold portions of the DIT that are hierarchically * below the information in this backend. */ private Backend<?>[] subordinateBackends; private Backend<?>[] subordinateBackends = new Backend[0]; /** The backend monitor associated with this backend. */ private BackendMonitor backendMonitor; @@ -79,26 +77,7 @@ private String backendID; /** The writability mode for this backend. */ private WritabilityMode writabilityMode; /** * Creates a new backend with the provided information. All backend * implementations must implement a default constructor that use * {@code super} to invoke this constructor. */ protected Backend() { backendID = null; parentBackend = null; subordinateBackends = new Backend[0]; isPrivateBackend = false; writabilityMode = WritabilityMode.ENABLED; backendMonitor = null; } private WritabilityMode writabilityMode = WritabilityMode.ENABLED; /** * Configure this backend based on the information in the provided @@ -267,10 +246,10 @@ * matching rule should be considered indexed, or * {@code false} if not. */ public boolean isIndexed(AttributeType attributeType, private boolean isIndexed(AttributeType attributeType, MatchingRule matchingRule) { return false; return false; // FIXME This should be overridden by the JE Backend at least! } @@ -321,36 +300,23 @@ // NOT filters are not considered indexed by default. return false; case EQUALITY: return isIndexed(filter.getAttributeType(), IndexType.EQUALITY); return isIndexed(filter.getAttributeType(), IndexType.EQUALITY); case SUBSTRING: return isIndexed(filter.getAttributeType(), IndexType.SUBSTRING); return isIndexed(filter.getAttributeType(), IndexType.SUBSTRING); case GREATER_OR_EQUAL: return isIndexed(filter.getAttributeType(), IndexType.GREATER_OR_EQUAL); return isIndexed(filter.getAttributeType(), IndexType.GREATER_OR_EQUAL); case LESS_OR_EQUAL: return isIndexed(filter.getAttributeType(), IndexType.LESS_OR_EQUAL); return isIndexed(filter.getAttributeType(), IndexType.LESS_OR_EQUAL); case PRESENT: return isIndexed(filter.getAttributeType(), IndexType.PRESENCE); return isIndexed(filter.getAttributeType(), IndexType.PRESENCE); case APPROXIMATE_MATCH: return isIndexed(filter.getAttributeType(), IndexType.APPROXIMATE); return isIndexed(filter.getAttributeType(), IndexType.APPROXIMATE); case EXTENSIBLE_MATCH: // The attribute type must be provided for us to make the @@ -374,6 +340,7 @@ { matchingRule = attrType.getEqualityMatchingRule(); } // FIXME isIndexed() always return false down below return matchingRule != null && isIndexed(attrType, matchingRule); @@ -874,8 +841,6 @@ return writabilityMode; } /** * Specifies the writability mode for this backend. * @@ -884,14 +849,8 @@ public final void setWritabilityMode( WritabilityMode writabilityMode) { if (writabilityMode == null) { this.writabilityMode = WritabilityMode.ENABLED; } else { this.writabilityMode = writabilityMode; } this.writabilityMode = writabilityMode != null ? writabilityMode : WritabilityMode.ENABLED; } @@ -989,113 +948,6 @@ } } /** * Indicates whether this backend has a subordinate backend * registered with the provided base DN. This may check recursively * if a subordinate backend has its own subordinate backends. * * @param subSuffixDN The DN of the sub-suffix for which to make * the determination. * * @return {@code true} if this backend has a subordinate backend * registered with the provided base DN, or {@code false} * if it does not. */ public final boolean hasSubSuffix(DN subSuffixDN) { for (Backend<?> b : subordinateBackends) { for (DN baseDN : b.getBaseDNs()) { if (baseDN.equals(subSuffixDN)) { return true; } } if (b.hasSubSuffix(subSuffixDN)) { return true; } } return false; } /** * Removes the backend associated with the specified sub-suffix if * it is registered. This may check recursively if a subordinate * backend has its own subordinate backends. * * @param subSuffixDN The DN of the sub-suffix to remove from this * backend. * @param parentDN The superior DN for the sub-suffix DN that * matches one of the subordinate base DNs for * this backend. * * @throws ConfigException If the sub-suffix exists but it is not * possible to remove it for some reason. */ public final void removeSubSuffix(DN subSuffixDN, DN parentDN) throws ConfigException { synchronized (this) { boolean matchFound = false; ArrayList<Backend<?>> subBackendList = new ArrayList<Backend<?>>(subordinateBackends.length); for (Backend<?> b : subordinateBackends) { boolean thisMatches = false; DN[] subBaseDNs = b.getBaseDNs(); for (DN dn : subBaseDNs) { if (dn.equals(subSuffixDN)) { if (subBaseDNs.length > 1) { Message message = ERR_BACKEND_CANNOT_REMOVE_MULTIBASE_SUB_SUFFIX. get(String.valueOf(subSuffixDN), String.valueOf(parentDN)); throw new ConfigException(message); } thisMatches = true; matchFound = true; break; } } if (! thisMatches) { if (b.hasSubSuffix(subSuffixDN)) { b.removeSubSuffix(subSuffixDN, parentDN); } else { subBackendList.add(b); } } } if (matchFound) { Backend<?>[] newSubordinateBackends = new Backend[subBackendList.size()]; subBackendList.toArray(newSubordinateBackends); subordinateBackends = newSubordinateBackends; } } } /** * Adds the provided backend to the set of subordinate backends for * this backend. opends/src/server/org/opends/server/core/SearchOperation.java
@@ -47,7 +47,7 @@ * @return The raw, unprocessed base DN as included in the request from the * client. */ public abstract ByteString getRawBaseDN(); ByteString getRawBaseDN(); /** * Specifies the raw, unprocessed base DN as included in the request from the @@ -56,7 +56,7 @@ * @param rawBaseDN The raw, unprocessed base DN as included in the request * from the client. */ public abstract void setRawBaseDN(ByteString rawBaseDN); void setRawBaseDN(ByteString rawBaseDN); /** * Retrieves the base DN for this search operation. This should not be called @@ -66,7 +66,7 @@ * @return The base DN for this search operation, or <CODE>null</CODE> if the * raw base DN has not yet been processed. */ public abstract DN getBaseDN(); DN getBaseDN(); /** * Specifies the base DN for this search operation. This method is only @@ -74,14 +74,14 @@ * * @param baseDN The base DN for this search operation. */ public abstract void setBaseDN(DN baseDN); void setBaseDN(DN baseDN); /** * Retrieves the scope for this search operation. * * @return The scope for this search operation. */ public abstract SearchScope getScope(); SearchScope getScope(); /** * Specifies the scope for this search operation. This should only be called @@ -89,14 +89,14 @@ * * @param scope The scope for this search operation. */ public abstract void setScope(SearchScope scope); void setScope(SearchScope scope); /** * Retrieves the alias dereferencing policy for this search operation. * * @return The alias dereferencing policy for this search operation. */ public abstract DereferencePolicy getDerefPolicy(); DereferencePolicy getDerefPolicy(); /** * Specifies the alias dereferencing policy for this search operation. This @@ -105,14 +105,14 @@ * @param derefPolicy The alias dereferencing policy for this search * operation. */ public abstract void setDerefPolicy(DereferencePolicy derefPolicy); void setDerefPolicy(DereferencePolicy derefPolicy); /** * Retrieves the size limit for this search operation. * * @return The size limit for this search operation. */ public abstract int getSizeLimit(); int getSizeLimit(); /** * Specifies the size limit for this search operation. This should only be @@ -120,21 +120,21 @@ * * @param sizeLimit The size limit for this search operation. */ public abstract void setSizeLimit(int sizeLimit); void setSizeLimit(int sizeLimit); /** * Retrieves the time limit for this search operation. * * @return The time limit for this search operation. */ public abstract int getTimeLimit(); int getTimeLimit(); /** * Get the time after which the search time limit has expired. * * @return the timeLimitExpiration */ public abstract long getTimeLimitExpiration(); long getTimeLimitExpiration(); /** * Specifies the time limit for this search operation. This should only be @@ -142,14 +142,14 @@ * * @param timeLimit The time limit for this search operation. */ public abstract void setTimeLimit(int timeLimit); void setTimeLimit(int timeLimit); /** * Retrieves the typesOnly flag for this search operation. * * @return The typesOnly flag for this search operation. */ public abstract boolean getTypesOnly(); boolean getTypesOnly(); /** * Specifies the typesOnly flag for this search operation. This should only @@ -157,7 +157,7 @@ * * @param typesOnly The typesOnly flag for this search operation. */ public abstract void setTypesOnly(boolean typesOnly); void setTypesOnly(boolean typesOnly); /** * Retrieves the raw, unprocessed search filter as included in the request @@ -168,7 +168,7 @@ * @return The raw, unprocessed search filter as included in the request from * the client. */ public abstract RawFilter getRawFilter(); RawFilter getRawFilter(); /** * Specifies the raw, unprocessed search filter as included in the request @@ -177,7 +177,7 @@ * @param rawFilter The raw, unprocessed search filter as included in the * request from the client. */ public abstract void setRawFilter(RawFilter rawFilter); void setRawFilter(RawFilter rawFilter); /** * Retrieves the filter for this search operation. This should not be called @@ -187,7 +187,7 @@ * @return The filter for this search operation, or <CODE>null</CODE> if the * raw filter has not yet been processed. */ public abstract SearchFilter getFilter(); SearchFilter getFilter(); /** * Retrieves the set of requested attributes for this search operation. Its @@ -195,7 +195,7 @@ * * @return The set of requested attributes for this search operation. */ public abstract Set<String> getAttributes(); Set<String> getAttributes(); /** * Specifies the set of requested attributes for this search operation. It @@ -204,7 +204,7 @@ * @param attributes The set of requested attributes for this search * operation. */ public abstract void setAttributes(Set<String> attributes); void setAttributes(Set<String> attributes); /** * Retrieves the number of entries sent to the client for this search @@ -213,7 +213,7 @@ * @return The number of entries sent to the client for this search * operation. */ public abstract int getEntriesSent(); int getEntriesSent(); /** * Retrieves the number of search references sent to the client for this @@ -222,7 +222,7 @@ * @return The number of search references sent to the client for this search * operation. */ public abstract int getReferencesSent(); int getReferencesSent(); /** * Used as a callback for backends to indicate that the provided entry matches @@ -239,7 +239,7 @@ * <CODE>false</CODE> if not for some reason (e.g., the size limit * has been reached or the search has been abandoned). */ public abstract boolean returnEntry(Entry entry, List<Control> controls); boolean returnEntry(Entry entry, List<Control> controls); /** * Used as a callback for backends to indicate that the provided entry matches @@ -258,7 +258,7 @@ * <CODE>false</CODE> if not for some reason (e.g., the size limit * has been reached or the search has been abandoned). */ public abstract boolean returnEntry(Entry entry, List<Control> controls, boolean returnEntry(Entry entry, List<Control> controls, boolean evaluateAci); /** @@ -274,7 +274,7 @@ * <CODE>false</CODE> if not for some reason (e.g., the size limit * has been reached or the search has been abandoned). */ public abstract boolean returnReference(DN dn, boolean returnReference(DN dn, SearchResultReference reference); /** @@ -292,7 +292,7 @@ * <CODE>false</CODE> if not for some reason (e.g., the size limit * has been reached or the search has been abandoned). */ public abstract boolean returnReference(DN dn, boolean returnReference(DN dn, SearchResultReference reference, boolean evaluateAci); @@ -304,43 +304,43 @@ * message should have been set for this operation before this method is * called. */ public abstract void sendSearchResultDone(); void sendSearchResultDone(); /** * Set the time after which the search time limit has expired. * * @param timeLimitExpiration - Time after which the search has expired */ public abstract void setTimeLimitExpiration(long timeLimitExpiration); void setTimeLimitExpiration(long timeLimitExpiration); /** * Indicates whether LDAP subentries should be returned or not. * * @return true if the LDAP subentries should be returned, false otherwise */ public abstract boolean isReturnSubentriesOnly(); boolean isReturnSubentriesOnly(); /** * Set the flag indicating wether the LDAP subentries should be returned. * Set the flag indicating whether the LDAP subentries should be returned. * * @param returnLDAPSubentries - Boolean indicating wether the LDAP * @param returnLDAPSubentries - Boolean indicating whether the LDAP * subentries should be returned or not */ public abstract void setReturnSubentriesOnly(boolean returnLDAPSubentries); void setReturnSubentriesOnly(boolean returnLDAPSubentries); /** * The matched values control associated with this search operation. * * @return the match values control */ public abstract MatchedValuesControl getMatchedValuesControl(); MatchedValuesControl getMatchedValuesControl(); /** * Set the match values control. * * @param controls - The matched values control */ public abstract void setMatchedValuesControl(MatchedValuesControl controls); void setMatchedValuesControl(MatchedValuesControl controls); /** * Indicates whether to include the account usable response control with @@ -349,7 +349,7 @@ * @return true if the usable control has to be part of the search result * entry */ public abstract boolean isIncludeUsableControl(); boolean isIncludeUsableControl(); /** * Specify whether to include the account usable response control within the @@ -359,14 +359,14 @@ * has to be included within the search result * entries, false otherwise */ public abstract void setIncludeUsableControl(boolean includeUsableControl); void setIncludeUsableControl(boolean includeUsableControl); /** * Indicates whether the client is able to handle referrals. * * @return true, if the client is able to handle referrals */ public abstract boolean isClientAcceptsReferrals(); boolean isClientAcceptsReferrals(); /** * Specify whether the client is able to handle referrals. @@ -374,51 +374,39 @@ * @param clientAcceptReferrals - Boolean set to true if the client * can handle referrals */ public abstract void setClientAcceptsReferrals(boolean clientAcceptReferrals); void setClientAcceptsReferrals(boolean clientAcceptReferrals); /** * Increments by 1 the number of entries sent to the client for this search * operation. */ public abstract void incrementEntriesSent(); /** * Increments by 1 the number of search references sent to the client for this * search operation. */ public abstract void incrementReferencesSent(); /** * Indicates wether the search result done message has to be sent * Indicates whether the search result done message has to be sent * to the client, or not. * * @return true if the search result done message is to be sent to the client */ public abstract boolean isSendResponse(); boolean isSendResponse(); /** * Specify wether the search result done message has to be sent * Specify whether the search result done message has to be sent * to the client, or not. * * @param sendResponse - boolean indicating wether the search result done * @param sendResponse - boolean indicating whether the search result done * message is to send to the client */ public abstract void setSendResponse(boolean sendResponse); void setSendResponse(boolean sendResponse); /** * Returns true if only real attributes should be returned. * * @return true if only real attributes should be returned, false otherwise */ public abstract boolean isRealAttributesOnly(); boolean isRealAttributesOnly(); /** * Specify wether to only return real attributes. * Specify whether to only return real attributes. * * @param realAttributesOnly - boolean setup to true, if only the real * attributes should be returned */ public abstract void setRealAttributesOnly(boolean realAttributesOnly); void setRealAttributesOnly(boolean realAttributesOnly); /** * Returns true if only virtual attributes should be returned. @@ -426,15 +414,15 @@ * @return true if only virtual attributes should be returned, false * otherwise */ public abstract boolean isVirtualAttributesOnly(); boolean isVirtualAttributesOnly(); /** * Specify wether to only return virtual attributes. * Specify whether to only return virtual attributes. * * @param virtualAttributesOnly - boolean setup to true, if only the virtual * attributes should be returned */ public abstract void setVirtualAttributesOnly(boolean virtualAttributesOnly); void setVirtualAttributesOnly(boolean virtualAttributesOnly); /** * Sends the provided search result entry to the client. @@ -446,7 +434,7 @@ * to send the entry to the client and * the search should be terminated. */ public abstract void sendSearchEntry(SearchResultEntry entry) void sendSearchEntry(SearchResultEntry entry) throws DirectoryException; /** @@ -464,7 +452,7 @@ * to send the reference to the client * and the search should be terminated. */ public abstract boolean sendSearchReference(SearchResultReference reference) boolean sendSearchReference(SearchResultReference reference) throws DirectoryException; /** @@ -475,7 +463,7 @@ * authorization has been requested, or {@code null} if proxied * authorization has not been requested. */ public abstract DN getProxiedAuthorizationDN(); DN getProxiedAuthorizationDN(); /** * Set the proxied authorization DN for this operation if proxied @@ -486,6 +474,6 @@ * authorization has been requested, or {@code null} if proxied * authorization has not been requested. */ public abstract void setProxiedAuthorizationDN(DN proxiedAuthorizationDN); void setProxiedAuthorizationDN(DN proxiedAuthorizationDN); } opends/src/server/org/opends/server/core/SearchOperationBasis.java
@@ -28,13 +28,14 @@ import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import org.opends.messages.Message; import org.opends.server.api.AccessControlHandler; import org.opends.server.api.AuthenticationPolicyState; import org.opends.server.api.ClientConnection; import org.opends.server.api.plugin.PluginResult; import org.opends.server.controls.AccountUsableResponseControl; import org.opends.server.controls.ExternalChangelogRequestControl; import org.opends.server.controls.MatchedValuesControl; import org.opends.server.core.networkgroups.NetworkGroup; import org.opends.server.loggers.debug.DebugLogger; @@ -74,10 +75,10 @@ * Indicates whether a search result done response has been sent to the * client. */ private AtomicBoolean responseSent; private final AtomicBoolean responseSent = new AtomicBoolean(false); /** Indicates whether the client is able to handle referrals. */ private boolean clientAcceptsReferrals; private boolean clientAcceptsReferrals = true; /** * Indicates whether to include the account usable control with search result @@ -121,12 +122,12 @@ private DN proxiedAuthorizationDN; /** The number of entries that have been sent to the client. */ private int entriesSent; private final AtomicInteger entriesSent = new AtomicInteger(); /** * The number of search result references that have been sent to the client. */ private int referencesSent; private final AtomicInteger referencesSent = new AtomicInteger(); /** The size limit for the search operation. */ private int sizeLimit; @@ -141,13 +142,7 @@ private Set<String> attributes; /** The set of response controls for this search operation. */ private List<Control> responseControls; /** The time that processing started on this operation. */ private long processingStartTime; /** The time that processing ended on this operation. */ private long processingStopTime; private final List<Control> responseControls = new ArrayList<Control>(); /** The time that the search time limit has expired. */ private long timeLimitExpiration; @@ -164,8 +159,6 @@ /** Indicates whether to send the search result done to the client or not. */ private boolean sendResponse = true; private ExternalChangelogRequestControl eclRequestControl; /** * Creates a new search operation with the provided information. * @@ -198,7 +191,6 @@ { super(clientConnection, operationID, messageID, requestControls); this.rawBaseDN = rawBaseDN; this.scope = scope; this.derefPolicy = derefPolicy; @@ -206,32 +198,10 @@ this.timeLimit = timeLimit; this.typesOnly = typesOnly; this.rawFilter = rawFilter; if (attributes == null) { this.attributes = new LinkedHashSet<String>(0); } else { this.attributes = attributes; } this.attributes = attributes != null ? attributes : new LinkedHashSet<String>(0); this.sizeLimit = getSizeLimit(sizeLimit, clientConnection); this.timeLimit = getTimeLimit(timeLimit, clientConnection); baseDN = null; filter = null; entriesSent = 0; referencesSent = 0; responseControls = new ArrayList<Control>(); cancelRequest = null; clientAcceptsReferrals = true; includeUsableControl = false; responseSent = new AtomicBoolean(false); returnSubentriesOnly = false; matchedValuesControl = null; realAttributesOnly = false; virtualAttributesOnly = false; } /** @@ -263,7 +233,6 @@ { super(clientConnection, operationID, messageID, requestControls); this.baseDN = baseDN; this.scope = scope; this.derefPolicy = derefPolicy; @@ -271,31 +240,13 @@ this.timeLimit = timeLimit; this.typesOnly = typesOnly; this.filter = filter; if (attributes == null) { this.attributes = new LinkedHashSet<String>(0); } else { this.attributes = attributes; } this.attributes = attributes != null ? attributes : new LinkedHashSet<String>(0); rawBaseDN = ByteString.valueOf(baseDN.toString()); rawFilter = new LDAPFilter(filter); this.sizeLimit = getSizeLimit(sizeLimit, clientConnection); this.timeLimit = getTimeLimit(timeLimit, clientConnection); entriesSent = 0; referencesSent = 0; responseControls = new ArrayList<Control>(); cancelRequest = null; clientAcceptsReferrals = true; includeUsableControl = false; responseSent = new AtomicBoolean(false); returnSubentriesOnly = false; matchedValuesControl = null; } @@ -325,21 +276,14 @@ return Math.min(timeLimit, clientConnection.getTimeLimit()); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final ByteString getRawBaseDN() { return rawBaseDN; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final void setRawBaseDN(ByteString rawBaseDN) { @@ -348,10 +292,7 @@ baseDN = null; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final DN getBaseDN() { @@ -377,118 +318,91 @@ return baseDN; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final void setBaseDN(DN baseDN) { this.baseDN = baseDN; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final SearchScope getScope() { return scope; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final void setScope(SearchScope scope) { this.scope = scope; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final DereferencePolicy getDerefPolicy() { return derefPolicy; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final void setDerefPolicy(DereferencePolicy derefPolicy) { this.derefPolicy = derefPolicy; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final int getSizeLimit() { return sizeLimit; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final void setSizeLimit(int sizeLimit) { this.sizeLimit = sizeLimit; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final int getTimeLimit() { return timeLimit; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final void setTimeLimit(int timeLimit) { this.timeLimit = timeLimit; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final boolean getTypesOnly() { return typesOnly; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final void setTypesOnly(boolean typesOnly) { this.typesOnly = typesOnly; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final RawFilter getRawFilter() { return rawFilter; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final void setRawFilter(RawFilter rawFilter) { @@ -497,9 +411,7 @@ filter = null; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final SearchFilter getFilter() { @@ -525,18 +437,14 @@ return filter; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final Set<String> getAttributes() { return attributes; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final void setAttributes(Set<String> attributes) { @@ -550,36 +458,28 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final int getEntriesSent() { return entriesSent; return entriesSent.get(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final int getReferencesSent() { return referencesSent; return referencesSent.get(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final boolean returnEntry(Entry entry, List<Control> controls) { return returnEntry(entry, controls, true); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final boolean returnEntry(Entry entry, List<Control> controls, boolean evaluateAci) @@ -588,7 +488,7 @@ // See if the size limit has been exceeded. If so, then don't send the // entry and indicate that the search should end. if ((getSizeLimit() > 0) && (getEntriesSent() >= getSizeLimit())) if (getSizeLimit() > 0 && getEntriesSent() >= getSizeLimit()) { setResultCode(ResultCode.SIZE_LIMIT_EXCEEDED); appendErrorMessage(ERR_SEARCH_SIZE_LIMIT_EXCEEDED.get(getSizeLimit())); @@ -597,8 +497,8 @@ // See if the time limit has expired. If so, then don't send the entry and // indicate that the search should end. if ((getTimeLimit() > 0) && (TimeThread.getTime() >= getTimeLimitExpiration())) if (getTimeLimit() > 0 && TimeThread.getTime() >= getTimeLimitExpiration()) { setResultCode(ResultCode.TIME_LIMIT_EXCEEDED); appendErrorMessage(ERR_SEARCH_TIME_LIMIT_EXCEEDED.get(getTimeLimit())); @@ -609,26 +509,23 @@ // should be returned. if (entry.isSubentry() || entry.isLDAPSubentry()) { if (filterNeedsCheckingForSubentries == true) if (filterNeedsCheckingForSubentries) { filterIncludesSubentries = checkFilterForLDAPSubEntry(filter, 0); filterNeedsCheckingForSubentries = false; } if ((getScope() != SearchScope.BASE_OBJECT) if (getScope() != SearchScope.BASE_OBJECT && !filterIncludesSubentries && !isReturnSubentriesOnly()) { return true; } } else else if (isReturnSubentriesOnly()) { if (isReturnSubentriesOnly()) { // Subentries are visible and normal entries are not. return true; } // Subentries are visible and normal entries are not. return true; } // Determine whether to include the account usable control. If so, then @@ -673,18 +570,15 @@ secondsBeforeExpiration)); } } // Another type of authentication policy (e.g. PTA). else if (state.isDisabled()) { controls.add(new AccountUsableResponseControl(false, false, false, -1, true, -1)); } else { // Another type of authentication policy (e.g. PTA). if (state.isDisabled()) { controls.add(new AccountUsableResponseControl(false, false, false, -1, true, -1)); } else { controls.add(new AccountUsableResponseControl(-1)); } controls.add(new AccountUsableResponseControl(-1)); } } catch (Exception e) @@ -697,15 +591,10 @@ } // Check to see if the entry can be read by the client. SearchResultEntry unfilteredSearchEntry = new SearchResultEntry(entry, controls); if (evaluateAci) SearchResultEntry unfilteredSearchEntry = new SearchResultEntry(entry, controls); if (evaluateAci && !getACIHandler().maySend(this, unfilteredSearchEntry)) { if (AccessControlConfigManager.getInstance().getAccessControlHandler() .maySend(this, unfilteredSearchEntry) == false) { return true; } return true; } // Make a copy of the entry and pare it down to only include the set @@ -720,7 +609,7 @@ // If there is a matched values control, then further pare down the entry // based on the filters that it contains. MatchedValuesControl matchedValuesControl = getMatchedValuesControl(); if ((matchedValuesControl != null) && (! typesOnly)) if (matchedValuesControl != null && !typesOnly) { // First, look at the set of objectclasses. @@ -732,8 +621,7 @@ while (ocIterator.hasNext()) { String ocName = ocIterator.next(); AttributeValue v = AttributeValues.create(attrType,ocName); AttributeValue v = AttributeValues.create(attrType,ocName); if (! matchedValuesControl.valueMatches(attrType, v)) { ocIterator.remove(); @@ -806,8 +694,7 @@ // values that the client is not permitted to see. if (evaluateAci) { AccessControlConfigManager.getInstance().getAccessControlHandler() .filterEntry(this, unfilteredSearchEntry, filteredSearchEntry); getACIHandler().filterEntry(this, unfilteredSearchEntry, filteredSearchEntry); } // Invoke any search entry plugins that may be registered with the server. @@ -825,7 +712,7 @@ { sendSearchEntry(filteredSearchEntry); incrementEntriesSent(); entriesSent.incrementAndGet(); } catch (DirectoryException de) { @@ -842,26 +729,27 @@ return pluginResult.continueProcessing(); } /** * {@inheritDoc} */ private AccessControlHandler<?> getACIHandler() { return AccessControlConfigManager.getInstance().getAccessControlHandler(); } /** {@inheritDoc} */ @Override public final boolean returnReference(DN dn, SearchResultReference reference) { return returnReference(dn, reference, true); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final boolean returnReference(DN dn, SearchResultReference reference, boolean evaluateAci) { // See if the time limit has expired. If so, then don't send the entry and // indicate that the search should end. if ((getTimeLimit() > 0) && (TimeThread.getTime() >= getTimeLimitExpiration())) if (getTimeLimit() > 0 && TimeThread.getTime() >= getTimeLimitExpiration()) { setResultCode(ResultCode.TIME_LIMIT_EXCEEDED); appendErrorMessage(ERR_SEARCH_TIME_LIMIT_EXCEEDED.get(getTimeLimit())); @@ -871,22 +759,14 @@ // See if we know that this client can't handle referrals. If so, then // don't even try to send it. if (! isClientAcceptsReferrals()) if (!isClientAcceptsReferrals() // See if the client has permission to read this reference. || (evaluateAci && !getACIHandler().maySend(dn, this, reference))) { return true; } // See if the client has permission to read this reference. if (evaluateAci) { if (AccessControlConfigManager.getInstance() .getAccessControlHandler().maySend(dn, this, reference) == false) { return true; } } // Invoke any search reference plugins that may be registered with the // server. PluginResult.IntermediateResponse pluginResult = @@ -906,7 +786,7 @@ { if (sendSearchReference(reference)) { incrementReferencesSent(); referencesSent.incrementAndGet(); // FIXME -- Should the size limit apply here? } @@ -932,9 +812,7 @@ return pluginResult.continueProcessing(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final void sendSearchResultDone() { @@ -943,21 +821,16 @@ // multithreaded in the event of a persistent search, so do it safely. if (responseSent.compareAndSet(false, true)) { // Log the search result. logSearchResultDone(this); // Send the response to the client. clientConnection.sendResponse(this); // Invoke the post-response search plugins. invokePostResponsePlugins(); } } /** * {@inheritDoc} */ @Override() /** {@inheritDoc} */ @Override public final OperationType getOperationType() { // Note that no debugging will be done in this method because it is a likely @@ -965,48 +838,36 @@ return OperationType.SEARCH; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public DN getProxiedAuthorizationDN() { return proxiedAuthorizationDN; } /** * {@inheritDoc} */ @Override() /** {@inheritDoc} */ @Override public final List<Control> getResponseControls() { return responseControls; } /** * {@inheritDoc} */ @Override() /** {@inheritDoc} */ @Override public final void addResponseControl(Control control) { responseControls.add(control); } /** * {@inheritDoc} */ @Override() /** {@inheritDoc} */ @Override public final void removeResponseControl(Control control) { responseControls.remove(control); } /** * {@inheritDoc} */ @Override() /** {@inheritDoc} */ @Override public void abort(CancelRequest cancelRequest) { if(cancelResult == null && this.cancelRequest == null) @@ -1015,12 +876,8 @@ } } /** * {@inheritDoc} */ @Override() /** {@inheritDoc} */ @Override public final void toString(StringBuilder buffer) { buffer.append("SearchOperation(connID="); @@ -1036,171 +893,119 @@ buffer.append(")"); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setTimeLimitExpiration(long timeLimitExpiration) { this.timeLimitExpiration = timeLimitExpiration; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean isReturnSubentriesOnly() { return returnSubentriesOnly; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setReturnSubentriesOnly(boolean returnLDAPSubentries) { this.returnSubentriesOnly = returnLDAPSubentries; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public MatchedValuesControl getMatchedValuesControl() { return matchedValuesControl; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setMatchedValuesControl(MatchedValuesControl controls) { this.matchedValuesControl = controls; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean isIncludeUsableControl() { return includeUsableControl; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setIncludeUsableControl(boolean includeUsableControl) { this.includeUsableControl = includeUsableControl; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public long getTimeLimitExpiration() { return timeLimitExpiration; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean isClientAcceptsReferrals() { return clientAcceptsReferrals; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setClientAcceptsReferrals(boolean clientAcceptReferrals) { this.clientAcceptsReferrals = clientAcceptReferrals; } /** * {@inheritDoc} */ @Override public void incrementEntriesSent() { entriesSent++; } /** * {@inheritDoc} */ @Override public void incrementReferencesSent() { referencesSent++; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean isSendResponse() { return sendResponse; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setSendResponse(boolean sendResponse) { this.sendResponse = sendResponse; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean isRealAttributesOnly() { return this.realAttributesOnly; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean isVirtualAttributesOnly() { return this.virtualAttributesOnly; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setRealAttributesOnly(boolean realAttributesOnly) { this.realAttributesOnly = realAttributesOnly; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setVirtualAttributesOnly(boolean virtualAttributesOnly) { this.virtualAttributesOnly = virtualAttributesOnly; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void sendSearchEntry(SearchResultEntry searchEntry) throws DirectoryException @@ -1208,9 +1013,7 @@ getClientConnection().sendSearchEntry(this, searchEntry); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean sendSearchReference(SearchResultReference searchReference) throws DirectoryException @@ -1218,18 +1021,14 @@ return getClientConnection().sendSearchReference(this, searchReference); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setProxiedAuthorizationDN(DN proxiedAuthorizationDN) { this.proxiedAuthorizationDN = proxiedAuthorizationDN; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final void run() { @@ -1421,8 +1220,8 @@ // FIXME : technically this is not correct since the presence // of draft oc would trigger rfc oc visibility and visa versa. String stringValueLC = toLowerCase(v.getValue().toString()); if (stringValueLC.equals(OC_LDAP_SUBENTRY_LC) || stringValueLC.equals(OC_SUBENTRY)) if (OC_LDAP_SUBENTRY_LC.equals(stringValueLC) || OC_SUBENTRY.equals(stringValueLC)) { return true; } opends/src/server/org/opends/server/core/SearchOperationWrapper.java
@@ -51,18 +51,14 @@ super(search); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean returnEntry(Entry entry, List<Control> controls) { return getOperation().returnEntry(entry, controls); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean returnEntry(Entry entry, List<Control> controls, boolean evaluateAci) @@ -70,18 +66,14 @@ return getOperation().returnEntry(entry, controls, evaluateAci); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean returnReference(DN dn, SearchResultReference reference) { return getOperation().returnReference(dn, reference); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean returnReference(DN dn, SearchResultReference reference, boolean evaluateAci) @@ -89,375 +81,277 @@ return getOperation().returnReference(dn, reference, evaluateAci); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public String toString() { return getOperation().toString(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public Set<String> getAttributes() { return getOperation().getAttributes(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public DN getBaseDN() { return getOperation().getBaseDN(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public DereferencePolicy getDerefPolicy() { return getOperation().getDerefPolicy(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public int getEntriesSent() { return getOperation().getEntriesSent(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public SearchFilter getFilter() { return getOperation().getFilter(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public ByteString getRawBaseDN() { return getOperation().getRawBaseDN(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public RawFilter getRawFilter() { return getOperation().getRawFilter(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public int getReferencesSent() { return getOperation().getReferencesSent(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public SearchScope getScope() { return getOperation().getScope(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public int getSizeLimit() { return getOperation().getSizeLimit(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public int getTimeLimit() { return getOperation().getTimeLimit(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean getTypesOnly() { return getOperation().getTypesOnly(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void sendSearchResultDone() { getOperation().sendSearchResultDone(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setAttributes(Set<String> attributes) { getOperation().setAttributes(attributes); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setBaseDN(DN baseDN) { getOperation().setBaseDN(baseDN); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setDerefPolicy(DereferencePolicy derefPolicy) { getOperation().setDerefPolicy(derefPolicy); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setRawBaseDN(ByteString rawBaseDN) { getOperation().setRawBaseDN(rawBaseDN); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setRawFilter(RawFilter rawFilter) { getOperation().setRawFilter(rawFilter); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setScope(SearchScope scope) { getOperation().setScope(scope); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setSizeLimit(int sizeLimit) { getOperation().setSizeLimit(sizeLimit); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setTimeLimit(int timeLimit) { getOperation().setTimeLimit(timeLimit); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setTypesOnly(boolean typesOnly) { getOperation().setTypesOnly(typesOnly); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setTimeLimitExpiration(long timeLimitExpiration) { getOperation().setTimeLimitExpiration(timeLimitExpiration); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean isReturnSubentriesOnly() { return getOperation().isReturnSubentriesOnly(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setReturnSubentriesOnly(boolean returnLDAPSubentries) { getOperation().setReturnSubentriesOnly(returnLDAPSubentries); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public MatchedValuesControl getMatchedValuesControl() { return getOperation().getMatchedValuesControl(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setMatchedValuesControl(MatchedValuesControl controls) { getOperation().setMatchedValuesControl(controls); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean isIncludeUsableControl() { return getOperation().isIncludeUsableControl(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setIncludeUsableControl(boolean includeUsableControl) { getOperation().setIncludeUsableControl(includeUsableControl); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public long getTimeLimitExpiration() { return getOperation().getTimeLimitExpiration(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean isClientAcceptsReferrals() { return getOperation().isClientAcceptsReferrals(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setClientAcceptsReferrals(boolean clientAcceptReferrals) { getOperation().setClientAcceptsReferrals(clientAcceptReferrals); } /** * {@inheritDoc} */ @Override public void incrementEntriesSent() { getOperation().incrementEntriesSent(); } /** * {@inheritDoc} */ @Override public void incrementReferencesSent() { getOperation().incrementReferencesSent(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean isSendResponse() { return getOperation().isSendResponse(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setSendResponse(boolean sendResponse) { getOperation().setSendResponse(sendResponse); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean isRealAttributesOnly(){ return getOperation().isRealAttributesOnly(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setRealAttributesOnly(boolean realAttributesOnly){ getOperation().setRealAttributesOnly(realAttributesOnly); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean isVirtualAttributesOnly() { return getOperation().isVirtualAttributesOnly(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setVirtualAttributesOnly(boolean virtualAttributesOnly){ getOperation().setVirtualAttributesOnly(virtualAttributesOnly); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void sendSearchEntry(SearchResultEntry entry) throws DirectoryException @@ -465,9 +359,7 @@ getOperation().sendSearchEntry(entry); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean sendSearchReference(SearchResultReference reference) throws DirectoryException @@ -475,18 +367,14 @@ return getOperation().sendSearchReference(reference); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public DN getProxiedAuthorizationDN() { return getOperation().getProxiedAuthorizationDN(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setProxiedAuthorizationDN(DN proxiedAuthorizationDN){ getOperation().setProxiedAuthorizationDN(proxiedAuthorizationDN); opends/src/server/org/opends/server/core/WorkflowTopology.java
@@ -22,14 +22,13 @@ * * * Copyright 2008 Sun Microsystems, Inc. * Portions Copyright 2014 ForgeRock AS */ package org.opends.server.core; import org.opends.server.types.DN; import org.opends.server.types.SearchScope; /** * This class is the base class used to build the workflow topology. * A workflow topology is a tree of workflows. Each node in the tree @@ -40,30 +39,10 @@ * nodes in the workflow topology (WorkflowTopologyNode) and the second * one is used to implement the root DSE node (RootDseWorkflowTopology). */ public abstract class WorkflowTopology implements Workflow { // The workflow implementation containing the task tree (ie. the processing) private WorkflowImpl workflowImpl = null; /** * Each workflow node may have specific tasks to be executed before * the workflow task tree. The tasks to execute before are stored in * the following array, which is empty at the moment (implementation * will come later on when needed). */ // private WorkflowElement[] preWorkflowElements = null; /** * Each workflow node may have specific tasks to be executed after * the workflow task tree. The tasks to execute after are stored in * the following array, which is empty at the moment (implementation * will come later on when needed). */ // private WorkflowElement[] postWorkflowElements = null; /** The workflow implementation containing the task tree (ie. the processing). */ private WorkflowImpl workflowImpl; /** * Create a new instance of the workflow topology base class. @@ -97,6 +76,7 @@ * * @return the base DN of the workflow containing the processing. */ @Override public DN getBaseDN() { return getWorkflowImpl().getBaseDN(); @@ -112,10 +92,7 @@ * @return the new scope to use for searches on subordinate workflows, * <code>null</code> when current scope is 'base' */ protected SearchScope elaborateScopeForSearchInSubordinates( SearchScope currentScope ) protected SearchScope elaborateScopeForSearchInSubordinates(SearchScope currentScope) { switch (currentScope) { @@ -131,4 +108,11 @@ } } /** {@inheritDoc} */ @Override public String toString() { return getClass().getSimpleName() + " " + workflowImpl; } }