Replace org.opends.server.util.Validator class by
org.forgerock.util.Reject class from forgerock-util module
2 files deleted
90 files modified
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | |
| | | import org.opends.server.authorization.dseecompat.AciException; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.ByteString; |
| | | import static org.opends.server.util.Validator.ensureNotNull; |
| | | import static org.forgerock.util.Reject.ifNull; |
| | | |
| | | import java.util.EnumSet; |
| | | |
| | |
| | | @Override |
| | | public void validateValue(Aci value) |
| | | throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | // No additional validation required. |
| | | } |
| | |
| | | @Override |
| | | public Aci decodeValue(String value) |
| | | throws IllegalPropertyValueStringException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | try { |
| | | return Aci.decode(ByteString.valueOf(value), DN.NULL_DN); |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin; |
| | | |
| | |
| | | |
| | | import static org.opends.messages.AdminMessages.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | |
| | | @Override |
| | | public String decodeValue(String value) |
| | | throws IllegalPropertyValueStringException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | try { |
| | | validateValue(value); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | | |
| | | |
| | | |
| | | import static org.opends.server.util.Validator.ensureNotNull; |
| | | import static org.forgerock.util.Reject.ifNull; |
| | | |
| | | import java.util.EnumSet; |
| | | |
| | |
| | | @Override |
| | | public AttributeType decodeValue(String value) |
| | | throws IllegalPropertyValueStringException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | String name = value.trim().toLowerCase(); |
| | | AttributeType type = DirectoryServer.getAttributeType(name, |
| | |
| | | @Override |
| | | public void validateValue(AttributeType value) |
| | | throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | // No implementation required. |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | | |
| | | |
| | | |
| | | import static org.opends.server.util.Validator.ensureNotNull; |
| | | import static org.forgerock.util.Reject.ifNull; |
| | | |
| | | import java.util.EnumSet; |
| | | import java.util.HashMap; |
| | |
| | | @Override |
| | | public void validateValue(Boolean value) |
| | | throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | // No additional validation required. |
| | | } |
| | |
| | | @Override |
| | | public Boolean decodeValue(String value) |
| | | throws IllegalPropertyValueStringException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | String nvalue = value.trim().toLowerCase(); |
| | | Boolean b = VALUE_MAP.get(nvalue); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.admin; |
| | | |
| | |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | |
| | | |
| | |
| | | public synchronized void addExtension(String... extensions) |
| | | throws InitializationException, IllegalStateException, |
| | | IllegalArgumentException { |
| | | Validator.ensureNotNull(extensions); |
| | | Reject.ifNull(extensions); |
| | | |
| | | if (loader == null) { |
| | | throw new IllegalStateException( |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | | |
| | | |
| | | |
| | | import static org.opends.server.util.Validator.ensureNotNull; |
| | | import static org.forgerock.util.Reject.ifNull; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.EnumSet; |
| | |
| | | * implement. |
| | | */ |
| | | public final void addInstanceOf(String className) { |
| | | ensureNotNull(className); |
| | | ifNull(className); |
| | | |
| | | /* |
| | | * Do some basic checks to make sure the string representation is valid. |
| | |
| | | @Override |
| | | public String decodeValue(String value) |
| | | throws IllegalPropertyValueStringException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | try { |
| | | validateValue(value); |
| | |
| | | public <T> Class<? extends T> loadClass(String className, |
| | | Class<T> instanceOf) throws IllegalPropertyValueException, |
| | | ClassCastException { |
| | | ensureNotNull(className, instanceOf); |
| | | ifNull(className, instanceOf); |
| | | |
| | | // Make sure that the named class is valid. |
| | | validateClassName(className); |
| | |
| | | @Override |
| | | public String normalizeValue(String value) |
| | | throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | return value.trim(); |
| | | } |
| | |
| | | @Override |
| | | public void validateValue(String value) |
| | | throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | // Always make sure the name is a valid class name. |
| | | validateClassName(value); |
| | |
| | | |
| | | |
| | | |
| | | import static org.opends.server.util.Validator.ensureNotNull; |
| | | import static org.forgerock.util.Reject.ifNull; |
| | | |
| | | import java.util.EnumSet; |
| | | |
| | |
| | | @Override |
| | | public void validateValue(DN value) |
| | | throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | if (baseDN != null) { |
| | | DN parent = value.parent(); |
| | |
| | | @Override |
| | | public DN decodeValue(String value) |
| | | throws IllegalPropertyValueStringException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | try { |
| | | DN dn = DN.valueOf(value); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | | |
| | | |
| | | |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | import java.util.EnumSet; |
| | | |
| | |
| | | * than the maximum unit. |
| | | */ |
| | | public final void setBaseUnit(String unit) throws IllegalArgumentException { |
| | | ensureNotNull(unit); |
| | | ifNull(unit); |
| | | |
| | | setBaseUnit(DurationUnit.getUnit(unit)); |
| | | } |
| | |
| | | */ |
| | | public final void setBaseUnit(DurationUnit unit) |
| | | throws IllegalArgumentException { |
| | | ensureNotNull(unit); |
| | | ifNull(unit); |
| | | |
| | | // Make sure that the base unit is not bigger than the maximum |
| | | // unit. |
| | |
| | | */ |
| | | @Override |
| | | public void validateValue(Long value) throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | long nvalue = baseUnit.toMilliSeconds(value); |
| | | if (!allowUnlimited && nvalue < lowerLimit) { |
| | |
| | | */ |
| | | @Override |
| | | public String encodeValue(Long value) throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | // Make sure that we correctly encode negative values as |
| | | // "unlimited". |
| | |
| | | @Override |
| | | public Long decodeValue(String value) |
| | | throws IllegalPropertyValueStringException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | // First check for the special "unlimited" value when necessary. |
| | | if (allowUnlimited) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | |
| | | |
| | | |
| | | |
| | | import static org.opends.server.util.Validator.ensureNotNull; |
| | | import static org.forgerock.util.Reject.ifNull; |
| | | |
| | | import java.util.EnumSet; |
| | | import java.util.HashMap; |
| | |
| | | @Override |
| | | public E decodeValue(String value) |
| | | throws IllegalPropertyValueStringException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | String nvalue = value.trim().toLowerCase(); |
| | | E eValue = decodeMap.get(nvalue); |
| | |
| | | @Override |
| | | public String normalizeValue(E value) |
| | | throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | return value.toString().trim().toLowerCase(); |
| | | } |
| | |
| | | @Override |
| | | public void validateValue(E value) |
| | | throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | // No additional validation required. |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | | |
| | | |
| | | |
| | | import static org.opends.server.util.Validator.ensureNotNull; |
| | | import static org.forgerock.util.Reject.ifNull; |
| | | |
| | | import java.util.EnumSet; |
| | | |
| | |
| | | @Override |
| | | public void validateValue(AddressMask value) |
| | | throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | // No additional validation required. |
| | | } |
| | |
| | | @Override |
| | | public AddressMask decodeValue(String value) |
| | | throws IllegalPropertyValueStringException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | try { |
| | | return AddressMask.decode(value); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | | |
| | | |
| | | |
| | | import static org.opends.server.util.Validator.ensureNotNull; |
| | | import static org.forgerock.util.Reject.ifNull; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.net.UnknownHostException; |
| | |
| | | @Override |
| | | public void validateValue(InetAddress value) |
| | | throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | // No additional validation required. |
| | | } |
| | |
| | | @Override |
| | | public InetAddress decodeValue(String value) |
| | | throws IllegalPropertyValueStringException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | try { |
| | | return InetAddress.getByName(value); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | |
| | | |
| | | |
| | | |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | |
| | | */ |
| | | public void setNamingProperty( |
| | | PropertyDefinition<?> namingPropertyDefinition) { |
| | | ensureNotNull(namingPropertyDefinition); |
| | | ifNull(namingPropertyDefinition); |
| | | this.namingPropertyDefinition = namingPropertyDefinition; |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | |
| | | |
| | | |
| | | |
| | | import static org.opends.server.util.Validator.ensureNotNull; |
| | | import static org.forgerock.util.Reject.ifNull; |
| | | |
| | | import java.util.EnumSet; |
| | | import java.util.Locale; |
| | |
| | | @Override |
| | | public void validateValue(Integer value) |
| | | throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | if (!allowUnlimited && value < lowerLimit) { |
| | | throw new IllegalPropertyValueException(this, value); |
| | |
| | | @Override |
| | | public String encodeValue(Integer value) |
| | | throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | // Make sure that we correctly encode negative values as "unlimited". |
| | | if (allowUnlimited) { |
| | |
| | | @Override |
| | | public Integer decodeValue(String value) |
| | | throws IllegalPropertyValueStringException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | if (allowUnlimited) { |
| | | if (value.trim().equalsIgnoreCase(UNLIMITED)) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | | |
| | | |
| | | |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | import java.util.Comparator; |
| | | import java.util.EnumSet; |
| | |
| | | * The administrator action. |
| | | */ |
| | | public final void setAdministratorAction(AdministratorAction adminAction) { |
| | | ensureNotNull(adminAction); |
| | | ifNull(adminAction); |
| | | this.adminAction = adminAction; |
| | | } |
| | | |
| | |
| | | */ |
| | | public final void setDefaultBehaviorProvider( |
| | | DefaultBehaviorProvider<T> defaultBehavior) { |
| | | ensureNotNull(defaultBehavior); |
| | | ifNull(defaultBehavior); |
| | | this.defaultBehavior = defaultBehavior; |
| | | } |
| | | |
| | |
| | | * The property option. |
| | | */ |
| | | public final void setOption(PropertyOption option) { |
| | | ensureNotNull(option); |
| | | ifNull(option); |
| | | options.add(option); |
| | | } |
| | | |
| | |
| | | Class<T> theClass, String propertyName, EnumSet<PropertyOption> options, |
| | | AdministratorAction adminAction, |
| | | DefaultBehaviorProvider<T> defaultBehavior) { |
| | | ensureNotNull(d, theClass, propertyName); |
| | | ensureNotNull(options, adminAction, defaultBehavior); |
| | | ifNull(d, theClass, propertyName); |
| | | ifNull(options, adminAction, defaultBehavior); |
| | | |
| | | this.definition = d; |
| | | this.theClass = theClass; |
| | |
| | | * the second. |
| | | */ |
| | | public int compare(T o1, T o2) { |
| | | ensureNotNull(o1, o2); |
| | | ifNull(o1, o2); |
| | | |
| | | String s1 = normalizeValue(o1); |
| | | String s2 = normalizeValue(o2); |
| | |
| | | * If the property value is invalid. |
| | | */ |
| | | public String encodeValue(T value) throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | return value.toString(); |
| | | } |
| | |
| | | * If the property value is invalid. |
| | | */ |
| | | public String normalizeValue(T value) throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | return encodeValue(value); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | |
| | | |
| | | |
| | | |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | import java.util.EnumSet; |
| | | import java.util.Locale; |
| | |
| | | * The relation option. |
| | | */ |
| | | public final void setOption(RelationOption option) { |
| | | ensureNotNull(option); |
| | | ifNull(option); |
| | | common.options.add(option); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | | |
| | | |
| | | |
| | | import static org.opends.server.util.Validator.ensureNotNull; |
| | | import static org.forgerock.util.Reject.ifNull; |
| | | |
| | | import java.util.EnumSet; |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public void validateValue(Long value) throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | if (!allowUnlimited && value < lowerLimit) { |
| | | throw new IllegalPropertyValueException(this, value); |
| | |
| | | */ |
| | | @Override |
| | | public String encodeValue(Long value) throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | // Make sure that we correctly encode negative values as "unlimited". |
| | | if (allowUnlimited) { |
| | |
| | | @Override |
| | | public Long decodeValue(String value) |
| | | throws IllegalPropertyValueStringException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | // First check for the special "unlimited" value when necessary. |
| | | if (allowUnlimited) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | |
| | | |
| | | |
| | | |
| | | import static org.opends.server.util.Validator.ensureNotNull; |
| | | import static org.forgerock.util.Reject.ifNull; |
| | | |
| | | import java.util.EnumSet; |
| | | import java.util.Locale; |
| | |
| | | @Override |
| | | public String decodeValue(String value) |
| | | throws IllegalPropertyValueStringException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | try { |
| | | validateValue(value); |
| | |
| | | @Override |
| | | public String normalizeValue(String value) |
| | | throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | if (isCaseInsensitive()) { |
| | | return value.trim().toLowerCase(); |
| | |
| | | */ |
| | | @Override |
| | | public void validateValue(String value) throws IllegalPropertyValueException { |
| | | ensureNotNull(value); |
| | | ifNull(value); |
| | | |
| | | if (pattern != null) { |
| | | Matcher matcher = pattern.matcher(value); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin; |
| | | import org.opends.messages.Message; |
| | |
| | | import java.util.MissingResourceException; |
| | | |
| | | import org.opends.server.admin.std.meta.RootCfgDefn; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | |
| | | |
| | |
| | | * If the tag name was not recognized. |
| | | */ |
| | | public static Tag valueOf(String name) throws IllegalArgumentException { |
| | | Validator.ensureNotNull(name); |
| | | Reject.ifNull(name); |
| | | |
| | | // Hack to force initialization of the tag definitions. |
| | | RootCfgDefn.getInstance(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin.client; |
| | |
| | | import org.opends.server.admin.DecodingException; |
| | | import org.opends.server.admin.ManagedObjectDefinition; |
| | | import org.opends.server.admin.PropertyException; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | |
| | | |
| | |
| | | // Create the message. |
| | | private static Message createMessage(ManagedObject<?> partialManagedObject, |
| | | Collection<PropertyException> causes) { |
| | | Validator.ensureNotNull(causes); |
| | | Validator.ensureTrue(!causes.isEmpty()); |
| | | Reject.ifNull(causes); |
| | | Reject.ifFalse(!causes.isEmpty()); |
| | | |
| | | ManagedObjectDefinition<?, ?> d = partialManagedObject |
| | | .getManagedObjectDefinition(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin.client; |
| | |
| | | import org.opends.messages.MessageBuilder; |
| | | import org.opends.server.admin.OperationsException; |
| | | import org.opends.server.admin.PropertyIsMandatoryException; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | |
| | | |
| | |
| | | // Create the message. |
| | | private static Message createMessage( |
| | | Collection<PropertyIsMandatoryException> causes) { |
| | | Validator.ensureNotNull(causes); |
| | | Validator.ensureTrue(!causes.isEmpty()); |
| | | Reject.ifNull(causes); |
| | | Reject.ifFalse(!causes.isEmpty()); |
| | | |
| | | if (causes.size() == 1) { |
| | | return ERR_MISSING_MANDATORY_PROPERTIES_EXCEPTION_SINGLE.get(causes |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin.client; |
| | |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.messages.MessageBuilder; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | // Gets the default message. |
| | | private static Message getDefaultMessage(Collection<Message> messages) { |
| | | Validator.ensureNotNull(messages); |
| | | Validator.ensureTrue(!messages.isEmpty()); |
| | | Reject.ifNull(messages); |
| | | Reject.ifFalse(!messages.isEmpty()); |
| | | |
| | | if (messages.size() == 1) { |
| | | return ERR_OPERATION_REJECTED_EXCEPTION_SINGLE.get(messages.iterator() |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin.client.ldap; |
| | |
| | | import org.opends.server.admin.LDAPProfile; |
| | | import org.opends.server.admin.client.ManagementContext; |
| | | import org.opends.server.admin.client.spi.Driver; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | |
| | | |
| | |
| | | * @return Returns the new management context. |
| | | */ |
| | | public static ManagementContext createFromContext(LDAPConnection connection) { |
| | | Validator.ensureNotNull(connection); |
| | | Reject.ifNull(connection); |
| | | return new LDAPManagementContext(connection, LDAPProfile.getInstance()); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.condition; |
| | | |
| | |
| | | import org.opends.server.admin.client.ManagementContext; |
| | | import org.opends.server.admin.server.ServerManagedObject; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | |
| | | |
| | |
| | | * logical AND. |
| | | */ |
| | | public ANDCondition(Condition... conditions) { |
| | | Validator.ensureNotNull(conditions); |
| | | Reject.ifNull(conditions); |
| | | this.conditions = Arrays.asList(conditions); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.condition; |
| | | |
| | |
| | | import org.opends.server.admin.client.ManagementContext; |
| | | import org.opends.server.admin.server.ServerManagedObject; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | |
| | | |
| | |
| | | * value. |
| | | */ |
| | | public ContainsCondition(String propertyName, String stringValue) { |
| | | Validator.ensureNotNull(propertyName, stringValue); |
| | | Reject.ifNull(propertyName, stringValue); |
| | | this.propertyName = propertyName; |
| | | this.propertyStringValue = stringValue; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.condition; |
| | | |
| | |
| | | import org.opends.server.admin.client.ManagementContext; |
| | | import org.opends.server.admin.server.ServerManagedObject; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | |
| | | |
| | |
| | | * The property name. |
| | | */ |
| | | public IsPresentCondition(String propertyName) { |
| | | Validator.ensureNotNull(propertyName); |
| | | Reject.ifNull(propertyName); |
| | | this.propertyName = propertyName; |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.condition; |
| | | |
| | |
| | | import org.opends.server.admin.client.ManagementContext; |
| | | import org.opends.server.admin.server.ServerManagedObject; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | |
| | | |
| | |
| | | * The sub-condition which will be inverted. |
| | | */ |
| | | public NOTCondition(Condition condition) { |
| | | Validator.ensureNotNull(condition); |
| | | Reject.ifNull(condition); |
| | | this.condition = condition; |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.condition; |
| | | |
| | |
| | | import org.opends.server.admin.client.ManagementContext; |
| | | import org.opends.server.admin.server.ServerManagedObject; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | |
| | | |
| | |
| | | * logical OR. |
| | | */ |
| | | public ORCondition(Condition... conditions) { |
| | | Validator.ensureNotNull(conditions); |
| | | Reject.ifNull(conditions); |
| | | this.conditions = Arrays.asList(conditions); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin.server; |
| | |
| | | import org.opends.messages.Message; |
| | | import org.opends.messages.MessageBuilder; |
| | | import org.opends.server.admin.DecodingException; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | // Gets the default message. |
| | | private static Message getDefaultMessage(Collection<Message> messages) { |
| | | Validator.ensureNotNull(messages); |
| | | Validator.ensureTrue(!messages.isEmpty()); |
| | | Reject.ifNull(messages); |
| | | Reject.ifFalse(!messages.isEmpty()); |
| | | |
| | | if (messages.size() == 1) { |
| | | return ERR_CONSTRAINT_VIOLATION_EXCEPTION_SINGLE.get(messages.iterator() |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin.server; |
| | |
| | | import org.opends.server.admin.DecodingException; |
| | | import org.opends.server.admin.ManagedObjectDefinition; |
| | | import org.opends.server.admin.PropertyException; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | |
| | | |
| | |
| | | private static Message createMessage( |
| | | ServerManagedObject<?> partialManagedObject, |
| | | Collection<PropertyException> causes) { |
| | | Validator.ensureNotNull(causes); |
| | | Validator.ensureTrue(!causes.isEmpty()); |
| | | Reject.ifNull(causes); |
| | | Reject.ifFalse(!causes.isEmpty()); |
| | | |
| | | ManagedObjectDefinition<?, ?> d = partialManagedObject |
| | | .getManagedObjectDefinition(); |
| | |
| | | import static org.opends.server.util.StaticUtils.isDigit; |
| | | import static org.opends.server.util.StaticUtils.isHexDigit; |
| | | import static org.opends.server.util.StaticUtils.hexStringToByteArray; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | |
| | | List<PatternRDN[]> subAnyElements, |
| | | PatternRDN[] subFinal) |
| | | { |
| | | Validator.ensureNotNull(subAnyElements); |
| | | Reject.ifNull(subAnyElements); |
| | | this.subInitial = subInitial; |
| | | this.subAnyElements = subAnyElements; |
| | | this.subFinal = subFinal; |
| | |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.schema.BooleanSyntax; |
| | | import org.opends.server.schema.GeneralizedTimeSyntax; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | |
| | | } |
| | | |
| | | |
| | | Validator.ensureTrue(config instanceof BackupBackendCfg); |
| | | Reject.ifFalse(config instanceof BackupBackendCfg); |
| | | |
| | | currentConfig = (BackupBackendCfg)config; |
| | | } |
| | |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.util.*; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.server.loggers.ErrorLogger.*; |
| | |
| | | { |
| | | if (config != null) |
| | | { |
| | | Validator.ensureTrue(config instanceof LDIFBackendCfg); |
| | | Reject.ifFalse(config instanceof LDIFBackendCfg); |
| | | currentConfig = (LDIFBackendCfg) config; |
| | | currentConfig.addLDIFChangeListener(this); |
| | | |
| | |
| | | import org.opends.server.util.LDIFException; |
| | | import org.opends.server.util.LDIFReader; |
| | | import org.opends.server.util.LDIFWriter; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | |
| | | { |
| | | if (config != null) |
| | | { |
| | | Validator.ensureTrue(config instanceof MemoryBackendCfg); |
| | | Reject.ifFalse(config instanceof MemoryBackendCfg); |
| | | MemoryBackendCfg cfg = (MemoryBackendCfg)config; |
| | | DN[] baseDNs = new DN[cfg.getBaseDN().size()]; |
| | | cfg.getBaseDN().toArray(baseDNs); |
| | |
| | | import org.opends.server.util.DynamicConstants; |
| | | import org.opends.server.util.LDIFWriter; |
| | | import org.opends.server.util.TimeThread; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | |
| | | |
| | |
| | | public void configureBackend(final Configuration config) |
| | | throws ConfigException |
| | | { |
| | | Validator.ensureNotNull(config); |
| | | Validator.ensureTrue(config instanceof MonitorBackendCfg); |
| | | Reject.ifNull(config); |
| | | Reject.ifFalse(config instanceof MonitorBackendCfg); |
| | | |
| | | final MonitorBackendCfg cfg = (MonitorBackendCfg) config; |
| | | final ConfigEntry configEntry = DirectoryServer.getConfigEntry(cfg.dn()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends; |
| | | |
| | |
| | | import org.opends.server.util.LDIFException; |
| | | import org.opends.server.util.LDIFReader; |
| | | import org.opends.server.util.LDIFWriter; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | |
| | | { |
| | | if (config != null) |
| | | { |
| | | Validator.ensureTrue(config instanceof BackendCfg); |
| | | Reject.ifFalse(config instanceof BackendCfg); |
| | | BackendCfg cfg = (BackendCfg)config; |
| | | DN[] cfgBaseDNs = new DN[cfg.getBaseDN().size()]; |
| | | cfg.getBaseDN().toArray(cfgBaseDNs); |
| | |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.util.LDIFWriter; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.messages.ConfigMessages. |
| | |
| | | public void configureBackend(Configuration config) |
| | | throws ConfigException |
| | | { |
| | | Validator.ensureNotNull(config); |
| | | Validator.ensureTrue(config instanceof RootDSEBackendCfg); |
| | | Reject.ifNull(config); |
| | | Reject.ifFalse(config instanceof RootDSEBackendCfg); |
| | | currentConfig = (RootDSEBackendCfg)config; |
| | | configEntryDN = config.dn(); |
| | | } |
| | |
| | | import org.opends.server.util.LDIFException; |
| | | import org.opends.server.util.LDIFReader; |
| | | import org.opends.server.util.LDIFWriter; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | |
| | | throw new ConfigException(message); |
| | | } |
| | | |
| | | Validator.ensureTrue(config instanceof SchemaBackendCfg); |
| | | Reject.ifFalse(config instanceof SchemaBackendCfg); |
| | | SchemaBackendCfg cfg = (SchemaBackendCfg)config; |
| | | ConfigEntry configEntry = DirectoryServer.getConfigEntry(cfg.dn()); |
| | | |
| | |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.util.CertificateManager; |
| | | import org.opends.server.util.SetupUtils; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | |
| | | |
| | |
| | | @Override() |
| | | public void configureBackend(Configuration config) throws ConfigException |
| | | { |
| | | Validator.ensureNotNull(config); |
| | | Validator.ensureTrue(config instanceof TrustStoreBackendCfg); |
| | | Reject.ifNull(config); |
| | | Reject.ifFalse(config instanceof TrustStoreBackendCfg); |
| | | |
| | | configuration = (TrustStoreBackendCfg)config; |
| | | } |
| | |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.util.RuntimeInformation; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | import com.sleepycat.je.DatabaseException; |
| | | import com.sleepycat.je.Durability; |
| | |
| | | public void configureBackend(Configuration cfg) |
| | | throws ConfigException |
| | | { |
| | | Validator.ensureNotNull(cfg); |
| | | Validator.ensureTrue(cfg instanceof LocalDBBackendCfg); |
| | | Reject.ifNull(cfg); |
| | | Reject.ifFalse(cfg instanceof LocalDBBackendCfg); |
| | | |
| | | this.cfg = (LocalDBBackendCfg)cfg; |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | | import org.opends.server.types.EntryEncodeConfig; |
| | | |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | /** |
| | | * Configuration class to indicate desired compression and cryptographic options |
| | |
| | | |
| | | if (compressedSchema == null) |
| | | { |
| | | ensureTrue(! compactEncoding); |
| | | ifFalse(! compactEncoding); |
| | | this.encodeConfig = new EntryEncodeConfig(false, compactEncoding, false); |
| | | } |
| | | else |
| | |
| | | { |
| | | if (compressedSchema == null) |
| | | { |
| | | ensureTrue(! compactEncoding); |
| | | ifFalse(! compactEncoding); |
| | | this.encodeConfig = new EntryEncodeConfig(false, compactEncoding, |
| | | compactEncoding); |
| | | } |
| | |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.util.*; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | |
| | | public void configureBackend(Configuration config) |
| | | throws ConfigException |
| | | { |
| | | Validator.ensureNotNull(config); |
| | | Validator.ensureTrue(config instanceof TaskBackendCfg); |
| | | Reject.ifNull(config); |
| | | Reject.ifFalse(config instanceof TaskBackendCfg); |
| | | |
| | | TaskBackendCfg cfg = (TaskBackendCfg)config; |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.controls; |
| | | import org.opends.messages.Message; |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.asn1.*; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | |
| | | String rawAttributeType, |
| | | ByteString rawAssertionValue) |
| | | { |
| | | Validator.ensureNotNull(rawAttributeType,rawAssertionValue); |
| | | Reject.ifNull(rawAttributeType,rawAssertionValue); |
| | | |
| | | return new MatchedValuesFilter(EQUALITY_MATCH_TYPE, rawAttributeType, |
| | | rawAssertionValue, null, null, null, null); |
| | |
| | | AttributeType attributeType, |
| | | AttributeValue assertionValue) |
| | | { |
| | | Validator.ensureNotNull(attributeType, assertionValue); |
| | | Reject.ifNull(attributeType, assertionValue); |
| | | String rawAttributeType = attributeType.getNameOrOID(); |
| | | ByteString rawAssertionValue = assertionValue.getValue(); |
| | | |
| | |
| | | List<ByteString> subAny, |
| | | ByteString subFinal) |
| | | { |
| | | Validator.ensureNotNull(rawAttributeType); |
| | | Reject.ifNull(rawAttributeType); |
| | | return new MatchedValuesFilter(SUBSTRINGS_TYPE, rawAttributeType, null, |
| | | subInitial, subAny, subFinal, null); |
| | | } |
| | |
| | | List<ByteString> subAny, |
| | | ByteString subFinal) |
| | | { |
| | | Validator.ensureNotNull(attributeType); |
| | | Reject.ifNull(attributeType); |
| | | String rawAttributeType = attributeType.getNameOrOID(); |
| | | |
| | | MatchedValuesFilter filter = |
| | |
| | | String rawAttributeType, |
| | | ByteString rawAssertionValue) |
| | | { |
| | | Validator.ensureNotNull(rawAttributeType, rawAssertionValue); |
| | | Reject.ifNull(rawAttributeType, rawAssertionValue); |
| | | |
| | | return new MatchedValuesFilter(GREATER_OR_EQUAL_TYPE, rawAttributeType, |
| | | rawAssertionValue, null, null, null, null); |
| | |
| | | AttributeType attributeType, |
| | | AttributeValue assertionValue) |
| | | { |
| | | Validator.ensureNotNull(attributeType, assertionValue); |
| | | Reject.ifNull(attributeType, assertionValue); |
| | | |
| | | String rawAttributeType = attributeType.getNameOrOID(); |
| | | ByteString rawAssertionValue = assertionValue.getValue(); |
| | |
| | | String rawAttributeType, |
| | | ByteString rawAssertionValue) |
| | | { |
| | | Validator.ensureNotNull(rawAttributeType, rawAssertionValue); |
| | | Reject.ifNull(rawAttributeType, rawAssertionValue); |
| | | return new MatchedValuesFilter(LESS_OR_EQUAL_TYPE, rawAttributeType, |
| | | rawAssertionValue, null, null, null, null); |
| | | } |
| | |
| | | AttributeType attributeType, |
| | | AttributeValue assertionValue) |
| | | { |
| | | Validator.ensureNotNull(attributeType, assertionValue); |
| | | Reject.ifNull(attributeType, assertionValue); |
| | | |
| | | String rawAttributeType = attributeType.getNameOrOID(); |
| | | ByteString rawAssertionValue = assertionValue.getValue(); |
| | |
| | | */ |
| | | public static MatchedValuesFilter createPresentFilter(String rawAttributeType) |
| | | { |
| | | Validator.ensureNotNull(rawAttributeType) ; |
| | | Reject.ifNull(rawAttributeType) ; |
| | | return new MatchedValuesFilter(PRESENT_TYPE, rawAttributeType, null, null, |
| | | null, null, null); |
| | | } |
| | |
| | | public static MatchedValuesFilter createPresentFilter( |
| | | AttributeType attributeType) |
| | | { |
| | | Validator.ensureNotNull(attributeType); |
| | | Reject.ifNull(attributeType); |
| | | String rawAttributeType = attributeType.getNameOrOID(); |
| | | |
| | | MatchedValuesFilter filter = |
| | |
| | | String rawAttributeType, |
| | | ByteString rawAssertionValue) |
| | | { |
| | | Validator.ensureNotNull(rawAttributeType,rawAssertionValue); |
| | | Reject.ifNull(rawAttributeType,rawAssertionValue); |
| | | |
| | | return new MatchedValuesFilter(APPROXIMATE_MATCH_TYPE, rawAttributeType, |
| | | rawAssertionValue, null, null, null, null); |
| | |
| | | AttributeType attributeType, |
| | | AttributeValue assertionValue) |
| | | { |
| | | Validator.ensureNotNull(attributeType,assertionValue); |
| | | Reject.ifNull(attributeType,assertionValue); |
| | | String rawAttributeType = attributeType.getNameOrOID(); |
| | | ByteString rawAssertionValue = assertionValue.getValue(); |
| | | |
| | |
| | | String matchingRuleID, |
| | | ByteString rawAssertionValue) |
| | | { |
| | | Validator |
| | | .ensureNotNull(rawAttributeType, matchingRuleID, rawAssertionValue); |
| | | Reject.ifNull(rawAttributeType, matchingRuleID, rawAssertionValue); |
| | | return new MatchedValuesFilter(EXTENSIBLE_MATCH_TYPE, rawAttributeType, |
| | | rawAssertionValue, null, null, null, |
| | | matchingRuleID); |
| | |
| | | MatchingRule matchingRule, |
| | | AttributeValue assertionValue) |
| | | { |
| | | Validator.ensureNotNull(attributeType, matchingRule, assertionValue); |
| | | Reject.ifNull(attributeType, matchingRule, assertionValue); |
| | | String rawAttributeType = attributeType.getNameOrOID(); |
| | | String matchingRuleID = matchingRule.getOID(); |
| | | ByteString rawAssertionValue = assertionValue.getValue(); |
| | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | /** |
| | | * This class implements version 2 of the proxied authorization control as |
| | |
| | | { |
| | | super(OID_PROXIED_AUTH_V2, isCritical); |
| | | |
| | | ensureNotNull(authorizationID); |
| | | ifNull(authorizationID); |
| | | |
| | | this.authorizationID = authorizationID; |
| | | } |
| | |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.ResultCode; |
| | | import org.opends.server.api.Backend; |
| | | import static org.opends.server.util.Validator.ensureNotNull; |
| | | import static org.forgerock.util.Reject.ifNull; |
| | | import org.opends.messages.Message; |
| | | import static org.opends.messages.CoreMessages.*; |
| | | |
| | |
| | | { |
| | | LinkedList<Message> errors = new LinkedList<Message>(); |
| | | |
| | | ensureNotNull(baseDN); |
| | | ifNull(baseDN); |
| | | |
| | | // Make sure that the Directory Server actually contains a backend with |
| | | // the specified base DN. |
| | |
| | | import static org.opends.server.util.DynamicConstants.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | import java.io.*; |
| | | import java.lang.management.ManagementFactory; |
| | |
| | | import org.opends.server.tools.ConfigureWindowsService; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.util.*; |
| | | import org.forgerock.util.Reject; |
| | | import org.opends.server.util.args.*; |
| | | import org.opends.server.workflowelement.WorkflowElement; |
| | | import org.opends.server.workflowelement.WorkflowElementConfigManager; |
| | |
| | | public static void setOfflineSchemaChanges(List<Modification> |
| | | offlineSchemaChanges) |
| | | { |
| | | ensureNotNull(offlineSchemaChanges); |
| | | ifNull(offlineSchemaChanges); |
| | | |
| | | directoryServer.offlineSchemaChanges = offlineSchemaChanges; |
| | | } |
| | |
| | | */ |
| | | public static AuthenticationPolicy getAuthenticationPolicy(DN configEntryDN) |
| | | { |
| | | Validator.ensureNotNull(configEntryDN); |
| | | Reject.ifNull(configEntryDN); |
| | | return directoryServer.authenticationPolicies.get(configEntryDN); |
| | | } |
| | | |
| | |
| | | public static void registerAuthenticationPolicy(DN configEntryDN, |
| | | AuthenticationPolicy policy) |
| | | { |
| | | Validator.ensureNotNull(configEntryDN, policy); |
| | | Reject.ifNull(configEntryDN, policy); |
| | | |
| | | // Ensure default policy is synchronized. |
| | | synchronized (directoryServer.authenticationPolicies) |
| | |
| | | */ |
| | | public static void deregisterAuthenticationPolicy(DN configEntryDN) |
| | | { |
| | | Validator.ensureNotNull(configEntryDN); |
| | | Reject.ifNull(configEntryDN); |
| | | |
| | | // Ensure default policy is synchronized. |
| | | synchronized (directoryServer.authenticationPolicies) |
| | |
| | | */ |
| | | public static RotationPolicy getRotationPolicy(DN configEntryDN) |
| | | { |
| | | Validator.ensureNotNull(configEntryDN); |
| | | Reject.ifNull(configEntryDN); |
| | | |
| | | return directoryServer.rotationPolicies.get(configEntryDN); |
| | | } |
| | |
| | | public static void registerRotationPolicy(DN configEntryDN, |
| | | RotationPolicy policy) |
| | | { |
| | | Validator.ensureNotNull(configEntryDN, policy); |
| | | Reject.ifNull(configEntryDN, policy); |
| | | |
| | | directoryServer.rotationPolicies.put(configEntryDN, policy); |
| | | } |
| | |
| | | */ |
| | | public static void deregisterRotationPolicy(DN configEntryDN) |
| | | { |
| | | Validator.ensureNotNull(configEntryDN); |
| | | Reject.ifNull(configEntryDN); |
| | | |
| | | directoryServer.rotationPolicies.remove(configEntryDN); |
| | | } |
| | |
| | | */ |
| | | public static RetentionPolicy getRetentionPolicy(DN configEntryDN) |
| | | { |
| | | Validator.ensureNotNull(configEntryDN); |
| | | Reject.ifNull(configEntryDN); |
| | | |
| | | return directoryServer.retentionPolicies.get(configEntryDN); |
| | | } |
| | |
| | | public static void registerRetentionPolicy(DN configEntryDN, |
| | | RetentionPolicy policy) |
| | | { |
| | | Validator.ensureNotNull(configEntryDN, policy); |
| | | Reject.ifNull(configEntryDN, policy); |
| | | |
| | | directoryServer.retentionPolicies.put(configEntryDN, policy); |
| | | } |
| | |
| | | */ |
| | | public static void deregisterRetentionPolicy(DN configEntryDN) |
| | | { |
| | | Validator.ensureNotNull(configEntryDN); |
| | | Reject.ifNull(configEntryDN); |
| | | |
| | | directoryServer.retentionPolicies.remove(configEntryDN); |
| | | } |
| | |
| | | public static void registerBackend(Backend backend) |
| | | throws DirectoryException |
| | | { |
| | | ensureNotNull(backend); |
| | | ifNull(backend); |
| | | |
| | | String backendID = backend.getBackendID(); |
| | | ensureNotNull(backendID); |
| | | ifNull(backendID); |
| | | |
| | | synchronized (directoryServer) |
| | | { |
| | |
| | | */ |
| | | public static void deregisterBackend(Backend backend) |
| | | { |
| | | ensureNotNull(backend); |
| | | ifNull(backend); |
| | | |
| | | synchronized (directoryServer) |
| | | { |
| | |
| | | boolean isPrivate) |
| | | throws DirectoryException |
| | | { |
| | | ensureNotNull(baseDN, backend); |
| | | ifNull(baseDN, backend); |
| | | |
| | | synchronized (directoryServer) |
| | | { |
| | |
| | | public static void deregisterBaseDN(DN baseDN) |
| | | throws DirectoryException |
| | | { |
| | | ensureNotNull(baseDN); |
| | | ifNull(baseDN); |
| | | |
| | | synchronized(directoryServer) { |
| | | |
| | |
| | | */ |
| | | public static void registerWorkflowElement(WorkflowElement we) |
| | | throws DirectoryException { |
| | | ensureNotNull(we); |
| | | ifNull(we); |
| | | |
| | | String workflowElementID = we.getWorkflowElementID(); |
| | | ensureNotNull(workflowElementID); |
| | | ifNull(workflowElementID); |
| | | |
| | | synchronized (directoryServer) |
| | | { |
| | |
| | | * {@code null}. |
| | | */ |
| | | public static void deregisterWorkflowElement(WorkflowElement we) { |
| | | ensureNotNull(we); |
| | | ifNull(we); |
| | | |
| | | String workflowElementID = we.getWorkflowElementID(); |
| | | ensureNotNull(workflowElementID); |
| | | ifNull(workflowElementID); |
| | | |
| | | synchronized (directoryServer) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.util.Validator.ensureNotNull; |
| | | import static org.forgerock.util.Reject.ifNull; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.Observable; |
| | |
| | | public void register() |
| | | throws DirectoryException |
| | | { |
| | | ensureNotNull(workflowID); |
| | | ifNull(workflowID); |
| | | |
| | | synchronized (registeredWorkflowsLock) |
| | | { |
| | |
| | | */ |
| | | public void deregister() |
| | | { |
| | | ensureNotNull(workflowID); |
| | | ifNull(workflowID); |
| | | |
| | | // Deregister the workflow with the list of objects to notify when |
| | | // a workflow element is created or deleted. |
| | |
| | | import static org.opends.server.loggers.ErrorLogger.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.lang.reflect.Method; |
| | |
| | | */ |
| | | void register() throws InitializationException |
| | | { |
| | | ensureNotNull(networkGroupID); |
| | | ifNull(networkGroupID); |
| | | |
| | | synchronized (registeredNetworkGroupsLock) |
| | | { |
| | |
| | | throws DirectoryException |
| | | { |
| | | String workflowID = workflowNode.getWorkflowImpl().getWorkflowId(); |
| | | ensureNotNull(workflowID); |
| | | ifNull(workflowID); |
| | | |
| | | // If the network group is the "internal" network group then bypass |
| | | // the check because the internal network group may contain |
| | |
| | | throws DirectoryException |
| | | { |
| | | String workflowID = workflowNode.getWorkflowImpl().getWorkflowId(); |
| | | ensureNotNull(workflowID); |
| | | ifNull(workflowID); |
| | | |
| | | synchronized (registeredWorkflowNodesLock) |
| | | { |
| | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | import org.opends.server.util.SelectableCertificateKeyManager; |
| | | import org.opends.server.util.StaticUtils; |
| | | import org.opends.server.util.Base64; |
| | |
| | | * {@code KeyEntryID}. |
| | | */ |
| | | public KeyEntryID(final byte[] keyEntryID) { |
| | | Validator.ensureTrue(getByteValueLength() == keyEntryID.length); |
| | | Reject.ifFalse(getByteValueLength() == keyEntryID.length); |
| | | long hiBytes = 0; |
| | | long loBytes = 0; |
| | | for (int i = 0; i < 8; ++i) { |
| | |
| | | final int ivLengthBits, |
| | | final boolean isCompromised) |
| | | throws CryptoManagerException { |
| | | Validator.ensureNotNull(keyIDString, transformation, secretKey); |
| | | Validator.ensureTrue(0 <= ivLengthBits); |
| | | Reject.ifNull(keyIDString, transformation, secretKey); |
| | | Reject.ifFalse(0 <= ivLengthBits); |
| | | |
| | | final KeyEntryID keyID = new KeyEntryID(keyIDString); |
| | | |
| | |
| | | final CryptoManagerImpl cryptoManager, |
| | | final String transformation, |
| | | final int keyLengthBits) { |
| | | Validator.ensureNotNull(cryptoManager, transformation); |
| | | Validator.ensureTrue(0 < keyLengthBits); |
| | | Reject.ifNull(cryptoManager, transformation); |
| | | Reject.ifFalse(0 < keyLengthBits); |
| | | |
| | | CipherKeyEntry keyEntry = null; |
| | | // search for an existing key that satisfies the request |
| | |
| | | * @param ivLengthBits The initiazliation vector length in bits. |
| | | */ |
| | | private void setIVLengthBits(int ivLengthBits) { |
| | | Validator.ensureTrue(-1 == fIVLengthBits && 0 <= ivLengthBits); |
| | | Reject.ifFalse(-1 == fIVLengthBits && 0 <= ivLengthBits); |
| | | fIVLengthBits = ivLengthBits; |
| | | } |
| | | |
| | |
| | | final int mode, |
| | | final byte[] initializationVector) |
| | | throws CryptoManagerException { |
| | | Validator.ensureTrue(Cipher.ENCRYPT_MODE == mode |
| | | Reject.ifFalse(Cipher.ENCRYPT_MODE == mode |
| | | || Cipher.DECRYPT_MODE == mode); |
| | | Validator.ensureTrue(Cipher.ENCRYPT_MODE != mode |
| | | Reject.ifFalse(Cipher.ENCRYPT_MODE != mode |
| | | || null == initializationVector); |
| | | Validator.ensureTrue(-1 != keyEntry.getIVLengthBits() |
| | | Reject.ifFalse(-1 != keyEntry.getIVLengthBits() |
| | | || Cipher.ENCRYPT_MODE == mode); |
| | | Validator.ensureTrue(null == initializationVector |
| | | Reject.ifFalse(null == initializationVector |
| | | || initializationVector.length * Byte.SIZE |
| | | == keyEntry.getIVLengthBits()); |
| | | |
| | |
| | | final String algorithm, |
| | | final int keyLengthBits) |
| | | throws CryptoManagerException { |
| | | Validator.ensureNotNull(algorithm); |
| | | Reject.ifNull(algorithm); |
| | | |
| | | final Map<KeyEntryID, MacKeyEntry> cache = (null == cryptoManager) |
| | | ? null : cryptoManager.macKeyEntryCache; |
| | |
| | | final int secretKeyLengthBits, |
| | | final boolean isCompromised) |
| | | throws CryptoManagerException { |
| | | Validator.ensureNotNull(keyIDString, secretKey); |
| | | Reject.ifNull(keyIDString, secretKey); |
| | | |
| | | final KeyEntryID keyID = new KeyEntryID(keyIDString); |
| | | |
| | |
| | | final CryptoManagerImpl cryptoManager, |
| | | final String algorithm, |
| | | final int keyLengthBits) { |
| | | Validator.ensureNotNull(cryptoManager, algorithm); |
| | | Validator.ensureTrue(0 < keyLengthBits); |
| | | Reject.ifNull(cryptoManager, algorithm); |
| | | Reject.ifFalse(0 < keyLengthBits); |
| | | |
| | | MacKeyEntry keyEntry = null; |
| | | // search for an existing key that satisfies the request |
| | |
| | | public String getMacEngineKeyEntryID(final String macAlgorithm, |
| | | final int keyLengthBits) |
| | | throws CryptoManagerException { |
| | | Validator.ensureNotNull(macAlgorithm); |
| | | Reject.ifNull(macAlgorithm); |
| | | |
| | | MacKeyEntry keyEntry = MacKeyEntry.getKeyEntry(this, macAlgorithm, |
| | | keyLengthBits); |
| | |
| | | byte[] data) |
| | | throws GeneralSecurityException, CryptoManagerException |
| | | { |
| | | Validator.ensureNotNull(cipherTransformation, data); |
| | | Reject.ifNull(cipherTransformation, data); |
| | | |
| | | CipherKeyEntry keyEntry = CipherKeyEntry.getKeyEntry(this, |
| | | cipherTransformation, keyLengthBits); |
| | |
| | | OutputStream outputStream) |
| | | throws CryptoManagerException |
| | | { |
| | | Validator.ensureNotNull(cipherTransformation, outputStream); |
| | | Reject.ifNull(cipherTransformation, outputStream); |
| | | |
| | | CipherKeyEntry keyEntry = CipherKeyEntry.getKeyEntry( |
| | | this, cipherTransformation, keyLengthBits); |
| | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | |
| | | |
| | |
| | | { |
| | | super(); |
| | | |
| | | ensureNotNull(groupEntryDN, memberURLs); |
| | | ifNull(groupEntryDN, memberURLs); |
| | | |
| | | this.groupEntryDN = groupEntryDN; |
| | | this.memberURLs = memberURLs; |
| | |
| | | public DynamicGroup newInstance(Entry groupEntry) |
| | | throws DirectoryException |
| | | { |
| | | ensureNotNull(groupEntry); |
| | | ifNull(groupEntry); |
| | | |
| | | |
| | | // Get the memberURL attribute from the entry, if there is one, and parse |
| | |
| | | @Override() |
| | | public boolean isGroupDefinition(Entry entry) |
| | | { |
| | | ensureNotNull(entry); |
| | | ifNull(entry); |
| | | |
| | | // FIXME -- This needs to exclude enhanced groups once we have support for |
| | | //them. |
| | |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | |
| | | |
| | |
| | | DN baseDN, SearchScope scope, |
| | | SearchFilter filter) |
| | | { |
| | | ensureNotNull(groupDN, memberDNs); |
| | | ifNull(groupDN, memberDNs); |
| | | |
| | | this.groupDN = groupDN; |
| | | this.memberDNs = new ArrayList<ByteString>(memberDNs); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | import org.opends.messages.Message; |
| | |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | |
| | | |
| | |
| | | */ |
| | | public SimpleStaticGroupMemberList(DN groupDN, Set<ByteString> memberDNs) |
| | | { |
| | | ensureNotNull(groupDN, memberDNs); |
| | | ifNull(groupDN, memberDNs); |
| | | |
| | | this.groupDN = groupDN; |
| | | this.memberDNs = new ArrayList<ByteString>(memberDNs); |
| | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | |
| | | |
| | |
| | | super(); |
| | | |
| | | |
| | | ensureNotNull(groupEntryDN, memberAttributeType, memberDNs); |
| | | ifNull(groupEntryDN, memberAttributeType, memberDNs); |
| | | |
| | | this.groupEntryDN = groupEntryDN; |
| | | this.memberAttributeType = memberAttributeType; |
| | |
| | | public StaticGroup newInstance(Entry groupEntry) |
| | | throws DirectoryException |
| | | { |
| | | ensureNotNull(groupEntry); |
| | | ifNull(groupEntry); |
| | | |
| | | |
| | | // Determine whether it is a groupOfNames, groupOfEntries or |
| | |
| | | @Override() |
| | | public boolean isGroupDefinition(Entry entry) |
| | | { |
| | | ensureNotNull(entry); |
| | | ifNull(entry); |
| | | |
| | | // FIXME -- This needs to exclude enhanced groups once we have support for |
| | | //them. |
| | |
| | | public void addNestedGroup(DN nestedGroupDN) |
| | | throws UnsupportedOperationException, DirectoryException |
| | | { |
| | | ensureNotNull(nestedGroupDN); |
| | | ifNull(nestedGroupDN); |
| | | |
| | | synchronized (this) |
| | | { |
| | |
| | | public void removeNestedGroup(DN nestedGroupDN) |
| | | throws UnsupportedOperationException, DirectoryException |
| | | { |
| | | ensureNotNull(nestedGroupDN); |
| | | ifNull(nestedGroupDN); |
| | | |
| | | synchronized (this) |
| | | { |
| | |
| | | public void addMember(Entry userEntry) |
| | | throws UnsupportedOperationException, DirectoryException |
| | | { |
| | | ensureNotNull(userEntry); |
| | | ifNull(userEntry); |
| | | |
| | | synchronized (this) |
| | | { |
| | |
| | | public void removeMember(DN userDN) |
| | | throws UnsupportedOperationException, DirectoryException |
| | | { |
| | | ensureNotNull(userDN); |
| | | ifNull(userDN); |
| | | |
| | | ByteString userDNString = ByteString.valueOf(userDN.toNormalizedString()); |
| | | synchronized (this) |
| | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | |
| | | |
| | |
| | | { |
| | | super(); |
| | | |
| | | ensureNotNull(groupEntryDN, targetGroupDN); |
| | | ifNull(groupEntryDN, targetGroupDN); |
| | | |
| | | this.groupEntryDN = groupEntryDN; |
| | | this.targetGroupDN = targetGroupDN; |
| | |
| | | public VirtualStaticGroup newInstance(Entry groupEntry) |
| | | throws DirectoryException |
| | | { |
| | | ensureNotNull(groupEntry); |
| | | ifNull(groupEntry); |
| | | |
| | | |
| | | // Get the target group DN attribute from the entry, if there is one. |
| | |
| | | @Override() |
| | | public boolean isGroupDefinition(Entry entry) |
| | | { |
| | | ensureNotNull(entry); |
| | | ifNull(entry); |
| | | |
| | | // FIXME -- This needs to exclude enhanced groups once we have support for |
| | | //them. |
| | |
| | | import org.opends.server.replication.server.changelog.api.DBCursor; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.util.*; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | import static java.util.Collections.*; |
| | | |
| | |
| | | { |
| | | if (config != null) |
| | | { |
| | | Validator.ensureTrue(config instanceof BackendCfg); |
| | | Reject.ifFalse(config instanceof BackendCfg); |
| | | BackendCfg cfg = (BackendCfg) config; |
| | | DN[] newBaseDNs = new DN[cfg.getBaseDN().size()]; |
| | | cfg.getBaseDN().toArray(newBaseDNs); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | |
| | |
| | | |
| | | |
| | | import org.opends.server.types.ByteSequence; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | import org.opends.server.util.Platform; |
| | | |
| | | |
| | |
| | | boolean trim, |
| | | boolean foldCase) |
| | | { |
| | | ensureNotNull(buffer); |
| | | ensureNotNull(sequence); |
| | | ifNull(buffer); |
| | | ifNull(sequence); |
| | | //Optimize in the case of purely ascii characters which is the most common |
| | | //case. |
| | | int length = sequence.length(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.dsconfig; |
| | | |
| | |
| | | import org.opends.server.admin.client.ManagementContext; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | import org.opends.server.tools.ClientException; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | import org.opends.server.util.cli.CLIException; |
| | | import org.opends.server.util.cli.ConsoleApplication; |
| | | import org.opends.server.util.cli.HelpCallback; |
| | |
| | | // Creates a new property editor for the specified property. |
| | | private MultiValuedPropertyEditor(ManagedObject<?> mo, |
| | | PropertyDefinition<?> pd) { |
| | | Validator.ensureTrue(pd.hasOption(PropertyOption.MULTI_VALUED)); |
| | | Reject.ifFalse(pd.hasOption(PropertyOption.MULTI_VALUED)); |
| | | |
| | | this.mo = mo; |
| | | this.pd = pd; |
| | |
| | | // Creates a new property editor for the specified property. |
| | | private SingleValuedPropertyEditor(ManagedObject<?> mo, |
| | | PropertyDefinition<?> pd) { |
| | | Validator.ensureTrue(!pd.hasOption(PropertyOption.MULTI_VALUED)); |
| | | Reject.ifFalse(!pd.hasOption(PropertyOption.MULTI_VALUED)); |
| | | |
| | | this.mo = mo; |
| | | this.pd = pd; |
| | |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | | import org.opends.server.types.operation.PostResponseOperation; |
| | | import org.opends.server.types.operation.PreParseOperation; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | |
| | |
| | | @Override |
| | | public void addAdditionalLogItem(AdditionalLogItem item) |
| | | { |
| | | Validator.ensureNotNull(item); |
| | | Reject.ifNull(item); |
| | | if (additionalLogItems == null) |
| | | { |
| | | additionalLogItems = new LinkedList<AdditionalLogItem>(); |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | | |
| | | |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | |
| | | |
| | |
| | | public static AdditionalLogItem keyOnly(final Class<?> source, |
| | | final String key) |
| | | { |
| | | Validator.ensureNotNull(source, key); |
| | | Reject.ifNull(source, key); |
| | | return new AdditionalLogItem(source, key, null, false); |
| | | } |
| | | |
| | |
| | | public static AdditionalLogItem quotedKeyValue(final Class<?> source, |
| | | final String key, final Object value) |
| | | { |
| | | Validator.ensureNotNull(source, key, value); |
| | | Reject.ifNull(source, key, value); |
| | | return new AdditionalLogItem(source, key, value, true); |
| | | } |
| | | |
| | |
| | | public static AdditionalLogItem unquotedKeyValue(final Class<?> source, |
| | | final String key, final Object value) |
| | | { |
| | | Validator.ensureNotNull(source, key, value); |
| | | Reject.ifNull(source, key, value); |
| | | return new AdditionalLogItem(source, key, value, false); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2013 ForgeRock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | import org.opends.server.api.SubstringMatchingRule; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | |
| | | /** |
| | |
| | | public void setInitialCapacity(int initialCapacity) |
| | | throws IllegalStateException |
| | | { |
| | | Validator.ensureTrue(initialCapacity >= 0); |
| | | Reject.ifFalse(initialCapacity >= 0); |
| | | |
| | | if (elements != null) |
| | | { |
| | |
| | | */ |
| | | public AttributeBuilder(AttributeType attributeType, String name) |
| | | { |
| | | Validator.ensureNotNull(attributeType, name); |
| | | Reject.ifNull(attributeType, name); |
| | | |
| | | this.attributeType = attributeType; |
| | | this.name = name; |
| | |
| | | AttributeType attributeType, |
| | | String name) |
| | | { |
| | | Validator.ensureNotNull(attributeType, name); |
| | | Reject.ifNull(attributeType, name); |
| | | |
| | | this.attributeType = attributeType; |
| | | this.name = name; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | |
| | | |
| | |
| | | extraProperties); |
| | | |
| | | |
| | | ensureNotNull(definition, oid); |
| | | ifNull(definition, oid); |
| | | |
| | | this.superiorType = superiorType; |
| | | this.isCollective = isCollective; |
| | |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | /** |
| | | * This class defines a data structure that may be used to store |
| | |
| | | public AuthenticationInfo(Entry authenticationEntry, DN simpleBindDN, |
| | | boolean isRoot) |
| | | { |
| | | ensureNotNull(authenticationEntry); |
| | | ifNull(authenticationEntry); |
| | | |
| | | this.authenticationEntry = authenticationEntry; |
| | | this.simpleBindDN = simpleBindDN; |
| | |
| | | String saslMechanism, |
| | | boolean isRoot) |
| | | { |
| | | ensureNotNull(authenticationEntry, saslMechanism); |
| | | ifNull(authenticationEntry, saslMechanism); |
| | | |
| | | this.authenticationEntry = authenticationEntry; |
| | | this.isRoot = isRoot; |
| | |
| | | ByteString saslCredentials, |
| | | boolean isRoot) |
| | | { |
| | | ensureNotNull(authenticationEntry, saslMechanism); |
| | | ifNull(authenticationEntry, saslMechanism); |
| | | |
| | | this.authenticationEntry = authenticationEntry; |
| | | this.authorizationEntry = authorizationEntry; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | import static org.opends.messages.SchemaMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.toLowerCase; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | |
| | | */ |
| | | public final void setExtraProperty(String name, String value) { |
| | | |
| | | ensureNotNull(name); |
| | | ifNull(name); |
| | | |
| | | if (value == null) |
| | | { |
| | |
| | | public final void setExtraProperty(String name, |
| | | List<String> values) { |
| | | |
| | | ensureNotNull(name); |
| | | ifNull(name); |
| | | |
| | | if ((values == null) || values.isEmpty()) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | |
| | | |
| | |
| | | boolean isObsolete, |
| | | Map<String,List<String>> extraProperties) |
| | | { |
| | | ensureNotNull(definition, structuralClass); |
| | | ifNull(definition, structuralClass); |
| | | |
| | | this.structuralClass = structuralClass; |
| | | this.description = description; |
| | |
| | | */ |
| | | public void setExtraProperty(String name, String value) |
| | | { |
| | | ensureNotNull(name); |
| | | ifNull(name); |
| | | |
| | | if (value == null) |
| | | { |
| | |
| | | */ |
| | | public void setExtraProperty(String name, List<String> values) |
| | | { |
| | | ensureNotNull(name); |
| | | ifNull(name); |
| | | |
| | | if ((values == null) || values.isEmpty()) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | |
| | | |
| | |
| | | Set<DITStructureRule> superiorRules, |
| | | Map<String,List<String>> extraProperties) |
| | | { |
| | | ensureNotNull(definition); |
| | | ifNull(definition); |
| | | |
| | | this.ruleID = ruleID; |
| | | this.description = description; |
| | |
| | | */ |
| | | public void setExtraProperty(String name, String value) |
| | | { |
| | | ensureNotNull(name); |
| | | ifNull(name); |
| | | |
| | | if (value == null) |
| | | { |
| | |
| | | */ |
| | | public void setExtraProperty(String name, List<String> values) |
| | | { |
| | | ensureNotNull(name); |
| | | ifNull(name); |
| | | |
| | | if ((values == null) || values.isEmpty()) |
| | | { |
| | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | /** |
| | | * This class defines a data structure for storing and interacting |
| | |
| | | */ |
| | | public DN(RDN rdn, DN parentDN) |
| | | { |
| | | ensureNotNull(rdn, parentDN); |
| | | ifNull(rdn, parentDN); |
| | | if (parentDN.isRootDN()) |
| | | { |
| | | rdnComponents = new RDN[] { rdn }; |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | |
| | | |
| | |
| | | |
| | | import org.opends.server.schema.LDAPSyntaxDescriptionSyntax; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | |
| | | |
| | |
| | | String description, |
| | | Map<String,List<String>> extraProperties) |
| | | { |
| | | ensureNotNull(definition,descriptionSyntax); |
| | | ifNull(definition,descriptionSyntax); |
| | | |
| | | this.descriptionSyntax = descriptionSyntax; |
| | | this.oid = descriptionSyntax.getOID(); |
| | |
| | | */ |
| | | public void setExtraProperty(String name, String value) |
| | | { |
| | | ensureNotNull(name); |
| | | ifNull(name); |
| | | |
| | | if (value == null) |
| | | { |
| | |
| | | */ |
| | | public void setExtraProperty(String name, List<String> values) |
| | | { |
| | | ensureNotNull(name); |
| | | ifNull(name); |
| | | |
| | | if ((values == null) || values.isEmpty()) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | |
| | | |
| | |
| | | Set<AttributeType> attributes, |
| | | Map<String,List<String>> extraProperties) |
| | | { |
| | | ensureNotNull(definition, matchingRule); |
| | | ifNull(definition, matchingRule); |
| | | |
| | | this.matchingRule = matchingRule; |
| | | this.description = description; |
| | |
| | | */ |
| | | public void setExtraProperty(String name, String value) |
| | | { |
| | | ensureNotNull(name); |
| | | ifNull(name); |
| | | |
| | | if (value == null) |
| | | { |
| | |
| | | */ |
| | | public void setExtraProperty(String name, List<String> values) |
| | | { |
| | | ensureNotNull(name); |
| | | ifNull(name); |
| | | |
| | | if ((values == null) || values.isEmpty()) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | |
| | | |
| | |
| | | Set<AttributeType> optionalAttributes, |
| | | Map<String,List<String>> extraProperties) |
| | | { |
| | | ensureNotNull(definition, oid, structuralClass); |
| | | ifNull(definition, oid, structuralClass); |
| | | |
| | | this.oid = oid; |
| | | this.description = description; |
| | |
| | | */ |
| | | public void setExtraProperty(String name, String value) |
| | | { |
| | | ensureNotNull(name); |
| | | ifNull(name); |
| | | |
| | | if (value == null) |
| | | { |
| | |
| | | */ |
| | | public void setExtraProperty(String name, List<String> values) |
| | | { |
| | | ensureNotNull(name); |
| | | ifNull(name); |
| | | |
| | | if ((values == null) || values.isEmpty()) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | |
| | | |
| | |
| | | extraProperties); |
| | | |
| | | |
| | | ensureNotNull(definition, oid); |
| | | ifNull(definition, oid); |
| | | |
| | | // Construct unmodifiable views of the superior classes. |
| | | if (superiorClasses != null) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.protocols.ldap.LDAPResultCode.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | |
| | | */ |
| | | public static RawAttribute create(String attributeType) |
| | | { |
| | | ensureNotNull(attributeType); |
| | | ifNull(attributeType); |
| | | |
| | | return new LDAPAttribute(attributeType); |
| | | } |
| | |
| | | public static RawAttribute create(String attributeType, |
| | | String value) |
| | | { |
| | | ensureNotNull(attributeType, value); |
| | | ifNull(attributeType, value); |
| | | |
| | | return new LDAPAttribute(attributeType, value); |
| | | } |
| | |
| | | public static RawAttribute create(String attributeType, |
| | | ByteString value) |
| | | { |
| | | ensureNotNull(attributeType); |
| | | ifNull(attributeType); |
| | | |
| | | return new LDAPAttribute(attributeType, value); |
| | | } |
| | |
| | | public static RawAttribute create(String attributeType, |
| | | ArrayList<ByteString> values) |
| | | { |
| | | ensureNotNull(attributeType); |
| | | ifNull(attributeType); |
| | | |
| | | return new LDAPAttribute(attributeType, values); |
| | | } |
| | |
| | | */ |
| | | public static RawAttribute create(Attribute attribute) |
| | | { |
| | | ensureNotNull(attribute); |
| | | ifNull(attribute); |
| | | |
| | | return new LDAPAttribute(attribute); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | import org.opends.messages.Message; |
| | | |
| | | |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | import static org.opends.messages.CoreMessages.*; |
| | | |
| | |
| | | */ |
| | | private ResultCode(int intValue, Message name) |
| | | { |
| | | Validator.ensureNotNull(name); |
| | | Reject.ifNull(name); |
| | | this.intValue = intValue; |
| | | this.resultCodeName = name; |
| | | } |
| | |
| | | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | /** |
| | | * This class defines a virtual attribute rule, which associates a |
| | |
| | | VirtualAttributeCfgDefn.ConflictBehavior |
| | | conflictBehavior) |
| | | { |
| | | ensureNotNull(attributeType, provider, baseDNs, groupDNs); |
| | | ensureNotNull(filters, conflictBehavior); |
| | | ifNull(attributeType, provider, baseDNs, groupDNs); |
| | | ifNull(filters, conflictBehavior); |
| | | |
| | | this.attributeType = attributeType; |
| | | this.provider = provider; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.util; |
| | | |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | |
| | | super(dn); |
| | | |
| | | |
| | | ensureNotNull(attributes); |
| | | ifNull(attributes); |
| | | |
| | | |
| | | this.attributes = new ArrayList<Attribute>(attributes.size()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.util; |
| | | |
| | |
| | | import static org.opends.messages.UtilityMessages.*; |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | |
| | | |
| | |
| | | */ |
| | | public static String encode(byte[] rawData) |
| | | { |
| | | ensureNotNull(rawData); |
| | | ifNull(rawData); |
| | | |
| | | |
| | | StringBuilder buffer = new StringBuilder(4 * rawData.length / 3); |
| | |
| | | */ |
| | | public static String encode(ByteSequence rawData) |
| | | { |
| | | ensureNotNull(rawData); |
| | | ifNull(rawData); |
| | | |
| | | |
| | | StringBuilder buffer = new StringBuilder(4 * rawData.length() / 3); |
| | |
| | | public static byte[] decode(String encodedData) |
| | | throws ParseException |
| | | { |
| | | ensureNotNull(encodedData); |
| | | ifNull(encodedData); |
| | | |
| | | |
| | | // The encoded value must have length that is a multiple of four bytes. |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.util; |
| | | |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | import org.opends.server.types.DN; |
| | | |
| | |
| | | */ |
| | | protected ChangeRecordEntry(DN dn) |
| | | { |
| | | ensureNotNull(dn); |
| | | ifNull(dn); |
| | | this.dn = dn; |
| | | } |
| | | |
| | |
| | | import static org.opends.server.loggers.ErrorLogger.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | import java.io.*; |
| | | import java.net.URL; |
| | |
| | | public LDIFReader(LDIFImportConfig importConfig) |
| | | throws IOException |
| | | { |
| | | ensureNotNull(importConfig); |
| | | ifNull(importConfig); |
| | | this.importConfig = importConfig; |
| | | |
| | | reader = importConfig.getReader(); |
| | |
| | | public LDIFReader(LDIFImportConfig importConfig, RootContainer rootContainer) |
| | | throws IOException |
| | | { |
| | | ensureNotNull(importConfig); |
| | | ifNull(importConfig); |
| | | this.importConfig = importConfig; |
| | | this.reader = importConfig.getReader(); |
| | | this.lineNumber = 0; |
| | |
| | | import org.opends.server.types.*; |
| | | |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | /** |
| | | * This class provides a mechanism for writing entries in LDIF form to a file or |
| | |
| | | public LDIFWriter(LDIFExportConfig exportConfig) |
| | | throws IOException |
| | | { |
| | | ensureNotNull(exportConfig); |
| | | ifNull(exportConfig); |
| | | this.exportConfig = exportConfig; |
| | | |
| | | writer = exportConfig.getWriter(); |
| | |
| | | public void writeComment(Message comment, int wrapColumn) |
| | | throws IOException |
| | | { |
| | | ensureNotNull(comment); |
| | | ifNull(comment); |
| | | |
| | | |
| | | // First, break up the comment into multiple lines to preserve the original |
| | |
| | | public boolean writeEntry(Entry entry) |
| | | throws IOException, LDIFException |
| | | { |
| | | ensureNotNull(entry); |
| | | ifNull(entry); |
| | | return entry.toLDIF(exportConfig); |
| | | } |
| | | |
| | |
| | | public boolean writeTemplateEntry(TemplateEntry templateEntry) |
| | | throws IOException, LDIFException |
| | | { |
| | | ensureNotNull(templateEntry); |
| | | ifNull(templateEntry); |
| | | return templateEntry.toLDIF(exportConfig); |
| | | } |
| | | |
| | |
| | | public void writeChangeRecord(ChangeRecordEntry changeRecord) |
| | | throws IOException |
| | | { |
| | | ensureNotNull(changeRecord); |
| | | ifNull(changeRecord); |
| | | |
| | | |
| | | // Get the information necessary to write the LDIF. |
| | |
| | | public void writeAddChangeRecord(Entry entry) |
| | | throws IOException |
| | | { |
| | | ensureNotNull(entry); |
| | | ifNull(entry); |
| | | |
| | | |
| | | // Get the information necessary to write the LDIF. |
| | |
| | | public void writeDeleteChangeRecord(Entry entry, boolean commentEntry) |
| | | throws IOException |
| | | { |
| | | ensureNotNull(entry); |
| | | ifNull(entry); |
| | | |
| | | // Get the information necessary to write the LDIF. |
| | | BufferedWriter writer = exportConfig.getWriter(); |
| | |
| | | public void writeModifyChangeRecord(DN dn, List<Modification> modifications) |
| | | throws IOException |
| | | { |
| | | ensureNotNull(dn, modifications); |
| | | ifNull(dn, modifications); |
| | | |
| | | // If there aren't any modifications, then there's nothing to do. |
| | | if (modifications.isEmpty()) |
| | |
| | | DN newSuperior) |
| | | throws IOException |
| | | { |
| | | ensureNotNull(dn, newRDN); |
| | | ifNull(dn, newRDN); |
| | | |
| | | |
| | | // Get the information necessary to write the LDIF. |
| | |
| | | public static void appendLDIFSeparatorAndValue(StringBuilder buffer, |
| | | ByteSequence valueBytes, boolean isURL, boolean isBase64) |
| | | { |
| | | ensureNotNull(buffer, valueBytes); |
| | | ifNull(buffer, valueBytes); |
| | | |
| | | |
| | | // If the value is empty, then just append a single colon (the URL '<' if |
| | |
| | | boolean wrapLines, int wrapColumn) |
| | | throws IOException |
| | | { |
| | | ensureNotNull(line, writer); |
| | | ifNull(line, writer); |
| | | |
| | | int length = line.length(); |
| | | if (wrapLines && length > wrapColumn) |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.util; |
| | | |
| | | |
| | | |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | |
| | | |
| | |
| | | */ |
| | | public static int calculate(String source, String target) |
| | | { |
| | | ensureNotNull(source, target); |
| | | ifNull(source, target); |
| | | |
| | | // sl == source length; tl == target length |
| | | int sl = source.length(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.util; |
| | | |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | |
| | | super(dn); |
| | | |
| | | |
| | | ensureNotNull(modifications); |
| | | ifNull(modifications); |
| | | |
| | | this.modifications = new ArrayList<RawModification>(modifications); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.util; |
| | | |
| | | import static org.opends.server.util.Validator.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.RDN; |
| | |
| | | { |
| | | super(dn); |
| | | |
| | | ensureNotNull(newRDN); |
| | | ifNull(newRDN); |
| | | |
| | | this.newSuperiorDN = newSuperiorDN; |
| | | this.newRDN = newRDN; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.util; |
| | | |
| | |
| | | import java.io.OutputStream; |
| | | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | |
| | | import org.forgerock.util.Reject; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | |
| | |
| | | */ |
| | | public MultiOutputStream(OutputStream... targetStreams) |
| | | { |
| | | Validator.ensureNotNull(targetStreams); |
| | | Reject.ifNull(targetStreams); |
| | | |
| | | this.targetStreams = targetStreams; |
| | | } |
| | |
| | | import javax.naming.NamingException; |
| | | import javax.naming.ldap.InitialLdapContext; |
| | | |
| | | import org.forgerock.util.Reject; |
| | | import org.opends.messages.Message; |
| | | import org.opends.messages.MessageBuilder; |
| | | import org.opends.messages.MessageDescriptor; |
| | |
| | | */ |
| | | public static String decodeUTF8(final byte[] bytes) |
| | | { |
| | | Validator.ensureNotNull(bytes); |
| | | Reject.ifNull(bytes); |
| | | |
| | | if (bytes.length == 0) |
| | | { |
| | |
| | | */ |
| | | public static String wrapText(String text, int width, int indent) |
| | | { |
| | | Validator.ensureTrue(indent >= 0 && indent < width); |
| | | Reject.ifFalse(indent >= 0 && indent < width); |
| | | |
| | | // Calculate the real width and indentation padding. |
| | | width -= indent; |
| | |
| | | import org.opends.server.types.operation.PostResponseModifyOperation; |
| | | import org.opends.server.types.operation.PostSynchronizationModifyOperation; |
| | | import org.opends.server.types.operation.PreOperationModifyOperation; |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | /** |
| | | * This class defines an operation used to modify an entry in a local backend |
| | |
| | | */ |
| | | private void validateObjectClasses(Attribute attr) throws DirectoryException |
| | | { |
| | | Validator.ensureTrue(attr.getAttributeType().isObjectClassType()); |
| | | Reject.ifFalse(attr.getAttributeType().isObjectClassType()); |
| | | for (AttributeValue v : attr) |
| | | { |
| | | String name = v.getValue().toString(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | |
| | | |
| | | /** |
| | | * Sets up tests. |
| | | * |
| | | * |
| | | * @throws Exception |
| | | * If the server could not be initialized. |
| | | */ |
| | |
| | | /** |
| | | * Tests validateValue() with illegal data |
| | | */ |
| | | @Test(expectedExceptions = AssertionError.class) |
| | | @Test(expectedExceptions = NullPointerException.class) |
| | | public void testValidateValue2() { |
| | | BooleanPropertyDefinition d = createPropertyDefinition(); |
| | | d.validateValue(null); |
| | |
| | | * @param value to decode |
| | | */ |
| | | @Test(dataProvider = "testDecodeValueData2", |
| | | expectedExceptions = {AssertionError.class,IllegalPropertyValueStringException.class}) |
| | | expectedExceptions = {NullPointerException.class,IllegalPropertyValueStringException.class}) |
| | | public void testDecodeValue2(String value) { |
| | | BooleanPropertyDefinition d = createPropertyDefinition(); |
| | | d.decodeValue(value); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | |
| | | * @param value to decode |
| | | */ |
| | | @Test(dataProvider = "decodeValueData2", |
| | | expectedExceptions = {AssertionError.class, |
| | | expectedExceptions = {NullPointerException.class, |
| | | IllegalPropertyValueStringException.class} ) |
| | | public void testDecodeValue2(String value) { |
| | | EnumPropertyDefinition epd = builder.getInstance(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.client.ldap; |
| | | |
| | |
| | | import javax.naming.directory.Attributes; |
| | | import javax.naming.ldap.LdapName; |
| | | |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | import org.testng.Assert; |
| | | |
| | | |
| | |
| | | */ |
| | | public void addExpectedAttribute(String expectedName, |
| | | String... expectedValues) { |
| | | Validator.ensureNotNull(expectedName); |
| | | Validator.ensureNotNull(expectedValues); |
| | | Validator.ensureTrue(expectedValues.length > 0); |
| | | Reject.ifNull(expectedName); |
| | | Reject.ifNull(expectedValues); |
| | | Reject.ifFalse(expectedValues.length > 0); |
| | | attributes.put(expectedName, Arrays.asList(expectedValues)); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.client.ldap; |
| | | |
| | |
| | | import javax.naming.directory.Attributes; |
| | | import javax.naming.ldap.LdapName; |
| | | |
| | | import org.opends.server.util.Validator; |
| | | import org.forgerock.util.Reject; |
| | | import org.testng.Assert; |
| | | |
| | | |
| | |
| | | */ |
| | | public void addExpectedModification(String expectedName, |
| | | String... expectedValues) { |
| | | Validator.ensureNotNull(expectedName); |
| | | Validator.ensureNotNull(expectedValues); |
| | | Reject.ifNull(expectedName); |
| | | Reject.ifNull(expectedValues); |
| | | modifications.put(expectedName, Arrays.asList(expectedValues)); |
| | | } |
| | | |
| | |
| | | /** |
| | | * Tests the constructor with a {@code null} authorization ID. |
| | | */ |
| | | @Test(expectedExceptions = { AssertionError.class }) |
| | | @Test(expectedExceptions = { NullPointerException.class }) |
| | | public void testConstructorNullAuthzID() |
| | | { |
| | | new ProxiedAuthV2Control(null); |
| | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the Similarity-Based Password Validator. |
| | | * A set of test cases for the Similarity-Based Password Reject. |
| | | */ |
| | | public class SimilarityBasedPasswordValidatorTestCase |
| | | extends ExtensionsTestCase |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.util; |
| | | |
| | |
| | | // ===+++======= --> 3 |
| | | new Object[] { "brad+angelina", "brangelina", 3 }, |
| | | |
| | | // test international chars |
| | | // test international chars |
| | | // ?e?uli?ka |
| | | // e?uli?ka |
| | | // -======== --> 1 |
| | |
| | | * @param t The target string to compare. |
| | | */ |
| | | @Test(dataProvider = "testnulls", |
| | | expectedExceptions = { AssertionError.class }) |
| | | expectedExceptions = { NullPointerException.class }) |
| | | public void testNullStrings(String s, String t) |
| | | { |
| | | LevenshteinDistance.calculate(s, t); |