diff -r d01685a7e07d -r 936ad9853a30 java/nekurak.net-lib/src/cz/frantovo/nekurak/web/HledacSluzby.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/nekurak.net-lib/src/cz/frantovo/nekurak/web/HledacSluzby.java Tue Apr 06 00:09:59 2010 +0200 @@ -0,0 +1,47 @@ +package cz.frantovo.nekurak.web; + +import cz.frantovo.nekurak.ejb.PodnikRemote; +import cz.frantovo.nekurak.ejb.UzivatelRemote; +import java.io.Serializable; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; + +/** + * + * @author fiki + */ +public class HledacSluzby implements Serializable { + + private PodnikRemote podnikEJB; + private UzivatelRemote uzivatelEJB; + private static final Logger log = Logger.getLogger(HledacSluzby.class.getSimpleName()); + + public PodnikRemote getPodnikEJB() { + if (podnikEJB == null) { + try { + Context c = new InitialContext(); + podnikEJB = (PodnikRemote) c.lookup("cz.frantovo.nekurak.ejb.PodnikRemote"); + } catch (NamingException e) { + log.log(Level.SEVERE, "Chyba při hledání PodnikRemote", e); + throw new RuntimeException(e); + } + } + return podnikEJB; + } + + public UzivatelRemote getUzivatelEJB() { + if (uzivatelEJB == null) { + try { + Context c = new InitialContext(); + uzivatelEJB = (UzivatelRemote) c.lookup("cz.frantovo.nekurak.ejb.UzivatelRemote"); + } catch (NamingException e) { + log.log(Level.SEVERE, "Chyba při hledání UzivatelRemote", e); + throw new RuntimeException(e); + } + } + return uzivatelEJB; + } +}