blob: 67094447ddfbe005ead5e11d56bbea309725294f [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2005-2006 Sun Microsystems, Inc. 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26package javax.smartcardio;
27
28import java.util.*;
29
30/**
31 * The TerminalFactorySpi class defines the service provider interface.
32 * Applications do not access this class directly, instead see
33 * {@linkplain TerminalFactory}.
34 *
35 * <P>Service providers that want to write a new implementation should define
36 * a concrete subclass of TerminalFactorySpi with a constructor that takes
37 * an <code>Object</code> as parameter. That class needs to be registered
38 * in a {@linkplain java.security.Provider}. The engine
39 * {@linkplain java.security.Provider.Service#getType type} is
40 * <code>TerminalFactory</code>.
41 * Service providers also need to implement subclasses of the abstract classes
42 * {@linkplain CardTerminals}, {@linkplain CardTerminal}, {@linkplain Card},
43 * and {@linkplain CardChannel}.
44 *
45 * <p>For example:
46 * <pre><em>file MyProvider.java:</em>
47 *
48 * package com.somedomain.card;
49 *
50 * import java.security.Provider;
51 *
52 * public class MyProvider extends Provider {
53 * public MyProvider() {
54 * super("MyProvider", 1.0d, "Smart Card Example");
55 * put("TerminalFactory.MyType", "com.somedomain.card.MySpi");
56 * }
57 * }
58 *
59 *<em>file MySpi.java</em>
60 *
61 * package com.somedomain.card;
62 *
63 * import javax.smartcardio.*;
64 *
65 * public class MySpi extends TerminalFactoySpi {
66 * public MySpi(Object parameter) {
67 * // initialize as appropriate
68 * }
69 * protected CardTerminals engineTerminals() {
70 * // add implementation code here
71 * }
72 * }
73 * </pre>
74 *
75 * @see TerminalFactory
76 * @see java.security.Provider
77 *
78 * @since 1.6
79 * @author Andreas Sterbenz
80 * @author JSR 268 Expert Group
81 */
82public abstract class TerminalFactorySpi {
83
84 /**
85 * Constructs a new TerminalFactorySpi object.
86 *
87 * <p>This class is part of the service provider interface and not accessed
88 * directly by applications. Applications
89 * should use TerminalFactory objects, which can be obtained by calling
90 * one of the
91 * {@linkplain TerminalFactory#getInstance TerminalFactory.getInstance()}
92 * methods.
93 *
94 * <p>Concrete subclasses should define a constructor that takes an
95 * <code>Object</code> as parameter. It will be invoked when an
96 * application calls one of the {@linkplain TerminalFactory#getInstance
97 * TerminalFactory.getInstance()} methods and receives the <code>params</code>
98 * object specified by the application.
99 */
100 protected TerminalFactorySpi() {
101 // empty
102 }
103
104 /**
105 * Returns the CardTerminals created by this factory.
106 *
107 * @return the CardTerminals created by this factory.
108 */
109 protected abstract CardTerminals engineTerminals();
110
111}