Search in sources :

Example 1 with NameRegistrar

use of org.jpos.util.NameRegistrar in project jPOS by jpos.

the class TMMON method showTMs.

private void showTMs(CLIContext cli) {
    NameRegistrar nr = NameRegistrar.getInstance();
    int maxw = 0;
    Iterator iter = NameRegistrar.getAsMap().entrySet().iterator();
    StringBuilder sb = new StringBuilder("available transaction managers:");
    while (iter.hasNext()) {
        Map.Entry entry = (Map.Entry) iter.next();
        String key = (String) entry.getKey();
        if (entry.getValue() instanceof TransactionManager) {
            sb.append(' ');
            sb.append(key);
        }
    }
    cli.println(sb.toString());
}
Also used : NameRegistrar(org.jpos.util.NameRegistrar) TransactionManager(org.jpos.transaction.TransactionManager) Iterator(java.util.Iterator) Map(java.util.Map)

Example 2 with NameRegistrar

use of org.jpos.util.NameRegistrar in project jPOS by jpos.

the class SHOWNR method showAll.

private void showAll(CLIContext cli, boolean detail) {
    NameRegistrar nr = NameRegistrar.getInstance();
    int maxw = 0;
    Iterator iter = NameRegistrar.getAsMap().entrySet().iterator();
    while (iter.hasNext()) {
        Map.Entry entry = (Map.Entry) iter.next();
        maxw = Math.max(maxw, entry.getKey().toString().length());
    }
    iter = NameRegistrar.getAsMap().entrySet().iterator();
    maxw++;
    while (iter.hasNext()) {
        Map.Entry entry = (Map.Entry) iter.next();
        cli.println(ISOUtil.strpad(entry.getKey().toString(), maxw) + entry.getValue().toString());
        if (detail && entry.getValue() instanceof Loggeable) {
            cli.printLoggeable((Loggeable) entry.getValue(), "   ");
        }
    }
}
Also used : NameRegistrar(org.jpos.util.NameRegistrar) Iterator(java.util.Iterator) Loggeable(org.jpos.util.Loggeable) Map(java.util.Map)

Example 3 with NameRegistrar

use of org.jpos.util.NameRegistrar in project jPOS by jpos.

the class TAIL method showLoggers.

private void showLoggers(CLIContext cli) {
    NameRegistrar nr = NameRegistrar.getInstance();
    int maxw = 0;
    Iterator iter = NameRegistrar.getAsMap().entrySet().iterator();
    StringBuilder sb = new StringBuilder("available loggers:");
    while (iter.hasNext()) {
        Map.Entry entry = (Map.Entry) iter.next();
        String key = (String) entry.getKey();
        if (key.startsWith("logger.") && entry.getValue() instanceof Logger) {
            sb.append(' ');
            sb.append(key.substring(7));
        }
    }
    cli.println(sb.toString());
}
Also used : NameRegistrar(org.jpos.util.NameRegistrar) Iterator(java.util.Iterator) Logger(org.jpos.util.Logger) Map(java.util.Map)

Aggregations

Iterator (java.util.Iterator)3 Map (java.util.Map)3 NameRegistrar (org.jpos.util.NameRegistrar)3 TransactionManager (org.jpos.transaction.TransactionManager)1 Loggeable (org.jpos.util.Loggeable)1 Logger (org.jpos.util.Logger)1