java/nekurak.net-lib/src/cz/frantovo/nekurak/web/HledacSluzby.java
changeset 149 8238cdb4113a
parent 145 0efefbf5f8b6
child 188 74d06a8a4948
     1.1 --- a/java/nekurak.net-lib/src/cz/frantovo/nekurak/web/HledacSluzby.java	Sun Jun 27 22:00:48 2010 +0200
     1.2 +++ b/java/nekurak.net-lib/src/cz/frantovo/nekurak/web/HledacSluzby.java	Wed Jun 30 00:26:14 2010 +0200
     1.3 @@ -1,5 +1,6 @@
     1.4  package cz.frantovo.nekurak.web;
     1.5  
     1.6 +import cz.frantovo.nekurak.ejb.ChatRemote;
     1.7  import cz.frantovo.nekurak.ejb.ClanekRemote;
     1.8  import cz.frantovo.nekurak.ejb.PodnikRemote;
     1.9  import cz.frantovo.nekurak.ejb.UzivatelRemote;
    1.10 @@ -19,6 +20,7 @@
    1.11  	private PodnikRemote podnikEJB;
    1.12  	private UzivatelRemote uzivatelEJB;
    1.13  	private ClanekRemote clanekEJB;
    1.14 +	private ChatRemote chatEJB;
    1.15  	private static final Logger log = Logger.getLogger(HledacSluzby.class.getSimpleName());
    1.16  
    1.17  	public PodnikRemote getPodnikEJB() {
    1.18 @@ -59,4 +61,17 @@
    1.19  		}
    1.20  		return clanekEJB;
    1.21  	}
    1.22 +
    1.23 +	public ChatRemote getChatEJB() {
    1.24 +		if (chatEJB == null) {
    1.25 +			try {
    1.26 +				Context c = new InitialContext();
    1.27 +				chatEJB = (ChatRemote) c.lookup("cz.frantovo.nekurak.ejb.ChatRemote");
    1.28 +			} catch (NamingException e) {
    1.29 +				log.log(Level.SEVERE, "Chyba při hledání ChatRemote", e);
    1.30 +				throw new RuntimeException(e);
    1.31 +			}
    1.32 +		}
    1.33 +		return chatEJB;
    1.34 +	}
    1.35  }