/*
 * JOnAS: Java(TM) Open Application Server
 * Copyright (C) 1999 Bull S.A.
 * Contact: jonas-team@objectweb.org
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * Initial developer(s): Adriana Danes
 * Contributor(s): 
 *
 * --------------------------------------------------------------------------
 * $Id$
 * --------------------------------------------------------------------------
 */

package org.objectweb.jonas.container;

import org.objectweb.jonas_ejb.container.JEntityFactory;

/**
 * MBean Class for Entity EJB Management 
 * MBean type: Standard
 * MBean model: Delegate (JEntityFactory)
 */
public class JmxEntityFactory extends JmxBeanFactory implements JmxEntityFactoryMBean {

    /**
     * Constructor
     * @param JEntityFactory factory to manage
     */
    public JmxEntityFactory(JEntityFactory factoryToManage) {
	super(factoryToManage);
    }

    /**
     * passivation time out
     */
    public Long getPassivationTimeOut(){
	return new Long(ejbToManage.getContainer().getSwapTime());
    }
    public void setPassivationTimeOut(Long timeOut) {
	ejbToManage.getContainer().setSwapTime(timeOut.intValue());
    }

    /**
     * shared
     */
    public Boolean getShared() {
	return new Boolean (((JEntityFactory)ejbToManage).isShared());
    }

    /**
     * min-pool-size
     */
    public Integer getMinPoolSize() {
	return new Integer(((JEntityFactory)ejbToManage).getMinPoolSize());
    }

    /**
     * max-cache-size
     */
    public Integer getMaxCacheSize() {
	return new Integer(((JEntityFactory)ejbToManage).getMaxCacheSize());
    }

    /**
     * pool-size
     */
    public Integer getPoolSize() {
	return new Integer(((JEntityFactory)ejbToManage).getPoolSize());
    }

    /**
     * Cache Size
     */
    public Integer getCacheSize() {
	return new Integer(((JEntityFactory)ejbToManage).getCacheSize());
    }

    /**
     * Instance Counters
     */
    /*
    public Integer[] getEntityCounters() {
	EntityCounters ec = ((JEntityFactory) ejbToManage).getEntityCounters();
	Integer[] result = new Integer[4];
	result[0] = new Integer(ec.inTx);
	result[1] = new Integer(ec.outTx);
	result[2] = new Integer(ec.idle);
	result[3] = new Integer(ec.passive);
	return result;
    }    
    */
}
