All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jpos.q2.cli.SSM Maven / Gradle / Ivy

Go to download

jPOS is an ISO-8583 based financial transaction library/framework that can be customized and extended in order to implement financial interchanges.

There is a newer version: 2.1.9
Show newest version
package org.jpos.q2.cli;

import org.jpos.q2.CLICommand;
import org.jpos.q2.CLIContext;
import org.jpos.q2.CLISubSystem;
import org.jpos.security.jceadapter.JCESecurityModule;

import java.util.HashMap;
import java.util.Map;

/**
 * CLI implementation - SSM subsystem
 *
 * @author Alwyn Schoeman - [email protected]
 */
public class SSM implements CLISubSystem, CLICommand {
    private static final String SYSTEM_KEY = "SSM";
    private static final String JCE_KEY = "jce-sm";

    @Override
    public String getPrompt(CLIContext ctx, String[] args) {
        return "ssm> ";
    }

    @Override
    public String[] getCompletionPrefixes(CLIContext ctx, String[] args) {
        return new String[] { "org.jpos.q2.cli.ssm.actions." };
    }

    @Override
    public void exec(CLIContext cli, String[] strings) throws Exception {
        cli.setActiveSubSystem(SYSTEM_KEY);
        cli.getUserData().put(SYSTEM_KEY, new HashMap());
    }

    public static JCESecurityModule getSecurityModule(CLIContext cliContext) {
        return (JCESecurityModule) getSystemStorage(cliContext).get(JCE_KEY);
    }

    public static void setSecurityModule(CLIContext cliContext, JCESecurityModule securityModule) {
        getSystemStorage(cliContext).put(JCE_KEY, securityModule);
    }

    private static Map getSystemStorage(CLIContext cliContext) {
        return (Map) cliContext.getUserData().get(SYSTEM_KEY);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy