java/nekurak.net-web/src/java/cz/frantovo/nekurak/web/HledacSluzby.java
changeset 39 ea342cf8c15a
parent 28 0f037986bb6b
child 49 9b2a597cc862
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/java/nekurak.net-web/src/java/cz/frantovo/nekurak/web/HledacSluzby.java	Thu Feb 25 02:41:57 2010 +0100
     1.3 @@ -0,0 +1,33 @@
     1.4 +package cz.frantovo.nekurak.web;
     1.5 +
     1.6 +import cz.frantovo.nekurak.ejb.PodnikDAORemote;
     1.7 +import cz.frantovo.nekurak.ejb.PodnikRemote;
     1.8 +import java.io.Serializable;
     1.9 +import java.util.logging.Level;
    1.10 +import java.util.logging.Logger;
    1.11 +import javax.naming.Context;
    1.12 +import javax.naming.InitialContext;
    1.13 +import javax.naming.NamingException;
    1.14 +
    1.15 +/**
    1.16 + *
    1.17 + * @author fiki
    1.18 + */
    1.19 +public class HledacSluzby implements Serializable {
    1.20 +
    1.21 +    private PodnikRemote podnikEJB;
    1.22 +    private static final Logger log = Logger.getLogger(HledacSluzby.class.getSimpleName());
    1.23 +
    1.24 +    public PodnikRemote getPodnikEJB() {
    1.25 +	if (podnikEJB == null) {
    1.26 +	    try {
    1.27 +		Context c = new InitialContext();
    1.28 +		podnikEJB = (PodnikRemote) c.lookup("cz.frantovo.nekurak.ejb.PodnikRemote");
    1.29 +	    } catch (NamingException e) {
    1.30 +		log.log(Level.SEVERE, "Chyba při hledání PodnikRemote", e);
    1.31 +		throw new RuntimeException(e);
    1.32 +	    }
    1.33 +	}
    1.34 +	return podnikEJB;
    1.35 +    }
    1.36 +}