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

Matthew Swift
16.53.2013 23d2472ba3431670243ac0b12e7314728bc518dd
OPENDJ-757: Add Rest2LDAP gateway Servlet

* minor refactory of connection factory configuration.
2 files modified
26 ■■■■ changed files
opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LDAP.java 22 ●●●●● patch | view | raw | blame | history
opendj3/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/Example.java 4 ●●●● patch | view | raw | blame | history
opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LDAP.java
@@ -123,6 +123,24 @@
        }
        /**
         * Configures the connection factory using the provided JSON
         * configuration. See
         * {@link Rest2LDAP#configureConnectionFactory(JsonValue)} for a
         * detailed specification of the JSON configuration.
         *
         * @param configuration
         *            The JSON configuration.
         * @return A reference to this builder.
         * @throws IllegalArgumentException
         *             If the configuration is invalid.
         */
        public Builder configureConnectionFactory(final JsonValue configuration)
                throws IllegalArgumentException {
            connectionFactory(Rest2LDAP.configureConnectionFactory(configuration));
            return this;
        }
        /**
         * Configures the JSON to LDAP mapping using the provided JSON
         * configuration. The caller is still required to set the connection
         * factory. The configuration should look like this, excluding the
@@ -196,7 +214,7 @@
            return this;
        }
        public Builder factory(final ConnectionFactory factory) {
        public Builder connectionFactory(final ConnectionFactory factory) {
            ensureNotNull(factory);
            this.factory = factory;
            return this;
@@ -452,7 +470,7 @@
     * @throws IllegalArgumentException
     *             If the configuration is invalid.
     */
    public static ConnectionFactory connectionFactory(final JsonValue configuration)
    public static ConnectionFactory configureConnectionFactory(final JsonValue configuration)
            throws IllegalArgumentException {
        // Parse pool parameters,
        final int connectionPoolSize =
opendj3/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/Example.java
@@ -66,7 +66,7 @@
        // Create user resource.
        CollectionResourceProvider users =
                builder().factory(ldapFactory).baseDN("ou=people,dc=example,dc=com")
                builder().connectionFactory(ldapFactory).baseDN("ou=people,dc=example,dc=com")
                    .attribute("schemas", constant(Arrays.asList("urn:scim:schemas:core:1.0")))
                    .attribute("id", simple("uid").isSingleValued().isRequired().writability(CREATE_ONLY))
                    .attribute("rev", simple("etag").isSingleValued().writability(READ_ONLY))
@@ -84,7 +84,7 @@
        // Create group resource.
        CollectionResourceProvider groups =
                builder().factory(ldapFactory).baseDN("ou=groups,dc=example,dc=com")
                builder().connectionFactory(ldapFactory).baseDN("ou=groups,dc=example,dc=com")
                    .attribute("cn", simple("cn").isSingleValued())
                    .attribute("description", simple("description"))
                    .attribute("member", simple("uniquemember"))