FileDocCategorySizeDatePackage
RuntimeDescriptor.javaAPI DocGlassfish v2 API7261Thu May 17 12:58:34 BST 2007com.sun.enterprise.deployment.runtime

RuntimeDescriptor

public abstract class RuntimeDescriptor extends com.sun.enterprise.deployment.Descriptor
This base class defines common behaviour and data for all runtime descriptors.
author
Jerome Dochez

Fields Summary
protected PropertyChangeSupport
propListeners
Constructors Summary
public RuntimeDescriptor(RuntimeDescriptor other)
Creates a new instance of RuntimeDescriptor

	super(other);
	propListeners = new PropertyChangeSupport(this); // not copied  
    
public RuntimeDescriptor()
Creates a new instance of RuntimeDescriptor

	propListeners = new PropertyChangeSupport(this);    
    
Methods Summary
public voidaddPropertyChangeListener(java.beans.PropertyChangeListener l)
Add a property listener for this bean

param
the property listener

        propListeners.addPropertyChangeListener(l);
    
public voidaddPropertyChangeListener(java.lang.String n, java.beans.PropertyChangeListener l)
Add a property listener for a specific property name

param
the property name
param
the property listener

        propListeners.addPropertyChangeListener(n, l);
    
protected intaddValue(java.lang.String name, java.lang.Object value)

	List list = getIndexedProperty(name);
	list.add(value);
	setValue(name, list);
	return list.indexOf(value);
    
public java.lang.StringgetAttributeValue(java.lang.String elementName, java.lang.String attributeName)

	return getAttributeValue(elementName,0, attributeName);
    
public java.lang.StringgetAttributeValue(java.lang.String attributeName)

	return (String) getValue(attributeName);
    
public java.lang.StringgetAttributeValue(java.lang.String elementName, int index, java.lang.String attributeName)

	return (String) getValue(elementName + "-" + index + "-" + attributeName);
    
private java.util.ListgetIndexedProperty(java.lang.String name)

	Object o = getValue(name);
	if (o==null) {
	    return new ArrayList();
	} else {
	    return (List) o;
	}
    
protected java.lang.ObjectgetValue(java.lang.String name, int index)

	List list = getIndexedProperty(name);
	return list.get(index);	
    
public java.lang.ObjectgetValue(java.lang.String name)

return
a property value

 
        return getExtraAttribute(name);
    
protected java.lang.Object[]getValues(java.lang.String name)

	List list = (List) getValue(name);
	if (list!=null && list.size()>0) {
	    Class c = list.get(0).getClass();
	    Object array = java.lang.reflect.Array.newInstance(c, list.size());
	    return list.toArray((Object[]) array);
	}
	else 
	    return null;
    
public voidremovePropertyChangeListener(java.beans.PropertyChangeListener l)
removes a property listener for this bean

param
the property listener to remove

        propListeners.removePropertyChangeListener(l);
    
public voidremovePropertyChangeListener(java.lang.String n, java.beans.PropertyChangeListener l)
Remover a property listener for specific property name

param
the property name
param
the property listener

        propListeners.removePropertyChangeListener(n, l);
    
protected intremoveValue(java.lang.String name, java.lang.Object value)

	List list = getIndexedProperty(name);
	int index = list.indexOf(value);
	list.remove(index);
	return index;
    
protected voidremoveValue(java.lang.String name, int index)

	List list = getIndexedProperty(name);
	list.remove(index);
    
public voidsetAttributeValue(java.lang.String elementName, java.lang.String attributeName, java.lang.Object value)

	// here we have to play games...
	// the nodes cannot know if the property scalar is 0,1 or n 
	// so we look if the key name is already used (means property* 
	// DTD langua) and find the last one entered
	
	
	int index = 0;
	while (getValue(elementName + "-" + index + "-" + attributeName)!=null) {
	    index++;
	}

        setValue(elementName + "-" + index + "-" + attributeName, value);
    
public voidsetAttributeValue(java.lang.String attributeName, java.lang.String value)

	setValue(attributeName, value);
    
public voidsetAttributeValue(java.lang.String elementName, int index, java.lang.String attributeName, java.lang.Object value)

	setValue(elementName + "-" + index + "-" + attributeName, value);
    
public voidsetValue(java.lang.String name, java.lang.Object value)
Sets a property value

param
the property name
param
the property value

        Object oldValue = getExtraAttribute(name);
        addExtraAttribute(name, value);
        propListeners.firePropertyChange(name, oldValue, value);
    
protected voidsetValue(java.lang.String name, int index, java.lang.Object value)
indexed property support

	List list = getIndexedProperty(name);
	list.set(index, value);
	setValue(name, list);
    
protected voidsetValues(java.lang.String name, java.lang.Object[] values)

	List list = getIndexedProperty(name);
	for (int i=0;i<values.length;) {
	    list.add(values[i]);
	}
    
protected intsize(java.lang.String name)

	List list = (List) getValue(name);
	if (list!=null) 
	    return list.size();
	else 
	    return 0;