FileDocCategorySizeDatePackage
J2EEResourceBase.javaAPI DocGlassfish v2 API5217Fri May 04 22:35:10 BST 2007com.sun.enterprise.repository

J2EEResourceBase

public abstract class J2EEResourceBase extends Object implements Serializable, J2EEResource
Base class for common J2EEResource implementation.
author

Fields Summary
String
name_
Map
properties_
boolean
enabled_
String
description_
Constructors Summary
public J2EEResourceBase(String name)

        name_ = name;
        properties_ = new HashMap();
    
Methods Summary
public voidaddProperty(ResourceProperty property)

        properties_.put(property.getName(), property);
    
protected abstract J2EEResourcedoClone(java.lang.String name)

public java.lang.StringgetDescription()

        return description_;
    
public java.lang.StringgetName()

        return name_;
    
public java.util.SetgetProperties()

        Set shallowCopy = new HashSet();
        Collection collection = properties_.values();
        for(Iterator iter = collection.iterator(); iter.hasNext();) {
            ResourceProperty next = (ResourceProperty) iter.next();
            shallowCopy.add(next);
        }
        return shallowCopy;
    
public ResourcePropertygetProperty(java.lang.String propertyName)

        return (ResourceProperty) properties_.get(propertyName);
    
protected java.lang.StringgetPropsString()

        StringBuffer propsBuffer = new StringBuffer();
        Set props = getProperties();
        if( !props.isEmpty() ) {
            for(Iterator iter = props.iterator(); iter.hasNext(); ) {
                if( propsBuffer.length() == 0 ) {
                    propsBuffer.append("[ ");
                } else {
                    propsBuffer.append(" , ");
                }
                ResourceProperty next = (ResourceProperty) iter.next();
                propsBuffer.append(next.getName() + "=" + next.getValue());
            }
            propsBuffer.append(" ]");
        }
        return propsBuffer.toString();
    
public abstract intgetType()

public booleanisEnabled()

        return enabled_;
    
public J2EEResourcemakeClone(java.lang.String name)

        J2EEResource clone = doClone(name);
        Set entrySet = properties_.entrySet();
        for(Iterator iter = entrySet.iterator(); iter.hasNext();) {
            Map.Entry next = (Map.Entry) iter.next();
            ResourceProperty nextProp = (ResourceProperty) next.getValue();
            ResourceProperty propClone =
                new ResourcePropertyImpl((String) next.getKey());
            propClone.setValue(next.getValue());
                                         
            clone.addProperty(propClone);
        }
        // START OF IASRI #4626188
        clone.setEnabled(isEnabled());
        clone.setDescription(getDescription());
        // END OF IASRI #4626188             
        return clone;
    
public booleanremoveProperty(ResourceProperty property)

        Object removedObj = properties_.remove(property.getName());
        return (removedObj != null);
    
public voidsetDescription(java.lang.String value)

        description_ = value;
    
public voidsetEnabled(boolean value)

        enabled_ = value;