[mud4j-commit] SF.net SVN: mud4j: [154] trunk/mud4j-core/src/java/net/sf/mud4j
Status: Pre-Alpha
Brought to you by:
mpurland
|
From: <mpu...@us...> - 2007-10-06 00:59:31
|
Revision: 154
http://mud4j.svn.sourceforge.net/mud4j/?rev=154&view=rev
Author: mpurland
Date: 2007-10-05 17:59:26 -0700 (Fri, 05 Oct 2007)
Log Message:
-----------
Add Tick and LoginService.
Added Paths:
-----------
trunk/mud4j-core/src/java/net/sf/mud4j/scheduling/Tick.java
trunk/mud4j-core/src/java/net/sf/mud4j/service/LoginService.java
Added: trunk/mud4j-core/src/java/net/sf/mud4j/scheduling/Tick.java
===================================================================
--- trunk/mud4j-core/src/java/net/sf/mud4j/scheduling/Tick.java (rev 0)
+++ trunk/mud4j-core/src/java/net/sf/mud4j/scheduling/Tick.java 2007-10-06 00:59:26 UTC (rev 154)
@@ -0,0 +1,5 @@
+package net.sf.mud4j.scheduling;
+
+public class Tick {
+
+}
Property changes on: trunk/mud4j-core/src/java/net/sf/mud4j/scheduling/Tick.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/mud4j-core/src/java/net/sf/mud4j/service/LoginService.java
===================================================================
--- trunk/mud4j-core/src/java/net/sf/mud4j/service/LoginService.java (rev 0)
+++ trunk/mud4j-core/src/java/net/sf/mud4j/service/LoginService.java 2007-10-06 00:59:26 UTC (rev 154)
@@ -0,0 +1,57 @@
+package net.sf.mud4j.service;
+import net.sf.mud4j.account.Account;
+import net.sf.mud4j.dao.AccountDao;
+
+import org.hibernate.ObjectNotFoundException;
+import org.springframework.dao.DataAccessException;
+
+
+/**
+ * Provides services for login validation and logging in.
+ *
+ * @author Matthew Purland
+ */
+public class LoginService {
+ private AccountDao accountDao;
+
+ /**
+ * Set the account DAO for the service.
+ *
+ * @param accountDao Account DAO to set.
+ */
+ public void setAccountDao(AccountDao accountDao) {
+ this.accountDao = accountDao;
+ }
+
+ /**
+ * Validate a login through the AccountDAO.
+ *
+ * @param login Login to validate with.
+ * @param password Password to validate the login.
+ * @return Returns true if validation is successful.
+ */
+ public boolean validateLogin(String login, String password) {
+ boolean accountValid = false;
+ Account account = null;
+
+ try {
+ // Find the account by the login
+ account = accountDao.findAccount(login);
+
+ if (account != null && account.validatePassword(password)) {
+ accountValid = true;
+ }
+ }
+ catch (DataAccessException ex) {
+
+ }
+// catch (ObjectRetrievalFailureException ex) {
+// // Do nothing since we cannot validate an account
+// }
+ catch (ObjectNotFoundException ex) {
+ System.err.println("Object not found ex caught.");
+ }
+
+ return accountValid;
+ }
+}
Property changes on: trunk/mud4j-core/src/java/net/sf/mud4j/service/LoginService.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|