MatlabProxyLogger

public class MatlabProxyLogger

Wraps around a MatlabProxy to provide a log of interactions. The data is not altered. This logger is useful for determining the Java types and structure of data returned from MATLAB. Entering a method, exiting a method, and throwing an exception are logged. Method parameters and return values are logged. The contents of a returned array will be recursively explored and its contents logged. As is convention, all of these interactions are logged at Level.FINER. If the logging system has not been otherwise configured, then the ConsoleHandler which prints log messages to the console will not show these log messages as their level is too low. To configure the ConsoleHandler to show these log messages, call showInConsoleHandler(). This class is unconditionally thread-safe.

Author:Joshua Kaplan

Constructors

MatlabProxyLogger

public MatlabProxyLogger(MatlabProxy proxy)

Constructs the logger. If the provided proxy throws an exception it will be caught, logged, and then rethrown.

Parameters:
  • proxy

Methods

addDisconnectionListener

public void addDisconnectionListener(DisconnectionListener listener)

Delegates to the proxy; logs the interaction.

Parameters:
  • listener

disconnect

public boolean disconnect()

Delegates to the proxy; logs the interaction.

eval

public void eval(String command)

Delegates to the proxy; logs the interaction.

Parameters:
  • command
Throws:

exit

public void exit()

Delegates to the proxy; logs the interaction.

Throws:

feval

public void feval(String functionName, Object... args)

Delegates to the proxy; logs the interaction.

Parameters:
  • functionName
  • args
Throws:

getIdentifier

public Identifier getIdentifier()

Delegates to the proxy; logs the interaction.

getVariable

public Object getVariable(String variableName)

Delegates to the proxy; logs the interaction.

Parameters:
  • variableName
Throws:

invokeAndWait

public <U> U invokeAndWait(MatlabThreadCallable<U> callable)

Delegates to the proxy; logs the interaction.

Parameters:
  • <U>
  • callable
Throws:

isConnected

public boolean isConnected()

Delegates to the proxy; logs the interaction.

isExistingSession

public boolean isExistingSession()

Delegates to the proxy; logs the interaction.

isRunningInsideMatlab

public boolean isRunningInsideMatlab()

Delegates to the proxy; logs the interaction.

removeDisconnectionListener

public void removeDisconnectionListener(DisconnectionListener listener)

Delegates to the proxy; logs the interaction.

Parameters:
  • listener

returningEval

public Object[] returningEval(String command, int nargout)

Delegates to the proxy; logs the interaction.

Parameters:
  • command
  • nargout
Throws:
  • MatlabInvocationExceptio

returningFeval

public Object[] returningFeval(String functionName, int nargout, Object... args)

Delegates to the proxy; logs the interaction.

Parameters:
  • functionName
  • nargout
  • args
Throws:

setVariable

public void setVariable(String variableName, Object value)

Delegates to the proxy; logs the interaction.

Parameters:
  • variableName
  • value
Throws:

showInConsoleHandler

public static void showInConsoleHandler()

Configures the ConsoleHandler responsible for showing logging records to show the records that are logged by this interactor. This is behavior is useful if you have not otherwise configured logging in your application.

toString

public String toString()

Returns a brief description of this proxy. The exact details of this representation are unspecified and are subject to change.