com.sun.jaspic.config.factory
Class BaseAuthConfigFactory

java.lang.Object
  extended by javax.security.auth.message.config.AuthConfigFactory
      extended by com.sun.jaspic.config.factory.BaseAuthConfigFactory
Direct Known Subclasses:
AuthConfigFileFactory

public abstract class BaseAuthConfigFactory
extends AuthConfigFactory

This class implements methods in the abstract class AuthConfigFactory.

Author:
Shing Wai Chan

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.security.auth.message.config.AuthConfigFactory
AuthConfigFactory.RegistrationContext
 
Field Summary
protected static java.lang.String CONF_FILE_NAME
           
static java.util.concurrent.locks.Lock rLock
           
static java.util.concurrent.locks.Lock wLock
           
 
Fields inherited from class javax.security.auth.message.config.AuthConfigFactory
DEFAULT_FACTORY_SECURITY_PROPERTY
 
Constructor Summary
BaseAuthConfigFactory()
           
 
Method Summary
protected  void _loadFactory()
           
 java.lang.String[] detachListener(RegistrationListener listener, java.lang.String layer, java.lang.String appContext)
          Disassociate the listener from all the provider registrations whose layer and appContext values are matched by the corresponding arguments to this method.
 AuthConfigProvider getConfigProvider(java.lang.String layer, java.lang.String appContext, RegistrationListener listener)
          Get a registered AuthConfigProvider from the factory.
 AuthConfigFactory.RegistrationContext getRegistrationContext(java.lang.String registrationID)
          Get the the registration context for the identified registration.
 java.lang.String[] getRegistrationIDs(AuthConfigProvider provider)
          Get the registration identifiers for all registrations of the provider instance at the factory.
protected abstract  RegStoreFileParser getRegStore()
           
 void refresh()
          Cause the factory to reprocess its persistent declarative representation of provider registrations.
 java.lang.String registerConfigProvider(AuthConfigProvider provider, java.lang.String layer, java.lang.String appContext, java.lang.String description)
           
 java.lang.String registerConfigProvider(java.lang.String className, java.util.Map properties, java.lang.String layer, java.lang.String appContext, java.lang.String description)
          Registers within the factory, a provider of ServerAuthConfig and/or ClientAuthConfig objects for a message layer and application context identifier.
 boolean removeRegistration(java.lang.String registrationID)
          Remove the identified provider registration from the factory and invoke any listeners associated with the removed registration.
 
Methods inherited from class javax.security.auth.message.config.AuthConfigFactory
getFactory, setFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rLock

public static final java.util.concurrent.locks.Lock rLock

wLock

public static final java.util.concurrent.locks.Lock wLock

CONF_FILE_NAME

protected static final java.lang.String CONF_FILE_NAME
See Also:
Constant Field Values
Constructor Detail

BaseAuthConfigFactory

public BaseAuthConfigFactory()
Method Detail

getRegStore

protected abstract RegStoreFileParser getRegStore()

getConfigProvider

public AuthConfigProvider getConfigProvider(java.lang.String layer,
                                            java.lang.String appContext,
                                            RegistrationListener listener)
Get a registered AuthConfigProvider from the factory. Get the provider of ServerAuthConfig and/or ClientAuthConfig objects registered for the identified message layer and application context.

Specified by:
getConfigProvider in class AuthConfigFactory
Parameters:
layer - a String identifying the message layer for which the registered AuthConfigProvider is to be returned. This argument may be null.
appContext - a String that identifies the application messaging context for which the registered AuthConfigProvider is to be returned. This argument may be null.
listener - the RegistrationListener whose notify method is to be invoked if the corresponding registration is unregistered or replaced. The value of this argument may be null.
Returns:
the implementation of the AuthConfigProvider interface registered at the factory for the layer and appContext or null if no AuthConfigProvider is selected.

All factories shall employ the following precedence rules to select the registered AuthConfigProvider that matches (via matchConstructors) the layer and appContext arguments:

  • The provider that is specifically registered for both the corresponding message layer and appContext shall be selected.
  • if no provider is selected according to the preceding rule, the provider specifically registered for the corresponding appContext and for all message layers shall be selected.
  • if no provider is selected according to the preceding rules, the provider specifically registered for the corresponding message layer and for all appContexts shall be selected.
  • if no provider is selected according to the preceding rules, the provider registered for all message layers and for all appContexts shall be selected.
  • if no provider is selected according to the preceding rules, the factory shall terminate its search for a registered provider.

registerConfigProvider

public java.lang.String registerConfigProvider(java.lang.String className,
                                               java.util.Map properties,
                                               java.lang.String layer,
                                               java.lang.String appContext,
                                               java.lang.String description)
Registers within the factory, a provider of ServerAuthConfig and/or ClientAuthConfig objects for a message layer and application context identifier.

At most one registration may exist within the factory for a given combination of message layer and appContext. Any pre-existing registration with identical values for layer and appContext is replaced by a subsequent registration. When replacement occurs, the registration identifier, layer, and appContext identifier remain unchanged, and the AuthConfigProvider (with initialization properties) and description are replaced.

Within the lifetime of its Java process, a factory must assign unique registration identifiers to registrations, and must never assign a previously used registration identifier to a registration whose message layer and or appContext identifier differ from the previous use.

Programmatic registrations performed via this method must update (according to the replacement rules described above), the persistent declarative representation of provider registrations employed by the factory constructor.

Specified by:
registerConfigProvider in class AuthConfigFactory
Parameters:
className - the fully qualified name of an AuthConfigProvider implementation class. This argument must not be null.
properties - a Map object containing the initialization properties to be passed to the provider constructor. This argument may be null. When this argument is not null, all the values and keys occuring in the Map must be of type String.
layer - a String identifying the message layer for which the provider will be registered at the factory. A null value may be passed as an argument for this parameter, in which case, the provider is registered at all layers.
appContext - a String value that may be used by a runtime to request a configuration object from this provider. A null value may be passed as an argument for this parameter, in which case, the provider is registered for all configuration ids (at the indicated layers).
description - a text String describing the provider. this value may be null.
Returns:
a String identifier assigned by the factory to the provider registration, and that may be used to remove the registration from the provider.
Throws:
java.lang.SecurityException - if the caller does not have permission to register a provider at the factory.
AuthException - if the provider construction or registration fails.

registerConfigProvider

public java.lang.String registerConfigProvider(AuthConfigProvider provider,
                                               java.lang.String layer,
                                               java.lang.String appContext,
                                               java.lang.String description)
Specified by:
registerConfigProvider in class AuthConfigFactory

removeRegistration

public boolean removeRegistration(java.lang.String registrationID)
Remove the identified provider registration from the factory and invoke any listeners associated with the removed registration.

Specified by:
removeRegistration in class AuthConfigFactory
Parameters:
registrationID - a String that identifies a provider registration at the factory
Returns:
true if there was a registration with the specified identifier and it was removed. Return false if the registraionID was invalid.
Throws:
java.lang.SecurityException - if the caller does not have permission to unregister the provider at the factory.

detachListener

public java.lang.String[] detachListener(RegistrationListener listener,
                                         java.lang.String layer,
                                         java.lang.String appContext)
Disassociate the listener from all the provider registrations whose layer and appContext values are matched by the corresponding arguments to this method.

Specified by:
detachListener in class AuthConfigFactory
Parameters:
listener - the RegistrationListener to be detached.
layer - a String identifying the message layer or null.
appContext - a String value identifying the application context or null.
Returns:
an array of String values where each value identifies a provider registration from which the listener was removed. This method never returns null; it returns an empty array if the listener was not removed from any registrations.
Throws:
java.lang.SecurityException - if the caller does not have permission to detach the listener from the factory.

getRegistrationIDs

public java.lang.String[] getRegistrationIDs(AuthConfigProvider provider)
Get the registration identifiers for all registrations of the provider instance at the factory.

Specified by:
getRegistrationIDs in class AuthConfigFactory
Parameters:
provider - the AuthConfigurationProvider whose registration identifiers are to be returned. This argument may be null, in which case, it indicates that the the id's of all active registration within the factory are returned.
Returns:
an array of String values where each value identifies a provider registration at the factory. This method never returns null; it returns an empty array when their are no registrations at the factory for the identified provider.

getRegistrationContext

public AuthConfigFactory.RegistrationContext getRegistrationContext(java.lang.String registrationID)
Get the the registration context for the identified registration.

Specified by:
getRegistrationContext in class AuthConfigFactory
Parameters:
registrationID - a String that identifies a provider registration at the factory
Returns:
a RegistrationContext or null. When a Non-null value is returned, it is a copy of the registration context corresponding to the registration. Null is returned when the registration identifier does not correspond to an active registration

refresh

public void refresh()
Cause the factory to reprocess its persistent declarative representation of provider registrations.

A factory should only replace an existing registration when a change of provider implementation class or initialization properties has occurred.

Specified by:
refresh in class AuthConfigFactory
Throws:
AuthException - if an error occurred during the reinitialization.
java.lang.SecurityException - if the caller does not have permission to refresh the factory.

_loadFactory

protected void _loadFactory()


Copyright © 2012 GlassFish Community. All Rights Reserved.