| | |
| | | private final List<Attribute> additionalLDAPAttributes = new LinkedList<Attribute>(); |
| | | private DN baseDN; // TODO: support template variables. |
| | | private ConnectionFactory factory; |
| | | private Filter falseFilter = Filter.present("1.1"); |
| | | private MVCCStrategy mvccStrategy; |
| | | private NameStrategy nameStrategy; |
| | | private ReadOnUpdatePolicy readOnUpdatePolicy = USE_READ_ENTRY_CONTROLS; |
| | | private final ObjectAttributeMapper rootMapper = new ObjectAttributeMapper(); |
| | | private Schema schema = Schema.getDefaultSchema(); |
| | | private Filter trueFilter = Filter.objectClassPresent(); |
| | | |
| | | Builder() { |
| | | useEtagAttribute(); |
| | |
| | | throw new IllegalStateException("No mappings provided"); |
| | | } |
| | | return new LDAPCollectionResourceProvider(baseDN, rootMapper, factory, nameStrategy, |
| | | mvccStrategy, new Config(trueFilter, falseFilter, readOnUpdatePolicy, schema), |
| | | additionalLDAPAttributes); |
| | | mvccStrategy, new Config(readOnUpdatePolicy, schema), additionalLDAPAttributes); |
| | | } |
| | | |
| | | public Builder factory(final ConnectionFactory factory) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Sets the absolute false filter which should be used when querying the |
| | | * LDAP server. |
| | | * |
| | | * @param filter |
| | | * The absolute false filter. |
| | | * @return A reference to this builder. |
| | | */ |
| | | public Builder falseFilter(final Filter filter) { |
| | | this.falseFilter = ensureNotNull(filter); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * Sets the policy which should be used in order to read an entry before |
| | | * it is deleted, or after it is added or modified. |
| | | * |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * Sets the absolute true filter which should be used when querying the |
| | | * LDAP server. |
| | | * |
| | | * @param filter |
| | | * The absolute true filter. |
| | | * @return A reference to this builder. |
| | | */ |
| | | public Builder trueFilter(final Filter filter) { |
| | | this.trueFilter = ensureNotNull(filter); |
| | | return this; |
| | | } |
| | | |
| | | public Builder useClientDNNaming(final AttributeType attribute) { |
| | | this.nameStrategy = new DNNameStrategy(attribute); |
| | | return this; |
| | |
| | | |
| | | @Override |
| | | SearchRequest createSearchRequest(final Context c, final DN baseDN, final String resourceId) { |
| | | return newSearchRequest(baseDN.child(rdn(resourceId)), SearchScope.BASE_OBJECT, c |
| | | .getConfig().trueFilter()); |
| | | return newSearchRequest(baseDN.child(rdn(resourceId)), SearchScope.BASE_OBJECT, Filter |
| | | .objectClassPresent()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | * ... |
| | | * }, |
| | | * |
| | | * // Additional options (all are optional). |
| | | * "options" : { |
| | | * "trueFilter" : "(objectClass=*)", |
| | | * "falseFilter" : "(1.1=*)", |
| | | * }, |
| | | * |
| | | * // The base DN beneath which LDAP entries are to be found. |
| | | * "baseDN" : "ou=people,dc=example,dc=com", |
| | | * |