Path: blob/master/src/java.smartcardio/share/classes/javax/smartcardio/TerminalFactorySpi.java
41153 views
/*1* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.smartcardio;2627import java.util.*;2829/**30* The TerminalFactorySpi class defines the service provider interface.31* Applications do not access this class directly, instead see32* {@linkplain TerminalFactory}.33*34* <P>Service providers that want to write a new implementation should define35* a concrete subclass of TerminalFactorySpi with a constructor that takes36* an <code>Object</code> as parameter. That class needs to be registered37* in a {@linkplain java.security.Provider}. The engine38* {@linkplain java.security.Provider.Service#getType type} is39* <code>TerminalFactory</code>.40* Service providers also need to implement subclasses of the abstract classes41* {@linkplain CardTerminals}, {@linkplain CardTerminal}, {@linkplain Card},42* and {@linkplain CardChannel}.43*44* <p>For example:45* <pre><em>file MyProvider.java:</em>46*47* package com.somedomain.card;48*49* import java.security.Provider;50*51* public class MyProvider extends Provider {52* public MyProvider() {53* super("MyProvider", 1.0d, "Smart Card Example");54* put("TerminalFactory.MyType", "com.somedomain.card.MySpi");55* }56* }57*58*<em>file MySpi.java</em>59*60* package com.somedomain.card;61*62* import javax.smartcardio.*;63*64* public class MySpi extends TerminalFactoySpi {65* public MySpi(Object parameter) {66* // initialize as appropriate67* }68* protected CardTerminals engineTerminals() {69* // add implementation code here70* }71* }72* </pre>73*74* @see TerminalFactory75* @see java.security.Provider76*77* @since 1.678* @author Andreas Sterbenz79* @author JSR 268 Expert Group80*/81public abstract class TerminalFactorySpi {8283/**84* Constructs a new TerminalFactorySpi object.85*86* <p>This class is part of the service provider interface and not accessed87* directly by applications. Applications88* should use TerminalFactory objects, which can be obtained by calling89* one of the90* {@linkplain TerminalFactory#getInstance TerminalFactory.getInstance()}91* methods.92*93* <p>Concrete subclasses should define a constructor that takes an94* <code>Object</code> as parameter. It will be invoked when an95* application calls one of the {@linkplain TerminalFactory#getInstance96* TerminalFactory.getInstance()} methods and receives the <code>params</code>97* object specified by the application.98*/99protected TerminalFactorySpi() {100// empty101}102103/**104* Returns the CardTerminals created by this factory.105*106* @return the CardTerminals created by this factory.107*/108protected abstract CardTerminals engineTerminals();109110}111112113