Skip to content

Commit bc0bedf

Browse files
feat: migrate to Keypop Generic Card API (#21)
1 parent 162301d commit bc0bedf

14 files changed

+72
-363
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
### Changed
10+
- Migrated to `keypop-genericcard-jvm-api` 1.0.0
11+
### Removed
12+
- Removed deprecated enum `ChannelControl`
13+
- Removed deprecated class `TransactionException`
14+
915
## [3.2.1] - 2026-02-20
1016
### Changed
1117
- Normalized logging and error messages using Keyple coding standards.

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ plugins {
1616
dependencies {
1717
implementation("org.eclipse.keypop:keypop-reader-java-api:2.1.0")
1818
implementation("org.eclipse.keypop:keypop-card-java-api:2.0.1")
19+
implementation("org.eclipse.keypop:keypop-genericcard-jvm-api:1.0.0")
1920
implementation("org.eclipse.keyple:keyple-common-java-api:2.0.2")
2021
implementation("org.eclipse.keyple:keyple-service-resource-java-lib:3.1.1")
2122
implementation("org.eclipse.keyple:keyple-util-java-lib:2.4.1")

src/main/java/org/eclipse/keyple/card/generic/CardTransactionManager.java

Lines changed: 0 additions & 129 deletions
This file was deleted.

src/main/java/org/eclipse/keyple/card/generic/CardTransactionManagerAdapter.java

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.eclipse.keyple.core.util.HexUtil;
1919
import org.eclipse.keypop.card.*;
2020
import org.eclipse.keypop.card.spi.ApduRequestSpi;
21+
import org.eclipse.keypop.genericcard.CardTransactionManager;
2122
import org.eclipse.keypop.reader.CardCommunicationException;
2223
import org.eclipse.keypop.reader.CardReader;
2324
import org.eclipse.keypop.reader.InvalidCardResponseException;
@@ -94,60 +95,6 @@ public CardTransactionManager prepareApdu(
9495
return this;
9596
}
9697

97-
/**
98-
* {@inheritDoc}
99-
*
100-
* @since 2.0.0
101-
*/
102-
@Override
103-
@Deprecated
104-
public List<byte[]> processApdusToByteArrays(ChannelControl channelControl)
105-
throws TransactionException {
106-
CardResponseApi cardResponse;
107-
if (apduRequests.isEmpty()) {
108-
return new ArrayList<>(0);
109-
}
110-
try {
111-
cardResponse =
112-
((ProxyReaderApi) reader)
113-
.transmitCardRequest(
114-
new CardRequestAdapter(apduRequests, false),
115-
channelControl == ChannelControl.CLOSE_AFTER
116-
? org.eclipse.keypop.card.ChannelControl.CLOSE_AFTER
117-
: org.eclipse.keypop.card.ChannelControl.KEEP_OPEN);
118-
} catch (ReaderBrokenCommunicationException e) {
119-
throw new TransactionException("Reader communication error", e);
120-
} catch (CardBrokenCommunicationException e) {
121-
throw new TransactionException("Card communication error", e);
122-
} catch (UnexpectedStatusWordException e) {
123-
throw new TransactionException("APDU error", e);
124-
} finally {
125-
apduRequests.clear();
126-
}
127-
List<byte[]> apduResponsesBytes = new ArrayList<>();
128-
for (ApduResponseApi apduResponse : cardResponse.getApduResponses()) {
129-
apduResponsesBytes.add(apduResponse.getApdu());
130-
}
131-
return apduResponsesBytes;
132-
}
133-
134-
/**
135-
* {@inheritDoc}
136-
*
137-
* @since 2.0.0
138-
*/
139-
@Override
140-
@Deprecated
141-
public List<String> processApdusToHexStrings(ChannelControl channelControl)
142-
throws TransactionException {
143-
List<byte[]> apduResponsesBytes = processApdusToByteArrays(channelControl);
144-
List<String> apduResponsesHex = new ArrayList<>();
145-
for (byte[] bytes : apduResponsesBytes) {
146-
apduResponsesHex.add(HexUtil.toHex(bytes));
147-
}
148-
return apduResponsesHex;
149-
}
150-
15198
/**
15299
* {@inheritDoc}
153100
*

src/main/java/org/eclipse/keyple/card/generic/ChannelControl.java

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/* **************************************************************************************
2+
* Copyright (c) 2026 Calypso Networks Association https://calypsonet.org/
3+
*
4+
* See the NOTICE file(s) distributed with this work for additional information
5+
* regarding copyright ownership.
6+
*
7+
* This program and the accompanying materials are made available under the terms of the
8+
* Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0
9+
*
10+
* SPDX-License-Identifier: EPL-2.0
11+
************************************************************************************** */
12+
package org.eclipse.keyple.card.generic;
13+
14+
import org.eclipse.keypop.genericcard.CardTransactionManager;
15+
import org.eclipse.keypop.genericcard.GenericCardApiFactory;
16+
import org.eclipse.keypop.genericcard.GenericCardSelectionExtension;
17+
import org.eclipse.keypop.reader.CardReader;
18+
import org.eclipse.keypop.reader.selection.spi.SmartCard;
19+
20+
/**
21+
* Adapter of {@link GenericCardApiFactory}.
22+
*
23+
* @since 4.0.0
24+
*/
25+
class GenericCardApiFactoryAdapter implements GenericCardApiFactory {
26+
27+
/**
28+
* {@inheritDoc}
29+
*
30+
* @since 4.0.0
31+
*/
32+
@Override
33+
public GenericCardSelectionExtension createGenericCardSelectionExtension() {
34+
return new GenericCardSelectionExtensionAdapter();
35+
}
36+
37+
/**
38+
* {@inheritDoc}
39+
*
40+
* @since 4.0.0
41+
*/
42+
@Override
43+
public CardTransactionManager createCardTransaction(CardReader cardReader, SmartCard card) {
44+
return new CardTransactionManagerAdapter(cardReader, card);
45+
}
46+
}

src/main/java/org/eclipse/keyple/card/generic/GenericCardResourceProfileExtensionAdapter.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import org.eclipse.keyple.core.service.resource.spi.CardResourceProfileExtension;
1515
import org.eclipse.keyple.core.util.Assert;
16+
import org.eclipse.keypop.genericcard.GenericCardSelectionExtension;
1617
import org.eclipse.keypop.reader.CardReader;
1718
import org.eclipse.keypop.reader.ReaderApiFactory;
1819
import org.eclipse.keypop.reader.selection.CardSelectionManager;
@@ -24,8 +25,8 @@
2425
import org.slf4j.LoggerFactory;
2526

2627
/**
27-
* Implementation of {@link CardResourceProfileExtension} that provides the capability to filter
28-
* cards of any type.
28+
* Implementation of {@link CardResourceProfileExtension} that provides the ability to filter cards
29+
* of any type.
2930
*
3031
* @since 2.0.0
3132
*/

src/main/java/org/eclipse/keyple/card/generic/GenericCardSelectionExtension.java

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/main/java/org/eclipse/keyple/card/generic/GenericCardSelectionExtensionAdapter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import java.util.Set;
1616
import org.eclipse.keypop.card.CardSelectionResponseApi;
1717
import org.eclipse.keypop.card.spi.*;
18+
import org.eclipse.keypop.genericcard.GenericCardSelectionExtension;
1819

1920
/**
2021
* Implementation of {@link GenericCardSelectionExtension}.

0 commit comments

Comments
 (0)