APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.security.jgss

public final Class ProviderList

extends Object
Class Inheritance
Imports
java.lang.reflect.InvocationTargetException, org.ietf.jgss.*, java.security.Provider, .Security, java.util.ArrayList, .HashSet, .HashMap, .Iterator, .Objects, sun.security.jgss.spi.*, sun.security.jgss.wrapper.NativeGSSFactory, .SunNativeProvider

This class stores the list of providers that this GSS-Implementation is configured to use. The GSSManagerImpl class queries this class whenever it needs a mechanism's factory.

This class stores an ordered list of pairs of the form <provider, oid>. When it attempts to instantiate a mechanism defined by oid o, it steps through the list looking for an entry with oid=o, or with oid=null. (An entry with oid=null matches all mechanisms.) When it finds such an entry, the corresponding provider is approached for the mechanism's factory class. At instantiation time this list in initialized to contain those system-wide providers that contain a property of the form "GssApiMechanism.x.y.z..." where "x.y.z..." is a numeric object identifier with numbers x, y, z, etc. Such a property is defined to map to that provider's implementation of the MechanismFactory interface for the mechanism x.y.z... As and when a MechanismFactory is instantiated, it is cached for future use.

An application can cause more providers to be added by means of the addProviderAtFront and addProviderAtEnd methods on GSSManager which get delegated to this class. The addProviderAtFront method can also cause a change in the ordering of the providers without adding any new providers, by causing a provider to move up in a list. The method addProviderAtEnd can only add providers at the end of the list if they are not already in the list. The rationale is that an application will call addProviderAtFront when it wants a provider to be used in preference over the default ones. And it will call addProviderAtEnd when it wants a provider to be used in case the system ones don't suffice.

If a mechanism's factory is being obtained from a provider as a result of encountering an entry of the form <provider, oid> where oid is non-null, then the assumption is that the application added this entry, and it wants this mechanism to be obtained from this provider. Thus is the provider does not actually contain the requested mechanism, an exception will be thrown. However, if the entry were of the form <provider, null>, then it is viewed more liberally and is simply skipped over if the provider does not claim to support the requested mechanism.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
ProviderList.PreferencesEntry

Stores a provider and a mechanism oid indicating that the provider should be used for the mechanism.

Field Summary

Modifier and TypeField and Description
private final GSSCaller
public static final Oid
private final HashMap<ProviderList.PreferencesEntry, MechanismFactory>
private final HashSet<Oid>
private final ArrayList<ProviderList.PreferencesEntry>
private static final String
private static final int
private static final String

Constructor Summary

AccessConstructor and Description
public
ProviderList(GSSCaller caller, boolean useNative)

Method Summary

Modifier and TypeMethod and Description
private boolean

Returns:

true if there is at least one mechanism that this provider contributed, false otherwise
addAllMechsFromProvider
(Provider
the provider to query
p
)

Helper routine to go through all properties contained in a provider and add its mechanisms to the list of supported mechanisms.

public synchronized void
public synchronized void
private static GSSException
createGSSException(Provider p, String className, String trailingMsg, Exception cause)

public synchronized MechanismFactory
public synchronized MechanismFactory

Returns:

a MechanismFactory for the desired mechanism.
getMechFactory
(Oid
the oid of the desired mechanism
mechOid
,
Provider p)

Obtains a MechanismFactory for a given mechanism.

private MechanismFactory
getMechFactory(ProviderList.PreferencesEntry
the preferences entry that contains the provider and either a null of an explicit oid that matched the oid of the desired mechanism.
e
,
Oid
the oid of the desired mechanism
mechOid
)

Helper routine that uses a preferences entry to obtain an implementation of a MechanismFactory from it.

private static MechanismFactory
getMechFactoryImpl(Provider
the provider whose classloader must be used for instantiating the desired MechanismFactory @ param className the name of the MechanismFactory class
p
,
String className, Oid mechOid, GSSCaller caller)

Helper routine to obtain a MechanismFactory implementation from the same class loader as the provider of this implementation.

public Oid[]
private Oid
private boolean

Returns:

true if this is a GSS-API property, false otherwise.
isMechFactoryProperty
(String prop)

Determines if the given provider property represents a GSS-API Oid to MechanismFactory mapping.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

callerback to summary
private final GSSCaller caller
DEFAULT_MECH_OIDback to summary
public static final Oid DEFAULT_MECH_OID
factoriesback to summary
private final HashMap<ProviderList.PreferencesEntry, MechanismFactory> factories
mechsback to summary
private final HashSet<Oid> mechs
preferencesback to summary
private final ArrayList<ProviderList.PreferencesEntry> preferences
PROV_PROP_PREFIXback to summary
private static final String PROV_PROP_PREFIX
PROV_PROP_PREFIX_LENback to summary
private static final int PROV_PROP_PREFIX_LEN
SPI_MECH_FACTORY_TYPEback to summary
private static final String SPI_MECH_FACTORY_TYPE

Constructor Detail

ProviderListback to summary
public ProviderList(GSSCaller caller, boolean useNative)

Method Detail

addAllMechsFromProviderback to summary
private boolean addAllMechsFromProvider(Provider p)

Helper routine to go through all properties contained in a provider and add its mechanisms to the list of supported mechanisms. If no default mechanism has been assigned so far, it sets the default MechanismFactory and Oid as well.

Parameters
p:Provider

the provider to query

Returns:boolean

true if there is at least one mechanism that this provider contributed, false otherwise

addProviderAtEndback to summary
public synchronized void addProviderAtEnd(Provider p, Oid mechOid) throws GSSException
addProviderAtFrontback to summary
public synchronized void addProviderAtFront(Provider p, Oid mechOid) throws GSSException
createGSSExceptionback to summary
private static GSSException createGSSException(Provider p, String className, String trailingMsg, Exception cause)
getMechFactoryback to summary
public synchronized MechanismFactory getMechFactory(Oid mechOid) throws GSSException
getMechFactoryback to summary
public synchronized MechanismFactory getMechFactory(Oid mechOid, Provider p) throws GSSException

Obtains a MechanismFactory for a given mechanism. If the specified provider is not null, then the impl from the provider is used. Otherwise, the most preferred impl based on the configured preferences is used.

Parameters
mechOid:Oid

the oid of the desired mechanism

Returns:MechanismFactory

a MechanismFactory for the desired mechanism.

Exceptions
GSSException:
when the specified provider does not support the desired mechanism, or when no provider supports the desired mechanism.
getMechFactoryback to summary
private MechanismFactory getMechFactory(ProviderList.PreferencesEntry e, Oid mechOid) throws GSSException

Helper routine that uses a preferences entry to obtain an implementation of a MechanismFactory from it.

Parameters
e:ProviderList.PreferencesEntry

the preferences entry that contains the provider and either a null of an explicit oid that matched the oid of the desired mechanism.

mechOid:Oid

the oid of the desired mechanism

Exceptions
GSSException:
If the application explicitly requested this entry's provider to be used for the desired mechanism but some problem is encountered
getMechFactoryImplback to summary
private static MechanismFactory getMechFactoryImpl(Provider p, String className, Oid mechOid, GSSCaller caller) throws GSSException

Helper routine to obtain a MechanismFactory implementation from the same class loader as the provider of this implementation.

Parameters
p:Provider

the provider whose classloader must be used for instantiating the desired MechanismFactory @ param className the name of the MechanismFactory class

Exceptions
GSSException:
If some error occurs when trying to instantiate this MechanismFactory.
getMechsback to summary
public Oid[] getMechs()
getOidFromMechFactoryPropertyback to summary
private Oid getOidFromMechFactoryProperty(String prop) throws GSSException
isMechFactoryPropertyback to summary
private boolean isMechFactoryProperty(String prop)

Determines if the given provider property represents a GSS-API Oid to MechanismFactory mapping.

Returns:boolean

true if this is a GSS-API property, false otherwise.

sun.security.jgss back to summary

private final Class ProviderList.PreferencesEntry

extends Object
Class Inheritance

Stores a provider and a mechanism oid indicating that the provider should be used for the mechanism. If the mechanism Oid is null, then it indicates that this preference holds for any mechanism.

The ProviderList maintains an ordered list of PreferencesEntry's and iterates through them as it tries to instantiate MechanismFactory's.

Field Summary

Modifier and TypeField and Description
private Oid
private Provider
p

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object other)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

pack-priv Oid
pack-priv Provider
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

pack-priv boolean
implies(Object other)

Determines if a preference implies another.

pack-priv boolean

Returns:

true if the provider in this entry should be queried for this mechanism.
impliesMechanism
(Oid oid)

Determines if this entry is applicable to the desired mechanism.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

oidback to summary
private Oid oid
pback to summary
private Provider p

Constructor Detail

PreferencesEntryback to summary
pack-priv PreferencesEntry(Provider p, Oid oid)

Method Detail

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
getOidback to summary
pack-priv Oid getOid()
getProviderback to summary
pack-priv Provider getProvider()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
impliesback to summary
pack-priv boolean implies(Object other)

Determines if a preference implies another. A preference implies another if the latter is subsumed by the former. e.g., implies because the null in the former indicates that it should be used for all mechanisms.

impliesMechanismback to summary
pack-priv boolean impliesMechanism(Oid oid)

Determines if this entry is applicable to the desired mechanism. The entry is applicable to the desired mech if it contains the same oid or if it contains a null oid indicating that it is applicable to all mechs.

Returns:boolean

true if the provider in this entry should be queried for this mechanism.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.