/* JFox, the OpenSource J2EE Application Server
 *
 * Distributable under GNU LGPL license by gun.org
 * more details please visit http://www.huihoo.org/jfox
 */
package org.jfox.ejb.meta;

/**
 * the base class for all ejb description and ejb-ref description
 *
 * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
 */

public abstract class EJBDescriptorBase extends Descriptor {
    public static final String SESSION_BEAN = "Session";
    public static final String ENTITY_BEAN = "Entity";
    private String ejbName;
    protected String homeClassName;
    protected String jndiName;
    private String remoteClassName;

    protected EJBDescriptorBase() {

    }

    public String getEjbName() {
        return ejbName;
    }

    public String getHomeClassName() {
        return homeClassName;
    }

    /**
     * if jndiName is not set, may not implements EJBMeta
     *
     * @return
     */
    public String getJndiName() {
        if(jndiName == null)
            jndiName = "ejb/" + ejbName;
        return jndiName;
    }

    public String getRemoteClassName() {
        return remoteClassName;
    }

    public abstract String getType();

    public boolean isSession() {
        return "Session".equals(getType());
    }

    public void setEjbName(String s) {
        ejbName = s;
    }

    public void setHomeClassName(String s) {
        homeClassName = s;
    }

    public void setJndiName(String s) {
        jndiName = s;
    }

    public void setRemoteClassName(String s) {
        remoteClassName = s;
    }

    public static void main(String[] args) {

    }
}

