|
|
Choosing A Webhost: |
svn commit: r219008 - /lenya/trunk/src/java/org/apache/lenya/cms/ac/usecase: msg#00061cms.lenya.cvs
Author: andreas Date: Thu Jul 14 01:05:41 2005 New Revision: 219008 URL: http://svn.apache.org/viewcvs?rev=219008&view=rev Log: [minor change] removed unused variable, added javadoc tag Modified: lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/SessionViewer.java Modified: lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/SessionViewer.java URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/SessionViewer.java?rev=219008&r1=219007&r2=219008&view=diff ============================================================================== --- lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/SessionViewer.java (original) +++ lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/SessionViewer.java Thu Jul 14 01:05:41 2005 @@ -22,7 +22,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Enumeration; import java.util.Vector; import javax.servlet.http.*; @@ -34,73 +33,69 @@ import org.apache.lenya.util.SessionListener; /** - * SessionViewer usecase which gets all session objects from the SessionListener - * and extract the necessary informations. + * SessionViewer usecase which gets all session objects from the SessionListener and extract the + * necessary informations. * - * @version $Id:$ + * @version $Id$ */ public class SessionViewer extends AccessControlUsecase { - private static final String IDENTITY = Identity.class.getName(); + private static final String IDENTITY = Identity.class.getName(); - private static final String HISTORY = "org.apache.lenya.cms.cocoon.acting.History"; + private static final String HISTORY = "org.apache.lenya.cms.cocoon.acting.History"; - protected static final String USERS = "users"; + protected static final String USERS = "users"; - /** - * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters() - */ - protected void initParameters() { - super.initParameters(); - this.getSourceURL(); - - SessionListener sessions = new SessionListener(); - WeakHashMap allSessions = sessions.getAllSessions(); - List userList = new ArrayList(); - - Iterator userit = allSessions.entrySet().iterator(); - while (userit.hasNext()) { - Map.Entry entry = (Map.Entry) userit.next(); - HttpSession nextsession = (HttpSession) entry.getValue(); - - Enumeration enum = nextsession.getAttributeNames(); - Identity identity = (Identity) nextsession.getAttribute(IDENTITY); - - User user = identity.getUser(); - if (user != null) { - Vector history = (Vector) nextsession.getAttribute(HISTORY); - String publicationID = getPublicationIDfromHistory(history); - if (publicationID.equals(getPublicationIDfromURL())) { - userList.add(identity.getUser()); - } - } - } - setParameter(USERS, userList); - } - - /** - * Extract the publicationID from the history information stored in the - * session - * - * @param history - * The history stored in the session.. An entry looks like \/ - * <publication-id>/authoring/index.html - * - */ - private String getPublicationIDfromHistory(Vector history) { - - String firstElement = history.firstElement().toString(); - String publicationID = firstElement.substring(1, firstElement.indexOf( - "/", 1)); - - return publicationID; - } - - /** - * @return The publicationID from an URL. - */ - private String getPublicationIDfromURL() { - URLInformation info = new URLInformation(getSourceURL()); - return info.getPublicationId(); - } + /** + * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters() + */ + protected void initParameters() { + super.initParameters(); + this.getSourceURL(); + + SessionListener sessions = new SessionListener(); + WeakHashMap allSessions = sessions.getAllSessions(); + List userList = new ArrayList(); + + Iterator userit = allSessions.entrySet().iterator(); + while (userit.hasNext()) { + Map.Entry entry = (Map.Entry) userit.next(); + HttpSession nextsession = (HttpSession) entry.getValue(); + + Identity identity = (Identity) nextsession.getAttribute(IDENTITY); + + User user = identity.getUser(); + if (user != null) { + Vector history = (Vector) nextsession.getAttribute(HISTORY); + String publicationID = getPublicationIDfromHistory(history); + if (publicationID.equals(getPublicationIDfromURL())) { + userList.add(identity.getUser()); + } + } + } + setParameter(USERS, userList); + } + + /** + * Extract the publicationID from the history information stored in the session + * + * @param history The history stored in the session.. An entry looks like \/ + * <publication-id>/authoring/index.html + * @return A publication ID. + */ + private String getPublicationIDfromHistory(Vector history) { + + String firstElement = history.firstElement().toString(); + String publicationID = firstElement.substring(1, firstElement.indexOf("/", 1)); + + return publicationID; + } + + /** + * @return The publicationID from an URL. + */ + private String getPublicationIDfromURL() { + URLInformation info = new URLInformation(getSourceURL()); + return info.getPublicationId(); + } }
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | svn commit: r219003 - /lenya/trunk/src/cocoon/local.blocks.properties, michi |
|---|---|
| Next by Date: | svn commit: r219009 - in /lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/webdav: FilePropfind.java Propfind.java Put.java, andreas |
| Previous by Thread: | svn commit: r219003 - /lenya/trunk/src/cocoon/local.blocks.properties, michi |
| Next by Thread: | svn commit: r219009 - in /lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/webdav: FilePropfind.java Propfind.java Put.java, andreas |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |