jdk/src/share/classes/javax/smartcardio/TerminalFactorySpi.java
author never
Mon, 12 Jul 2010 22:27:18 -0700
changeset 5926 a36f90d986b6
parent 5506 202f599c92aa
permissions -rw-r--r--
6968385: malformed xml in sweeper logging Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.smartcardio;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * The TerminalFactorySpi class defines the service provider interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * Applications do not access this class directly, instead see
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * {@linkplain TerminalFactory}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * <P>Service providers that want to write a new implementation should define
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * a concrete subclass of TerminalFactorySpi with a constructor that takes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * an <code>Object</code> as parameter. That class needs to be registered
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * in a {@linkplain java.security.Provider}. The engine
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * {@linkplain java.security.Provider.Service#getType type} is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * <code>TerminalFactory</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * Service providers also need to implement subclasses of the abstract classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * {@linkplain CardTerminals}, {@linkplain CardTerminal}, {@linkplain Card},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * and {@linkplain CardChannel}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * <p>For example:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <pre><em>file MyProvider.java:</em>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * package com.somedomain.card;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * import java.security.Provider;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * public class MyProvider extends Provider {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 *     public MyProvider() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *         super("MyProvider", 1.0d, "Smart Card Example");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *         put("TerminalFactory.MyType", "com.somedomain.card.MySpi");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 *<em>file MySpi.java</em>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * package com.somedomain.card;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * import javax.smartcardio.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * public class MySpi extends TerminalFactoySpi {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 *      public MySpi(Object parameter) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 *          // initialize as appropriate
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 *      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 *      protected CardTerminals engineTerminals() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 *          // add implementation code here
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 *      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * @see TerminalFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * @see java.security.Provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * @since   1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * @author  Andreas Sterbenz
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * @author  JSR 268 Expert Group
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
public abstract class TerminalFactorySpi {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * Constructs a new TerminalFactorySpi object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * <p>This class is part of the service provider interface and not accessed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * directly by applications. Applications
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * should use TerminalFactory objects, which can be obtained by calling
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * one of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * {@linkplain TerminalFactory#getInstance TerminalFactory.getInstance()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * <p>Concrete subclasses should define a constructor that takes an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * <code>Object</code> as parameter. It will be invoked when an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * application calls one of the {@linkplain TerminalFactory#getInstance
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * TerminalFactory.getInstance()} methods and receives the <code>params</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * object specified by the application.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    protected TerminalFactorySpi() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        // empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * Returns the CardTerminals created by this factory.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * @return the CardTerminals created by this factory.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    protected abstract CardTerminals engineTerminals();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
}