001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.jetspeed.sso.impl;
019:
020: import java.sql.Timestamp;
021: import java.util.Collection;
022: import java.util.Vector;
023:
024: import org.apache.jetspeed.security.om.InternalUserPrincipal;
025: import org.apache.jetspeed.sso.SSOPrincipal;
026:
027: /**
028: * <p>
029: * SSOPrincipalImpl
030: * Class used for mapping Principal information for a site. This is the short form of
031: * the InternalPrincipalImpl
032: * .</p>
033: *
034: * @author <a href="mailto:rogerrut @apache.org">Roger Ruttimann</a>
035: */
036: public class SSOPrincipalImpl implements SSOPrincipal {
037: /** The principal id. */
038: private long principalId;
039:
040: /** The class name. */
041: private String classname;
042:
043: /** The is mapping only. */
044: private boolean isMappingOnly = false;
045:
046: /** The full path. */
047: private String fullPath;
048:
049: /** The creation date. */
050: private Timestamp creationDate;
051:
052: /** The modified date. */
053: private Timestamp modifiedDate;
054:
055: /** The enabled state. */
056: private boolean enabled = true;
057:
058: /** Permissions not used by required by the interface*/
059: private Collection permissions;
060:
061: /** Remote principals for Principal */
062: private Collection remotePrincipals = new Vector();
063:
064: /** SIteID for Remote principal */
065: private int siteID;
066:
067: /**
068: * <p>
069: * The special attribute telling OJB the object's concrete type.
070: * </p>
071: * <p>
072: * NOTE: this attribute MUST be called ojbConcreteClass
073: * </p>
074: */
075: protected String ojbConcreteClass;
076:
077: /**
078: * <p>
079: * InternalPrincipal implementation default constructor.
080: * </p>
081: */
082: public SSOPrincipalImpl() {
083: }
084:
085: /**
086: * <p>
087: * InternalPrincipal constructor given a classname and name.
088: * </p>
089: *
090: * @param classname The classname.
091: * @param fullPath The full path.
092: */
093: public SSOPrincipalImpl(String classname, String fullPath) {
094: this .ojbConcreteClass = classname;
095: this .classname = classname;
096: this .fullPath = fullPath;
097: this .permissions = null; // Not used
098: this .creationDate = new Timestamp(System.currentTimeMillis());
099: this .modifiedDate = this .creationDate;
100: }
101:
102: /**
103: * addRemotePrincipal()
104: * adds a principal to the list of remote principals
105: */
106: public void addRemotePrincipal(InternalUserPrincipal principal) {
107: /* if (remotePrincipals == null)
108: {
109: remotePrincipals = new ArrayList(1);
110: }
111: */
112:
113: remotePrincipals.add(principal);
114: }
115:
116: /**
117: * @see org.apache.jetspeed.security.om.InternalPrincipal#getPrincipalId()
118: */
119: public long getPrincipalId() {
120: return this .principalId;
121: }
122:
123: /**
124: * @see org.apache.jetspeed.security.om.InternalPrincipal#setPrincipalId(int)
125: */
126: public void setPrincipalId(long principalId) {
127: this .principalId = principalId;
128: }
129:
130: /**
131: * @see org.apache.jetspeed.security.om.InternalPrincipal#getClassname()
132: */
133: public String getClassname() {
134: return this .classname;
135: }
136:
137: /**
138: * @see org.apache.jetspeed.security.om.InternalPrincipal#setClassname(java.lang.String)
139: */
140: public void setClassname(String classname) {
141: this .ojbConcreteClass = classname;
142: this .classname = classname;
143: }
144:
145: /**
146: * @return Returns the isMappingOnly.
147: */
148: public boolean isMappingOnly() {
149: return isMappingOnly;
150: }
151:
152: /**
153: * @param isMappingOnly The isMappingOnly to set.
154: */
155: public void setMappingOnly(boolean isMappingOnly) {
156: this .isMappingOnly = isMappingOnly;
157: }
158:
159: /**
160: * @see org.apache.jetspeed.security.om.InternalPrincipal#getFullPath()
161: */
162: public String getFullPath() {
163: return this .fullPath;
164: }
165:
166: /**
167: * @see org.apache.jetspeed.security.om.InternalPrincipal#setFullPath(java.lang.String)
168: */
169: public void setFullPath(String fullPath) {
170: this .fullPath = fullPath;
171: }
172:
173: /**
174: * @see org.apache.jetspeed.security.om.InternalPrincipal#getPermissions()
175: */
176: public Collection getPermissions() {
177: return this .permissions;
178: }
179:
180: /**
181: * @see org.apache.jetspeed.security.om.InternalPrincipal#setPermissions(java.util.Collection)
182: */
183: public void setPermissions(Collection permissions) {
184: this .permissions = permissions;
185: }
186:
187: /**
188: * @see org.apache.jetspeed.security.om.InternalPrincipal#getCreationDate()
189: */
190: public Timestamp getCreationDate() {
191: return this .creationDate;
192: }
193:
194: /**
195: * @see org.apache.jetspeed.security.om.InternalPrincipal#setCreationDate(java.sql.Timestamp)
196: */
197: public void setCreationDate(Timestamp creationDate) {
198: this .creationDate = creationDate;
199: }
200:
201: /**
202: * @see org.apache.jetspeed.security.om.InternalPrincipal#getModifiedDate()
203: */
204: public Timestamp getModifiedDate() {
205: return this .modifiedDate;
206: }
207:
208: /**
209: * @see org.apache.jetspeed.security.om.InternalPrincipal#setModifiedDate(java.sql.Timestamp)
210: */
211: public void setModifiedDate(Timestamp modifiedDate) {
212: this .modifiedDate = modifiedDate;
213: }
214:
215: /**
216: * @see org.apache.jetspeed.security.om.InternalPrincipal#isEnabled()
217: */
218: public boolean isEnabled() {
219: return enabled;
220: }
221:
222: /**
223: * @see org.apache.jetspeed.security.om.InternalPrincipal#setEnabled(boolean)
224: */
225: public void setEnabled(boolean enabled) {
226: this .enabled = enabled;
227: }
228:
229: /**
230: * @return Returns the remotePrincipals.
231: */
232: public Collection getRemotePrincipals() {
233: return remotePrincipals;
234: }
235:
236: /**
237: * @param remotePrincipals The remotePrincipals to set.
238: */
239: public void setRemotePrincipals(Collection remotePrincipals) {
240: this .remotePrincipals = remotePrincipals;
241: }
242:
243: /**
244: * @return Returns the siteID.
245: */
246: public int getSiteID() {
247: return siteID;
248: }
249:
250: /**
251: * @param siteID The siteID to set.
252: */
253: public void setSiteID(int siteID) {
254: this.siteID = siteID;
255: }
256: }
|