diff --git a/CHANGELOG.md b/CHANGELOG.md index 96b6a4b..47674ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed +- Migrated to `keypop-genericcard-jvm-api` 1.0.0 +### Removed +- Removed deprecated enum `ChannelControl` +- Removed deprecated class `TransactionException` + ## [3.2.1] - 2026-02-20 ### Changed - Normalized logging and error messages using Keyple coding standards. diff --git a/build.gradle.kts b/build.gradle.kts index b33221b..9ce06b6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,6 +16,7 @@ plugins { dependencies { implementation("org.eclipse.keypop:keypop-reader-java-api:2.1.0") implementation("org.eclipse.keypop:keypop-card-java-api:2.0.1") + implementation("org.eclipse.keypop:keypop-genericcard-jvm-api:1.0.0") implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2") implementation("org.eclipse.keyple:keyple-service-resource-java-lib:3.1.1") implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.1") diff --git a/src/main/java/org/eclipse/keyple/card/generic/CardTransactionManager.java b/src/main/java/org/eclipse/keyple/card/generic/CardTransactionManager.java deleted file mode 100644 index 05a58a3..0000000 --- a/src/main/java/org/eclipse/keyple/card/generic/CardTransactionManager.java +++ /dev/null @@ -1,129 +0,0 @@ -/* ************************************************************************************** - * Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/ - * - * See the NOTICE file(s) distributed with this work for additional information - * regarding copyright ownership. - * - * This program and the accompanying materials are made available under the terms of the - * Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - ************************************************************************************** */ -package org.eclipse.keyple.card.generic; - -import java.util.List; - -/** Provides basic methods to prepare and process APDU exchange with a card. */ -public interface CardTransactionManager - extends org.eclipse.keypop.reader.transaction.spi.CardTransactionManager< - CardTransactionManager> { - - /** - * Prepares an APDU to be transmitted the next time {@link - * #processApdusToByteArrays(ChannelControl)} is invoked. - * - * @param apduCommand A not empty hexadecimal string containing a raw APDU command. - * @return This instance. - * @since 2.0.0 - */ - CardTransactionManager prepareApdu(String apduCommand); - - /** - * Prepares an APDU to be transmitted the next time {@link - * #processApdusToByteArrays(ChannelControl)} is invoked. - * - * @param apduCommand A not empty byte arrays containing raw APDU commands. - * @return This instance. - * @since 2.0.0 - */ - CardTransactionManager prepareApdu(byte[] apduCommand); - - /** - * Prepares an APDU to be transmitted the next time {@link - * #processApdusToByteArrays(ChannelControl)} is invoked. - * - * @param cla The class byte. - * @param ins The instruction byte. - * @param p1 The P1 parameter. - * @param p2 The P2 parameter. - * @param dataIn The APDU data, null if there is no data. - * @param le The expected output length, 0 if the output length is unspecified, null if no output - * data is expected. - * @return This instance. - * @since 2.0.0 - */ - CardTransactionManager prepareApdu(byte cla, byte ins, byte p1, byte p2, byte[] dataIn, Byte le); - - /** - * Transmits all prepared APDUs, closes the physical channel if required, and returns a list of - * responses to the APDUs in the form of list of of byte arrays. - * - *
If the prepared APDU list is empty an empty list is returned. - * - *
The prepared APDU list is cleared after this method has been invoked.
- *
- * @param channelControl Policy for managing the physical channel after executing commands to the
- * card.
- * @return A not null reference.
- * @throws TransactionException If the communication with the card or the reader has failed.
- * @since 2.0.0
- * @deprecated Use {@link #processCommands(org.eclipse.keypop.reader.ChannelControl)} and {@link
- * #getResponsesAsByteArrays()} instead.
- */
- @Deprecated
- List If the prepared APDU list is empty an empty list is returned.
- *
- * The prepared APDU list is cleared after this method has been invoked.
- *
- * @param channelControl Policy for managing the physical channel after executing commands to the
- * card.
- * @return A not null reference.
- * @throws TransactionException If the communication with the card or the reader has failed.
- * @since 2.0.0
- * @deprecated Use {@link #processCommands(org.eclipse.keypop.reader.ChannelControl)} and {@link
- * #getResponsesAsHexStrings()} instead.
- */
- @Deprecated
- List Each element in the returned list represents the response of one command, in the same order
- * as the commands were prepared. The returned list is never {@code null}. Each element in the returned list represents the response of one command, in the same order
- * as the commands were prepared. The returned list is never {@code null}. Note: initially, the list contains the standard successful status word {@code 9000h}.
- *
- * @param statusWord A positive int ≤ {@code FFFFh}.
- * @return The current instance.
- * @since 2.0.0
- */
- GenericCardSelectionExtension addSuccessfulStatusWord(int statusWord);
-}
diff --git a/src/main/java/org/eclipse/keyple/card/generic/GenericCardSelectionExtensionAdapter.java b/src/main/java/org/eclipse/keyple/card/generic/GenericCardSelectionExtensionAdapter.java
index b09bcad..97db432 100644
--- a/src/main/java/org/eclipse/keyple/card/generic/GenericCardSelectionExtensionAdapter.java
+++ b/src/main/java/org/eclipse/keyple/card/generic/GenericCardSelectionExtensionAdapter.java
@@ -15,6 +15,7 @@
import java.util.Set;
import org.eclipse.keypop.card.CardSelectionResponseApi;
import org.eclipse.keypop.card.spi.*;
+import org.eclipse.keypop.genericcard.GenericCardSelectionExtension;
/**
* Implementation of {@link GenericCardSelectionExtension}.
diff --git a/src/main/java/org/eclipse/keyple/card/generic/GenericExtensionService.java b/src/main/java/org/eclipse/keyple/card/generic/GenericExtensionService.java
index 613d122..d946a78 100644
--- a/src/main/java/org/eclipse/keyple/card/generic/GenericExtensionService.java
+++ b/src/main/java/org/eclipse/keyple/card/generic/GenericExtensionService.java
@@ -15,11 +15,10 @@
import org.eclipse.keyple.core.common.KeypleCardExtension;
import org.eclipse.keyple.core.service.resource.spi.CardResourceProfileExtension;
import org.eclipse.keypop.card.CardApiProperties;
-import org.eclipse.keypop.reader.CardReader;
+import org.eclipse.keypop.genericcard.GenericCardApiFactory;
+import org.eclipse.keypop.genericcard.GenericCardSelectionExtension;
import org.eclipse.keypop.reader.ReaderApiProperties;
import org.eclipse.keypop.reader.selection.IsoCardSelector;
-import org.eclipse.keypop.reader.selection.spi.CardSelectionExtension;
-import org.eclipse.keypop.reader.selection.spi.SmartCard;
/**
* Card extension service providing basic access to APDU exchange functions with a card.
@@ -43,25 +42,13 @@ public static GenericExtensionService getInstance() {
}
/**
- * Creates an instance of {@link CardSelectionExtension}.
+ * Returns an instance of {@link GenericCardApiFactory}.
*
* @return A not null reference.
- * @since 2.0.0
- */
- public GenericCardSelectionExtension createGenericCardSelectionExtension() {
- return new GenericCardSelectionExtensionAdapter();
- }
-
- /**
- * Creates an instance of {@link CardTransactionManager}.
- *
- * @param reader The reader through which the card communicates.
- * @param card The initial card data provided by the selection process.
- * @return A not null reference.
- * @since 2.0.0
+ * @since 4.0.0
*/
- public CardTransactionManager createCardTransaction(CardReader reader, SmartCard card) {
- return new CardTransactionManagerAdapter(reader, card);
+ public GenericCardApiFactory getGenericCardApiFactory() {
+ return new GenericCardApiFactoryAdapter();
}
/**
diff --git a/src/main/java/org/eclipse/keyple/card/generic/TransactionException.java b/src/main/java/org/eclipse/keyple/card/generic/TransactionException.java
deleted file mode 100644
index 1a3567b..0000000
--- a/src/main/java/org/eclipse/keyple/card/generic/TransactionException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/* **************************************************************************************
- * Copyright (c) 2021 Calypso Networks Association https://calypsonet.org/
- *
- * See the NOTICE file(s) distributed with this work for additional information
- * regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the terms of the
- * Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- ************************************************************************************** */
-package org.eclipse.keyple.card.generic;
-
-/**
- * Exception when an error or a communication failure with the card or the reader occurs.
- *
- * @since 2.0.0
- * @deprecated Will be removed in a future version.
- */
-@Deprecated
-public class TransactionException extends RuntimeException {
-
- /**
- * Builds a new exception.
- *
- * @param message Message to identify the exception context.
- * @since 2.0.0
- */
- public TransactionException(String message) {
- super(message);
- }
-
- /**
- * Builds a new exception with the originating exception.
- *
- * @param message Message to identify the exception context.
- * @param cause The cause
- * @since 2.0.0
- */
- public TransactionException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/src/main/javadoc/overview.html b/src/main/javadoc/overview.html
index 59c1336..a587145 100644
--- a/src/main/javadoc/overview.html
+++ b/src/main/javadoc/overview.html
@@ -10,17 +10,9 @@
- * This method does not alter the internal state of the manager: the list of responses remains
- * available for later calls until {@link
- * #processCommands(org.eclipse.keypop.reader.ChannelControl)} is invoked again, at which point it
- * is replaced by the new set of responses.
- *
- * @return A not {@code null} list of byte arrays representing the command responses, in the same
- * order as the commands were sent.
- * @since 3.2.0
- */
- List
- * This method does not alter the internal state of the manager: the list of responses remains
- * available for later calls until {@link
- * #processCommands(org.eclipse.keypop.reader.ChannelControl)} is invoked again, at which point it
- * is replaced by the new set of responses.
- *
- * @return A not {@code null} list of hexadecimal strings representing the command responses, in
- * the same order as the commands were sent.
- * @since 3.2.0
- */
- List
- * The physical channel closes instantly or a card removal sequence is initiated depending on the
- * observation mode.
- *
- * @since 3.0.0
- */
- CLOSE_AFTER
-}
diff --git a/src/main/java/org/eclipse/keyple/card/generic/GenericCardApiFactoryAdapter.java b/src/main/java/org/eclipse/keyple/card/generic/GenericCardApiFactoryAdapter.java
new file mode 100644
index 0000000..a00bb04
--- /dev/null
+++ b/src/main/java/org/eclipse/keyple/card/generic/GenericCardApiFactoryAdapter.java
@@ -0,0 +1,46 @@
+/* **************************************************************************************
+ * Copyright (c) 2026 Calypso Networks Association https://calypsonet.org/
+ *
+ * See the NOTICE file(s) distributed with this work for additional information
+ * regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the terms of the
+ * Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ ************************************************************************************** */
+package org.eclipse.keyple.card.generic;
+
+import org.eclipse.keypop.genericcard.CardTransactionManager;
+import org.eclipse.keypop.genericcard.GenericCardApiFactory;
+import org.eclipse.keypop.genericcard.GenericCardSelectionExtension;
+import org.eclipse.keypop.reader.CardReader;
+import org.eclipse.keypop.reader.selection.spi.SmartCard;
+
+/**
+ * Adapter of {@link GenericCardApiFactory}.
+ *
+ * @since 4.0.0
+ */
+class GenericCardApiFactoryAdapter implements GenericCardApiFactory {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @since 4.0.0
+ */
+ @Override
+ public GenericCardSelectionExtension createGenericCardSelectionExtension() {
+ return new GenericCardSelectionExtensionAdapter();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @since 4.0.0
+ */
+ @Override
+ public CardTransactionManager createCardTransaction(CardReader cardReader, SmartCard card) {
+ return new CardTransactionManagerAdapter(cardReader, card);
+ }
+}
diff --git a/src/main/java/org/eclipse/keyple/card/generic/GenericCardResourceProfileExtensionAdapter.java b/src/main/java/org/eclipse/keyple/card/generic/GenericCardResourceProfileExtensionAdapter.java
index 09fe4a9..8e8b6b0 100644
--- a/src/main/java/org/eclipse/keyple/card/generic/GenericCardResourceProfileExtensionAdapter.java
+++ b/src/main/java/org/eclipse/keyple/card/generic/GenericCardResourceProfileExtensionAdapter.java
@@ -13,6 +13,7 @@
import org.eclipse.keyple.core.service.resource.spi.CardResourceProfileExtension;
import org.eclipse.keyple.core.util.Assert;
+import org.eclipse.keypop.genericcard.GenericCardSelectionExtension;
import org.eclipse.keypop.reader.CardReader;
import org.eclipse.keypop.reader.ReaderApiFactory;
import org.eclipse.keypop.reader.selection.CardSelectionManager;
@@ -24,8 +25,8 @@
import org.slf4j.LoggerFactory;
/**
- * Implementation of {@link CardResourceProfileExtension} that provides the capability to filter
- * cards of any type.
+ * Implementation of {@link CardResourceProfileExtension} that provides the ability to filter cards
+ * of any type.
*
* @since 2.0.0
*/
diff --git a/src/main/java/org/eclipse/keyple/card/generic/GenericCardSelectionExtension.java b/src/main/java/org/eclipse/keyple/card/generic/GenericCardSelectionExtension.java
deleted file mode 100644
index 8aee252..0000000
--- a/src/main/java/org/eclipse/keyple/card/generic/GenericCardSelectionExtension.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/* **************************************************************************************
- * Copyright (c) 2023 Calypso Networks Association https://calypsonet.org/
- *
- * See the NOTICE file(s) distributed with this work for additional information
- * regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the terms of the
- * Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- ************************************************************************************** */
-package org.eclipse.keyple.card.generic;
-
-import org.eclipse.keypop.reader.selection.spi.CardSelectionExtension;
-
-/**
- * Card specific {@link CardSelectionExtension} providing means to add successful status word.
- *
- * @since 3.0.0
- */
-public interface GenericCardSelectionExtension extends CardSelectionExtension {
-
- /**
- * Adds a status word to the list of those that should be considered successful for the Select
- * Application APDU.
- *
- * Overview
- {@link org.eclipse.keyple.card.generic.GenericExtensionService#createGenericCardSelectionExtension()}
- A selection case targets a specific card defined by various filtering options including the expected successful
- status words.
-
- {@link org.eclipse.keyple.card.generic.GenericExtensionService#createCardTransaction(CardReader reader,
- SmartCard card)}
+ Use {@link org.eclipse.keyple.card.generic.GenericExtensionService#getGenericCardApiFactory()} to retrieve the
+ factory to create the various instance of classes used to manage ISO/IEC 7816 cards.