⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loginserviceimpl.java

📁 Java mulitplayer strategy game. Adaptation of KDE Galaxy Conquest. (rules are changed - but still th
💻 JAVA
字号:
package net.sf.jawp.gf.server;

import javax.security.auth.login.LoginException;
import net.sf.jawp.gf.api.domain.User;

import net.sf.jawp.gf.api.services.LoginService;
import net.sf.jawp.gf.api.services.SessionService;
import net.sf.jawp.gf.domain.GameWorldBase;
import net.sf.jawp.gf.domain.GameWorldRO;
import net.sf.jawp.gf.persistence.PersistenceController;
import net.sf.jawp.gf.system.RootSystem;
import net.sf.jawp.gf.system.RootSystemUnmodifiable;
import net.sf.jawp.util.PasswordUtil;

/**
 * implementation of login service
 * @author jarek
 * @version $Revision: 1.12 $
 * @param <GAME> game type
 * @param <GAMEVIEW> RO view of game
 * @param <GAMESERVICE> service definition for game
 */
public class LoginServiceImpl<GAMESERVICE  , GAME extends GameWorldBase<GAMEVIEW>, GAMEVIEW extends GameWorldRO> implements LoginService<GAMESERVICE>
{
	private final String login;
	
	private final String chapSeed;
	
	private final RootSystemUnmodifiable usersDB;
	
	private final PersistenceController<RootSystem<GAME, GAMEVIEW, GAMESERVICE>, RootSystemUnmodifiable< GAMEVIEW> > persistence;
	
	public LoginServiceImpl(final RootSystemUnmodifiable db, final String login, 
			final PersistenceController<RootSystem<GAME, GAMEVIEW, GAMESERVICE>, RootSystemUnmodifiable<GAMEVIEW> > persistence)
	{
		this.usersDB = db;
		this.chapSeed = PasswordUtil.generateRandomSeed();
		this.login = login;
		this.persistence = persistence;
	}
	
	public final String getServerSeed()
	{
		return this.chapSeed;
	}
	
	public final SessionService<GAMESERVICE> login( final String clientString)
		throws LoginException
	{
		final User user = usersDB.login(this.login, clientString, chapSeed); 
		return new SessionServiceImpl<GAMESERVICE, GAME, GAMEVIEW>(user, this.persistence);
	}

	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -