From: <the...@us...> - 2003-12-17 16:59:15
|
Update of /cvsroot/junk/junk/WEB-INF/classes/junk/controller In directory sc8-pr-cvs1:/tmp/cvs-serv22162 Added Files: WhoIsOnlineAction.java Log Message: initial release --- NEW FILE: WhoIsOnlineAction.java --- /* * juNK - a file search system for smb shares * * Copyright 2003 by Marcus Proest (theevilflow at users dot sf dot net) * * This file is part of junk (java usefull net kollektor). * * junk 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. * * junk 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 junk; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package junk.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import junk.plugin.scanner.ScannerPlugin; import junk.util.HostMap; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; /** * * @author flow */ public class WhoIsOnlineAction extends Action { public static final String KEY_ONLINE_ITERATOR = "wio-iterator"; public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletRespone) throws Exception { HostMap hosts = (HostMap) getServlet().getServletContext() .getAttribute(ScannerPlugin.KEY_HOSTS_MAP); java.util.Iterator i = hosts.keySet().iterator(); java.util.TreeSet l = new java.util.TreeSet(); while (i.hasNext()) { String ip = (String) i.next(); junk.util.NameOnline no = (junk.util.NameOnline) hosts.get(ip); junk.util.Computer c = new junk.util.Computer(); c.setIp(ip); c.setName(no.getName()); c.setNetFiles(null); c.setOnline(no.getOnline()); l.add(c); } //free mem as soon as possible hosts = null; i = null; httpServletRequest.setAttribute(KEY_ONLINE_ITERATOR, l); return actionMapping.findForward("wio"); } } |