1 /*
2 * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
214
215 /**
216 * Returns a TerminalFactory of the specified type that is initialized
217 * with the specified parameters.
218 *
219 * <p> This method traverses the list of registered security Providers,
220 * starting with the most preferred Provider.
221 * A new TerminalFactory object encapsulating the
222 * TerminalFactorySpi implementation from the first
223 * Provider that supports the specified type is returned.
224 *
225 * <p> Note that the list of registered providers may be retrieved via
226 * the {@linkplain Security#getProviders() Security.getProviders()} method.
227 *
228 * <p>The <code>TerminalFactory</code> is initialized with the
229 * specified parameters Object. The type of parameters
230 * needed may vary between different types of <code>TerminalFactory</code>s.
231 *
232 * @implNote
233 * The JDK Reference Implementation additionally uses the
234 * {@code jdk.security.provider.preferred} property to determine
235 * the preferred provider order for the specified algorithm. This
236 * may be different than the order of providers returned by
237 * {@link Security#getProviders() Security.getProviders()}.
238 *
239 * @param type the type of the requested TerminalFactory
240 * @param params the parameters to pass to the TerminalFactorySpi
241 * implementation, or null if no parameters are needed
242 * @return a TerminalFactory of the specified type
243 *
244 * @throws NullPointerException if type is null
245 * @throws NoSuchAlgorithmException if no Provider supports a
246 * TerminalFactorySpi of the specified type
247 */
248 public static TerminalFactory getInstance(String type, Object params)
249 throws NoSuchAlgorithmException {
250 Instance instance = GetInstance.getInstance("TerminalFactory",
251 TerminalFactorySpi.class, type, params);
252 return new TerminalFactory((TerminalFactorySpi)instance.impl,
253 instance.provider, type);
254 }
|
1 /*
2 * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
214
215 /**
216 * Returns a TerminalFactory of the specified type that is initialized
217 * with the specified parameters.
218 *
219 * <p> This method traverses the list of registered security Providers,
220 * starting with the most preferred Provider.
221 * A new TerminalFactory object encapsulating the
222 * TerminalFactorySpi implementation from the first
223 * Provider that supports the specified type is returned.
224 *
225 * <p> Note that the list of registered providers may be retrieved via
226 * the {@linkplain Security#getProviders() Security.getProviders()} method.
227 *
228 * <p>The <code>TerminalFactory</code> is initialized with the
229 * specified parameters Object. The type of parameters
230 * needed may vary between different types of <code>TerminalFactory</code>s.
231 *
232 * @implNote
233 * The JDK Reference Implementation additionally uses the
234 * {@code jdk.security.provider.preferred}
235 * {@link Security#getProperty(String) Security} property to determine
236 * the preferred provider order for the specified algorithm. This
237 * may be different than the order of providers returned by
238 * {@link Security#getProviders() Security.getProviders()}.
239 *
240 * @param type the type of the requested TerminalFactory
241 * @param params the parameters to pass to the TerminalFactorySpi
242 * implementation, or null if no parameters are needed
243 * @return a TerminalFactory of the specified type
244 *
245 * @throws NullPointerException if type is null
246 * @throws NoSuchAlgorithmException if no Provider supports a
247 * TerminalFactorySpi of the specified type
248 */
249 public static TerminalFactory getInstance(String type, Object params)
250 throws NoSuchAlgorithmException {
251 Instance instance = GetInstance.getInstance("TerminalFactory",
252 TerminalFactorySpi.class, type, params);
253 return new TerminalFactory((TerminalFactorySpi)instance.impl,
254 instance.provider, type);
255 }
|