View Javadoc

1   /*
2    * @(#) CreateGameContext.java Nov 9, 2004
3    * 
4    * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
5    * Delft, the Netherlands. All rights reserved.
6    * 
7    * See for project information <a href="http://www.simulation.tudelft.nl/">
8    * www.simulation.tudelft.nl </a>.
9    * 
10   * The source code and binary code of this software is proprietary information
11   * of Delft University of Technology.
12   */
13  package org.gscg.gameleader.interactionlayer;
14  
15  import nl.tudelft.simulation.logger.Logger;
16  import nl.tudelft.simulation.naming.InitialEventContext;
17  
18  
19  /***
20   * Creates a game context server-side.
21   * <p>
22   * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
23   * Delft, the Netherlands. All rights reserved.
24   * 
25   * See for project information <a href="http://www.simulation.tudelft.nl/">
26   * www.simulation.tudelft.nl </a>.
27   * 
28   * The source code and binary code of this software is proprietary information
29   * of Delft University of Technology.
30   * 
31   * @author <a
32   *         href="http://www.tbm.tudelft.nl/webstaf/stijnh/index.htm">Stijn-Pieter
33   *         van Houten </a>
34   * @version $Revision: 1.1 $ $Date: 2005/06/16 12:34:10 $
35   * @since 1.0.0 <br>
36   */
37  public class CreateGameContext
38  {
39  	/***
40  	 * constructs a new CreateGameContext
41  	 */
42  	public CreateGameContext()
43  	{
44  		super();
45  	}
46  
47  	/***
48  	 * Initializes a context and binds a game leader interaction layer to it.
49  	 * 
50  	 * @return returns a reference to the game leader interaction layer, or null
51  	 *         if anything went wrong
52  	 */
53  	public GameLeaderInteractionLayer initialize()
54  	{
55  		try
56  		{
57  			// we create our game context
58  			new InitialEventContext();
59  
60  			// we bind the game leader interaction layer
61  			GameLeaderInteractionLayer interactionLayer = new GameLeaderInteractionLayer(
62  					"game leader");
63  
64  			Logger.info(this, "<init>", "GameContext created successfully");
65  			return interactionLayer;
66  		} catch (Exception exception)
67  		{
68  			Logger.severe(this, "<init>", exception);
69  			return null;
70  		}
71  	}
72  
73  	/***
74  	 * @param args command-line arguments
75  	 */
76  	public static void main(final String[] args)
77  	{
78  		new CreateGameContext().initialize();
79  	}
80  }