001: /*
002: * Copyright (c) 2001 - 2005 ivata limited.
003: * All rights reserved.
004: * -----------------------------------------------------------------------------
005: * ivata groupware may be redistributed under the GNU General Public
006: * License as published by the Free Software Foundation;
007: * version 2 of the License.
008: *
009: * These programs are free software; you can redistribute them and/or
010: * modify them under the terms of the GNU General Public License
011: * as published by the Free Software Foundation; version 2 of the License.
012: *
013: * These programs are distributed in the hope that they will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016: *
017: * See the GNU General Public License in the file LICENSE.txt for more
018: * details.
019: *
020: * If you would like a copy of the GNU General Public License write to
021: *
022: * Free Software Foundation, Inc.
023: * 59 Temple Place - Suite 330
024: * Boston, MA 02111-1307, USA.
025: *
026: *
027: * To arrange commercial support and licensing, contact ivata at
028: * http://www.ivata.com/contact.jsp
029: * -----------------------------------------------------------------------------
030: * $Log: TestSecuritySession.java,v $
031: * Revision 1.5 2005/10/11 18:53:07 colinmacleod
032: * Fixed some checkstyle and javadoc issues.
033: *
034: * Revision 1.4 2005/10/03 10:21:14 colinmacleod
035: * Fixed some style and javadoc issues.
036: *
037: * Revision 1.3 2005/09/29 14:17:03 colinmacleod
038: * Split UserGroupDO off from GroupDO.
039: * Moved UserGroupDO, Right classes to security subproject (from
040: * addressbook).
041: * Centralized user right handling into Rights and RightsImpl.
042: *
043: * Revision 1.2 2005/04/09 17:19:11 colinmacleod
044: * Changed copyright text to GPL v2 explicitly.
045: *
046: * Revision 1.1.1.1 2005/03/10 17:50:14 colinmacleod
047: * Restructured ivata op around Hibernate/PicoContainer.
048: * Renamed ivata groupware.
049: *
050: * Revision 1.1 2004/07/13 19:41:17 colinmacleod
051: * Moved project to POJOs from EJBs.
052: * Applied PicoContainer to services layer (replacing session EJBs).
053: * Applied Hibernate to persistence layer (replacing entity EJBs).
054: * -----------------------------------------------------------------------------
055: */
056: package com.ivata.groupware.admin.security.server;
057:
058: import java.io.Serializable;
059: import java.util.HashMap;
060: import java.util.Map;
061:
062: import org.picocontainer.PicoContainer;
063:
064: import com.ivata.groupware.admin.security.user.UserDO;
065:
066: /**
067: * This security session is a dummy, useful for testing.
068: *
069: * @author Colin MacLeod
070: * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
071: * @since ivata groupware 0.10 (Jun 2, 2004)
072: * @version $Revision: 1.5 $
073: */
074: public class TestSecuritySession implements SecuritySession {
075: /**
076: * Serialization version (for <code>Serializable</code> interface).
077: */
078: private static final long serialVersionUID = 1L;
079: /**
080: * <copyDoc>Refer to {@link #getAttribute(String)}.</copyDoc>
081: */
082: private Map attributes = new HashMap();
083: /**
084: * <copyDoc>Refer to {@link #getUser()}.</copyDoc>
085: */
086: private UserDO user;
087:
088: /**
089: * Construct the test security session.
090: *
091: * @param userParam the test site user.
092: */
093: public TestSecuritySession(final UserDO userParam) {
094: super ();
095: this .user = userParam;
096: }
097:
098: /**
099: * {@inheritDoc}
100: *
101: * @param name {@inheritDoc}
102: * @return {@inheritDoc}
103: */
104: public final Serializable getAttribute(final String name) {
105: return (Serializable) attributes.get(name);
106: }
107:
108: /**
109: * {@inheritDoc}
110: *
111: * @return Always returns <code>null</code>.
112: */
113: public final PicoContainer getContainer() {
114: return null;
115: }
116:
117: /**
118: * <copyDoc>Refer to {@link SecuritySession#getPassword}.</copyDoc>
119: * @return <copyDoc>Refer to {@link SecuritySession#getPassword}.</copyDoc>
120: */
121: public String getPassword() {
122: return null;
123: }
124:
125: /**
126: * {@inheritDoc}
127: *
128: * @return {@inheritDoc}
129: */
130: public UserDO getUser() {
131: return user;
132: }
133:
134: /**
135: * <copyDoc>Refer to {@link }.</copyDoc>
136: * @see com.ivata.groupware.admin.security.server.SecuritySession#isGuest()
137: * @return
138: */
139: public boolean isGuest() {
140: return false;
141: }
142:
143: /**
144: * {@inheritDoc}
145: *
146: * @param name {@inheritDoc}
147: * @param value {@inheritDoc}
148: */
149: public final void setAttribute(final String name,
150: final Serializable value) {
151: attributes.put(name, value);
152: }
153:
154: }
|