1 package org.argosfields.spring;
2
3 import org.apache.commons.logging.Log;
4 import org.apache.commons.logging.LogFactory;
5 import org.argosfields.service.IGameManager;
6 import org.argosfields.service.ILoginManager;
7 import org.springframework.context.ConfigurableApplicationContext;
8 import org.springframework.context.support.ClassPathXmlApplicationContext;
9
10 /***
11 * ClientContextHelper.java
12 *
13 * @author Xavier Cho
14 * @version $Revision 1.1 $ $Date: 2004/04/15 05:43:55 $
15 */
16 public final class ClientContextHelper extends AbstractContextHelper {
17
18 private static Log log = LogFactory.getLog(ServerContextHelper.class);
19
20 private static ClientContextHelper instance;
21
22 private ILoginManager loginManager;
23 private IGameManager gameManager;
24
25 private ClientContextHelper() {
26 if (log.isInfoEnabled()) {
27 log.info("AccountManager has been initialized successfully.");
28 }
29 }
30
31 public static ClientContextHelper getInstance() {
32 if (instance == null) {
33 synchronized (ClientContextHelper.class) {
34 instance = new ClientContextHelper();
35 }
36 }
37
38 return instance;
39 }
40
41 /***
42 * @see org.argosfields.spring.AbstractContextHelper#createApplicationContext()
43 */
44 protected ConfigurableApplicationContext createApplicationContext() {
45 if (log.isInfoEnabled()) {
46 log.info("Loading client application context.");
47 }
48
49 return new ClassPathXmlApplicationContext(
50 "applicationClientContext.xml");
51 }
52
53 public ILoginManager getLoginManager() {
54 if (loginManager == null) {
55 loginManager = createLoginManager();
56 }
57
58 return loginManager;
59 }
60
61 public IGameManager getGameManager() {
62 if (gameManager == null) {
63 gameManager = createGameManager();
64 }
65
66 return gameManager;
67 }
68
69 protected ILoginManager createLoginManager() {
70 return (ILoginManager) getApplicationContext().getBean(
71 ILoginManager.NAME);
72 }
73
74 protected IGameManager createGameManager() {
75 return (IGameManager) getApplicationContext().getBean(
76 IGameManager.NAME);
77 }
78 }
This page was automatically generated by Maven