use of org.apache.karaf.shell.impl.console.commands.SubShellCommand in project karaf by apache.
the class SessionFactoryImpl method unregister.
@Override
public void unregister(Object service) {
synchronized (services) {
super.unregister(service);
if (service instanceof Command) {
Command command = (Command) service;
String scope = command.getScope();
String name = command.getName();
commandProcessor.removeCommand(scope, name);
if (!Session.SCOPE_GLOBAL.equals(scope)) {
if (subshells.get(scope).decrement() == 0) {
SubShellCommand subShell = subshells.remove(scope);
unregister(subShell);
}
}
}
}
}
use of org.apache.karaf.shell.impl.console.commands.SubShellCommand in project karaf by apache.
the class SessionFactoryImpl method register.
@Override
public void register(Object service) {
synchronized (services) {
if (service instanceof Command) {
Command command = (Command) service;
String scope = command.getScope();
String name = command.getName();
if (!Session.SCOPE_GLOBAL.equals(scope)) {
if (!subshells.containsKey(scope)) {
SubShellCommand subShell = new SubShellCommand(scope);
subshells.put(scope, subShell);
register(subShell);
}
subshells.get(scope).increment();
}
commandProcessor.addCommand(scope, wrap(command), name);
}
super.register(service);
}
}
Aggregations