/* Generated by Together */

package cobalt.deployment.descriptor.dist;

import java.util.ArrayList;
import cobalt.deployment.descriptor.EntityEjbDescriptor;

/**
 * Title:        WebLogic 6.x entity ejb component descriptor
 * Description:  Represents WebLogic 6.x-specific entity ejb component for standard entity ejb component
 * Copyright:    Copyright (c) 2001
 * Company:      ETRI
 * @author Yeon Jun Choi
 * @version 1.0
 */

public class Weblogic60EntityEjbDescriptor extends Weblogic60EjbDescriptor {
    public Weblogic60EntityEjbDescriptor(EntityEjbDescriptor descriptor) {
        super(descriptor);
        if ( descriptor.isCmp() ) {
		    setPersistentTypeId("WebLogic_CMP_RDBMS");
		    setPersistentTypeVersion("5.1.0");
		    setPersistentTypeStorage("META-INF/weblogic-cmp-rdbms-jar.xml");
		    setPersistenceUseTypeId("WebLogic_CMP_RDBMS");
		    setPersistenceUseTypeVersion("5.1.0");
            dbms = new Weblogic60DbmsBeanDescriptor();
	        dbms.setEjbName(descriptor.getEjbName());
            dbms.initFinders(descriptor.getMethodDescriptorIterator());
            String fieldname;
	        /*
            Enumeration enum = descriptor.getFields().getFieldNames();
	        while (enum.hasMoreElements()) {
                fieldname = (String)enum.nextElement();
	            dbms.putField(fieldname, fieldname);
	        }
            */
            ArrayList fields = descriptor.getFields().getFieldNames();
            for ( int i=0 ; i<fields.size() ; i++ ) {
                fieldname = (String)fields.get(i);
                dbms.putField(fieldname, fieldname);
            }
        }
    }

    public int getMaxBeansInFreePool(){
        return getInt("max-beans-in-free-pool", 32768);
    }

    public void setMaxBeansInFreePool(int maxBeansInFreePool){
        setInt("max-beans-in-free-pool", maxBeansInFreePool);
    }

    public String getMaxBeansInFreePoolValue(){
        return getString("max-beans-in-free-pool");
    }

    public int getInitialBeansInFreePool(){
        return getInt("initial-beans-in-free-pool", 0);
    }

    public void setInitialBeansInFreePool(int initialBeansInFreePool){
        setInt("initial-beans-in-free-pool", initialBeansInFreePool);
    }

    public String getInitialBeansInFreePoolValue(){
        return getString("initial-beans-in-free-pool");
    }

    public int getMaxBeansInCache(){
            return getInt("max-beans-in-cache", 100);
        }

    public String getMaxBeansInCacheString(){
            return getString("max-beans-in-cache");
        }

    public void setMaxBeansInCache(int maxBeansInCache){
            setInt("max-beans-in-cache", maxBeansInCache);
        }

    public int getIdleTimeoutSec(){
            return getInt("idle-timeout-seconds", 600);
        }

    public String getIdleTimeoutSecString(){
            return getString("idle-timeout-seconds");
        }

    public void setIdleTimeoutSec(int idleTimeoutSec){
            setInt("idle-timeout-seconds", idleTimeoutSec);
        }

    public int getReadTimeoutSec(){
            return getInt("read-timeout-seconds", 600);
        }

    public String getReadTimeoutSecString(){
            return getString("read-timeout-seconds");
        }

    public void setReadTimeoutSec(int readTimeoutSec){
            setInt("read-timeout-seconds", readTimeoutSec);
        }

    public String getConcurrencyStrategy(){
            return getString("concurrency-strategy");
        }

    public void setConcurrencyStrategy(String concurrencyStrategy){
            setString("concurrency-strategy", concurrencyStrategy);
        }

    public String getPassivStrategy(){
            return getString("passivate-strategy");
        }

    public void setPassivStrategy(String passivStrategy){
            setString("passivate-strategy", passivStrategy);
        }

    public String getIsModifiedMethod(){
            return getString("is-modified-method-name");
        }

    public void setIsModifiedMethod(String isModifiedMethod){
            setString("is-modified-method-name", isModifiedMethod);
        }

    public boolean isDelayUpdatesEndTx(){
            return getBoolean("delay-updates-until-end-of-tx", true);
        }

    public String isDelayUpdatesEndTxString(){
            return getString("delay-updates-until-end-of-tx");
        }

    public void setDelayUpdatesEndTx(boolean delayUpdatesEndTx){
            setBoolean("delay-updates-until-end-of-tx", delayUpdatesEndTx);
        }

    public boolean isFindersLoadBean(){
            return getBoolean("finders-load-bean", true);
        }

    public String isFindersLoadBeanString(){
            return getString("finders-load-bean");
        }

    public void setFindersLoadBean(boolean findersLoadBean){
            setBoolean("finders-load-bean", findersLoadBean);
        }

    public String getPersistentTypeId(){
            return getString("persistence-type-id");
        }

    public void setPersistentTypeId(String persistentTypeId){
            setString("persistence-type-id", persistentTypeId);
        }

    public String getPersistentTypeVersion(){
            return getString("persistence-type-version");
        }

    public void setPersistentTypeVersion(String persistentTypeVersion){
            setString("persistence-type-version", persistentTypeVersion);
        }

    public String getPersistentTypeStorage(){
            return getString("persistence-type-storage");
        }

    public void setPersistentTypeStorage(String persistentTypeStorage){
            setString("persistence-type-storage", persistentTypeStorage);
        }

    public boolean isDbShared(){
            return getBoolean("db-is-shared", true);
        }

    public String isDbSharedString(){
            return getString("db-is-shared");
        }

    public void setDbShared(boolean dbShared){
            setBoolean("db-is-shared", dbShared);
        }

    public String getPersistenceUseTypeId(){
            return getString("persistence-use-type-id");
        }

    public void setPersistenceUseTypeId(String persistenceUseTypeId){
            setString("persistence-use-type-id", persistenceUseTypeId);
        }

    public String getPersistenceUseTypeVersion(){
            return getString("persistence-use-type-version");
        }

    public void setPersistenceUseTypeVersion(String persistenceUseTypeVersion){
            setString("persistence-use-type-version", persistenceUseTypeVersion);
        }

    public Weblogic60DbmsBeanDescriptor getDbms(){ return dbms; }

    public void setDbms(Weblogic60DbmsBeanDescriptor dbms){ this.dbms = dbms; }

    public static final String[] CONCURRENCY_STRATEGY = {
        "Database", "Exclusive", "ReadOnly"
    };
    private Weblogic60DbmsBeanDescriptor dbms;

/*
    private int maxBeansInCache;
    private int idleTimeoutSec;
    private int readTimeoutSec;
    private String concurrencyStrategy;
    private String passivStrategy;
    private String isModifiedMethod;
    private boolean delayUpdatesEndTx;
    private boolean findersLoadBean;
    private String persistentTypeId = "WebLogic_CMP_RDBMS";
    private String persistentTypeVersion = "6.1.0";
    private String persistentTypeStorage = "weblogic-cmp-rdbms-jar.xml";//META-INF/web...
    private boolean dbShared;
    private String persistenceUseTypeId = "WebLogic_CMP_RDBMS";
    private String persistenceUseTypeVersion = "6.1.0";
*/
}
