Package org.wildfly.naming.client
Interface NamingProvider
-
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
RemoteNamingProvider
public interface NamingProvider extends AutoCloseable
A provider for a single naming scheme. Each implementation of a naming provider has different characteristics.- Author:
- David M. Lloyd
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidclose()Close the provider.static NamingProvidergetCurrentNamingProvider()Get the current naming provider being used for the current deserialization operation.default org.wildfly.security.auth.client.PeerIdentitygetPeerIdentityForNaming()Get a peer identity to use for context operations.org.wildfly.security.auth.client.PeerIdentitygetPeerIdentityForNaming(URI location)Get the peer identity to use for context operations for the specified location.default org.wildfly.security.auth.client.PeerIdentitygetPeerIdentityForNamingUsingRetry(RetryContext context)Get a peer identity to use for context operations, retrying on failure.ProviderEnvironmentgetProviderEnvironment()Get the provider environment.default <T,U,R>
RperformAction(BiFunction<T,U,R> function, T arg1, U arg2)Perform an action under the current naming provider.default <T,U,R,E extends Exception>
RperformExceptionAction(org.wildfly.common.function.ExceptionBiFunction<T,U,R,E> function, T arg1, U arg2)Perform an action under the current naming provider.default <T,R>
RperformExceptionAction(NamingOperation<T,R> function, RetryContext contextOrNull, Name name, T param)Perform an action under the current naming provider.default voidthrowNoMoreDestinationsException(RetryContext context)Throws either anExhaustedDestinationsExceptionutilizing the information passed in the specifiedRetryContext, or an explicit exception mandated by the context.
-
-
-
Method Detail
-
getProviderEnvironment
ProviderEnvironment getProviderEnvironment()
Get the provider environment.- Returns:
- the provider environment (must not be
null)
-
getPeerIdentityForNaming
default org.wildfly.security.auth.client.PeerIdentity getPeerIdentityForNaming() throws NamingExceptionGet a peer identity to use for context operations. The identity may be fixed or it may vary, depending on the context configuration. If the provider has multiple locations, a location is randomly selected.- Returns:
- the peer identity to use (must not be
null) - Throws:
NamingException- if connecting, authenticating, or re-authenticating the peer failed
-
getPeerIdentityForNamingUsingRetry
default org.wildfly.security.auth.client.PeerIdentity getPeerIdentityForNamingUsingRetry(RetryContext context) throws NamingException
Get a peer identity to use for context operations, retrying on failure. The identity may be fixed or it may vary, depending on the context configuration. If the provider has multiple locations, a location is randomly selected. If the retry context is null, a retry will not occur.- Parameters:
context- the retry context for storing state required when retrying- Returns:
- the peer identity to use (must not be
null) - Throws:
NamingException- if connecting, authenticating, or re-authenticating the peer failed
-
throwNoMoreDestinationsException
default void throwNoMoreDestinationsException(RetryContext context) throws NamingException
Throws either anExhaustedDestinationsExceptionutilizing the information passed in the specifiedRetryContext, or an explicit exception mandated by the context.- Parameters:
context- the current retry context of this invocation- Throws:
ExhaustedDestinationsException- if no explicit exception is specifiedNamingException- if explicity requiredRuntimeException- if explicity required
-
getPeerIdentityForNaming
org.wildfly.security.auth.client.PeerIdentity getPeerIdentityForNaming(URI location) throws NamingException
Get the peer identity to use for context operations for the specified location. The identity may be fixed or it may vary, depending on the context configuration. The location should be from the list returned byProviderEnvironment.getProviderUris().- Parameters:
location- a location fromProviderEnvironment.getProviderUris()(must not benull)- Returns:
- the peer identity to use (must not be
null) - Throws:
NamingException- if connecting, authenticating, or re-authenticating the peer failed
-
getCurrentNamingProvider
static NamingProvider getCurrentNamingProvider()
Get the current naming provider being used for the current deserialization operation.- Returns:
- the current naming provider, or
nullif no provider-related deserialization is occurring
-
performAction
default <T,U,R> R performAction(BiFunction<T,U,R> function, T arg1, U arg2)
Perform an action under the current naming provider.- Type Parameters:
T- the first argument typeU- the second argument typeR- the function return type- Parameters:
function- the function to apply (must not benull)arg1- the first argumentarg2- the second argument- Returns:
- the function return value
-
performExceptionAction
default <T,U,R,E extends Exception> R performExceptionAction(org.wildfly.common.function.ExceptionBiFunction<T,U,R,E> function, T arg1, U arg2) throws E extends Exception
Perform an action under the current naming provider.- Type Parameters:
T- the first argument typeU- the second argument typeR- the function return typeE- the function exception type- Parameters:
function- the function to apply (must not benull)arg1- the first argumentarg2- the second argument- Returns:
- the function return value
- Throws:
E- if the function throws an exception of the given typeE extends Exception
-
performExceptionAction
default <T,R> R performExceptionAction(NamingOperation<T,R> function, RetryContext contextOrNull, Name name, T param) throws NamingException
Perform an action under the current naming provider.- Type Parameters:
T- the first argument typeR- the function return type- Parameters:
function- the function to apply (must not benull)- Returns:
- the function return value
- Throws:
NamingException
-
close
default void close() throws NamingExceptionClose the provider. This method is called when the correspondingInitialContextis closed. This method should be idempotent.- Specified by:
closein interfaceAutoCloseable- Throws:
NamingException- if an error occurred while closing this provider
-
-