FileDocCategorySizeDatePackage
IasConnectorOneZero.javaAPI DocGlassfish v2 API9621Fri May 04 22:34:38 BST 2007com.sun.enterprise.tools.common.beans

IasConnectorOneZero

public class IasConnectorOneZero extends BasicIasBean
author
vkraemer
version

Fields Summary
private static final String
PROPNAME_MAXPOOLSIZE
private static final String
PROPNAME_STEADYPOOLSIZE
private static final String
PROPNAME_MAXWAITTIMEINMILLIS
private static final String
PROPNAME_IDLETIMEOUTINSECONDS
private static final String
PROPNAME_JNDINAME
private static final String
PROPNAME_DESCRIPTION
protected SunConnector
fileBean
protected ResourceAdapter
ra
protected com.sun.enterprise.tools.common.properties.RoleMapElement
roleMap
protected com.sun.enterprise.tools.common.properties.PropertyElements
propertyElements
public static final String
DEFAULT_MAP_ID
Constructors Summary
protected IasConnectorOneZero()

  //any number will do since there is only one role-map
    
    //private static ResourceBundle bundle =
        //ResourceBundle.getBundle("com.sun.enterprise.tools.common.beans.Bundle"); //NOI18N

      
        initListeners();
    
public IasConnectorOneZero(InputStream is)

        try {
            fileBean = SunConnector.createGraph(is);
        }
        catch (Throwable t) {
            // If there is ANY problem with the file on the input stream,
            // we will create a new EMPTY bean.
            fileBean = SunConnector.createGraph();
            ra = new ResourceAdapter();
            ra.setAttributeValue("jndi-name","default"); //NOI18N
            fileBean.setResourceAdapter(ra);
        }
        ra = fileBean.getResourceAdapter();
        RoleMap rm = fileBean.getRoleMap();
        if (null == rm) {
            rm = new RoleMap();
            rm.setAttributeValue("map-id", DEFAULT_MAP_ID);
            // if setRoleMap was called, this is the strategy I would use to allow the user
            // to edit values when the original SunConnector doesn't have a role-map
            // sub-element.
            // BUT, setRoleMap is not called....
            //
            //SunConnector tmp = SunConnector.createGraph();
            //tmp.setRoleMap(rm);
            fileBean.setRoleMap(rm);
        }
        roleMap = new RoleMapElement(rm);
        propertyElements = new PropertyElements(ra);
        initListeners();
    
Methods Summary
public java.lang.StringgetDescription()

        return ra.getDescription();
    
public intgetIdleTimeoutInSeconds()

        return Integer.parseInt(ra.getAttributeValue("idle-timeout-in-seconds")); //NOI18N
    
public java.lang.StringgetJndiName()

        return ra.getAttributeValue("jndi-name"); //NOI18N
    
public intgetMaxPoolSize()

        return Integer.parseInt(ra.getAttributeValue("max-pool-size")); //NOI18N
    
public intgetMaxWaitTimeInMillis()

        return Integer.parseInt(ra.getAttributeValue("max-wait-time-in-millis")); //NOI18N
    
public com.sun.enterprise.tools.common.properties.PropertyElementsgetPropertyElements()

        //System.out.println("in get property elements: " + propertyElements.hashCode()); //NOI18N
        return propertyElements;
    
public com.sun.enterprise.tools.common.properties.RoleMapElementgetRoleMap()

        return roleMap;
    
public intgetSteadyPoolSize()

        return Integer.parseInt(ra.getAttributeValue("steady-pool-size")); //NOI18N
    
public SunConnectorgetSunConnector()

       return fileBean;
   
private voidinitListeners()

        getVCS().addVetoableChangeListener(PROPNAME_MAXPOOLSIZE, greaterThanNegOne);
        getVCS().addVetoableChangeListener(PROPNAME_STEADYPOOLSIZE, greaterThanNegOne);
        getVCS().addVetoableChangeListener(PROPNAME_MAXWAITTIMEINMILLIS, greaterThanNegOne);
        getVCS().addVetoableChangeListener(PROPNAME_IDLETIMEOUTINSECONDS, greaterThanNegOne);
        getVCS().addVetoableChangeListener(PROPNAME_JNDINAME, notNull);
    
public static voidmain(java.lang.String[] args)

       try {
       IasConnectorOneZero bean = new IasConnectorOneZero(null);
       bean.outTo(System.out); //NOI18N
       bean.setDescription("test setDescription"); // NOI18N
       bean.setIdleTimeoutInSeconds(1);
       bean.setJndiName("testSetJndiName"); // NOI18N
       bean.setMaxPoolSize(2);
       bean.setMaxWaitTimeInMillis(-3);
       bean.setSteadyPoolSize(4);
       bean.outTo(System.out); //NOI18N
       }
       catch (Throwable t) {
           t.printStackTrace();
       }
   
public voidoutTo(java.io.OutputStream os)

       
       fileBean.write(os);
   
public voidsetDescription(java.lang.String newDesc)

         String elementName = "description"; // NOI18N
         String propName = PROPNAME_DESCRIPTION;
         doElementSetProcessing(ra, newDesc, elementName, propName);
    
public voidsetIdleTimeoutInSeconds(int newVal)

        String attrName = "idle-timeout-in-seconds"; // NOI18N
        String propName = PROPNAME_IDLETIMEOUTINSECONDS;
        doAttrSetProcessing(ra, newVal,attrName, propName);
    
public voidsetJndiName(java.lang.String newName)

         String attrName = "jndi-name"; // NOI18N
         String propName = PROPNAME_JNDINAME;
         doAttrSetProcessing(ra, newName, attrName, propName);
     
public voidsetMaxPoolSize(int newVal)

        String attrName = "max-pool-size"; // NOI18N
        String propName = PROPNAME_MAXPOOLSIZE;
        doAttrSetProcessing(ra, newVal,attrName, propName);
    
public voidsetMaxWaitTimeInMillis(int newVal)

        String attrName = "max-wait-time-in-millis"; // NOI18N
        String propName = PROPNAME_MAXWAITTIMEINMILLIS;
        doAttrSetProcessing(ra, newVal,attrName, propName);
    
public voidsetPropertyElements(com.sun.enterprise.tools.common.properties.PropertyElements newVal)

        // why doesn't this get called
        //
        //System.out.println("in set property elements: " + newVal); //NOI18N
        PropertyElements oldVal = propertyElements;
        fireMyVetoableChange("propertyElements", oldVal, newVal); // NOI18N
        propertyElements = newVal;
        ra = newVal.getResourceAdapter();
        fileBean.setResourceAdapter(ra);
        fireMyPropertyChange("propertyElements", oldVal, newVal); // NOI18N
    
public voidsetRoleMap(com.sun.enterprise.tools.common.properties.RoleMapElement newVal)

        // why doesn't this get called
        //
        RoleMapElement oldVal = roleMap;
        fireMyVetoableChange("roleMap", oldVal, newVal); // NOI18N
        roleMap = newVal;
        fileBean.setRoleMap(newVal.getRoleMap());
        fireMyPropertyChange("roleMap", oldVal, newVal); // NOI18N
    
public voidsetSteadyPoolSize(int newVal)

        String attrName = "steady-pool-size"; // NOI18N
        String propName = PROPNAME_STEADYPOOLSIZE;
        doAttrSetProcessing(ra, newVal,attrName, propName);