Enginepublic class Engine extends Object This class implements common functionality for all engine classes |
Fields Summary |
---|
private String | serviceName | private Provider$Service | returnedService | private String | lastAlgorithm | private int | refreshNumber | public Provider | providerProvider | public Object | spiSPI instance | public static SecurityAccess | doorAccess to package visible api in java.security |
Constructors Summary |
---|
public Engine(String service)Creates a Engine object
this.serviceName = service;
|
Methods Summary |
---|
public synchronized void | getInstance(java.lang.String algorithm, java.lang.Object param)Finds the appropriate service implementation and creates instance of the
class that implements corresponding Service Provider Interface.
Provider.Service serv;
if (algorithm == null) {
throw new NoSuchAlgorithmException(Messages.getString("security.149")); //$NON-NLS-1$
}
Services.refresh();
if (returnedService != null
&& algorithm.equalsIgnoreCase(lastAlgorithm)
&& refreshNumber == Services.refreshNumber) {
serv = returnedService;
} else {
if (Services.isEmpty()) {
throw new NoSuchAlgorithmException(Messages.getString("security.14A", //$NON-NLS-1$
serviceName, algorithm));
}
serv = Services.getService(new StringBuffer(128)
.append(serviceName).append(".").append( //$NON-NLS-1$
algorithm.toUpperCase()).toString());
if (serv == null) {
throw new NoSuchAlgorithmException(Messages.getString("security.14A", //$NON-NLS-1$
serviceName, algorithm));
}
returnedService = serv;
lastAlgorithm = algorithm;
refreshNumber = Services.refreshNumber;
}
spi = serv.newInstance(param);
this.provider = serv.getProvider();
| public synchronized void | getInstance(java.lang.String algorithm, java.security.Provider provider, java.lang.Object param)Finds the appropriate service implementation and creates instance of the
class that implements corresponding Service Provider Interface.
Provider.Service serv = null;
if (algorithm == null) {
throw new NoSuchAlgorithmException(
Messages.getString("security.14B", serviceName)); //$NON-NLS-1$
}
serv = provider.getService(serviceName, algorithm);
if (serv == null) {
throw new NoSuchAlgorithmException(Messages.getString("security.14A", //$NON-NLS-1$
serviceName, algorithm));
}
spi = serv.newInstance(param);
this.provider = provider;
|
|