@@ -0,0 +1,2039 @@
+/*%0A * Copyright 2018 B2i Healthcare Pte Ltd, http://b2i.sg%0A * %0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.b2international.snowowl.core.console;%0A%0Aimport static com.google.common.collect.Lists.newArrayList;%0A%0Aimport java.util.Collections;%0Aimport java.util.List;%0A%0Aimport com.b2international.commons.CompareUtils;%0Aimport com.b2international.commons.Pair;%0Aimport com.b2international.commons.extension.Component;%0Aimport com.b2international.snowowl.core.ApplicationContext;%0Aimport com.b2international.snowowl.datastore.session.IApplicationSessionManager;%0Aimport com.google.common.base.Strings;%0A%0A/**%0A * @since 7.0%0A */%0A@Component%0A@picocli.CommandLine.Command(%0A%09name = %22users%22,%0A%09header = %22Displays and manages user sessions%22,%0A%09description = %22Displays information about user sessions and provides functionality to disconnect them from the server or prevent them from logging in, when required%22%0A)%0Apublic final class UsersCommand extends Command %7B%0A%0A%09@Override%0A%09public void run(CommandLineStream out) %7B%0A%09%09final List%3CPair%3CString, String%3E%3E info = newArrayList(ApplicationContext.getInstance().getService(IApplicationSessionManager.class).getConnectedSessionInfo());%0A%09%09%0A%09%09if (CompareUtils.isEmpty(info)) %7B%0A%09%09%09out.println(%22No users are connected to the server.%22);%0A%09%09%7D else %7B%0A%09%09%09Collections.sort(info, (o1, o2) -%3E Strings.nullToEmpty(o1.getA()).compareTo(Strings.nullToEmpty(o2.getA())));%0A%09%09%09%0A%09%09%09for (final Pair%3CString, String%3E pair : info) %7B%0A%09%09%09%09out.println(%22User: %25s %7C session ID: %25s%22, pair.getA(), pair.getB());%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

add UsersCommand