< prev index next >

src/java.base/share/classes/javax/security/auth/login/Configuration.java

Print this page
rev 15967 : [mq]: GetInstance


 312      *
 313      * <p> Note that the list of registered providers may be retrieved via
 314      * the {@link Security#getProviders() Security.getProviders()} method.
 315      *
 316      * @implNote
 317      * The JDK Reference Implementation additionally uses the
 318      * {@code jdk.security.provider.preferred}
 319      * {@link Security#getProperty(String) Security} property to determine
 320      * the preferred provider order for the specified algorithm. This
 321      * may be different than the order of providers returned by
 322      * {@link Security#getProviders() Security.getProviders()}.
 323      *
 324      * @param type the specified Configuration type.  See the Configuration
 325      *    section in the <a href=
 326      *    "{@docRoot}/../technotes/guides/security/StandardNames.html#Configuration">
 327      *    Java Cryptography Architecture Standard Algorithm Name
 328      *    Documentation</a> for a list of standard Configuration types.
 329      *
 330      * @param params parameters for the Configuration, which may be null.
 331      *
 332      * @return the new Configuration object.
 333      *
 334      * @exception SecurityException if the caller does not have permission
 335      *          to get a Configuration instance for the specified type.

 336      *
 337      * @exception NullPointerException if the specified type is null.

 338      *
 339      * @exception IllegalArgumentException if the specified parameters
 340      *          are not understood by the ConfigurationSpi implementation
 341      *          from the selected Provider.
 342      *
 343      * @exception NoSuchAlgorithmException if no Provider supports a
 344      *          ConfigurationSpi implementation for the specified type.
 345      *
 346      * @see Provider

 347      * @since 1.6
 348      */
 349     public static Configuration getInstance(String type,
 350                                 Configuration.Parameters params)
 351                 throws NoSuchAlgorithmException {
 352 

 353         checkPermission(type);
 354         try {
 355             GetInstance.Instance instance = GetInstance.getInstance
 356                                                         ("Configuration",
 357                                                         ConfigurationSpi.class,
 358                                                         type,
 359                                                         params);
 360             return new ConfigDelegate((ConfigurationSpi)instance.impl,
 361                                                         instance.provider,
 362                                                         type,
 363                                                         params);
 364         } catch (NoSuchAlgorithmException nsae) {
 365             return handleException (nsae);
 366         }
 367     }
 368 
 369     /**
 370      * Returns a Configuration object of the specified type.
 371      *
 372      * <p> A new Configuration object encapsulating the
 373      * ConfigurationSpi implementation from the specified provider
 374      * is returned.   The specified provider must be registered
 375      * in the provider list.
 376      *
 377      * <p> Note that the list of registered providers may be retrieved via
 378      * the {@link Security#getProviders() Security.getProviders()} method.
 379      *
 380      * @param type the specified Configuration type.  See the Configuration
 381      *    section in the <a href=
 382      *    "{@docRoot}/../technotes/guides/security/StandardNames.html#Configuration">
 383      *    Java Cryptography Architecture Standard Algorithm Name
 384      *    Documentation</a> for a list of standard Configuration types.
 385      *
 386      * @param params parameters for the Configuration, which may be null.
 387      *
 388      * @param provider the provider.
 389      *
 390      * @return the new Configuration object.
 391      *
 392      * @exception SecurityException if the caller does not have permission
 393      *          to get a Configuration instance for the specified type.


 394      *
 395      * @exception NullPointerException if the specified type is null.

 396      *
 397      * @exception IllegalArgumentException if the specified provider
 398      *          is null or empty,
 399      *          or if the specified parameters are not understood by
 400      *          the ConfigurationSpi implementation from the specified provider.
 401      *
 402      * @exception NoSuchProviderException if the specified provider is not
 403      *          registered in the security provider list.
 404      *
 405      * @exception NoSuchAlgorithmException if the specified provider does not
 406      *          support a ConfigurationSpi implementation for the specified
 407      *          type.
 408      *
 409      * @see Provider
 410      * @since 1.6
 411      */
 412     public static Configuration getInstance(String type,
 413                                 Configuration.Parameters params,
 414                                 String provider)
 415                 throws NoSuchProviderException, NoSuchAlgorithmException {
 416 

 417         if (provider == null || provider.length() == 0) {
 418             throw new IllegalArgumentException("missing provider");
 419         }
 420 
 421         checkPermission(type);
 422         try {
 423             GetInstance.Instance instance = GetInstance.getInstance
 424                                                         ("Configuration",
 425                                                         ConfigurationSpi.class,
 426                                                         type,
 427                                                         params,
 428                                                         provider);
 429             return new ConfigDelegate((ConfigurationSpi)instance.impl,
 430                                                         instance.provider,
 431                                                         type,
 432                                                         params);
 433         } catch (NoSuchAlgorithmException nsae) {
 434             return handleException (nsae);
 435         }
 436     }
 437 
 438     /**
 439      * Returns a Configuration object of the specified type.
 440      *
 441      * <p> A new Configuration object encapsulating the
 442      * ConfigurationSpi implementation from the specified Provider
 443      * object is returned.  Note that the specified Provider object
 444      * does not have to be registered in the provider list.
 445      *
 446      * @param type the specified Configuration type.  See the Configuration
 447      *    section in the <a href=
 448      *    "{@docRoot}/../technotes/guides/security/StandardNames.html#Configuration">
 449      *    Java Cryptography Architecture Standard Algorithm Name
 450      *    Documentation</a> for a list of standard Configuration types.
 451      *
 452      * @param params parameters for the Configuration, which may be null.
 453      *
 454      * @param provider the Provider.
 455      *
 456      * @return the new Configuration object.
 457      *
 458      * @exception SecurityException if the caller does not have permission
 459      *          to get a Configuration instance for the specified type.


 460      *
 461      * @exception NullPointerException if the specified type is null.


 462      *
 463      * @exception IllegalArgumentException if the specified Provider is null,
 464      *          or if the specified parameters are not understood by
 465      *          the ConfigurationSpi implementation from the specified Provider.
 466      *
 467      * @exception NoSuchAlgorithmException if the specified Provider does not
 468      *          support a ConfigurationSpi implementation for the specified
 469      *          type.
 470      *
 471      * @see Provider
 472      * @since 1.6
 473      */
 474     public static Configuration getInstance(String type,
 475                                 Configuration.Parameters params,
 476                                 Provider provider)
 477                 throws NoSuchAlgorithmException {
 478 

 479         if (provider == null) {
 480             throw new IllegalArgumentException("missing provider");
 481         }
 482 
 483         checkPermission(type);
 484         try {
 485             GetInstance.Instance instance = GetInstance.getInstance
 486                                                         ("Configuration",
 487                                                         ConfigurationSpi.class,
 488                                                         type,
 489                                                         params,
 490                                                         provider);
 491             return new ConfigDelegate((ConfigurationSpi)instance.impl,
 492                                                         instance.provider,
 493                                                         type,
 494                                                         params);
 495         } catch (NoSuchAlgorithmException nsae) {
 496             return handleException (nsae);
 497         }
 498     }




 312      *
 313      * <p> Note that the list of registered providers may be retrieved via
 314      * the {@link Security#getProviders() Security.getProviders()} method.
 315      *
 316      * @implNote
 317      * The JDK Reference Implementation additionally uses the
 318      * {@code jdk.security.provider.preferred}
 319      * {@link Security#getProperty(String) Security} property to determine
 320      * the preferred provider order for the specified algorithm. This
 321      * may be different than the order of providers returned by
 322      * {@link Security#getProviders() Security.getProviders()}.
 323      *
 324      * @param type the specified Configuration type.  See the Configuration
 325      *    section in the <a href=
 326      *    "{@docRoot}/../technotes/guides/security/StandardNames.html#Configuration">
 327      *    Java Cryptography Architecture Standard Algorithm Name
 328      *    Documentation</a> for a list of standard Configuration types.
 329      *
 330      * @param params parameters for the Configuration, which may be null.
 331      *
 332      * @return the new {@code Configuration} object
 333      *
 334      * @throws IllegalArgumentException if the specified parameters
 335      *         are not understood by the {@code ConfigurationSpi}
 336      *         implementation from the selected {@code Provider}
 337      *
 338      * @throws NoSuchAlgorithmException if no {@code Provider} supports a
 339      *         {@code ConfigurationSpi} implementation for the specified type
 340      *
 341      * @throws NullPointerException if {@code type} is {@code null}


 342      *
 343      * @throws SecurityException if the caller does not have permission
 344      *         to get a {@code Configuration} instance for the specified type
 345      *
 346      * @see Provider
 347      *
 348      * @since 1.6
 349      */
 350     public static Configuration getInstance(String type,
 351                                 Configuration.Parameters params)
 352                 throws NoSuchAlgorithmException {
 353 
 354         Objects.requireNonNull(type, "null type name");
 355         checkPermission(type);
 356         try {
 357             GetInstance.Instance instance = GetInstance.getInstance
 358                                                         ("Configuration",
 359                                                         ConfigurationSpi.class,
 360                                                         type,
 361                                                         params);
 362             return new ConfigDelegate((ConfigurationSpi)instance.impl,
 363                                                         instance.provider,
 364                                                         type,
 365                                                         params);
 366         } catch (NoSuchAlgorithmException nsae) {
 367             return handleException (nsae);
 368         }
 369     }
 370 
 371     /**
 372      * Returns a Configuration object of the specified type.
 373      *
 374      * <p> A new Configuration object encapsulating the
 375      * ConfigurationSpi implementation from the specified provider
 376      * is returned.   The specified provider must be registered
 377      * in the provider list.
 378      *
 379      * <p> Note that the list of registered providers may be retrieved via
 380      * the {@link Security#getProviders() Security.getProviders()} method.
 381      *
 382      * @param type the specified Configuration type.  See the Configuration
 383      *    section in the <a href=
 384      *    "{@docRoot}/../technotes/guides/security/StandardNames.html#Configuration">
 385      *    Java Cryptography Architecture Standard Algorithm Name
 386      *    Documentation</a> for a list of standard Configuration types.
 387      *
 388      * @param params parameters for the Configuration, which may be null.
 389      *
 390      * @param provider the provider.
 391      *
 392      * @return the new {@code Configuration} object
 393      *
 394      * @throws IllegalArgumentException if the specified provider
 395      *         is {@code null} or empty, or if the specified parameters
 396      *         are not understood by the {@code ConfigurationSpi}
 397      *         implementation from the specified provider
 398      *
 399      * @throws NoSuchProviderException if the specified provider is not
 400      *         registered in the security provider list
 401      *
 402      * @throws NoSuchAlgorithmException if the specified provider does not
 403      *         support a {@code ConfigurationSpi} implementation for the
 404      *         specified type

 405      *
 406      * @throws NullPointerException if {@code type} is {@code null}

 407      *
 408      * @throws SecurityException if the caller does not have permission
 409      *         to get a {@code Configuration} instance for the specified type

 410      *
 411      * @see Provider
 412      * @since 1.6
 413      */
 414     public static Configuration getInstance(String type,
 415                                 Configuration.Parameters params,
 416                                 String provider)
 417                 throws NoSuchProviderException, NoSuchAlgorithmException {
 418 
 419         Objects.requireNonNull(type, "null type name");
 420         if (provider == null || provider.length() == 0) {
 421             throw new IllegalArgumentException("missing provider");
 422         }
 423 
 424         checkPermission(type);
 425         try {
 426             GetInstance.Instance instance = GetInstance.getInstance
 427                                                         ("Configuration",
 428                                                         ConfigurationSpi.class,
 429                                                         type,
 430                                                         params,
 431                                                         provider);
 432             return new ConfigDelegate((ConfigurationSpi)instance.impl,
 433                                                         instance.provider,
 434                                                         type,
 435                                                         params);
 436         } catch (NoSuchAlgorithmException nsae) {
 437             return handleException (nsae);
 438         }
 439     }
 440 
 441     /**
 442      * Returns a Configuration object of the specified type.
 443      *
 444      * <p> A new Configuration object encapsulating the
 445      * ConfigurationSpi implementation from the specified Provider
 446      * object is returned.  Note that the specified Provider object
 447      * does not have to be registered in the provider list.
 448      *
 449      * @param type the specified Configuration type.  See the Configuration
 450      *    section in the <a href=
 451      *    "{@docRoot}/../technotes/guides/security/StandardNames.html#Configuration">
 452      *    Java Cryptography Architecture Standard Algorithm Name
 453      *    Documentation</a> for a list of standard Configuration types.
 454      *
 455      * @param params parameters for the Configuration, which may be null.
 456      *
 457      * @param provider the Provider.
 458      *
 459      * @return the new {@code Configuration} object
 460      *
 461      * @throws IllegalArgumentException if the specified {@code Provider}
 462      *         is {@code null}, or if the specified parameters are not
 463      *         understood by the {@code ConfigurationSpi} implementation
 464      *         from the specified Provider
 465      *
 466      * @throws NoSuchAlgorithmException if the specified {@code Provider}
 467      *         does not support a {@code ConfigurationSpi} implementation
 468      *         for the specified type
 469      *
 470      * @throws NullPointerException if {@code type} is {@code null}


 471      *
 472      * @throws SecurityException if the caller does not have permission
 473      *         to get a {@code Configuration} instance for the specified type

 474      *
 475      * @see Provider
 476      * @since 1.6
 477      */
 478     public static Configuration getInstance(String type,
 479                                 Configuration.Parameters params,
 480                                 Provider provider)
 481                 throws NoSuchAlgorithmException {
 482 
 483         Objects.requireNonNull(type, "null type name");
 484         if (provider == null) {
 485             throw new IllegalArgumentException("missing provider");
 486         }
 487 
 488         checkPermission(type);
 489         try {
 490             GetInstance.Instance instance = GetInstance.getInstance
 491                                                         ("Configuration",
 492                                                         ConfigurationSpi.class,
 493                                                         type,
 494                                                         params,
 495                                                         provider);
 496             return new ConfigDelegate((ConfigurationSpi)instance.impl,
 497                                                         instance.provider,
 498                                                         type,
 499                                                         params);
 500         } catch (NoSuchAlgorithmException nsae) {
 501             return handleException (nsae);
 502         }
 503     }


< prev index next >