/* 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.jms;

import org.jfox.framework.extra.ActiveComponent;
import org.jfox.framework.extra.Managable;
import org.jfox.framework.extra.ManagementInfo;
import org.jfox.jndi.InitialContextHelper;
import org.jfox.system.AbstractService;

/**
 * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
 */

public class JMSConnectionFactoryService extends AbstractService implements ActiveComponent, Managable {
    private String jndiName = "jms/defualtcf";

    public String getJndiName() {
        return jndiName;
    }

    public void setJndiName(String jndiName) {
        this.jndiName = jndiName;
    }

    protected void doInit() throws Exception {
    }

    protected void doStart() throws Exception {
        InitialContextHelper.getInitialContext().rebind(jndiName, new JMSConnectionFactory());
    }

    protected void doStop() throws Exception {
        InitialContextHelper.getInitialContext().unbind(jndiName);
    }

    protected void doDestroy() throws Exception {
    }

    public void run() {
    }

    public ManagementInfo getManagementInfo() {
        return ManagementInfo.exposePublic(this.getClass());
    }

    public static void main(String[] args) {

    }
}
