예제 #1
0
        public static SmartCardManagerTumunuOku getInstanceTumunuOku()
        {
            if (mSCManager == null)
            {
                mSCManager = new SmartCardManagerTumunuOku();
                return(mSCManager);
            }
            else
            {
                //Check is there any change
                try
                {
                    //If there is a new card in the system, user will select a smartcard.
                    //Create new SmartCard.
                    if (mSCManager.getSlotCount() < SmartOp.getCardTerminals().Length)
                    {
                        LOGGER.Debug("New card pluged in to system");
                        mSCManager = null;
                        return(getInstanceTumunuOku());
                    }

                    //If used card is removed, select new card.
                    String availableSerial = null;
                    try
                    {
                        availableSerial = StringUtil.ToString(mSCManager.getBasicSmartCard().getSerial());
                    }
                    catch (SmartCardException ex)
                    {
                        LOGGER.Debug("Card removed");
                        mSCManager = null;
                        return(getInstanceTumunuOku());
                    }
                    if (!mSCManager.getSelectedSerialNumber().Equals(availableSerial))
                    {
                        LOGGER.Debug("Serial number changed. New card is placed to system");
                        mSCManager = null;
                        return(getInstanceTumunuOku());
                    }

                    return(mSCManager);
                }
                catch (SmartCardException e)
                {
                    mSCManager = null;
                    throw;
                }
            }
        }
예제 #2
0
 public static void reset()
 {
     mSCManager = null;
 }