Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

svn commit: r219008 - /lenya/trunk/src/java/org/apache/lenya/cms/ac/usecase: msg#00061

cms.lenya.cvs

Subject: 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();
+ }
}


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
solaris.opensol...    editors.vim/200...    web.turbogears....    jakarta.ant.dev...    mathematics.max...    text.unicode.ge...    lang.ruby.core/...    xfce.announce/2...    network.centeri...    php.cvs.pear/20...    user-groups.lin...    kde.devel.quant...    file-systems.ar...    redhat.fedora.t...    apple.fink.auto...    gnome.orbit.gen...    qplus.devel/200...    culture.transpo...    video.dri.user/...    operators.nanog...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive 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

Navigation