You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2005/07/14 10:05:42 UTC
svn commit: r219008 -
/lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/SessionViewer.java
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();
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org