java.lang.Object
cl.netswitch.lib.client.ClientBase
Implements the common logic of a client application.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Executes the logic of a client action using a connected channel. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Connects to HyperNet and executes the specified action.protected String
Returns a formatted message built using format and arguments.protected void
Prints a formatted message using arguments.protected static void
printCompactStackTrace
(Throwable thrown) Prints a compact stack trace of a throwable in standard error.protected void
Prints a formatted message using arguments then terminates the line.protected void
register
(String name, ClientBase.Action action) Register a new test indexed by specified name.
-
Constructor Details
-
ClientBase
protected ClientBase()Constructs a newClientBase
instance.
-
-
Method Details
-
register
Register a new test indexed by specified name.- Parameters:
name
- the name of the action.action
- the client action to be executed.- Throws:
NullPointerException
- if an argument isnull
.IllegalArgumentException
- ifname
already defined.
-
println
Prints a formatted message using arguments then terminates the line.- Parameters:
format
- the format of formatted message.args
- an array of optional format arguments.- See Also:
-
print
Prints a formatted message using arguments.- Parameters:
format
- the format of formatted message.args
- an array of optional format arguments.- See Also:
-
format
Returns a formatted message built using format and arguments.- Parameters:
format
- the format of formatted message.args
- an array of optional format arguments.- Returns:
- a formatted message built using format and arguments.
- See Also:
-
connectAndExecute
Connects to HyperNet and executes the specified action.- Throws:
Exception
- if an unexpected error occurs.
-
printCompactStackTrace
Prints a compact stack trace of a throwable in standard error. After the compact stack trace is printed, this method terminates the execution of the JVM callingSystem.exit(1)
.- Parameters:
thrown
- the throwable whose compact stack will be printed.
-