📄 vpnclientmessagesink.java
字号:
/*
* SSL-Explorer
*
* Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package com.sslexplorer.notification.vpnclient;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.sslexplorer.core.CoreServlet;
import com.sslexplorer.notification.Message;
import com.sslexplorer.notification.MessageSink;
import com.sslexplorer.notification.Notifier;
import com.sslexplorer.notification.Recipient;
import com.sslexplorer.security.SessionInfo;
import com.sslexplorer.security.VPNSession;
public class VPNClientMessageSink implements MessageSink {
final static Log log = LogFactory.getLog(VPNClientMessageSink.class);
private Notifier notifier;
public VPNClientMessageSink() {
super();
}
public void start(Notifier notifier) throws Exception {
this.notifier = notifier;
}
public void stop() throws Exception {
}
public boolean send(Message message) throws Exception {
//
int sent = 0;
List l = notifier.getFullRecipientListAsUsers(message.getRecipients());
for (Iterator i = l.iterator(); i.hasNext();) {
Recipient r = (Recipient) i.next();
List sessionInfo = CoreServlet.getServlet().getLogonController().getSessionInfo(r.getRecipientAlias(), SessionInfo.UI);
if (sessionInfo != null) {
for (Iterator j = sessionInfo.iterator(); j.hasNext();) {
SessionInfo info = (SessionInfo) j.next();
List vpnSessions = CoreServlet.getServlet().getLogonController().getVPNSessionsByLogon(info.getLogonTicket());
if (vpnSessions != null) {
for (Iterator k = vpnSessions.iterator(); k.hasNext();) {
VPNSession vpnSession = (VPNSession) k.next();
if (vpnSession.getType() == VPNSession.STANDALONE_VPN_CLIENT) {
vpnSession.addMessage(new VPNSession.Message(0, message.getSubject(), message.getContent()));
sent++;
}
}
}
}
}
}
return sent > 0;
}
public String getName() {
return "VPNCLIENT";
}
public String getShortNameKey() {
return "notification.vpnClient.shortName";
}
public String getDescriptionKey() {
return "notification.vpnClient.description";
}
public String getBundle() {
return "setup";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -