Re: Use of Providers

Jan Luehe (Jan.Luehe@Eng)
Fri, 5 Sep 1997 17:09:36 -0700 (PDT)

Date: Fri, 5 Sep 1997 17:09:36 -0700 (PDT)
From: Jan Luehe <Jan.Luehe@Eng>
Subject: Re: Use of Providers
To: java-security@java0.javasoft.com, Mayank.Upadhyay@Eng

Mayank:

> I am working on a Java GSS-API (Generic Security Services API) at SunSoft
> for the WebNFS client and am interested in using the provider model of your
> JCA.

Great!

> My understanding is that a Provider basically provides the names of the
> classes that implement the abstract engine classes. A factory method in an
> engine class would use such a class name to return an instance of the
> implementation. However, I dont see any methods in the Provider class that
> would allow this information (class name) to be queried from it by another
> class.

An application does not need direct access to the class names that
implement the abstract engine classes.

The static getImpl() method in the Security class does the job for
you.
This method is called by all the getInstance() engine mthods.

getImpl() has access to all the registered providers, and can query
their properties. Each property is keyed by an algorithm/type name
and the associated value is the name of the class which provides
the implementation
(Remember: Provider extends Properties, which itself extends Hashtable!)

If you really need to access a provider's properties directly,
you can call

public static Provider getProvider(String name)

(this method is defined in Security.java, and "name" is the
name of the provider),

and then query the properties of the returned Provider object.

Hope this helps,

Jan