commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hus...@apache.org
Subject cvs commit: jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/struts/webapp/example Constants.java DatabaseMissingException.java ExpiredPasswordException.java Subscription.java User.java UserDatabase.java
Date Thu, 25 Mar 2004 12:42:04 GMT
husted      2004/03/25 04:42:04

  Added:       chain/apps/mailreader/src/java/org/apache/struts/webapp/example
                        Constants.java DatabaseMissingException.java
                        ExpiredPasswordException.java Subscription.java
                        User.java UserDatabase.java
  Log:
  Initial import of MailReader Example application for Commons Chain
  
  Revision  Changes    Path
  1.1                  jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/struts/webapp/example/Constants.java
  
  Index: Constants.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/struts/webapp/example/Constants.java,v
1.1 2004/03/25 12:42:03 husted Exp $
   * $Revision: 1.1 $
   * $Date: 2004/03/25 12:42:03 $
   *
   * Copyright 1999-2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.struts.webapp.example;
  
  
  /**
   * Manifest constants for the example application.
   *
   * @version $Revision: 1.1 $ $Date: 2004/03/25 12:42:03 $
   */
  
  public final class Constants {
  
  
      /**
       * The package name for this application.
       */
      public static final String PACKAGE = "org.apache.struts.webapp.example";
  
  
      /**
       * The application scope attribute under which our user database
       * is stored.
       */
      public static final String DATABASE_KEY = "database";
  
  
      /**
       * The session scope attribute under which the Subscription object
       * currently selected by our logged-in User is stored.
       */
      public static final String SUBSCRIPTION_KEY = "subscription";
  
  
      /**
       * The session scope attribute under which the User object
       * for the currently logged in user is stored.
       */
      public static final String USER_KEY = "user";
  
  
      /**
       * A static message in case database resource is not loaded.
       */
      public static final String ERROR_DATABASE_NOT_LOADED =
              "ERROR:  User database not loaded -- check servlet container logs for error
messages.";
  
  
      /**
       * A static message in case message resource is not loaded.
       */
      public static final String ERROR_MESSAGES_NOT_LOADED =
              "ERROR:  Message resources not loaded -- check servlet container logs for error
messages.";
  
  }
  
  
  1.1                  jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/struts/webapp/example/DatabaseMissingException.java
  
  Index: DatabaseMissingException.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/struts/webapp/example/DatabaseMissingException.java,v
1.1 2004/03/25 12:42:03 husted Exp $
   * $Revision: 1.1 $
   * $Date: 2004/03/25 12:42:03 $
   *
   * Copyright 1999-2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.struts.webapp.example;
  
  import org.apache.struts.util.ModuleException;
  
  /**
   * <p>Indicates that reference to database dissappeared.</p>
   */
  public class DatabaseMissingException extends ModuleException {
  
  
      /**
       * <p>Construct a new instance of this exception.</p>
       */
      public DatabaseMissingException() {
          super("error.database.missing");
      }
  
  }
  
  
  
  
  1.1                  jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/struts/webapp/example/ExpiredPasswordException.java
  
  Index: ExpiredPasswordException.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/struts/webapp/example/ExpiredPasswordException.java,v
1.1 2004/03/25 12:42:03 husted Exp $
   * $Revision: 1.1 $
   * $Date: 2004/03/25 12:42:03 $
   *
   * Copyright 1999-2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  
  package org.apache.struts.webapp.example;
  
  import org.apache.struts.util.ModuleException;
  
  /**
   * Example of an application-specific exception for which a handler
   * can be configured.
   */
  
  
  public class ExpiredPasswordException extends ModuleException {
  
  
      /**
       * Construct a new instance of this exception for the specified username.
       *
       * @param username Username whose password has expired
       */
      public ExpiredPasswordException(String username) {
          super("error.password.expired", username);
      }
  
  
  }
  
  
  
  
  1.1                  jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/struts/webapp/example/Subscription.java
  
  Index: Subscription.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/struts/webapp/example/Subscription.java,v
1.1 2004/03/25 12:42:04 husted Exp $
   * $Revision: 1.1 $
   * $Date: 2004/03/25 12:42:04 $
   *
   * Copyright 1999-2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  
  package org.apache.struts.webapp.example;
  
  
  /**
   * <p>A <strong>Subscription</strong> which is stored, along with the
   * associated {@link User}, in a {@link UserDatabase}.</p>
   *
   * @version $Revision: 1.1 $ $Date: 2004/03/25 12:42:04 $
   */
  
  public interface Subscription {
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * Return the auto-connect flag.
       */
      public boolean getAutoConnect();
  
  
      /**
       * Set the auto-connect flag.
       *
       * @param autoConnect The new auto-connect flag
       */
      public void setAutoConnect(boolean autoConnect);
  
  
      /**
       * Return the host name.
       */
      public String getHost();
  
  
      /**
       * Return the password.
       */
      public String getPassword();
  
  
      /**
       * Set the password.
       *
       * @param password The new password
       */
      public void setPassword(String password);
  
  
      /**
       * Return the subscription type.
       */
      public String getType();
  
  
      /**
       * Set the subscription type.
       *
       * @param type The new subscription type
       */
      public void setType(String type);
  
  
      /**
       * Return the {@link User} owning this Subscription.
       */
      public User getUser();
  
  
      /**
       * Return the username.
       */
      public String getUsername();
  
  
      /**
       * Set the username.
       *
       * @param username The new username
       */
      public void setUsername(String username);
  
  
  }
  
  
  
  1.1                  jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/struts/webapp/example/User.java
  
  Index: User.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/struts/webapp/example/User.java,v
1.1 2004/03/25 12:42:04 husted Exp $
   * $Revision: 1.1 $
   * $Date: 2004/03/25 12:42:04 $
   *
   * Copyright 1999-2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  
  package org.apache.struts.webapp.example;
  
  
  /**
   * <p>A <strong>User</strong> which is stored, along with his or her
   * associated {@link Subscription}s, in a {@link UserDatabase}.</p>
   *
   * @version $Revision: 1.1 $ $Date: 2004/03/25 12:42:04 $
   * @since Struts 1.1
   */
  
  public interface User {
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * Return the {@link UserDatabase} with which we are associated.
       */
      public UserDatabase getDatabase();
  
  
      /**
       * Return the from address.
       */
      public String getFromAddress();
  
  
      /**
       * Set the from address.
       *
       * @param fromAddress The new from address
       */
      public void setFromAddress(String fromAddress);
  
  
      /**
       * Return the full name.
       */
      public String getFullName();
  
  
      /**
       * Set the full name.
       *
       * @param fullName The new full name
       */
      public void setFullName(String fullName);
  
  
      /**
       * Return the password.
       */
      public String getPassword();
  
  
      /**
       * Set the password.
       *
       * @param password The new password
       */
      public void setPassword(String password);
  
  
      /**
       * Return the reply-to address.
       */
      public String getReplyToAddress();
  
  
      /**
       * Set the reply-to address.
       *
       * @param replyToAddress The new reply-to address
       */
      public void setReplyToAddress(String replyToAddress);
  
  
      /**
       * Find and return all {@link Subscription}s associated with this user.
       * If there are none, a zero-length array is returned.
       */
      public Subscription[] getSubscriptions();
  
  
      /**
       * Return the username.
       */
      public String getUsername();
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Create and return a new {@link Subscription} associated with this
       * User, for the specified host name.
       *
       * @param host Host name for which to create a subscription
       *
       * @exception IllegalArgumentException if the host name is not unique
       *  for this user
       */
      public Subscription createSubscription(String host);
  
  
      /**
       * Find and return the {@link Subscription} associated with the specified
       * host.  If none is found, return <code>null</code>.
       *
       * @param host Host name to look up
       */
      public Subscription findSubscription(String host);
  
  
      /**
       * Remove the specified {@link Subscription} from being associated
       * with this User.
       *
       * @param subscription Subscription to be removed
       *
       * @exception IllegalArgumentException if the specified subscription is not
       *  associated with this User
       */
      public void removeSubscription(Subscription subscription);
  
  
  }
  
  
  
  1.1                  jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/struts/webapp/example/UserDatabase.java
  
  Index: UserDatabase.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/chain/apps/mailreader/src/java/org/apache/struts/webapp/example/UserDatabase.java,v
1.1 2004/03/25 12:42:04 husted Exp $
   * $Revision: 1.1 $
   * $Date: 2004/03/25 12:42:04 $
   *
   * Copyright 2000-2004 Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.struts.webapp.example;
  
  
  /**
   * <p>A <strong>Data Access Object</strong> (DAO) interface describing
   * the available operations for retrieving and storing {@link User}s
   * (and their associated {@link Subscription}s) in some persistence layer
   * whose characteristics are not specified here.  One or more implementations
   * will be created to perform the actual I/O that is required.</p>
   *
   * @version $Revision: 1.1 $ $Date: 2004/03/25 12:42:04 $
   * @since Struts 1.1
   */
  public interface UserDatabase {
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * <p>Create and return a new {@link User} defined in this user database.
       * </p>
       *
       * @param username Username of the new user
       *
       * @exception IllegalArgumentException if the specified username
       *  is not unique
       */
      public User createUser(String username);
  
  
      /**
       * <p>Finalize access to the underlying persistence layer.</p>
       *
       * @exception Exception if a database access error occurs
       */
      public void close() throws Exception;
  
  
      /**
       * <p>Return the existing {@link User} with the specified username,
       * if any; otherwise return <code>null</code>.</p>
       *
       * @param username Username of the user to retrieve
       * @throws ExpiredPasswordException if user password has expired
       * and must be changed
       */
      public User findUser(String username) throws ExpiredPasswordException;
  
  
      /**
       * <p>Return the set of {@link User}s defined in this user database.</p>
       */
      public User[] findUsers();
  
  
      /**
       * <p>Initiate access to the underlying persistence layer.</p>
       *
       * @exception Exception if a database access error occurs
       */
      public void open() throws Exception;
  
  
      /**
       * Remove the specified {@link User} from this database.
       *
       * @param user User to be removed
       *
       * @exception IllegalArgumentException if the specified user is not
       *  associated with this database
       */
      public void removeUser(User user);
  
  
      /**
       * <p>Save any pending changes to the underlying persistence layer.</p>
       *
       * @exception Exception if a database access error occurs
       */
      public void save() throws Exception;
  
  
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message