org.jpos.q2.cli.SSM Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jpos Show documentation
Show all versions of jpos Show documentation
jPOS is an ISO-8583 based financial transaction
library/framework that can be customized and
extended in order to implement financial interchanges.
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);
}
}