AutoRefactored modifier's order + removed useless modifiers implied by context
| | |
| | | * The enumeration that should be used for values of this |
| | | * property definition. |
| | | */ |
| | | public final static class Builder<E extends Enum<E>> extends AbstractBuilder<E, EnumPropertyDefinition<E>> { |
| | | public static final class Builder<E extends Enum<E>> extends AbstractBuilder<E, EnumPropertyDefinition<E>> { |
| | | |
| | | /** The enumeration class. */ |
| | | private Class<E> enumClass; |
| | |
| | | } |
| | | |
| | | /** Get a resource instance creating it if necessary. */ |
| | | private synchronized static ManagedObjectDefinitionI18NResource getInstance(String prefix) { |
| | | private static synchronized ManagedObjectDefinitionI18NResource getInstance(String prefix) { |
| | | ManagedObjectDefinitionI18NResource instance = INSTANCES.get(prefix); |
| | | |
| | | if (instance == null) { |
| | |
| | | * @param <D> |
| | | * The type of property definition constructed by this builder. |
| | | */ |
| | | protected abstract static class AbstractBuilder<T, D extends PropertyDefinition<T>> { |
| | | protected static abstract class AbstractBuilder<T, D extends PropertyDefinition<T>> { |
| | | |
| | | /** The administrator action. */ |
| | | private AdministratorAction adminAction; |
| | |
| | | * A property provider which always returns empty property values, |
| | | * indicating default behavior. |
| | | */ |
| | | public static final PropertyProvider DEFAULT_PROVIDER = new PropertyProvider() { |
| | | PropertyProvider DEFAULT_PROVIDER = new PropertyProvider() { |
| | | |
| | | /** {@inheritDoc} */ |
| | | public <T> Collection<T> getPropertyValues(PropertyDefinition<T> d) { |
| | |
| | | * @param <D> |
| | | * The type of relation definition constructed by this builder. |
| | | */ |
| | | protected abstract static class AbstractBuilder<C extends ConfigurationClient, S extends Configuration, |
| | | protected static abstract class AbstractBuilder<C extends ConfigurationClient, S extends Configuration, |
| | | D extends RelationDefinition<C, S>> { |
| | | |
| | | /** Common fields. */ |
| | |
| | | public final class DSConfig extends ConsoleApplication { |
| | | |
| | | /** The name of this tool. */ |
| | | final static String DSCONFIGTOOLNAME = "dsconfig"; |
| | | static final String DSCONFIGTOOLNAME = "dsconfig"; |
| | | |
| | | /** |
| | | * The name of a command-line script used to launch an administrative tool. |
| | | */ |
| | | final static String PROPERTY_SCRIPT_NAME = "org.opends.server.scriptName"; |
| | | static final String PROPERTY_SCRIPT_NAME = "org.opends.server.scriptName"; |
| | | |
| | | /** |
| | | * A menu call-back which runs a sub-command interactively. |
| | |
| | | * @return Returns <code>true</code> if the proposed addition is acceptable, |
| | | * or <code>false</code> if it is not. |
| | | */ |
| | | public boolean isConfigurationAddAcceptable(T configuration, List<LocalizableMessage> unacceptableReasons); |
| | | boolean isConfigurationAddAcceptable(T configuration, List<LocalizableMessage> unacceptableReasons); |
| | | |
| | | /** |
| | | * Adds a new configuration to this add listener. |
| | |
| | | * The configuration that will be added. |
| | | * @return Returns information about the result of adding the configuration. |
| | | */ |
| | | public ConfigChangeResult applyConfigurationAdd(T configuration); |
| | | ConfigChangeResult applyConfigurationAdd(T configuration); |
| | | } |
| | |
| | | * @return Returns <code>true</code> if the proposed change is acceptable, |
| | | * or <code>false</code> if it is not. |
| | | */ |
| | | public boolean isConfigurationChangeAcceptable(T configuration, List<LocalizableMessage> unacceptableReasons); |
| | | boolean isConfigurationChangeAcceptable(T configuration, List<LocalizableMessage> unacceptableReasons); |
| | | |
| | | /** |
| | | * Applies the configuration changes to this change listener. |
| | |
| | | * @return Returns information about the result of changing the |
| | | * configuration. |
| | | */ |
| | | public ConfigChangeResult applyConfigurationChange(T configuration); |
| | | ConfigChangeResult applyConfigurationChange(T configuration); |
| | | } |
| | |
| | | * @return Returns <code>true</code> if the proposed deletion is acceptable, |
| | | * or <code>false</code> if it is not. |
| | | */ |
| | | public boolean isConfigurationDeleteAcceptable(T configuration, List<LocalizableMessage> unacceptableReasons); |
| | | boolean isConfigurationDeleteAcceptable(T configuration, List<LocalizableMessage> unacceptableReasons); |
| | | |
| | | /** |
| | | * Deletes an existing configuration from this delete listener. |
| | |
| | | * @return Returns information about the result of deleting the |
| | | * configuration. |
| | | */ |
| | | public ConfigChangeResult applyConfigurationDelete(T configuration); |
| | | ConfigChangeResult applyConfigurationDelete(T configuration); |
| | | } |
| | |
| | | * @return Returns <code>true</code> if the proposed addition is acceptable, |
| | | * or <code>false</code> if it is not. |
| | | */ |
| | | public boolean isConfigurationAddAcceptable(ServerManagedObject<? extends T> mo, |
| | | boolean isConfigurationAddAcceptable(ServerManagedObject<? extends T> mo, |
| | | List<LocalizableMessage> unacceptableReasons); |
| | | |
| | | /** |
| | |
| | | * @return Returns information about the result of adding the server managed |
| | | * object. |
| | | */ |
| | | public ConfigChangeResult applyConfigurationAdd(ServerManagedObject<? extends T> mo); |
| | | ConfigChangeResult applyConfigurationAdd(ServerManagedObject<? extends T> mo); |
| | | } |
| | |
| | | * @return Returns <code>true</code> if the proposed change is acceptable, |
| | | * or <code>false</code> if it is not. |
| | | */ |
| | | public boolean isConfigurationChangeAcceptable(ServerManagedObject<? extends T> mo, |
| | | boolean isConfigurationChangeAcceptable(ServerManagedObject<? extends T> mo, |
| | | List<LocalizableMessage> unacceptableReasons); |
| | | |
| | | /** |
| | |
| | | * @return Returns information about the result of changing the server |
| | | * managed object. |
| | | */ |
| | | public ConfigChangeResult applyConfigurationChange(ServerManagedObject<? extends T> mo); |
| | | ConfigChangeResult applyConfigurationChange(ServerManagedObject<? extends T> mo); |
| | | } |
| | |
| | | * @return Returns <code>true</code> if the proposed deletion is acceptable, |
| | | * or <code>false</code> if it is not. |
| | | */ |
| | | public boolean isConfigurationDeleteAcceptable(ServerManagedObject<? extends T> mo, |
| | | boolean isConfigurationDeleteAcceptable(ServerManagedObject<? extends T> mo, |
| | | List<LocalizableMessage> unacceptableReasons); |
| | | |
| | | /** |
| | |
| | | * @return Returns information about the result of deleting the server |
| | | * managed object. |
| | | */ |
| | | public ConfigChangeResult applyConfigurationDelete(ServerManagedObject<? extends T> mo); |
| | | ConfigChangeResult applyConfigurationDelete(ServerManagedObject<? extends T> mo); |
| | | } |
| | |
| | | * @return {@code true} if the proposed entry contains an acceptable |
| | | * configuration, or {@code false} if it does not. |
| | | */ |
| | | public boolean configAddIsAcceptable(Entry configEntry, LocalizableMessageBuilder unacceptableReason); |
| | | boolean configAddIsAcceptable(Entry configEntry, LocalizableMessageBuilder unacceptableReason); |
| | | |
| | | /** |
| | | * Attempts to apply a new configuration based on the provided added entry. |
| | |
| | | * @return Information about the result of processing the configuration |
| | | * change. |
| | | */ |
| | | public ConfigChangeResult applyConfigurationAdd(Entry configEntry); |
| | | ConfigChangeResult applyConfigurationAdd(Entry configEntry); |
| | | } |
| | |
| | | * @return {@code true} if the proposed entry contains an acceptable |
| | | * configuration, or {@code false} if it does not. |
| | | */ |
| | | public boolean configChangeIsAcceptable(Entry configEntry, LocalizableMessageBuilder unacceptableReason); |
| | | boolean configChangeIsAcceptable(Entry configEntry, LocalizableMessageBuilder unacceptableReason); |
| | | |
| | | /** |
| | | * Attempts to apply a new configuration to this Directory Server component |
| | |
| | | * @return Information about the result of processing the configuration |
| | | * change. |
| | | */ |
| | | public ConfigChangeResult applyConfigurationChange(Entry configEntry); |
| | | ConfigChangeResult applyConfigurationChange(Entry configEntry); |
| | | } |
| | |
| | | * @return {@code true} if the proposed entry may be removed from the |
| | | * configuration, or {@code false} if not. |
| | | */ |
| | | public boolean configDeleteIsAcceptable(Entry configEntry, LocalizableMessageBuilder unacceptableReason); |
| | | boolean configDeleteIsAcceptable(Entry configEntry, LocalizableMessageBuilder unacceptableReason); |
| | | |
| | | /** |
| | | * Attempts to apply a new configuration based on the provided deleted |
| | |
| | | * @return Information about the result of processing the configuration |
| | | * change. |
| | | */ |
| | | public ConfigChangeResult applyConfigurationDelete(Entry configEntry); |
| | | ConfigChangeResult applyConfigurationDelete(Entry configEntry); |
| | | } |
| | |
| | | * @param listener |
| | | * The add listener that should be registered. |
| | | */ |
| | | public void registerAddListener(DN dn, ConfigAddListener listener); |
| | | void registerAddListener(DN dn, ConfigAddListener listener); |
| | | |
| | | /** |
| | | * Registers the provided delete listener so that it will be notified if any |
| | |
| | | * @param listener |
| | | * The delete listener that should be registered. |
| | | */ |
| | | public void registerDeleteListener(DN dn, ConfigDeleteListener listener); |
| | | void registerDeleteListener(DN dn, ConfigDeleteListener listener); |
| | | |
| | | /** |
| | | * Registers the provided change listener so that it will be notified of any |
| | |
| | | * @param listener |
| | | * The change listener that should be registered. |
| | | */ |
| | | public void registerChangeListener(DN dn, ConfigChangeListener listener); |
| | | void registerChangeListener(DN dn, ConfigChangeListener listener); |
| | | |
| | | /** |
| | | * Deregisters the provided add listener so that it will no longer be |
| | |
| | | * @param listener |
| | | * The add listener that should be deregistered. |
| | | */ |
| | | public void deregisterAddListener(DN dn, ConfigAddListener listener); |
| | | void deregisterAddListener(DN dn, ConfigAddListener listener); |
| | | |
| | | /** |
| | | * Deregisters the provided delete listener so that it will no longer be |
| | |
| | | * @param listener |
| | | * The delete listener that should be deregistered. |
| | | */ |
| | | public void deregisterDeleteListener(DN dn, ConfigDeleteListener listener); |
| | | void deregisterDeleteListener(DN dn, ConfigDeleteListener listener); |
| | | |
| | | /** |
| | | * Attempts to deregister the provided change listener with the provided DN. |
| | |
| | | * @return <CODE>true</CODE> if the specified listener was deregistered, or |
| | | * <CODE>false</CODE> if it was not. |
| | | */ |
| | | public boolean deregisterChangeListener(DN dn, ConfigChangeListener listener); |
| | | boolean deregisterChangeListener(DN dn, ConfigChangeListener listener); |
| | | |
| | | /** |
| | | * Retrieves the add listeners that have been registered with the provided |
| | |
| | | * The DN of the configuration entry. |
| | | * @return The list of add listeners. |
| | | */ |
| | | public List<ConfigAddListener> getAddListeners(DN dn); |
| | | List<ConfigAddListener> getAddListeners(DN dn); |
| | | |
| | | /** |
| | | * Retrieves the delete listeners that have been registered with the |
| | |
| | | * The DN of the configuration entry. |
| | | * @return The list of delete listeners. |
| | | */ |
| | | public List<ConfigDeleteListener> getDeleteListeners(DN dn); |
| | | List<ConfigDeleteListener> getDeleteListeners(DN dn); |
| | | |
| | | /** |
| | | * Retrieves the change listeners that have been registered with the |
| | |
| | | * The DN of the configuration entry. |
| | | * @return The list of change listeners. |
| | | */ |
| | | public List<ConfigChangeListener> getChangeListeners(DN dn); |
| | | List<ConfigChangeListener> getChangeListeners(DN dn); |
| | | |
| | | } |
| | |
| | | * @throws Exception |
| | | * If an unexpected error occurred. |
| | | */ |
| | | public synchronized static void setUp() throws Exception { |
| | | public static synchronized void setUp() throws Exception { |
| | | initializeAndRegisterBundle(TestParentCfgDefn.getInstance()); |
| | | initializeAndRegisterBundle(TestChildCfgDefn.getInstance()); |
| | | |
| | |
| | | /** |
| | | * Deregisters the test configurations from the administration framework. |
| | | */ |
| | | public synchronized static void cleanup() { |
| | | public static synchronized void cleanup() { |
| | | LDAPProfile.getInstance().popWrapper(); |
| | | |
| | | AbstractManagedObjectDefinition<?, ?> root = RootCfgDefn.getInstance(); |
| | |
| | | |
| | | /** Construct a dummy path. */ |
| | | // @Checkstyle:off |
| | | private synchronized static <C extends ConfigurationClient, S extends Configuration> ManagedObjectPath<C, S> |
| | | private static synchronized <C extends ConfigurationClient, S extends Configuration> ManagedObjectPath<C, S> |
| | | getPath(AbstractManagedObjectDefinition<C, S> d) { |
| | | // @Checkstyle:on |
| | | if (!isProfileRegistered) { |
| | |
| | | * @see Connections#uncloseable(ConnectionFactory) |
| | | */ |
| | | @Override |
| | | public void close(); |
| | | void close(); |
| | | |
| | | /** |
| | | * Asynchronously obtains a connection to the Directory Server associated |
| | |
| | | * associated connection factories. |
| | | */ |
| | | @Override |
| | | public void close(); |
| | | void close(); |
| | | |
| | | /** |
| | | * Returns a connection factory which should be used in order to satisfy the |
| | |
| | | /** |
| | | * Search request context implementation. |
| | | */ |
| | | private final static class SearchRequestContextImpl extends RequestContextImpl<Result, ResultHandler<Result>> |
| | | private static final class SearchRequestContextImpl extends RequestContextImpl<Result, ResultHandler<Result>> |
| | | implements SearchResultHandler { |
| | | |
| | | private final SearchResultHandler entryHandler; |
| | |
| | | * A schema resolver which always returns the current default schema as |
| | | * returned by {@link Schema#getDefaultSchema()}. |
| | | */ |
| | | public static final SchemaResolver DEFAULT = new SchemaResolver() { |
| | | SchemaResolver DEFAULT = new SchemaResolver() { |
| | | |
| | | public Schema resolveSchema(String dn) { |
| | | return Schema.getDefaultSchema(); |
| | |
| | | * @return The appropriate schema for use with the provided distinguished |
| | | * name. |
| | | */ |
| | | public abstract Schema resolveSchema(String dn); |
| | | Schema resolveSchema(String dn); |
| | | } |
| | |
| | | * @return The delay to wait before next timeout callback in milliseconds, |
| | | * or zero if this listener should no longer be notified. |
| | | */ |
| | | long handleTimeout(final long currentTime); |
| | | long handleTimeout(long currentTime); |
| | | |
| | | /** |
| | | * Returns the timeout for this listener. |
| | |
| | | } |
| | | }; |
| | | |
| | | private final static ByteString CONTROL_VALUE = ByteString.valueOf("0"); |
| | | private static final ByteString CONTROL_VALUE = ByteString.valueOf("0"); |
| | | |
| | | /** |
| | | * Creates a new Netscape password expired response control. |
| | |
| | | * The name of the SASL mechanism that does not provide any authentication |
| | | * but rather uses anonymous access. |
| | | */ |
| | | public static final String SASL_MECHANISM_NAME = "ANONYMOUS"; |
| | | String SASL_MECHANISM_NAME = "ANONYMOUS"; |
| | | |
| | | @Override |
| | | AnonymousSASLBindRequest addControl(Control control); |
| | |
| | | */ |
| | | final class AnonymousSASLBindRequestImpl extends AbstractSASLBindRequest<AnonymousSASLBindRequest> |
| | | implements AnonymousSASLBindRequest { |
| | | private final static class Client extends SASLBindClientImpl { |
| | | private static final class Client extends SASLBindClientImpl { |
| | | private Client(final AnonymousSASLBindRequestImpl initialBindRequest, |
| | | final String serverName) { |
| | | super(initialBindRequest); |
| | |
| | | /** |
| | | * The authentication type value (0x80) reserved for simple authentication. |
| | | */ |
| | | public static final byte AUTHENTICATION_TYPE_SIMPLE = (byte) 0x80; |
| | | byte AUTHENTICATION_TYPE_SIMPLE = (byte) 0x80; |
| | | |
| | | /** |
| | | * The authentication type value (0xA3) reserved for SASL authentication. |
| | | */ |
| | | public static final byte AUTHENTICATION_TYPE_SASL = (byte) 0xA3; |
| | | byte AUTHENTICATION_TYPE_SASL = (byte) 0xA3; |
| | | |
| | | |
| | | @Override |
| | |
| | | /** |
| | | * The name of the SASL mechanism based on CRAM-MD5 authentication. |
| | | */ |
| | | public static final String SASL_MECHANISM_NAME = "CRAM-MD5"; |
| | | String SASL_MECHANISM_NAME = "CRAM-MD5"; |
| | | |
| | | @Override |
| | | CRAMMD5SASLBindRequest addControl(Control control); |
| | |
| | | */ |
| | | final class CRAMMD5SASLBindRequestImpl extends AbstractSASLBindRequest<CRAMMD5SASLBindRequest> |
| | | implements CRAMMD5SASLBindRequest { |
| | | private final static class Client extends SASLBindClientImpl { |
| | | private static final class Client extends SASLBindClientImpl { |
| | | private final String authenticationID; |
| | | private final ByteString password; |
| | | private final SaslClient saslClient; |
| | |
| | | /** |
| | | * A decoder which can be used to decode cancel extended operation requests. |
| | | */ |
| | | public static final ExtendedRequestDecoder<CancelExtendedRequest, ExtendedResult> DECODER = |
| | | ExtendedRequestDecoder<CancelExtendedRequest, ExtendedResult> DECODER = |
| | | new CancelExtendedRequestImpl.RequestDecoder(); |
| | | |
| | | /** |
| | | * The OID for the cancel extended operation request. |
| | | */ |
| | | public static final String OID = "1.3.6.1.1.8"; |
| | | String OID = "1.3.6.1.1.8"; |
| | | |
| | | @Override |
| | | CancelExtendedRequest addControl(Control control); |
| | |
| | | * Indicates that the client will accept connection encryption using the |
| | | * high strength triple-DES cipher. |
| | | */ |
| | | public static final String CIPHER_3DES = "3des"; |
| | | String CIPHER_3DES = "3des"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the |
| | | * medium strength DES cipher. |
| | | */ |
| | | public static final String CIPHER_DES = "des"; |
| | | String CIPHER_DES = "des"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the |
| | | * strongest supported cipher, as long as the cipher is considered to be |
| | | * high strength. |
| | | */ |
| | | public static final String CIPHER_HIGH = "high"; |
| | | String CIPHER_HIGH = "high"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the |
| | | * strongest supported cipher, even if the strongest cipher is considered to |
| | | * be medium or low strength. |
| | | */ |
| | | public static final String CIPHER_LOW = "low"; |
| | | String CIPHER_LOW = "low"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the |
| | | * strongest supported cipher, as long as the cipher is considered to be |
| | | * high or medium strength. |
| | | */ |
| | | public static final String CIPHER_MEDIUM = "medium"; |
| | | String CIPHER_MEDIUM = "medium"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the |
| | | * high strength 128-bit RC4 cipher. |
| | | */ |
| | | public static final String CIPHER_RC4_128 = "rc4"; |
| | | String CIPHER_RC4_128 = "rc4"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the low |
| | | * strength 40-bit RC4 cipher. |
| | | */ |
| | | public static final String CIPHER_RC4_40 = "rc4-40"; |
| | | String CIPHER_RC4_40 = "rc4-40"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept connection encryption using the |
| | | * medium strength 56-bit RC4 cipher. |
| | | */ |
| | | public static final String CIPHER_RC4_56 = "rc4-56"; |
| | | String CIPHER_RC4_56 = "rc4-56"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept authentication only. More |
| | |
| | | * SSL/TLS. This is the default if no QOP option is present in the bind |
| | | * request. |
| | | */ |
| | | public static final String QOP_AUTH = "auth"; |
| | | String QOP_AUTH = "auth"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept authentication with connection |
| | | * integrity protection and encryption. |
| | | */ |
| | | public static final String QOP_AUTH_CONF = "auth-conf"; |
| | | String QOP_AUTH_CONF = "auth-conf"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept authentication with connection |
| | | * integrity protection. More specifically, the underlying connection will |
| | | * not be encrypted, unless previously established using SSL/TLS. |
| | | */ |
| | | public static final String QOP_AUTH_INT = "auth-int"; |
| | | String QOP_AUTH_INT = "auth-int"; |
| | | |
| | | /** |
| | | * The name of the SASL mechanism based on DIGEST-MD5 authentication. |
| | | */ |
| | | public static final String SASL_MECHANISM_NAME = "DIGEST-MD5"; |
| | | String SASL_MECHANISM_NAME = "DIGEST-MD5"; |
| | | |
| | | /** |
| | | * Adds the provided additional authentication parameter to the list of |
| | |
| | | */ |
| | | final class DigestMD5SASLBindRequestImpl extends AbstractSASLBindRequest<DigestMD5SASLBindRequest> |
| | | implements DigestMD5SASLBindRequest { |
| | | private final static class Client extends SASLBindClientImpl { |
| | | private static final class Client extends SASLBindClientImpl { |
| | | private final String authenticationID; |
| | | private final ByteString password; |
| | | private final String realm; |
| | |
| | | /** |
| | | * The name of the SASL mechanism based on external authentication. |
| | | */ |
| | | public static final String SASL_MECHANISM_NAME = "EXTERNAL"; |
| | | String SASL_MECHANISM_NAME = "EXTERNAL"; |
| | | |
| | | @Override |
| | | ExternalSASLBindRequest addControl(Control control); |
| | |
| | | */ |
| | | final class ExternalSASLBindRequestImpl extends AbstractSASLBindRequest<ExternalSASLBindRequest> |
| | | implements ExternalSASLBindRequest { |
| | | private final static class Client extends SASLBindClientImpl { |
| | | private static final class Client extends SASLBindClientImpl { |
| | | private final SaslClient saslClient; |
| | | |
| | | private Client(final ExternalSASLBindRequestImpl initialBindRequest, final String serverName) |
| | |
| | | * SSL/TLS. This is the default if no QOP option is present in the bind |
| | | * request. |
| | | */ |
| | | public static final String QOP_AUTH = "auth"; |
| | | String QOP_AUTH = "auth"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept authentication with connection |
| | | * integrity protection and encryption. |
| | | */ |
| | | public static final String QOP_AUTH_CONF = "auth-conf"; |
| | | String QOP_AUTH_CONF = "auth-conf"; |
| | | |
| | | /** |
| | | * Indicates that the client will accept authentication with connection |
| | | * integrity protection. More specifically, the underlying connection will |
| | | * not be encrypted, unless previously established using SSL/TLS. |
| | | */ |
| | | public static final String QOP_AUTH_INT = "auth-int"; |
| | | String QOP_AUTH_INT = "auth-int"; |
| | | |
| | | /** |
| | | * The name of the SASL mechanism based on GSS-API authentication. |
| | | */ |
| | | public static final String SASL_MECHANISM_NAME = "GSSAPI"; |
| | | String SASL_MECHANISM_NAME = "GSSAPI"; |
| | | |
| | | /** |
| | | * Adds the provided additional authentication parameter to the list of |
| | |
| | | @SuppressWarnings("restriction") |
| | | final class GSSAPISASLBindRequestImpl extends AbstractSASLBindRequest<GSSAPISASLBindRequest> |
| | | implements GSSAPISASLBindRequest { |
| | | private final static class Client extends SASLBindClientImpl { |
| | | private static final class Client extends SASLBindClientImpl { |
| | | private static Subject kerberos5Login(final String authenticationID, |
| | | final ByteString password, final String realm, final String kdc) throws LdapException { |
| | | if (authenticationID == null) { |
| | |
| | | * A decoder which can be used to decode generic extended operation |
| | | * requests. |
| | | */ |
| | | public static final ExtendedRequestDecoder<GenericExtendedRequest, GenericExtendedResult> DECODER = |
| | | ExtendedRequestDecoder<GenericExtendedRequest, GenericExtendedResult> DECODER = |
| | | new GenericExtendedRequestImpl.RequestDecoder(); |
| | | |
| | | @Override |
| | |
| | | * A decoder which can be used to decode password modify extended operation |
| | | * requests. |
| | | */ |
| | | public static final ExtendedRequestDecoder<PasswordModifyExtendedRequest, PasswordModifyExtendedResult> DECODER = |
| | | ExtendedRequestDecoder<PasswordModifyExtendedRequest, PasswordModifyExtendedResult> DECODER = |
| | | new PasswordModifyExtendedRequestImpl.RequestDecoder(); |
| | | |
| | | /** |
| | | * The OID for the password modify extended operation request. |
| | | */ |
| | | public static final String OID = "1.3.6.1.4.1.4203.1.11.1"; |
| | | String OID = "1.3.6.1.4.1.4203.1.11.1"; |
| | | |
| | | @Override |
| | | PasswordModifyExtendedRequest addControl(Control control); |
| | |
| | | /** |
| | | * The name of the SASL mechanism based on PLAIN authentication. |
| | | */ |
| | | public static final String SASL_MECHANISM_NAME = "PLAIN"; |
| | | String SASL_MECHANISM_NAME = "PLAIN"; |
| | | |
| | | @Override |
| | | PlainSASLBindRequest addControl(Control control); |
| | |
| | | */ |
| | | final class PlainSASLBindRequestImpl extends AbstractSASLBindRequest<PlainSASLBindRequest> |
| | | implements PlainSASLBindRequest { |
| | | private final static class Client extends SASLBindClientImpl { |
| | | private static final class Client extends SASLBindClientImpl { |
| | | private final String authenticationID; |
| | | private final ByteString password; |
| | | private final SaslClient saslClient; |
| | |
| | | * A decoder which can be used to decode start TLS extended operation |
| | | * requests. |
| | | */ |
| | | public static final ExtendedRequestDecoder<StartTLSExtendedRequest, ExtendedResult> DECODER = |
| | | ExtendedRequestDecoder<StartTLSExtendedRequest, ExtendedResult> DECODER = |
| | | new StartTLSExtendedRequestImpl.RequestDecoder(); |
| | | |
| | | /** |
| | | * The OID for the start TLS extended operation request. |
| | | */ |
| | | public static final String OID = "1.3.6.1.4.1.1466.20037"; |
| | | String OID = "1.3.6.1.4.1.1466.20037"; |
| | | |
| | | @Override |
| | | StartTLSExtendedRequest addControl(Control control); |
| | |
| | | * A decoder which can be used to decode who am I extended operation |
| | | * requests. |
| | | */ |
| | | public static final ExtendedRequestDecoder<WhoAmIExtendedRequest, WhoAmIExtendedResult> DECODER = |
| | | ExtendedRequestDecoder<WhoAmIExtendedRequest, WhoAmIExtendedResult> DECODER = |
| | | new WhoAmIExtendedRequestImpl.RequestDecoder(); |
| | | |
| | | /** |
| | | * The OID for the who am I extended operation request. |
| | | */ |
| | | public static final String OID = "1.3.6.1.4.1.4203.1.11.3"; |
| | | String OID = "1.3.6.1.4.1.4203.1.11.3"; |
| | | |
| | | @Override |
| | | WhoAmIExtendedRequest addControl(Control control); |
| | |
| | | * decoder. |
| | | */ |
| | | <R extends ExtendedResult> ResultHandler<S> adaptExtendedResultHandler( |
| | | final ExtendedRequest<R> request, final ResultHandler<? super R> resultHandler, |
| | | DecodeOptions options); |
| | | ExtendedRequest<R> request, ResultHandler<? super R> resultHandler, DecodeOptions options); |
| | | |
| | | /** |
| | | * Decodes the provided extended operation result as a {@code Result} of |
| | |
| | | /** |
| | | * A fluent API for incrementally constructing matching rules. |
| | | */ |
| | | public final static class Builder extends SchemaElementBuilder<Builder> { |
| | | public static final class Builder extends SchemaElementBuilder<Builder> { |
| | | private String oid; |
| | | private final List<String> names = new LinkedList<String>(); |
| | | private boolean isObsolete = false; |
| | |
| | | /** |
| | | * A fluent API for incrementally constructing name forms. |
| | | */ |
| | | public final static class Builder extends SchemaElementBuilder<Builder> { |
| | | public static final class Builder extends SchemaElementBuilder<Builder> { |
| | | private boolean isObsolete = false; |
| | | private final List<String> names = new LinkedList<String>(); |
| | | private String oid; |
| | |
| | | /** |
| | | * A fluent API for incrementally constructing syntaxes. |
| | | */ |
| | | public final static class Builder extends SchemaElementBuilder<Builder> { |
| | | public static final class Builder extends SchemaElementBuilder<Builder> { |
| | | |
| | | private String oid; |
| | | private SyntaxImpl impl; |
| | |
| | | * attributes with this syntax, or {@code null} if approximate |
| | | * matches will not be allowed for this type by default. |
| | | */ |
| | | public String getApproximateMatchingRule(); |
| | | String getApproximateMatchingRule(); |
| | | |
| | | /** |
| | | * Retrieves the default equality matching rule that will be used for |
| | |
| | | * attributes with this syntax, or {@code null} if equality matches |
| | | * will not be allowed for this type by default. |
| | | */ |
| | | public String getEqualityMatchingRule(); |
| | | String getEqualityMatchingRule(); |
| | | |
| | | /** |
| | | * Retrieves the common name for this attribute syntax. |
| | | * |
| | | * @return The common name for this attribute syntax. |
| | | */ |
| | | public String getName(); |
| | | String getName(); |
| | | |
| | | /** |
| | | * Retrieves the default ordering matching rule that will be used for |
| | |
| | | * attributes with this syntax, or {@code null} if ordering matches |
| | | * will not be allowed for this type by default. |
| | | */ |
| | | public String getOrderingMatchingRule(); |
| | | String getOrderingMatchingRule(); |
| | | |
| | | /** |
| | | * Retrieves the default substring matching rule that will be used for |
| | |
| | | * attributes with this syntax, or {@code null} if substring matches |
| | | * will not be allowed for this type by default. |
| | | */ |
| | | public String getSubstringMatchingRule(); |
| | | String getSubstringMatchingRule(); |
| | | |
| | | /** |
| | | * Indicates whether this attribute syntax requires that values must be |
| | |
| | | * @see <a href="http://tools.ietf.org/html/rfc4522">RFC 4522 - Lightweight |
| | | * Directory Access Protocol (LDAP): The Binary Encoding Option </a> |
| | | */ |
| | | public boolean isBEREncodingRequired(); |
| | | boolean isBEREncodingRequired(); |
| | | |
| | | /** |
| | | * Indicates whether this attribute syntax would likely be a human readable |
| | |
| | | * The lock that will be used to provide threadsafe access to the date |
| | | * formatter. |
| | | */ |
| | | private final static Object DATE_FORMAT_LOCK; |
| | | private static final Object DATE_FORMAT_LOCK; |
| | | |
| | | /** |
| | | * The date formatter that will be used to convert dates into UTC time |
| | | * values. Note that all interaction with it must be synchronized. |
| | | */ |
| | | private final static SimpleDateFormat DATE_FORMAT; |
| | | private static final SimpleDateFormat DATE_FORMAT; |
| | | |
| | | /** |
| | | * The date formatter needs help converting 2-digit years. |
| | |
| | | * |
| | | * @return The address used by the connections. |
| | | */ |
| | | public InetSocketAddress getSocketAddress(); |
| | | InetSocketAddress getSocketAddress(); |
| | | |
| | | /** |
| | | * Returns the hostname used by the connections created by this factory. |
| | | * |
| | | * @return The hostname used by the connections. |
| | | */ |
| | | public String getHostName(); |
| | | String getHostName(); |
| | | |
| | | /** |
| | | * Returns the remote port number used by the connections created by this |
| | |
| | | * |
| | | * @return The remote port number used by the connections. |
| | | */ |
| | | public int getPort(); |
| | | int getPort(); |
| | | |
| | | } |
| | |
| | | * |
| | | * @return The address that this LDAP listener is listening on. |
| | | */ |
| | | public InetSocketAddress getSocketAddress(); |
| | | InetSocketAddress getSocketAddress(); |
| | | |
| | | /** |
| | | * Closes this stream and releases any system resources associated |
| | |
| | | * method has no effect. |
| | | */ |
| | | @Override |
| | | public void close(); |
| | | void close(); |
| | | |
| | | } |
| | |
| | | /** |
| | | * Result handler that places all responses in a queue. |
| | | */ |
| | | private final static class BufferHandler implements SearchResultHandler, ResultHandler<Result> { |
| | | private static final class BufferHandler implements SearchResultHandler, ResultHandler<Result> { |
| | | private final BlockingQueue<Response> responses; |
| | | private volatile boolean isInterrupted = false; |
| | | |
| | |
| | | * A handler which terminates processing by throwing a |
| | | * {@code DecodeException} as soon as a change is rejected. |
| | | */ |
| | | public final static RejectedChangeRecordListener FAIL_FAST = |
| | | new RejectedChangeRecordListener() { |
| | | RejectedChangeRecordListener FAIL_FAST = new RejectedChangeRecordListener() { |
| | | |
| | | public Entry handleDuplicateEntry(final AddRequest change, final Entry existingEntry) |
| | | throws DecodeException { |
| | | throw DecodeException.error(REJECTED_CHANGE_FAIL_ADD_DUPE.get(change.getName() |
| | | .toString())); |
| | | throw DecodeException.error(REJECTED_CHANGE_FAIL_ADD_DUPE.get(change.getName())); |
| | | } |
| | | |
| | | public Entry handleDuplicateEntry(final ModifyDNRequest change, |
| | | final Entry existingEntry, final Entry renamedEntry) throws DecodeException { |
| | | throw DecodeException.error(REJECTED_CHANGE_FAIL_MODIFYDN_DUPE.get(renamedEntry |
| | | .getName().toString())); |
| | | throw DecodeException.error(REJECTED_CHANGE_FAIL_MODIFYDN_DUPE.get(renamedEntry.getName())); |
| | | } |
| | | |
| | | public void handleRejectedChangeRecord(final AddRequest change, |
| | |
| | | * tolerates duplicate entries by overwriting the existing entry with the |
| | | * new entry. |
| | | */ |
| | | public final static RejectedChangeRecordListener OVERWRITE = |
| | | new RejectedChangeRecordListener() { |
| | | RejectedChangeRecordListener OVERWRITE = new RejectedChangeRecordListener() { |
| | | |
| | | public Entry handleDuplicateEntry(final AddRequest change, final Entry existingEntry) |
| | | throws DecodeException { |
| | |
| | | * processing by throwing a {@code DecodeException} as soon as a record is |
| | | * found to be malformed or rejected due to a schema validation failure. |
| | | */ |
| | | public static final RejectedLDIFListener FAIL_FAST = new RejectedLDIFListener() { |
| | | RejectedLDIFListener FAIL_FAST = new RejectedLDIFListener() { |
| | | |
| | | @Override |
| | | public void handleMalformedRecord(final long lineNumber, final List<String> lines, |
| | |
| | | /** |
| | | * A handler which ignores all rejected record notifications. |
| | | */ |
| | | public static final RejectedLDIFListener IGNORE_ALL = new RejectedLDIFListener() { |
| | | RejectedLDIFListener IGNORE_ALL = new RejectedLDIFListener() { |
| | | |
| | | @Override |
| | | public void handleMalformedRecord(final long lineNumber, final List<String> lines, |
| | |
| | | * Base tag to use to base presence of one attribute on the absence/presence |
| | | * of another attribute and/or attribute value. |
| | | */ |
| | | abstract static class IfTag extends TemplateTag { |
| | | static abstract class IfTag extends TemplateTag { |
| | | /** The attribute type for which to make the determination. */ |
| | | AttributeType attributeType; |
| | | |
| | |
| | | private static final String TEST_DN = "cn=test"; |
| | | |
| | | interface LDAPWrite { |
| | | public void perform(LDAPWriter<? extends ASN1Writer> writer) throws IOException; |
| | | void perform(LDAPWriter<? extends ASN1Writer> writer) throws IOException; |
| | | } |
| | | |
| | | @DataProvider |
| | |
| | | /** |
| | | * Returns a writer specific to the transport module. |
| | | */ |
| | | abstract protected LDAPWriter<? extends ASN1Writer> getLDAPWriter(); |
| | | protected abstract LDAPWriter<? extends ASN1Writer> getLDAPWriter(); |
| | | |
| | | /** |
| | | * Returns a reader specific to the transport module. |
| | | */ |
| | | abstract protected LDAPReader<? extends ASN1Reader> getLDAPReader(); |
| | | protected abstract LDAPReader<? extends ASN1Reader> getLDAPReader(); |
| | | |
| | | /** |
| | | * Transfer raw data from writer to the reader. |
| | | */ |
| | | abstract protected void transferFromWriterToReader(LDAPWriter<? extends ASN1Writer> writer, |
| | | protected abstract void transferFromWriterToReader(LDAPWriter<? extends ASN1Writer> writer, |
| | | LDAPReader<? extends ASN1Reader> reader); |
| | | } |
| | |
| | | } |
| | | |
| | | private interface SequenceLimiter { |
| | | public void checkLimit(int readSize) throws IOException; |
| | | void checkLimit(int readSize) throws IOException; |
| | | |
| | | public SequenceLimiter endSequence() throws IOException; |
| | | SequenceLimiter endSequence() throws IOException; |
| | | |
| | | public int remaining(); |
| | | int remaining(); |
| | | |
| | | public SequenceLimiter startSequence(int readLimit); |
| | | SequenceLimiter startSequence(int readLimit); |
| | | } |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | } |
| | | |
| | | private interface SequenceBuffer { |
| | | public SequenceBuffer endSequence() throws IOException; |
| | | SequenceBuffer endSequence() throws IOException; |
| | | |
| | | public SequenceBuffer startSequence(byte type) throws IOException; |
| | | SequenceBuffer startSequence(byte type) throws IOException; |
| | | |
| | | public void writeByte(byte b) throws IOException; |
| | | void writeByte(byte b) throws IOException; |
| | | |
| | | public void writeByteArray(byte[] bs, int offset, int length) throws IOException; |
| | | void writeByteArray(byte[] bs, int offset, int length) throws IOException; |
| | | } |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | * @throws IOException |
| | | * if an error occurs during writing |
| | | */ |
| | | abstract protected void writeResult(final LDAPWriter<ASN1BufferWriter> ldapWriter, |
| | | protected abstract void writeResult(final LDAPWriter<ASN1BufferWriter> ldapWriter, |
| | | final R result) throws IOException; |
| | | |
| | | /** |
| | |
| | | */ |
| | | final class DataSource { |
| | | private static interface IDataSource { |
| | | public IDataSource duplicate(); |
| | | IDataSource duplicate(); |
| | | |
| | | public Object getData(); |
| | | Object getData(); |
| | | } |
| | | |
| | | private static class IncrementLineFileDataSource implements IDataSource { |
| | |
| | | * authorization identity for this operation, or {@code null} if the |
| | | * authorization identity should be the unauthenticated user. |
| | | */ |
| | | public Entry getAuthorizationEntry(); |
| | | Entry getAuthorizationEntry(); |
| | | |
| | | /** |
| | | * Returns a connection for performing internal operations. |
| | | * |
| | | * @return A connection for performing internal operations. |
| | | */ |
| | | public Connection getConnection(); |
| | | Connection getConnection(); |
| | | |
| | | /** |
| | | * Retrieves the operation ID for this operation. |
| | | * |
| | | * @return The operation ID for this operation. |
| | | */ |
| | | public long getOperationID(); |
| | | long getOperationID(); |
| | | |
| | | /** |
| | | * Indicates whether the authenticate client has all of the specified |
| | |
| | | * @return {@code true} if the authenticated client has all of the specified |
| | | * privileges, or {@code false} if not. |
| | | */ |
| | | public boolean hasAllPrivileges(Collection<Privilege> privileges); |
| | | boolean hasAllPrivileges(Collection<Privilege> privileges); |
| | | |
| | | /** |
| | | * Indicates whether the authenticated client has the specified privilege. |
| | |
| | | * @return {@code true} if the authenticated client has the specified |
| | | * privilege, or {@code false} if not. |
| | | */ |
| | | public boolean hasPrivilege(Privilege privilege); |
| | | boolean hasPrivilege(Privilege privilege); |
| | | |
| | | /** |
| | | * Sets the entry for the user that should be considered the authorization |
| | |
| | | * authorization identity for this operation, or {@code null} if |
| | | * it should be the unauthenticated user. |
| | | */ |
| | | public void setAuthorizationEntry(Entry authorizationEntry); |
| | | void setAuthorizationEntry(Entry authorizationEntry); |
| | | |
| | | /** |
| | | * Retrieves the entry for the user as whom the client is authenticated. |
| | |
| | | */ |
| | | final class SetupLog { |
| | | |
| | | static private File logFile = null; |
| | | static private FileHandler fileHandler = null; |
| | | final static String LOGNAME = "setup.log"; |
| | | private static File logFile = null; |
| | | private static FileHandler fileHandler = null; |
| | | static final String LOGNAME = "setup.log"; |
| | | |
| | | private SetupLog() { |
| | | // Nothing to do. |
| | |
| | | * |
| | | * @return File representing the log file |
| | | */ |
| | | static public File getLogFile() { |
| | | public static File getLogFile() { |
| | | return logFile; |
| | | } |
| | | } |
| | |
| | | /** |
| | | * The configuration properties for the tests. |
| | | */ |
| | | final static Properties CONFIG_PROPERTIES = new Properties(); |
| | | static final Properties CONFIG_PROPERTIES = new Properties(); |
| | | |
| | | /** |
| | | * The path to the test classes. |
| | | */ |
| | | final static String TEST_CLASSES_PATH = "./target/test-classes/"; |
| | | static final String TEST_CLASSES_PATH = "./target/test-classes/"; |
| | | |
| | | /** |
| | | * The path to the configuration folder. |
| | | */ |
| | | final static String TEST_CLASSES_PATH_CONFIG = "./target/test-classes/config/"; |
| | | static final String TEST_CLASSES_PATH_CONFIG = "./target/test-classes/config/"; |
| | | |
| | | /** |
| | | * Starts the embedded server. |
| | |
| | | /** |
| | | * The configuration properties for the tests. |
| | | */ |
| | | final static Properties CONFIG_PROPERTIES = new Properties(); |
| | | static final Properties CONFIG_PROPERTIES = new Properties(); |
| | | |
| | | /** |
| | | * The path to the test classes. |
| | | */ |
| | | final static String TEST_CLASSES_PATH = "./target/test-classes/"; |
| | | static final String TEST_CLASSES_PATH = "./target/test-classes/"; |
| | | |
| | | /** |
| | | * The path to the configuration folder. |
| | | */ |
| | | final static String TEST_CLASSES_PATH_CONFIG = "./target/test-classes/config/"; |
| | | static final String TEST_CLASSES_PATH_CONFIG = "./target/test-classes/config/"; |
| | | |
| | | /** |
| | | * Starts the embedded server. |