FileDocCategorySizeDatePackage
ConfigBean.javaAPI DocGlassfish v2 API40051Fri May 04 22:31:18 BST 2007com.sun.enterprise.config

ConfigBean

public abstract class ConfigBean extends ConfigBeanBase implements Serializable
ConfigBean is the root class for all objects (beans) representing Config information in server.xml
author
Sridatta Viswanath

Fields Summary
private transient com.sun.enterprise.config.pluggable.ConfigBeanInterceptor
_interceptor
is pluggable for adding additional functionality FIXME: to be initialized
private transient com.sun.enterprise.config.pluggable.ConfigBeansSettings
_cbSettings
protected transient ConfigContext
ctx
private transient Hashtable
transientProperties
private static final String
UNINITIALIZED_ATTRIBUTE_VALUE
private static final long
UNINITIALIZED_LAST_MODIFIED_VALUE
private transient long
thisLastModified
lastModifed keeps track of the timestamp when it was modified last. This is not user visible and is automatically updated and maintained. User gets a StaleWriteConfigException if timestamp is different while updating from config change List. Changes to this feature are in updateFromConfig* methods There is no meaning for lastModified in a deserialized ConfigBean. So, it is transient. However, we do copy it during the clone operation. -1 is uninitialized value.
private transient long
globalLastModified
private String
xpath
private String
publicId
private String
systemId
private transient String
_state
state of the config beans
private static final String
VALID_STATE
private static final String
INVALID_STATE
Constructors Summary
public ConfigBean(Vector comps, org.netbeans.modules.schema2beans.Version version)

            super(comps, version);
            setThisLastModified();    
            //_interceptor = getInterceptor();
            _cbSettings = getConfigBeansSettings();
    
public ConfigBean()

	super(null, new org.netbeans.modules.schema2beans.Version(4, 0, 0));
        setThisLastModified();   
        //_interceptor = getInterceptor();
        _cbSettings = getConfigBeansSettings();
    
Methods Summary
private voidaddToConfigChangeList(java.lang.String xpath, java.lang.String tag, java.lang.String oldValue, java.lang.String newValue)

        ConfigChange cChange = null;
        if(ctx != null) {
            cChange = this.ctx.addToConfigChangeList(
                                        (null != xpath ? xpath.trim() : xpath),
                                        (null != tag ?   tag.trim() :   tag),
                                        (null != oldValue ? oldValue.trim() : oldValue),
                                        (null != newValue ? newValue.trim() : newValue));
            if(cChange!=null) //can be null for "description" change
                cChange.setGlobalLastModified(getGlobalLastModified());
        }
    
public intaddValue(java.lang.String name, java.lang.Object value)

         int i=0;
         try {
            i= addValue(name, value, true);
         } catch(StaleWriteConfigException swce) {
             //dont throw it!!
         }
         return i;
     
public intaddValue(java.lang.String name, java.lang.Object value, boolean overwrite)
throws StaleWriteConfigException for the case of checking timestamps throws exception if overwrite is false and file changed externally

         if (null != name){
             name = name.trim();
         }
         
         
         if(!overwrite && this.ctx != null && this.ctx.isFileChangedExternally()) {
             throw new StaleWriteConfigException
                ("ConfigBean: cannot change since FileChangedExternally");
         }

         preAddValue(name, value);
         int i = super.addValue(name, value);
         postAddValue(name, value);
         return i;
     
private voidaddXPathToChild(java.lang.Object obj)

          if(obj!=null && obj instanceof ConfigBean)
          {
            //set XPath for child bean
            ConfigBean cb = (ConfigBean)obj;
            if(cb.xpath==null && this.xpath!=null)
               cb.setXPath(cb.getAbsoluteXPath(this.xpath));          
          }
      
private voidaddXPathToChild(java.lang.Object[] obj)

          if(obj==null)
              return;
          for(int i=0; i<obj.length; i++)
          {
              addXPathToChild(obj[i]);
          }
      
public static java.lang.Stringcamelize(java.lang.String name)
camelize will convert the lower case into upper case in the following format. Eg: user-group ==> UserGroup Convert a DTD name into a bean name: Any - or _ character is removed. The letter following - and _ is changed to be upper-case. If the user mixes upper-case and lower-case, the case is not changed. If the Word is entirely in upper-case, the word is changed to lower-case (except the characters following - and _) The first letter is always upper-case.

        if (null != name) {
            name = name.trim();
        }
          

        CharacterIterator  ci;
        StringBuffer    n = new StringBuffer();
        boolean    up = true;
        boolean    keepCase = false;
        char    c;
        
        ci = new StringCharacterIterator(name);
        c = ci.first();
        
        // If everything is uppercase, we'll lowercase the name.
        while (c != CharacterIterator.DONE)
        {
            if (Character.isLowerCase(c))
            {
                keepCase = true;
                break;
            }
            c = ci.next();
        }
        
        c = ci.first();
        while (c != CharacterIterator.DONE)
        {
            if (c == '-" || c == '_")
                up = true;
            else
            {
                if (up)
                    c = Character.toUpperCase(c);
                else
                    if (!keepCase)
                        c = Character.toLowerCase(c);
                n.append(c);
                up = false;
            }
            c = ci.next();
        }
        return n.toString();
    
public booleancanHaveSiblings()
Indicate if the receiver can have siblings (i.e. there can be more than one of this kind of child under the current parent).

return
true iff the receiver can have siblings

        return beanProp() != null && beanProp().isIndexed();
    
public voidchanged()

    
public voidcleanup()

	this.ctx = null;
    this._interceptor = null;
        setInvalidState();
    
public synchronized java.lang.Objectclone()
We must support a clone() operation in which attribute values are not expanded. In other words the clone must have all system property references kept in the form ${xxxx} without expanding xxxx. The clone operation is synchronized with getAttributeValue so that an invocation of get AttributeValue while a clone is in progress will not result in a raw attribute value. We also clone the last modified timestamp.

  
            final Object orig = preClone();
            final ConfigBean result = (ConfigBean) super.clone();
            if (this == parent()){
                result.setDoctype(this.getPublicId(), this.getSystemId());
            }
            postClone(orig, result);
            result.setGlobalLastModified(getThisLastModified());
            return result;
        
public voiddumpAttributes(java.lang.String name, int index, java.lang.StringBuffer str, java.lang.String indent)
overriding BaseBean.java to maskout user names and passwords

          if (null != name) {
              name = name.trim();
          }
          
         String[] names = this.getAttributeNames(name);

         for (int i=0; i<names.length; i++) {
             String v = null;
             //To mask out Password and UserName
             if(names[i].indexOf("Password") != -1 || names[i].indexOf("UserName") != -1) {
                 v = "*****";
             }  else {
                v = this.getAttributeValue(name, index, names[i]);
             }
             
            if (v != null) {
                str.append(indent + "\t  attr: ");      // NOI18N
                str.append(names[i]);
                str.append("=");        // NOI18N
                str.append(v);
            }
         }
       
public java.lang.StringgetAbsoluteXPath(java.lang.String parentXpath)
get absolute xpath given the parent xpath

          if(xpath!=null)
              return this.xpath.trim();
          if(parentXpath==null)
              return null;
          String rel = getRelativeXPath();
          if(rel == null) return null;
          return parentXpath.trim() + "/" + getRelativeXPath().trim();
      
public com.sun.enterprise.config.ConfigBean[]getAllChildBeans()
get All child beans

         ArrayList cbRet = new ArrayList();
         String[] childNames = getChildBeanNames();
         if(childNames == null || childNames.length == 0) return null;
         
         for(int i = 0;i<childNames.length;i++) {
             ConfigBean[] cb = getChildBeansByName(childNames[i]);
             if (cb == null) continue;
             for(int k=0;k<cb.length;k++) {
                cbRet.add(cb[k]);
             }
         }
         return toConfigBeanArray(cbRet);
     
public synchronized java.lang.StringgetAttributeValue(java.lang.String name)
All attribute values containing strings of form ${system-property} are modified such that all occurrences of ${system-property} are replaced by the corresponding value of the specifed system property. If you wish to fetch the un-mapped value you must invoke getRawAttributeValue instead.

          if (null != name) {
              name = name.trim();
          }
          
            String res = getRawAttributeValue(name);       
            return postGetAttributeValue(name, res);
        
private java.lang.StringgetAttributeValueSafe(java.lang.String name)
remove this if getattribute value is always safe

        try {
            return this.getAttributeValue(name);
        } catch(Throwable t){
           //ignore exceptions. all kind.
        }
        return null;
    
private com.sun.enterprise.config.ConfigBean[]getChildBeanByName(java.lang.String childBeanName)

         ConfigBean[] ret = null;
          try {
                ConfigBean cb = (ConfigBean) getValue(childBeanName);
                if(cb!=null)
                {
                    ret = new ConfigBean[1];
                    ret[0] = cb; 
                }
             } catch (Exception c) {}
          return ret;
     
private java.lang.String[]getChildBeanNames()
getAll child bean names

         BaseProperty[] bp = super.listProperties();
         if(bp == null) return null;
         String[] s = new String[bp.length];
         for(int i = 0;i< bp.length;i++) {
                s[i] = bp[i].getDtdName();
         }
         return s;
     
public com.sun.enterprise.config.ConfigBean[]getChildBeansByName(java.lang.String childBeanName)
to get the child element generically

         validateState();

         if(childBeanName == null) return null;
         childBeanName = childBeanName.trim();
         
         childBeanName = _cbSettings.mapElementName(childBeanName);
         
         ConfigBean[] ret = null;
         try {
             ret = (ConfigBean[]) getValues(childBeanName);
         } catch(Exception e) {
             // is a single valued element
            ret = getChildBeanByName(childBeanName);
         }
         return ret;
     
private com.sun.enterprise.config.pluggable.ConfigBeansSettingsgetConfigBeansSettings()

        return EnvironmentFactory.
                getEnvironmentFactory().
                getConfigEnvironment().
                getConfigBeansSettings();
    
public ConfigContextgetConfigContext()

        return ctx;
    
public static java.lang.StringgetDefaultAttributeValue(java.lang.String attr)
generic method to get default value from dtd. will be over ridden in beans note that it is also static which can cause some confusion

          return null;
      
public static java.lang.StringgetDefaultAttributeValueFromDtd(java.lang.String attr)
generic method to get default value from dtd. will be over ridden in beans note that it is also static which can cause some confusion

deprecated
use getDefaultAttributeValue

          if (null != attr) {
              attr = attr.trim();
          }
          
          return getDefaultAttributeValue(attr);
      
private org.w3c.dom.DocumentTypegetDoctype()

        return (graphManager().getXmlDocument() != null
                ? graphManager().getXmlDocument().getDoctype()
                : (DocumentType) null);
    
public longgetGlobalLastModified()
is package scope since it is called from configcontext FIXME: temporarily making it public for testing

        return globalLastModified;
    
public synchronized com.sun.enterprise.config.pluggable.ConfigBeanInterceptorgetInterceptor()

        if (null != _interceptor) {
            return _interceptor;
        }
        ConfigBeanInterceptor cbi = null;
        //get interceptor of ctx.
        if (null != ctx) {
            /**
             * Should have used the ConfigContext interface. Too late and
             * risky to change the interface.
             */
            cbi = ((ConfigContextImpl)ctx).getConfigBeanInterceptor();
        } else {
            //get interceptor of parent.
            ConfigBean parent = (ConfigBean)parent();
            /*
                Hack :- BaseBean.parent() returns 'this' if this is root. 
                Added the check (this != parent) to avoid recursion.
            */
            if ((null != parent) && (this != parent)) {
                cbi = parent.getInterceptor();
            }
        }
		/*
        if (null == cbi) {
            cbi = EnvironmentFactory.getEnvironmentFactory().
                getConfigEnvironment().getConfigBeanInterceptor();
        }*/
        //_interceptor = cbi;
        return cbi;
    
private java.lang.StringgetPublicId()

        if (getDoctype() != null){
            publicId = getDoctype().getPublicId();
        }
        return publicId.trim();
    
public java.lang.StringgetRawAttributeValue(java.lang.String name)

           if (null != name) {
               name = name.trim();
           }

               //FIXME: description fix later for config change event.
            if(_cbSettings.isSpecialElement(name)) {
                final String v =  (String)super.getValue(name);
                return (null != v ? v.trim() : v);
            }
            preRawGetAttributeValue(name);
            String s = super.getAttributeValue(name);
            postRawGetAttributeValue(name, s);
          return (null != s ? s.trim() : s);
       
protected java.lang.StringgetRelativeXPath()
get the xpath representation for this element returns something like abc[@name='value'] or abc depending on the type of the bean

          return null;
      
private java.lang.StringgetSystemId()

        if (getDoctype() != null){
            systemId = getDoctype().getSystemId();
        }
        return systemId.trim();
    
public longgetThisLastModified()

        return thisLastModified;
    
public java.lang.ObjectgetTransientProperty(java.lang.String name)
Get transient property value returns value for transientProperty or null if it did not have one

    
                         
       
    
        if(name==null || transientProperties==null)
            return null;
        return transientProperties.get(name);
    
public java.lang.ObjectgetValue(java.lang.String name)

          if (null != name) {
              name = name.trim();
          }
          
          Object res = super.getValue(name);
          res = postGetValue(name, res);
          return res;
      
public java.lang.ObjectgetValue(java.lang.String name, int index)

          if (null != name) {
              name = name.trim();
          }
          
         Object res = super.getValue(name, index);
         res = postGetValue(name, res);
         return res;
      
public java.lang.ObjectgetValueById(java.lang.String name, int id)

          if (null != name) {
              name = name.trim();
          }
          
         Object res = super.getValueById(name, id);
         res = postGetValue(name, res);
         return res;
      
public java.lang.Object[]getValues(java.lang.String name)

          if (null != name) {
              name = name.trim();
          }
          
         Object[] res = super.getValues(name);
         res = postGetValues(name, res);
         return res;
      
public java.lang.StringgetXPath()

        return (null != xpath ? xpath.trim() : xpath);
    
public booleanisEnabled()

        //FIXME: to be removed
          return true;
    
public booleanisMonitoringEnabled()

                //FIXME: to be removed
          return false;
    
private voidpostAddValue(java.lang.String name, java.lang.Object value)

        
        //reset the lastmodified timestamp
         setThisLastModified();
         
        //notification
         if(ctx != null) {
         if(value instanceof ConfigBean) {
             try {
                 //FIXME: clone?
                ConfigChange cChange = 
                    this.ctx.addToConfigChangeList(
                        this.xpath, 
                        ((ConfigBean)value).getAbsoluteXPath(this.xpath), 
                        name, 
                        //this clone adds a lot of overhead and was there
                        //because of a bug in schema2beans
                        //((ConfigBean)this.ctx.getRootConfigBean().clone())); 
                        ((ConfigBean)this.ctx.getRootConfigBean())); 
                if(cChange != null) cChange.setGlobalLastModified(this.getGlobalLastModified());
             } catch(Exception ce) {
                 ce.printStackTrace();
             }
            
            ((ConfigBean)value).setConfigContext(this.ctx);
            ((ConfigBean)value).setXPath(((ConfigBean)value).getAbsoluteXPath(this.xpath));
         }
            
            ConfigContextEvent ccce = new ConfigContextEvent(ctx, ConfigContextEvent.POST_ADD_CHANGE,name,value,"ADD");
            this.ctx.postChange(ccce);
            
         } else {
			 //_logger.log(Level.INFO,"config.change_not_registered");
         }
    
private voidpostClone(java.lang.Object o, java.lang.Object result)

        final ConfigBeanInterceptor cbi = getInterceptor();
        if(cbi != null) {
            cbi.postClone(o);
        }
    
private java.lang.StringpostGetAttributeValue(java.lang.String name, java.lang.String res)

        String s = (getInterceptor()==null)
                ?res:getInterceptor().postGetAttributeValue(name, res);
	return (null != s ? s.trim() : s);
    
private java.lang.ObjectpostGetValue(java.lang.String name, java.lang.Object res)

        addXPathToChild(res);
        return (getInterceptor()==null)
                ?res:getInterceptor().postGetValue(this, name, res);
    
private java.lang.Object[]postGetValues(java.lang.String name, java.lang.Object[] res)

        addXPathToChild(res);
        return (getInterceptor()==null)
                ?res:getInterceptor().postGetValues(name, res);
    
private voidpostRawGetAttributeValue(java.lang.String name, java.lang.String s)

          if(ctx !=null) { 
             ConfigContextEvent ccce = new ConfigContextEvent(ctx, ConfigContextEvent.POST_ACCESS);
             ctx.postChange(ccce);
         }
      
private voidpostRemoveValue(java.lang.String name, java.lang.Object value)

        //reset the lastmodified timestamp
          setThisLastModified();
          
          //notification
         if(value instanceof ConfigBean){
         if(ctx != null) {
            ConfigChange cChange = this.ctx.addToConfigChangeList(((ConfigBean)value).getXPath()); 
            if(cChange != null) cChange.setGlobalLastModified(this.getGlobalLastModified());
            
            // <addition> srini@sun.com server.xml verifier
            //ctx.postChange(ConfigContextEvent.POST_DELETE_CHANGE);
            ConfigContextEvent ccce = new ConfigContextEvent(ctx, ConfigContextEvent.POST_DELETE_CHANGE,name,value,"DELETE");
            ctx.postChange(ccce);
            // </addition> server.xml verifier
            
         } else {
			 //_logger.log(Level.INFO,"config.change_not_registered");
         }
         }
    
private voidpostSetArrayValue(java.lang.String name, java.lang.Object[] value)

      
          //reset the lastmodified timestamp
          setThisLastModified();
          if(ctx != null) {
              ConfigChange cChange = 
                this.ctx.addToConfigChangeList(this.xpath, name, null, value);
              if(cChange != null) {
                    cChange.setGlobalLastModified(this.getGlobalLastModified());
              }
              
              ConfigContextEvent ccce = 
                new ConfigContextEvent(ctx, 
                                    ConfigContextEvent.POST_SET_CHANGE,
                                    name,
                                    value,
                                    "SET");
             //ccce.setClassObject(this); //why FIXME??
             ccce.setBeanName(this.name());
             try {
                ctx.postChange(ccce);           
             } catch(Exception e) {
                 //catch for now. may remove later.
                 //e.printStackTrace(); //FIXME
             }
          } else          {
			  //_logger.log(Level.INFO,"config.change_not_registered");
          }
      
private voidpostSetAttributeValue(java.lang.String name, java.lang.String value, java.lang.String oldValue)

        //reset the lastmodified timestamp
            setThisLastModified();
            
            ConfigChange cChange = null;
            
          if(ctx != null) {
                cChange = this.ctx.addToConfigChangeList(this.xpath, name, oldValue, value); 
                if(cChange != null) cChange.setGlobalLastModified(this.getGlobalLastModified());
                
                // <addition> srini@sun.com server.xml verifier
                //this.ctx.postChange(ConfigContextEvent.POST_UPDATE_CHANGE);
                ConfigContextEvent ccce = new ConfigContextEvent(ctx, ConfigContextEvent.POST_UPDATE_CHANGE,name,value,"UPDATE");
                this.ctx.postChange(ccce);
                // </addition> server.xml verifier  
            }
    
private voidpostSetAttributeValueSpecial(java.lang.String name, java.lang.String value, java.lang.String oldValue)

        //reset the lastmodified timestamp
        setThisLastModified();
             
        addToConfigChangeList(this.xpath,
                                     name,
                                     oldValue,
                                     value);   
    
private voidpostSetValue(java.lang.String name, java.lang.Object value)

         //reset the lastmodified timestamp
         setThisLastModified();
         
         if(ctx != null) {
            // this.ctx.addToConfigChangeList(this.xpath, name, value, null); 
            //FIXME: remove later
            if(value instanceof ConfigBean) {
                //FIXME: clone?
                ConfigChange cChange = this.ctx.addToConfigChangeList(this.xpath, name, ((ConfigBean)value).clone(), null); 
                if(cChange != null) cChange.setGlobalLastModified(this.getGlobalLastModified());
                
                ((ConfigBean)value).setConfigContext(this.ctx); //incase of description
                ((ConfigBean)value).setXPath(((ConfigBean)value).getAbsoluteXPath(this.xpath));
                // <addition> srini@sun.com
                //ctx.postChange(ConfigContextEvent.POST_SET_CHANGE);
                ConfigContextEvent ccce = new ConfigContextEvent(ctx,ConfigContextEvent.POST_SET_CHANGE,name,value,"SET");
                ctx.postChange(ccce);
                // </addition> server.xml verifier
                
            } else {
                ConfigChange cChange = this.ctx.addToConfigChangeList(this.xpath, name, value, null); 
                if(cChange != null) cChange.setGlobalLastModified(this.getGlobalLastModified());
            }
         } else {
			 //_logger.log(Level.INFO,"config.change_not_registered");
         }
    
private voidpreAddValue(java.lang.String name, java.lang.Object value)

        preConfigChange(name, value, ConfigContextEvent.PRE_ADD_CHANGE, "ADD");
    
private java.lang.ObjectpreClone()

        if(getInterceptor() != null)
            return getInterceptor().preClone();
        return null;
    
private voidpreConfigChange(java.lang.String name, java.lang.Object value, java.lang.String type, java.lang.String operation)

        preConfigChange(name, value, type,operation, null);
    
private voidpreConfigChange(java.lang.String name, java.lang.Object value, java.lang.String type, java.lang.String operation, java.lang.String beanName)

        validateState();
        
        if(ctx !=null) {
             ConfigContextEvent ccce = new ConfigContextEvent(ctx, type,name,value,operation, beanName);
             ccce.setClassObject(this);
             ctx.preChange(ccce);           
         }
    
private voidpreRawGetAttributeValue(java.lang.String name)

          validateState();
          
          if(ctx !=null) {
             ConfigContextEvent ccce = new ConfigContextEvent(ctx, ConfigContextEvent.PRE_ACCESS);
             ccce.setClassObject(this);
             ctx.preChange(ccce);
         }
      
private voidpreRemoveValue(java.lang.String name, java.lang.Object value)

         preConfigChange(name, value, ConfigContextEvent.PRE_DELETE_CHANGE, "DELETE");
    
private voidpreSetArrayValue(java.lang.String name, java.lang.Object[] value)

          validateState();
          
           if(ctx !=null) {
             ConfigContextEvent ccce = 
                new ConfigContextEvent(ctx, 
                                    ConfigContextEvent.PRE_SET_CHANGE,
                                    name,
                                    value,
                                    "SET");
             ccce.setClassObject(this);
             ccce.setBeanName(this.name());
             ctx.preChange(ccce);           
         }
      
private java.lang.StringpreSetAttributeValue(java.lang.String name, java.lang.String value)

        preConfigChange(name, value, ConfigContextEvent.PRE_UPDATE_CHANGE, "UPDATE",
                        (null != this.name() ? this.name().trim() : this.name()));
        
        return this.getAttributeValueSafe(name);
    
private java.lang.StringpreSetAttributeValueSpecial(java.lang.String name)

        return getAttributeValueSafe(name);
    
private voidpreSetValue(java.lang.String name, java.lang.Object value)

          preConfigChange(name, value, ConfigContextEvent.PRE_SET_CHANGE, "SET");
     
public intremoveChild(com.sun.enterprise.config.ConfigBean child)

         //FIXME: remove???
         return removeChild(child, true);
     
public intremoveChild(com.sun.enterprise.config.ConfigBean child, boolean overwrite)
generically remove child returns the index of removed child

         //FIXME: to be removed??
         if(!overwrite && this.ctx != null && this.ctx.isFileChangedExternally()) {
             throw new StaleWriteConfigException
                ("ConfigBean: cannot change since FileChangedExternally");
         }
         
         if(child == null)
             throw new ConfigException("Cannot remove null child");
         
         return this.removeValue(child.name(), child);
     
public intremoveValue(java.lang.String name, java.lang.Object value)

         if (null != name){
             name = name.trim();
         }
         
         int i=0;
         try {
            i= removeValue(name, value, true);
         } catch (StaleWriteConfigException swce) {
             //dont throw it!!
         }
         return i;
     
public intremoveValue(java.lang.String name, java.lang.Object value, boolean overwrite)

          if (null != name) {
              name = name.trim();
          }
          
         if(!overwrite && this.ctx != null && this.ctx.isFileChangedExternally()) {
             throw new StaleWriteConfigException
                ("ConfigBean: cannot change since FileChangedExternally");
         }
         
         preRemoveValue(name, value);
         int i = super.removeValue(name, value);
         postRemoveValue(name, value);
         return i;
      
public voidsetAttributeValue(java.lang.String name, java.lang.String value)

        try {
            setAttributeValue(name, value, true);
        } catch(StaleWriteConfigException swce) {
            String url = (this.ctx==null)?" ":ctx.getUrl();
            LoggerHelper.finest("Detected external changes to config file \"" +
                        url +
                        "\". Ignoring the condition and proceeding");
        }
    
public voidsetAttributeValue(java.lang.String name, java.lang.String value, boolean overwrite)

deprecated.
will be made private soon.

         final String nm = (null != name ? name.trim() : name);
         final String vl = (null != value ? value.trim() : value);
         
             //FIXME: make this private.

             // Do nothing if the value hasn't actually changed
         if (getAttributeValueSafe(nm) != null && getAttributeValueSafe(nm).equals(vl)){
             return;
         }
         
             
         if(!overwrite && this.ctx != null && this.ctx.isFileChangedExternally()) {
             throw new StaleWriteConfigException
                ("ConfigBean: cannot change since FileChangedExternally");
         }         
         
         String oldValue = UNINITIALIZED_ATTRIBUTE_VALUE;
         //special case for description
         if(_cbSettings.isSpecialElement(nm)) {
             oldValue = preSetAttributeValueSpecial(nm);
             super.setValue(nm, vl);
             postSetAttributeValueSpecial(nm, vl, oldValue);
         } else {
            oldValue = preSetAttributeValue(nm, vl);
            super.setAttributeValue(nm, vl);
            postSetAttributeValue(nm, vl, oldValue);
         }
     
public voidsetConfigContext(ConfigContext ctx)

 
        //FIXME make it package specific
        this.ctx = ctx;
    
private voidsetDoctype(java.lang.String pid, java.lang.String sid)

        publicId = (null != pid ? pid.trim() : pid);
        systemId = (null != sid ? sid.trim() : sid);
        if (graphManager() != null){
            graphManager().setDoctype(pid,sid);
        }
    
public voidsetEnabled(boolean enabled)

                //FIXME: to be removed
      //do nothing
    
private voidsetGlobalLastModified(long timestamp)
should be called ONLY from clone sets the lastmodified to timestamp

        globalLastModified = timestamp;
    
public synchronized voidsetInterceptor(com.sun.enterprise.config.pluggable.ConfigBeanInterceptor cbi)

        this._interceptor = cbi;
    
private voidsetInvalidState()

          _state = INVALID_STATE;
      
private voidsetThisLastModified()
should be called from the constructor and all the changeable methods Sets the lastModified to current time.

        thisLastModified = System.currentTimeMillis();
    
public java.lang.ObjectsetTransientProperty(java.lang.String name, java.lang.Object value)
Set value for named transientProperty if value==null then the property will be removed returns the previous value of the specified key, or null if it did not have one

        if(name==null)
            return null;
        if(value==null)
        {
            if(transientProperties==null)
                return null;
            value =  transientProperties.get(name);
            if(value!=null)
                transientProperties.remove(name);
            return value;
        }
        if(transientProperties==null)
            transientProperties=new Hashtable();
        return transientProperties.put(name, value);
    
public voidsetValue(java.lang.String name, java.lang.Object value)

          if (null != name) {
              name = name.trim();
          }
          
          try {
            setValue(name, value, true);
          } catch(StaleWriteConfigException swce) {
                // dont throw it!!
          }
      
public voidsetValue(java.lang.String name, java.lang.Object value, boolean overwrite)

          if (null != name) {
              name = name.trim();
          }
          
         
         if(!overwrite && this.ctx != null && this.ctx.isFileChangedExternally()) {
             throw new StaleWriteConfigException
                ("ConfigBean: cannot change since FileChangedExternally");
         }
         Object oldValue = super.getValue(name);
             
         preSetValue(name, value);
         super.setValue(name, value);
         if(oldValue!=null && oldValue!=value && oldValue instanceof ConfigBean)
            postRemoveValue(name, oldValue);
         postSetValue(name, value);
      
public voidsetValue(java.lang.String name, java.lang.Object[] value)

          if (null != name) {
              name = name.trim();
          }
          
         preSetArrayValue(name, value);
         super.setValue(name, value);
         postSetArrayValue(name, value);
         
         
          
      
public voidsetXPath(java.lang.String xpath)

        this.xpath = (null != xpath ? xpath.trim() : xpath);
    
public static booleantoBoolean(java.lang.String value)
This method is used to convert a string value to boolean.

return
true if the value is one of true, on, yes, 1. Note that the values are case sensitive. If it is not one of these values, then, it returns false. A finest message is printed if the value is null or a info message if the values are wrong cases for valid true values.

        final String v = (null != value ? value.trim() : value);
        return null != v && (v.equals("true")
                             || v.equals("yes")
                             || v.equals("on") 
                             || v.equals("1"));
    
private com.sun.enterprise.config.ConfigBean[]toConfigBeanArray(java.util.ArrayList cbRet)

          ConfigBean[] ret = new ConfigBean[cbRet.size()];
                for(int j=0;j<cbRet.size();j++) {
                    ret[j] = (ConfigBean) cbRet.get(j);
                }
         return ret;
     
private voidvalidateState()
is used to validate state before any operation to the config bean. If the state is not valid, a runtime exception will be thrown

      
                                     
         
          if(!VALID_STATE.equals(_state)) {
              throw new ConfigRuntimeException("Config API Usage Error: State of ConfigBean is INVALID. No operations are permitted");
          }