001: /*
002: * $Id: User.java 471754 2006-11-06 14:55:09Z husted $
003: *
004: * Licensed to the Apache Software Foundation (ASF) under one
005: * or more contributor license agreements. See the NOTICE file
006: * distributed with this work for additional information
007: * regarding copyright ownership. The ASF licenses this file
008: * to you under the Apache License, Version 2.0 (the
009: * "License"); you may not use this file except in compliance
010: * with the License. You may obtain a copy of the License at
011: *
012: * http://www.apache.org/licenses/LICENSE-2.0
013: *
014: * Unless required by applicable law or agreed to in writing,
015: * software distributed under the License is distributed on an
016: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017: * KIND, either express or implied. See the License for the
018: * specific language governing permissions and limitations
019: * under the License.
020: */
021:
022: package org.apache.struts.webapp.example;
023:
024: /**
025: * <p>A <strong>User</strong> which is stored, along with his or her
026: * associated {@link Subscription}s, in a {@link UserDatabase}.</p>
027: *
028: * @author Craig R. McClanahan
029: * @version $Rev: 471754 $ $Date: 2006-11-06 08:55:09 -0600 (Mon, 06 Nov 2006) $
030: * @since Struts 1.1
031: */
032:
033: public interface User {
034:
035: // ------------------------------------------------------------- Properties
036:
037: /**
038: * Return the {@link UserDatabase} with which we are associated.
039: */
040: public UserDatabase getDatabase();
041:
042: /**
043: * Return the from address.
044: */
045: public String getFromAddress();
046:
047: /**
048: * Set the from address.
049: *
050: * @param fromAddress The new from address
051: */
052: public void setFromAddress(String fromAddress);
053:
054: /**
055: * Return the full name.
056: */
057: public String getFullName();
058:
059: /**
060: * Set the full name.
061: *
062: * @param fullName The new full name
063: */
064: public void setFullName(String fullName);
065:
066: /**
067: * Return the password.
068: */
069: public String getPassword();
070:
071: /**
072: * Set the password.
073: *
074: * @param password The new password
075: */
076: public void setPassword(String password);
077:
078: /**
079: * Return the reply-to address.
080: */
081: public String getReplyToAddress();
082:
083: /**
084: * Set the reply-to address.
085: *
086: * @param replyToAddress The new reply-to address
087: */
088: public void setReplyToAddress(String replyToAddress);
089:
090: /**
091: * Find and return all {@link Subscription}s associated with this user.
092: * If there are none, a zero-length array is returned.
093: */
094: public Subscription[] getSubscriptions();
095:
096: /**
097: * Return the username.
098: */
099: public String getUsername();
100:
101: // --------------------------------------------------------- Public Methods
102:
103: /**
104: * Create and return a new {@link Subscription} associated with this
105: * User, for the specified host name.
106: *
107: * @param host Host name for which to create a subscription
108: *
109: * @exception IllegalArgumentException if the host name is not unique
110: * for this user
111: */
112: public Subscription createSubscription(String host);
113:
114: /**
115: * Find and return the {@link Subscription} associated with the specified
116: * host. If none is found, return <code>null</code>.
117: *
118: * @param host Host name to look up
119: */
120: public Subscription findSubscription(String host);
121:
122: /**
123: * Remove the specified {@link Subscription} from being associated
124: * with this User.
125: *
126: * @param subscription Subscription to be removed
127: *
128: * @exception IllegalArgumentException if the specified subscription is not
129: * associated with this User
130: */
131: public void removeSubscription(Subscription subscription);
132:
133: }
|