The jlupin-console-api-x.x.x.jar contains an API for remote console management.
API is intended for developers who want do develop their own server management console.
API is defined by the following interface:

package com.jlupin.console.api;

import com.jlupin.console.api.configuration.JLupinServerConfiguration;
import com.jlupin.console.api.exception.*;
import com.jlupin.console.api.session.JLupinOpenSession;

public interface JLupinConsoleApi {

    /__
     *  checking connection on single server
     *
     * @param jLupinServerConfiguration
     * @throws JLupinCheckConnectionException
     */
     void checkConnection(JLupinServerConfiguration jLupinServerConfiguration ) 
                          throws JLupinCheckConnectionException;

    /__
     *  authenticate and open session on single server
     *
     *
     * @param user
     * @param password
     * @param localIP
     * @param systemUserName
     * @param passwordToEncrypt
     * @param saltToEncrypt
     * @return JLupinOpenSession
     * @throws JLupinAuthenticateException
     */
    JLupinOpenSession openSession(JLupinServerConfiguration jLupinServerConfiguration, String user,
                                  String password,String localIP, String systemUserName,
                                  String passwordToEncrypt, String saltToEncrypt) 
                                  throws JLupinAuthenticateException;

    /__
     * send server command and get result
     *
     * @param jLupinOpenSession
     * @param command
     * @param value
     * @param 
     * @return T
     * @throws JLupinCommandException
     */
     T sendCommand(JLupinOpenSession jLupinOpenSession, String command, String value) 
                      throws JLupinCommandException;

    /__
     * closing socket and input/output streams
     *
     * @param jLupinOpenSession
     */
     void closeSocketAndIOStreams(JLupinOpenSession jLupinOpenSession);
}

Every implementation of the aforementioned interface must be associated with a particular Entry Point on the server side.

For example:

JLupin Next Server distribution delivers the server management entry point - JLupinDESXMLInStreamOutGlobalCommandEntryPointImpl

In order to properly establish communication with the aforementioned entry point it is necessary to use the JLupinConsoleApi interface - JLupinDESXMLConsoleApiImpl which
is supplied with the server.

Examine the usage of JLupinDESXMLConsoleApiImpl:

Step 1: checkConnection - checks the connection to a specific server (single node) by passing the connection details using the JLupinServerConfiguration object.

Step 2: openSession - opens a session on a single server node. As a result of that operation the JLupinOpenSession object is returned which specifies the open session.

Step 3: sendCommand - sends a specific command (command) to the server along with the parameters (value) - the session is determined by the JLupinOpenSession object from step 2.
As a result, the command returns the stream in the form of a BufferedReader which passes the result of the operation on a single node.

Step 4: closeSocketAndIOStreams - closes session on the selected node defined by the JLupinOpenSession object.

Maven project dependencies:

...
 <properties>
        <dependency.version.jlupin.ns>version</dependency.version.jlupin.ns>
 </properties>
...

 <dependencies>
        <dependency>
            <groupId>com.jlupin</groupId>
            <artifactId>jlupin-all-assembly</artifactId>
            <version>${dependency.version.jlupin.ns}</version>
            <scope>provided</scope>
        </dependency>
</dependencies>

An example of the JLupinDESXMLConsoleApiImpl server management class usage (in the example of the 'appRestart' command without parameters which causes all applications to restart)

package com.jlupin.console.api.test;

import com.jlupin.console.api.JLupinConsoleApi;
import com.jlupin.console.api.configuration.JLupinServerConfiguration;
import com.jlupin.console.api.impl.desxml.JLupinDESXMLConsoleApiImpl;
import com.jlupin.console.api.session.JLupinOpenSession;
import com.jlupin.impl.logger.impl.simple.stdout.JLupinSimpleSystemOutLoggerImpl;
import com.jlupin.interfaces.logger.JLupinLogger;
import com.jlupin.interfaces.logger.enums.LogMode;
import org.junit.Test;
import java.io.BufferedReader;
import java.net.InetAddress;
import java.util.LinkedList;
import java.util.List;

public class JLupinConsoleApiTest {

    @Test
    public void testConsoleApi() throws Throwable {

        List singleFirstServerConfigurationList =
            new LinkedList();

        singleFirstServerConfigurationList.add(new JLupinServerConfiguration("localhost", 9094));

        JLupinSimpleSystemOutLoggerImpl.initializeWithLogMode(LogMode.DEBUG);
        JLupinLogger jLupinLogger = JLupinSimpleSystemOutLoggerImpl.getInstance();

        JLupinConsoleApi jLupinConsoleApi = new JLupinDESXMLConsoleApiImpl(jLupinLogger);

        for(JLupinServerConfiguration jLupinServerConfiguration : singleFirstServerConfigurationList) {
            jLupinConsoleApi.checkConnection(jLupinServerConfiguration);
        }

        String passwordToEncrypt = "260e79781c889b9f99f93f7aaefca352936329a0eb83617437f94f1d3c116218";
        String saltToEncrypt     = "55253d22231b1d12";

        String user         = "jlns00001";
        String userPassword = "password1";

        String systemUserName = System.getProperty("user.name");
        InetAddress addr      = InetAddress.getLocalHost();
        String      ip        = addr.getHostAddress();

        List jLupinOpenSessionList = new LinkedList();

        for(JLupinServerConfiguration jLupinServerConfiguration : singleFirstServerConfigurationList) {
            JLupinOpenSession jLupinOpenSession =
            jLupinConsoleApi.openSession(jLupinServerConfiguration,user, userPassword, ip,
            systemUserName, passwordToEncrypt, saltToEncrypt);

            jLupinOpenSessionList.add(jLupinOpenSession);
        }

        for(JLupinOpenSession jLupinOpenSession :jLupinOpenSessionList) {
            BufferedReader bufferedReader = jLupinConsoleApi.sendCommand(jLupinOpenSession,"appRestart","");
            String line = null;
            while (true) {
                line = bufferedReader.readLine();
                if (line == null) {
                    jLupinLogger.info("received answer is empty");
                    break;
                }
                if (line.indexOf(JLupinDESXMLConsoleApiImpl.EOM) != -1) {
                    break;
                } else {
                    jLupinLogger.info(line);
                }
            }
            jLupinConsoleApi.closeSocketAndIOStreams(jLupinOpenSession);
        }

        for(JLupinOpenSession jLupinOpenSession :jLupinOpenSessionList) {
            BufferedReader bufferedReader = jLupinConsoleApi.sendCommand(jLupinOpenSession, "logout", "");
            String line = null;
            while (true) {
                line = bufferedReader.readLine();
                if (line == null) {
                    jLupinLogger.info("received answer is empty");
                    break;
                }
                if (line.indexOf(JLupinDESXMLConsoleApiImpl.EOM) != -1) {
                    break;
                } else {
                    jLupinLogger.info(line);
                }
            }
            jLupinConsoleApi.closeSocketAndIOStreams(jLupinOpenSession);
        }
    }

}