Skip to content

Commit 20bf6a3

Browse files
committed
fix(javadoc): phase 8 — CLI, CMF enum, ChannelEvent, CardHolder, CharTag, misc
- CLIContext: add class javadoc and inline comments for all 28 fields/methods/builder - CLI: add class javadoc; document all constructors, lifecycle methods, static exec helpers - CLICommandInterface: add class javadoc; document all 5 methods - CLISubSystem: add interface javadoc and method comments - CLIPrefixedClassNameCompleter: add class/field/constructor javadoc - CMF: add class javadoc; document valueOf(); add comments for representative enum constants - IRC: add descriptions to getIRC(), isSuccess(), isInhibit() - ChannelEvent (JFR): add @name field comment; expand setDetail/getDetail/constructor javadocs - CharTag: add lengthSize field comment - CharTagMap: add class javadoc; expand validateTag() - CardHolder: add description to getTrack2() - BinaryEMVTag: expand all 3 constructor javadocs to multi-line with descriptions - ChannelPool: add field comments; expand addChannel/removeChannel/size javadocs - ChannelInfoFilter: add field/constructor comments - ChannelAdaptor: fix duplicate @param channel; add grabSpace() comment - BinaryHexTaggedSequencePackager.TagPackager: expand constructor javadoc - AuditLogEvent: add comment marker inside sealed interface body - CheckFields, CheckPoint, CLR, SsmActionBase, CK: add class javadoc + constructor - BSHUI: add explicit documented constructor - BSH (qbean): add class javadoc + explicit constructor - BSHGroupSelector: add explicit constructor
1 parent 69df2a7 commit 20bf6a3

21 files changed

+195
-18
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ public String getNameOnCard() {
190190
}
191191

192192
/**
193+
* Returns a reconstructed track 2 string, or null if track 2 data is absent.
193194
* @return reconstructed track2 or null
194195
*/
195196
public String getTrack2() {

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

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

31-
/** @param tagType the standard EMV tag type
31+
/**
32+
* Creates a BinaryEMVTag with a standard tag type.
33+
* @param tagType the standard EMV tag type
3234
* @param value the raw byte value
3335
* @throws IllegalArgumentException if the value is invalid for the tag type
3436
*/
@@ -37,7 +39,9 @@ public BinaryEMVTag(EMVStandardTagType tagType, byte[] value)
3739
super(tagType, value);
3840
}
3941

40-
/** @param tagType the proprietary tag type
42+
/**
43+
* Creates a BinaryEMVTag with a proprietary tag type.
44+
* @param tagType the proprietary tag type
4145
* @param tagNumber the numeric tag identifier
4246
* @param value the raw byte value
4347
* @throws IllegalArgumentException if the value is invalid
@@ -47,7 +51,9 @@ public BinaryEMVTag(EMVProprietaryTagType tagType, Integer tagNumber, byte[] val
4751
super(tagType, tagNumber, value);
4852
}
4953

50-
/** @param tagType the proprietary tag type
54+
/**
55+
* Creates a BinaryEMVTag with a proprietary tag type and explicit format.
56+
* @param tagType the proprietary tag type
5157
* @param tagNumber the numeric tag identifier
5258
* @param dataFormat the TLV data format
5359
* @param value the raw byte value

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

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
* A pool of {@link ISOChannel} instances; tries each in order until one connects.
4242
*/
4343
public class ChannelPool implements ISOChannel, LogSource, Configurable, Cloneable {
44+
/** Whether this pool is in a usable state. */
4445
boolean usable = true;
46+
/** Registered name of this pool. */
4547
String name = "";
4648
/** Logger for this pool. */
4749
protected Logger logger;
@@ -173,29 +175,42 @@ public void setConfiguration (Configuration cfg)
173175
}
174176
}
175177
}
176-
/** @param channel the channel to add to the pool */
178+
/**
179+
* Adds a channel to the pool.
180+
* @param channel the channel to add
181+
*/
177182
public void addChannel (ISOChannel channel) {
178183
pool.add (channel);
179184
}
180-
/** @param name the NameRegistrar name of the channel to add
185+
/**
186+
* Adds a channel to the pool by its registered name.
187+
* @param name the NameRegistrar name of the channel to add
181188
* @throws NameRegistrar.NotFoundException if name not found
182189
*/
183190
public void addChannel (String name)
184191
throws NameRegistrar.NotFoundException
185192
{
186193
pool.add (NameRegistrar.get ("channel."+name));
187194
}
188-
/** @param channel the channel to remove */
195+
/**
196+
* Removes a channel from the pool.
197+
* @param channel the channel to remove
198+
*/
189199
public void removeChannel (ISOChannel channel) {
190200
pool.remove (channel);
191201
}
192-
/** @param name the channel name to remove
202+
/**
203+
* Removes a channel from the pool by its registered name.
204+
* @param name the channel name to remove
193205
* @throws NameRegistrar.NotFoundException if name not found
194206
*/
195207
public void removeChannel (String name) throws NameRegistrar.NotFoundException {
196208
pool.remove (NameRegistrar.get ("channel."+name));
197209
}
198-
/** @return the number of channels in the pool */
210+
/**
211+
* Returns the number of channels in the pool.
212+
* @return channel count
213+
*/
199214
public int size() {
200215
return pool.size();
201216
}

jpos/src/main/java/org/jpos/iso/filter/ChannelInfoFilter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@
3434
*/
3535
@SuppressWarnings("unused")
3636
public class ChannelInfoFilter implements ISOFilter, Configurable {
37+
/** Space field name to store the channel name. */
3738
String channelNameField;
39+
/** Space field name to store socket info. */
3840
String socketInfoField;
41+
/** Default constructor. */
3942
public ChannelInfoFilter() {
4043
super();
4144
}

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

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
@Name("jpos.Channel")
2828
@StackTrace
2929
public class ChannelEvent extends Event {
30+
/** JFR event detail string. */
3031
@Name("detail")
3132
/** Channel event detail string. */
3233
protected String detail;
@@ -40,12 +41,16 @@ public ChannelEvent(String detail) {
4041
this.detail = detail;
4142
}
4243

43-
/** @param detail new detail string */
44+
/** Sets the event detail string.
45+
* @param detail new detail string
46+
*/
4447
public void setDetail(String detail) {
4548
this.detail = detail;
4649
}
4750

48-
/** @return the event detail string */
51+
/** Returns the event detail string.
52+
* @return the event detail string
53+
*/
4954
public String getDetail() {
5055
return detail;
5156
}
@@ -98,7 +103,10 @@ public Disconnect() { }
98103
/** JFR event for a channel connection exception. */
99104
@Name("jpos.Channel.ConnectionException")
100105
public static class ConnectionException extends ChannelEvent {
101-
/** @param detail exception detail string */
106+
/**
107+
* Creates a ChannelEvent for a connection exception.
108+
* @param detail exception detail string
109+
*/
102110
public ConnectionException(String detail) {
103111
super(detail);
104112
}
@@ -107,7 +115,10 @@ public ConnectionException(String detail) {
107115
/** JFR event for a channel accept exception. */
108116
@Name("jpos.Channel.AcceptException")
109117
public static class AcceptException extends ChannelEvent {
110-
/** @param detail exception detail string */
118+
/**
119+
* Creates a ChannelEvent for an accept exception.
120+
* @param detail exception detail string
121+
*/
111122
public AcceptException(String detail) {
112123
super(detail);
113124
}
@@ -116,7 +127,10 @@ public AcceptException(String detail) {
116127
/** JFR event for a channel send exception. */
117128
@Name("jpos.Channel.SendException")
118129
public static class SendException extends ChannelEvent {
119-
/** @param detail exception detail string */
130+
/**
131+
* Creates a ChannelEvent for a send exception.
132+
* @param detail exception detail string
133+
*/
120134
public SendException(String detail) {
121135
super(detail);
122136
}

jpos/src/main/java/org/jpos/log/AuditLogEvent.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,6 @@
5353
public sealed interface AuditLogEvent
5454
permits Connect, Deploy, DeployActivity, Disconnect, License, Listen, LogMessage,
5555
SessionEnd, SessionStart, Shutdown, Start, Stop, SysInfo,
56-
ThrowableAuditLogEvent, Txn, UnDeploy, Warning { }
56+
ThrowableAuditLogEvent, Txn, UnDeploy, Warning {
57+
// marker interface — no methods
58+
}

jpos/src/main/java/org/jpos/q2/CLI.java

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@
2929
import java.util.logging.Level;
3030
import java.util.logging.Logger;
3131

32+
/** Interactive command-line interface for a running Q2 instance. */
3233
public class CLI implements Runnable {
3334
final private static String DEFAULT_PROMPT = "q2> ";
3435
final private static String ESCAPED_SEMICOLON = "__semicolon__";
3536
private Thread t;
3637
private String line = null;
3738
private boolean keepRunning = false;
3839
private boolean interactive = false;
40+
/** The context for this CLI session. */
3941
protected CLIContext ctx;
4042
private CLICommandInterface cmdInterface;
4143
private Terminal terminal;
@@ -44,10 +46,23 @@ public class CLI implements Runnable {
4446
private String prompt = DEFAULT_PROMPT;
4547
private History mainHistory;
4648

49+
/** @param q2 the Q2 instance
50+
* @param line the initial command line
51+
* @param keepRunning true to keep running after the first command
52+
* @throws IOException on I/O failure
53+
*/
4754
public CLI(Q2 q2, String line, boolean keepRunning) throws IOException {
4855
this(q2, System.in, System.out, line, keepRunning, true);
4956
}
5057

58+
/** @param q2 the Q2 instance
59+
* @param in input stream
60+
* @param rawout output stream
61+
* @param line initial command
62+
* @param keepRunning true to keep running
63+
* @param interactive true for interactive mode
64+
* @throws IOException on I/O failure
65+
*/
5166
public CLI(Q2 q2, InputStream in, OutputStream rawout, String line, boolean keepRunning, boolean interactive) throws IOException {
5267
Logger.getLogger("org.jline").setLevel(Level.SEVERE);
5368
this.q2 = q2;
@@ -63,18 +78,23 @@ public CLI(Q2 q2, InputStream in, OutputStream rawout, String line, boolean keep
6378
initCmdInterface(getCompletionPrefixes(), mainHistory);
6479
}
6580

81+
/** @return true if this CLI is still running */
6682
protected boolean running() {
6783
return getQ2() == null || getQ2().running();
6884
}
6985

86+
/** Called when the CLI is stopping; subclasses may override. */
7087
protected void markStopped() { }
7188

89+
/** Called when the CLI is starting; subclasses may override. */
7290
protected void markStarted() { }
7391

92+
/** @return array of command prefixes for tab-completion */
7493
protected String[] getCompletionPrefixes() {
7594
return new String[] {"org.jpos.q2.cli." };
7695
}
7796

97+
/** Called on normal exit; subclasses may override. */
7898
protected void handleExit() { }
7999

80100
void setPrompt(String prompt, String[] completionPrefixes) throws IOException {
@@ -95,13 +115,17 @@ private void initCmdInterface(String[] completionPrefixes, History history) thro
95115
}
96116
}
97117

118+
/** Starts the CLI session.
119+
* @throws Exception on startup failure
120+
*/
98121
public void start() throws Exception {
99122
markStarted();
100123
t = new Thread(this);
101124
t.setName("Q2-CLI");
102125
t.start();
103126
}
104127

128+
/** Stops the CLI session. */
105129
public void stop() {
106130
markStopped();
107131
try {
@@ -173,30 +197,47 @@ public void run() {
173197
handleExit();
174198
}
175199

200+
/** @return the Q2 instance this CLI is attached to */
176201
public Q2 getQ2() {
177202
return q2;
178203
}
179204

205+
/** @return true if this is an interactive session */
180206
public boolean isInteractive() {
181207
return interactive;
182208
}
183209

210+
/** @return the JLine3 LineReader for this session */
184211
public LineReader getReader() {
185212
return reader;
186213
}
187214

215+
/** @param in input stream
216+
* @param out output stream
217+
* @param command command to execute
218+
* @throws Exception on execution failure
219+
*/
188220
public static void exec (InputStream in, OutputStream out, String command) throws Exception {
189221
CLI cli = new CLI(Q2.getQ2(), in, out, command, false, false);
190222
cli.start();
191223
cli.stop();
192224
}
193225

226+
/** @param command command string to execute
227+
* @return captured output
228+
* @throws Exception on execution failure
229+
*/
194230
public static String exec (String command) throws Exception {
195231
ByteArrayOutputStream out = new ByteArrayOutputStream();
196232
exec (null, out, command);
197233
return out.toString();
198234
}
199235

236+
/** @param in input stream
237+
* @param out output stream
238+
* @return a JLine3 Terminal for this session
239+
* @throws IOException on I/O failure
240+
*/
200241
protected Terminal buildTerminal (InputStream in, OutputStream out) throws IOException {
201242
TerminalBuilder builder = TerminalBuilder.builder()
202243
.streams(in,out)

jpos/src/main/java/org/jpos/q2/CLICommandInterface.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,29 @@
2727
import org.jline.terminal.Terminal;
2828
import org.jpos.iso.ISOUtil;
2929

30+
/** Dispatches CLI command lines to the appropriate {@link CLICommand} implementation. */
3031
public class CLICommandInterface {
3132
CLIContext ctx;
3233
List<String> prefixes = new ArrayList<String>();
3334

35+
/** @return the list of registered command prefixes */
3436
public List<String> getPrefixes() {
3537
return prefixes;
3638
}
3739

40+
/** @param ctx the CLI context for this interface */
3841
public CLICommandInterface(CLIContext ctx) {
3942
this.ctx = ctx;
4043
}
4144

45+
/** @param prefix a command prefix to register */
4246
public void addPrefix(String prefix) {
4347
prefixes.add(prefix);
4448
}
4549

50+
/** @param line the full command line to execute
51+
* @throws IOException on I/O failure
52+
*/
4653
public void execCommand(String line) throws IOException {
4754
String args[] = parseCommand(line);
4855
if (args.length == 0) {
@@ -91,6 +98,10 @@ private Object getCommand(String className) throws ClassNotFoundException, Insta
9198
return cl.loadClass(className).newInstance();
9299
}
93100

101+
/** @param line the full command line to parse
102+
* @return tokens: [prefix, command, args...]
103+
* @throws IOException on I/O failure
104+
*/
94105
public String[] parseCommand(String line) throws IOException {
95106
if (line == null) {
96107
return new String[0];

0 commit comments

Comments
 (0)