| | |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * Copyright 2015 ForgeRock AS |
| | | * Copyright 2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.maven; |
| | | |
| | |
| | | linePattern = bufferedLines.get(indexCommentToken++); |
| | | commentToken = getCommentTokenInBlock(linePattern); |
| | | } |
| | | if (commentToken != null) { |
| | | return linePattern.substring(0, linePattern.indexOf(commentToken) + 1); |
| | | } else { |
| | | throw new Exception("Uncompatibles comments lines in the file."); |
| | | if (commentToken == null) { |
| | | throw new Exception("Incompatibles comments lines in the file."); |
| | | } |
| | | return linePattern.substring(0, linePattern.indexOf(commentToken) + 1); |
| | | } |
| | | |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | * Portions copyright 2013-2016 ForgeRock AS |
| | | */ |
| | | |
| | | package com.forgerock.opendj.ldap.extensions; |
| | | |
| | | import java.io.IOException; |
| | |
| | | final DecodeOptions options) throws DecodeException { |
| | | if (result instanceof GetConnectionIDExtendedResult) { |
| | | return (GetConnectionIDExtendedResult) result; |
| | | } else { |
| | | } |
| | | |
| | | final ResultCode resultCode = result.getResultCode(); |
| | | final GetConnectionIDExtendedResult newResult = |
| | | GetConnectionIDExtendedResult.newResult(resultCode).setMatchedDN( |
| | | result.getMatchedDN()).setDiagnosticMessage( |
| | | result.getDiagnosticMessage()); |
| | | GetConnectionIDExtendedResult.newResult(resultCode) |
| | | .setMatchedDN(result.getMatchedDN()) |
| | | .setDiagnosticMessage(result.getDiagnosticMessage()); |
| | | |
| | | final ByteString responseValue = result.getValue(); |
| | | if (!resultCode.isExceptional() && responseValue == null) { |
| | |
| | | return newResult; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * The OID for the extended operation that can be used to get the client |
| | |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * Copyright 2014-2015 ForgeRock AS. |
| | | * Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap; |
| | | |
| | | import static com.forgerock.opendj.util.StaticUtils.getProvider; |
| | |
| | | * <p> |
| | | * The default setting is {@code -1} (disabled) and may be configured using |
| | | * the {@code org.forgerock.opendj.io.linger} property. |
| | | * |
| | | * @param linger |
| | | * The value of the {@link java.net.SocketOptions#SO_LINGER |
| | | * SO_LINGER} socket option for new connections, or -1 if linger |
| | | * should be disabled. |
| | | * @return A reference to this set of options. |
| | | */ |
| | | public static final Option<Integer> SO_LINGER_IN_SECONDS = Option.withDefault( |
| | | getIntProperty("org.forgerock.opendj.io.linger", -1)); |
| | |
| | | * <p> |
| | | * The default setting is {@code true} and may be configured using the |
| | | * {@code org.forgerock.opendj.io.keepAlive} property. |
| | | * |
| | | */ |
| | | public static final Option<Boolean> SO_KEEPALIVE = Option.withDefault( |
| | | getBooleanProperty("org.forgerock.opendj.io.keepAlive", true)); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2014 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.requests; |
| | | |
| | |
| | | |
| | | final List<Control> controls = impl.getControls(); |
| | | final Control control = AbstractRequestImpl.getControl(controls, decoder.getOID()); |
| | | if (control != null) { |
| | | if (control == null) { |
| | | return null; |
| | | } |
| | | |
| | | // Got a match. Return a defensive copy only if necessary. |
| | | final C decodedControl = decoder.decodeControl(control, options); |
| | | if (decodedControl != control) { |
| | |
| | | final GenericControl genericControl = GenericControl.newControl(control); |
| | | return decoder.decodeControl(genericControl, options); |
| | | } |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | * Portions Copyright 2011-2016 ForgeRock AS |
| | | * Portions Copyright 2014 Manuel Gaupp |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | final AttributeType type = getAttributeType0(name); |
| | | if (type != null) { |
| | | return type; |
| | | } else { |
| | | throw new UnknownSchemaElementException(WARN_ATTR_TYPE_UNKNOWN.get(name)); |
| | | } |
| | | throw new UnknownSchemaElementException(WARN_ATTR_TYPE_UNKNOWN.get(name)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | // should be valid. |
| | | foundMatchingNameForms = true; |
| | | |
| | | if (checkNameForm(entry, policy, nameFormWarnings, nf)) { |
| | | if (checkNameForm(entry, nameFormWarnings, nf)) { |
| | | nameForm = nf; |
| | | break; |
| | | } |
| | |
| | | return true; |
| | | } |
| | | |
| | | private boolean checkNameForm(final Entry entry, final SchemaValidationPolicy policy, |
| | | final List<LocalizableMessage> nameFormWarnings, final NameForm nameForm) { |
| | | private boolean checkNameForm(final Entry entry, final List<LocalizableMessage> nameFormWarnings, |
| | | final NameForm nameForm) { |
| | | final RDN rdn = entry.getName().rdn(); |
| | | if (rdn != null) { |
| | | // Make sure that all the required AVAs are present. |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2014-2015 ForgeRock AS. |
| | | * Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.spi; |
| | | |
| | | import static org.forgerock.opendj.ldap.spi.LdapPromises.*; |
| | | |
| | | import java.util.concurrent.ExecutionException; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.concurrent.TimeoutException; |
| | |
| | | import org.forgerock.opendj.ldap.LdapException; |
| | | import org.forgerock.opendj.ldap.LdapPromise; |
| | | import org.forgerock.util.AsyncFunction; |
| | | import org.forgerock.util.promise.ExceptionHandler; |
| | | import org.forgerock.util.Function; |
| | | import org.forgerock.util.promise.ExceptionHandler; |
| | | import org.forgerock.util.promise.Promise; |
| | | import org.forgerock.util.promise.ResultHandler; |
| | | import org.forgerock.util.promise.RuntimeExceptionHandler; |
| | | |
| | | import static org.forgerock.opendj.ldap.spi.LdapPromises.*; |
| | | |
| | | /** |
| | | * Provides a {@link Promise} wrapper and a {@link LdapPromise} implementation. |
| | | * |
| | |
| | | this.requestID = requestID; |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | @Override |
| | | public int getRequestID() { |
| | | return wrappedPromise instanceof LdapPromise ? ((LdapPromise<R>) wrappedPromise).getRequestID() |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2015 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap; |
| | | |
| | |
| | | b(0xFF), b(0xFF), b(0xFF), b(0xFF), b(0xFF) } }, |
| | | { new ByteStringBuilder(11).appendUtf8("this is a").appendUtf8(" test"), |
| | | "this is a test".getBytes("UTF-8") }, |
| | | { new ByteStringBuilder().appendObject((Object) "this is a").appendObject((Object) " test"), |
| | | { new ByteStringBuilder().appendObject("this is a").appendObject(" test"), |
| | | "this is a test".getBytes("UTF-8") }, |
| | | { |
| | | new ByteStringBuilder().appendUtf8("this is a".toCharArray()).appendUtf8( |
| | | " test".toCharArray()), "this is a test".getBytes("UTF-8") }, |
| | | { |
| | | new ByteStringBuilder().appendObject((Object) "this is a".toCharArray()).appendObject( |
| | | (Object) " test".toCharArray()), "this is a test".getBytes("UTF-8") }, |
| | | new ByteStringBuilder().appendObject("this is a".toCharArray()).appendObject( |
| | | " test".toCharArray()), "this is a test".getBytes("UTF-8") }, |
| | | { |
| | | new ByteStringBuilder().appendObject((Object) EIGHT_BYTES).appendObject((Object) EIGHT_BYTES), |
| | | new ByteStringBuilder().appendObject(EIGHT_BYTES).appendObject(EIGHT_BYTES), |
| | | new byte[] { b(0x01), b(0x02), b(0x03), b(0x04), b(0x05), |
| | | b(0x06), b(0x07), b(0x08), b(0x01), b(0x02), b(0x03), |
| | | b(0x04), b(0x05), b(0x06), b(0x07), b(0x08) } }, |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2015 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap; |
| | | |
| | |
| | | new byte[] { (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, |
| | | (byte) 0x00, (byte) 0x00, (byte) 0x00 } }, |
| | | { ByteString.valueOfUtf8("cn=testvalue"), "cn=testvalue".getBytes("UTF-8") }, |
| | | { ByteString.valueOfObject((Object) "cn=testvalue"), "cn=testvalue".getBytes("UTF-8") }, |
| | | { ByteString.valueOfObject("cn=testvalue"), "cn=testvalue".getBytes("UTF-8") }, |
| | | { ByteString.valueOfUtf8("cn=testvalue".toCharArray()), "cn=testvalue".getBytes("UTF-8") }, |
| | | { ByteString.valueOfObject((Object) "cn=testvalue".toCharArray()), |
| | | { ByteString.valueOfObject("cn=testvalue".toCharArray()), |
| | | "cn=testvalue".getBytes("UTF-8") }, |
| | | { ByteString.valueOfBytes(new byte[0]), new byte[0] }, |
| | | { ByteString.valueOfBytes(testBytes), testBytes }, |
| | | { ByteString.valueOfObject((Object) testBytes), testBytes }, |
| | | { ByteString.valueOfObject(testBytes), testBytes }, |
| | | { ByteString.valueOfObject(ByteString.valueOfUtf8("cn=testvalue")), |
| | | "cn=testvalue".getBytes("UTF-8") }, |
| | | { ByteString.wrap(new byte[0]), new byte[0] }, |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2013-2015 ForgeRock AS. |
| | | * Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap; |
| | | |
| | | import static org.fest.assertions.Assertions.assertThat; |
| | |
| | | assertThat(hbc.isClosed()).isFalse(); |
| | | } |
| | | |
| | | @SuppressWarnings({ "rawtypes", "unchecked" }) |
| | | @Test(description = "OPENDJ-1348") |
| | | public void testBindPreventsHeartBeatTimeout() throws Exception { |
| | | mockConnectionWithInitialHeartbeatResult(ResultCode.SUCCESS); |
| | |
| | | assertThat(hbc.isValid()).isFalse(); |
| | | } |
| | | |
| | | @SuppressWarnings({ "unchecked", "rawtypes" }) |
| | | @Test |
| | | public void testHeartBeatWhileBindInProgress() throws Exception { |
| | | mockConnectionWithInitialHeartbeatResult(ResultCode.SUCCESS); |