Skip to content

Commit 69df2a7

Browse files
committed
fix(javadoc): phase 7 — Card/CardHolder rewrites, ChannelAdaptor, UI, BSH, misc
- Card.java: full rewrite — all inline javadocs expanded, Builder methods documented - CardHolder.java: add descriptions to all bare-tag javadocs; fix @exception descriptions; add @param pan/exp to constructor; document hasTrack2/getTrack2/setSecurityData/getSecurityData - Channel.java: add description to receive(long timeout) - ChannelAdaptor.java: fix addFilters (add @param channel + @throws); move Receiver/Sender javadoc before @SuppressWarnings; add Receiver/Sender constructors; add disconnect() doc - ChannelAdaptorMBean.java: document all JMX methods - BinaryEMVTag.java: document all 3 constructors - UIAware.java: add method description to setUI - UIFactory.java: add create() method description - BSHUI.java: add explicit documented constructor; move doScript() javadoc - CALCLUHN.java: move class javadoc before @SuppressWarnings; add exec() comment - BSH.java: add class javadoc; add explicit documented constructor - BSHGroupSelector.java: add explicit constructor; add class javadoc - BcdPrefixer.java, BinaryPrefixer.java: expand inline constructor javadocs to multi-line - BinaryTagValue.java: expand constructor javadoc - BlockingQueue.java: move class javadoc before @SuppressWarnings - BufferedExceptionLogListener.java: add class javadoc and constructor - DefaultICCBERTLVPackager.java: add @param tag description
1 parent 044d21b commit 69df2a7

21 files changed

+276
-27
lines changed

jpos/src/main/java/org/jpos/bsh/BSHUI.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
*
3333
*/
3434
public class BSHUI extends UI {
35+
/** Default constructor. */
36+
public BSHUI() { super(); }
37+
/** {@inheritDoc} */
38+
@Override
3539
protected JComponent doScript (JComponent component, Element e) {
3640
try {
3741
Interpreter bsh = new Interpreter ();

jpos/src/main/java/org/jpos/core/CardHolder.java

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,18 @@ public void setTrailler (String trailer) {
247247
this.trailer = trailer;
248248
}
249249

250-
/** @return the card trailer string */
250+
/**
251+
* Returns the card trailer string.
252+
* @return card trailer
253+
*/
251254
public String getTrailer() {
252255
return trailer;
253256
}
254257

255-
/** @param trailer the card trailer string */
258+
/**
259+
* Sets the card trailer string.
260+
* @param trailer card trailer
261+
*/
256262
public void setTrailer(String trailer) {
257263
this.trailer = trailer;
258264
}
@@ -284,8 +290,10 @@ public String getPAN () {
284290
* Can be used for the newer 8-digit BINs, or some arbitrary length.
285291
* @return <code>len</code>-digit bank issuer number
286292
*/
287-
/** @param len number of BIN digits to return
288-
* @return the BIN (first {@code len} digits of the PAN)
293+
/**
294+
* Returns the first {@code len} digits of the PAN (the BIN).
295+
* @param len number of BIN digits to return
296+
* @return the BIN prefix
289297
*/
290298
public String getBIN (int len) {
291299
return pan.substring(0, len);
@@ -350,12 +358,17 @@ public boolean isExpired(Date currentDate) {
350358
}
351359
return true;
352360
}
353-
/** @return true if the PAN passes the Luhn check */
361+
/**
362+
* Returns true if the PAN passes the Luhn (mod-10) check.
363+
* @return true if the Luhn check passes
364+
*/
354365
public boolean isValidCRC () {
355366
return isValidCRC(this.pan);
356367
}
357-
/** @param p the PAN to validate
358-
* @return true if {@code p} passes the Luhn check
368+
/**
369+
* Returns true if the given PAN passes the Luhn (mod-10) check.
370+
* @param p the PAN to validate
371+
* @return true if the Luhn check passes
359372
*/
360373
public static boolean isValidCRC (String p) {
361374
int i, crc;
@@ -412,7 +425,10 @@ public String getServiceCode () {
412425
trailer.substring (0, 3) :
413426
" ";
414427
}
415-
/** @return true if this card entry appears to be manual (not swiped/dipped) */
428+
/**
429+
* Returns true if this card appears to have been entered manually.
430+
* @return true if manual entry is suspected
431+
*/
416432
public boolean seemsManualEntry() {
417433
return trailer == null || trailer.trim().length() == 0;
418434
}

jpos/src/main/java/org/jpos/emv/BinaryEMVTag.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,31 @@
2828
*/
2929
public class BinaryEMVTag extends EMVTag<byte[]> {
3030

31+
/** @param tagType the standard EMV tag type
32+
* @param value the raw byte value
33+
* @throws IllegalArgumentException if the value is invalid for the tag type
34+
*/
3135
public BinaryEMVTag(EMVStandardTagType tagType, byte[] value)
3236
throws IllegalArgumentException {
3337
super(tagType, value);
3438
}
3539

40+
/** @param tagType the proprietary tag type
41+
* @param tagNumber the numeric tag identifier
42+
* @param value the raw byte value
43+
* @throws IllegalArgumentException if the value is invalid
44+
*/
3645
public BinaryEMVTag(EMVProprietaryTagType tagType, Integer tagNumber, byte[] value)
3746
throws IllegalArgumentException {
3847
super(tagType, tagNumber, value);
3948
}
4049

50+
/** @param tagType the proprietary tag type
51+
* @param tagNumber the numeric tag identifier
52+
* @param dataFormat the TLV data format
53+
* @param value the raw byte value
54+
* @throws IllegalArgumentException if the value is invalid
55+
*/
4156
public BinaryEMVTag(EMVProprietaryTagType tagType, Integer tagNumber, TLVDataFormat dataFormat, byte[] value)
4257
throws IllegalArgumentException {
4358
super(tagType, tagNumber, dataFormat, value);

jpos/src/main/java/org/jpos/iso/BcdPrefixer.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ public class BcdPrefixer implements Prefixer
5858
/** The number of digits allowed to express the length */
5959
private int nDigits;
6060

61-
/** @param nDigits the number of BCD digits used for the length prefix */
61+
/**
62+
* Creates a BcdPrefixer with the given number of digits.
63+
* @param nDigits the number of BCD digits used for the length prefix
64+
*/
6265
public BcdPrefixer(int nDigits)
6366
{
6467
this.nDigits = nDigits;

jpos/src/main/java/org/jpos/iso/BinaryPrefixer.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ public class BinaryPrefixer implements Prefixer
4242
/** The number of digits allowed to express the length */
4343
private int nBytes;
4444

45-
/** @param nBytes the number of bytes used for the length prefix */
45+
/**
46+
* Creates a BinaryPrefixer with the given number of bytes.
47+
* @param nBytes the number of bytes used for the length prefix
48+
*/
4649
public BinaryPrefixer(int nBytes)
4750
{
4851
this.nBytes = nBytes;

jpos/src/main/java/org/jpos/iso/Channel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ public interface Channel {
3838
*/
3939
ISOMsg receive();
4040
/**
41+
* Receives an ISO message, waiting at most {@code timeout} milliseconds.
4142
* @param timeout time to wait for a message
42-
* @return received message or null
43+
* @return received message or null on timeout
4344
*/
4445
ISOMsg receive(long timeout);
4546
}

jpos/src/main/java/org/jpos/iso/channel/ChannelPool.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,22 @@
3737
import java.util.concurrent.locks.ReentrantLock;
3838

3939
@SuppressWarnings("unchecked")
40+
/**
41+
* A pool of {@link ISOChannel} instances; tries each in order until one connects.
42+
*/
4043
public class ChannelPool implements ISOChannel, LogSource, Configurable, Cloneable {
4144
boolean usable = true;
4245
String name = "";
46+
/** Logger for this pool. */
4347
protected Logger logger;
48+
/** Log realm for this pool. */
4449
protected String realm;
4550
Configuration cfg = null;
4651
List pool;
4752
ISOChannel current;
4853
Lock lock = new ReentrantLock();
4954

55+
/** Default constructor. */
5056
public ChannelPool () {
5157
super ();
5258
pool = new Vector ();
@@ -167,23 +173,36 @@ public void setConfiguration (Configuration cfg)
167173
}
168174
}
169175
}
176+
/** @param channel the channel to add to the pool */
170177
public void addChannel (ISOChannel channel) {
171178
pool.add (channel);
172179
}
180+
/** @param name the NameRegistrar name of the channel to add
181+
* @throws NameRegistrar.NotFoundException if name not found
182+
*/
173183
public void addChannel (String name)
174184
throws NameRegistrar.NotFoundException
175185
{
176186
pool.add (NameRegistrar.get ("channel."+name));
177187
}
188+
/** @param channel the channel to remove */
178189
public void removeChannel (ISOChannel channel) {
179190
pool.remove (channel);
180191
}
192+
/** @param name the channel name to remove
193+
* @throws NameRegistrar.NotFoundException if name not found
194+
*/
181195
public void removeChannel (String name) throws NameRegistrar.NotFoundException {
182196
pool.remove (NameRegistrar.get ("channel."+name));
183197
}
198+
/** @return the number of channels in the pool */
184199
public int size() {
185200
return pool.size();
186201
}
202+
/** Returns the currently active channel, trying to connect if necessary.
203+
* @return the active ISOChannel
204+
* @throws IOException if no channel can be connected
205+
*/
187206
public ISOChannel getCurrent () throws IOException {
188207
lock.lock();
189208
try {

jpos/src/main/java/org/jpos/jfr/ChannelEvent.java

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,63 +20,103 @@
2020

2121
import jdk.jfr.*;
2222

23+
/**
24+
* JFR event base class for jPOS channel operations.
25+
*/
2326
@Category("jPOS")
2427
@Name("jpos.Channel")
2528
@StackTrace
2629
public class ChannelEvent extends Event {
2730
@Name("detail")
31+
/** Channel event detail string. */
2832
protected String detail;
2933

34+
/** Creates a ChannelEvent with no detail. */
3035
public ChannelEvent() {}
36+
/** Creates a ChannelEvent with the given detail.
37+
* @param detail event detail string
38+
*/
3139
public ChannelEvent(String detail) {
3240
this.detail = detail;
3341
}
3442

43+
/** @param detail new detail string */
3544
public void setDetail(String detail) {
3645
this.detail = detail;
3746
}
3847

48+
/** @return the event detail string */
3949
public String getDetail() {
4050
return detail;
4151
}
4252

53+
/** Appends additional detail to this event.
54+
* @param additionalDetail text to append
55+
* @return this event
56+
*/
4357
public ChannelEvent append (String additionalDetail) {
4458
detail = detail != null ?
4559
"%s, %s".formatted (detail, additionalDetail) : additionalDetail;
4660
return this;
4761
}
4862

63+
/** JFR event for a channel send operation. */
4964
@Name("jpos.Channel.Send")
50-
public static class Send extends ChannelEvent { }
65+
public static class Send extends ChannelEvent {
66+
/** Default constructor. */
67+
public Send() { }
68+
}
5169

70+
/** JFR event for a channel receive operation. */
5271
@Name("jpos.Channel.Receive")
53-
public static class Receive extends ChannelEvent { }
72+
public static class Receive extends ChannelEvent {
73+
/** Default constructor. */
74+
public Receive() { }
75+
}
5476

77+
/** JFR event for a channel connect operation. */
5578
@Name("jpos.Channel.Connect")
56-
public static class Connect extends ChannelEvent { }
79+
public static class Connect extends ChannelEvent {
80+
/** Default constructor. */
81+
public Connect() { }
82+
}
5783

84+
/** JFR event for a channel accept (inbound connection) operation. */
5885
@Name("jpos.Channel.Accept")
59-
public static class Accept extends ChannelEvent { }
86+
public static class Accept extends ChannelEvent {
87+
/** Default constructor. */
88+
public Accept() { }
89+
}
6090

91+
/** JFR event for a channel disconnect operation. */
6192
@Name("jpos.Channel.Disconnect")
62-
public static class Disconnect extends ChannelEvent { }
93+
public static class Disconnect extends ChannelEvent {
94+
/** Default constructor. */
95+
public Disconnect() { }
96+
}
6397

98+
/** JFR event for a channel connection exception. */
6499
@Name("jpos.Channel.ConnectionException")
65100
public static class ConnectionException extends ChannelEvent {
101+
/** @param detail exception detail string */
66102
public ConnectionException(String detail) {
67103
super(detail);
68104
}
69105
}
70106

107+
/** JFR event for a channel accept exception. */
71108
@Name("jpos.Channel.AcceptException")
72109
public static class AcceptException extends ChannelEvent {
110+
/** @param detail exception detail string */
73111
public AcceptException(String detail) {
74112
super(detail);
75113
}
76114
}
77115

116+
/** JFR event for a channel send exception. */
78117
@Name("jpos.Channel.SendException")
79118
public static class SendException extends ChannelEvent {
119+
/** @param detail exception detail string */
80120
public SendException(String detail) {
81121
super(detail);
82122
}

jpos/src/main/java/org/jpos/q2/cli/CALCLUHN.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@
2222
import org.jpos.q2.CLICommand;
2323
import org.jpos.q2.CLIContext;
2424

25-
@SuppressWarnings("unused")
2625
/**
2726
* CLI command that calculates a Luhn check digit.
2827
*/
28+
@SuppressWarnings("unused")
2929
public class CALCLUHN implements CLICommand {
3030
/** Default constructor. */
3131
public CALCLUHN() { }
32+
/** @param ctx CLI context
33+
* @param args command arguments (first arg = PAN to check)
34+
* @throws Exception on error
35+
*/
3236
public void exec(CLIContext ctx, String[] args) throws Exception {
3337
if (args.length < 2) {
3438
ctx.println (String.format ("Usage: %span(s)", args[0]));

0 commit comments

Comments
 (0)