Class CardServiceFactory

    • Constructor Detail

      • CardServiceFactory

        public CardServiceFactory()
        Instantiate a CardServiceFactory.
    • Method Detail

      • getCardServiceInstance

        protected CardService getCardServiceInstance​(java.lang.Class clazz,
                                                     CardType type,
                                                     CardServiceScheduler scheduler,
                                                     SmartCard card,
                                                     boolean block)
                                              throws CardServiceException
        Instantiate a CardService implementing the class clazz.
        Parameters:
        clazz - The Class object for which an implementing CardService is requested.
        cid - A CardID object representing the smart card for which the CardService is requested.
        scheduler - The controlling CardServiceScheduler
        card - The SmarCard object requesting the CardService
        block - Specifies the waiting behavior of the newly created CardService; if true it will wait for CardChannel (i.e., block).
        Returns:
        An instance of the requested CardService, or null if the requested CardService cannot be instantiated.
        Throws:
        CardServiceException
      • getClassFor

        protected java.lang.Class getClassFor​(java.lang.Class clazz,
                                              CardType type)
        Locate the CardService class that implements clazz.
        Parameters:
        clazz - The Class object for which an implementing CardService is requested.
        type - A CardType object representing the smart card for which the CardService is requested.
        Returns:
        The class object of the CardService class that implements clazz if there is one; null otherwise.
      • getCardType

        protected abstract CardType getCardType​(CardID cid,
                                                CardServiceScheduler scheduler)
                                         throws CardTerminalException
        Indicate whether this CardServiceFactory "knows" the smart card OS and/or installed card applications and might be able to instantiate CardServices for it.

        This method replaces the former knows() method. Note: OCF 1.1 style card service factories should instead derive from opencard.opt.service.OCF11CardServiceFactory which still offers the knows() and cardServiceClasses() methods.

        Should return a CardType that contains enough information to answer the getClassFor() method.

        The factory can inspect the card (communicate with the card) using the provided CardServiceScheduler if the CardID information is insufficient to classify the card.

        Parameters:
        cid - A CardID received from a Slot.
        scheduler - A CardServiceScheduler that can be used to communicate with the card to determine its type.
        Returns:
        A valid CardType if the factory can instantiate services for this card. CardType.UNSUPPORTED if the factory does not know the card.
        Throws:
        CardTerminalException
      • getClasses

        protected abstract java.util.Enumeration getClasses​(CardType type)
        Return an enumeration of known CardService classes.

        Replaces the former cardServiceClasses() method. Note: OCF 1.1 style card service factories should instead derive from opencard.opt.service.OCF11CardServiceFactory which still offers the knows() and cardServiceClasses() methods.

        Parameters:
        type - The CardType of the smart card for which the enumeration is requested.
        Returns:
        An Enumeration of class objects.