1 /**
2 * Copyright 2006 Matthew Purland (m.purland@gmail.com)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package net.sf.mud4j.dao;
17
18 import java.util.List;
19
20 import net.sf.mud4j.account.Account;
21
22 import org.springframework.dao.DataAccessException;
23 import org.springframework.dao.PermissionDeniedDataAccessException;
24
25 /**
26 * Account dao interface.
27 *
28 * @author Matthew Purland
29 */
30 public interface AccountDao {
31 /**
32 * Get list of accounts.
33 * @return Returns a list of accounts.
34 * @throws DataAccessException in case of data access I/O problems
35 */
36 List getAccounts() throws DataAccessException;
37
38 /**
39 * Load an account from the username.
40 *
41 * @param username Username of the account to load.
42 * @return Returns an account from the username.
43 * @throws DataAccessException in case of data access I/O problems
44 */
45 Account loadAccount(String username) throws DataAccessException;
46
47 /**
48 * Load an account from the username accessed by a password.
49 *
50 * @param username Username of the account.
51 * @param password Password of the account to verify.
52 * @return Returns an account if verified.
53 * @throws DataAccessException in case of data access I/O
54 * @throws PermissionDeniedDataAccessException if password is incorrect
55 */
56 Account loadAccount(String username, String password) throws DataAccessException, PermissionDeniedDataAccessException;
57 }