/*
Copyright 2002-2006 The Members of the OSS through Java(TM) Initiative.
All rights reserved. Use is subject to license terms.
 */
package com.infomodel;

import ossj.common.AttributeManager;
import ossj.common.Utils;


/**
 * An implementation class for the <CODE>com.infomodel.MplsVpnServiceValue</CODE> interface.
 *
 * @see javax.oss.AttributeAccess
 *
 * @see com.infomodel.MplsVpnServiceValue
 *
 * @see javax.oss.ManagedEntityValue
 *
 * @author OSS through Java(tm) Initiative, Vincent Perrot Sun Microsystems Inc.
 * @version 1.3
 * @since January 2006
 */


public class MplsVpnServiceValueImpl
        extends ossj.common.cbe.service.ServiceValueImpl
        implements MplsVpnServiceValue {
    
    /**
     * Constructs a new MplsVpnServiceValueImpl with empty attributes.
     *
     */
    
    public MplsVpnServiceValueImpl() {
        super();
        setManagedEntityKeyInstance( new MplsVpnServiceKeyImpl());
        javax.oss.cbe.CharacteristicSpecification[] charac = new javax.oss.cbe.CharacteristicSpecification[2];
        charac[0] = (javax.oss.cbe.CharacteristicSpecification) new ossj.common.cbe.CharacteristicSpecificationImpl("privateName", "java.lang.String","The privateName of the Service");
        charac[1] = (javax.oss.cbe.CharacteristicSpecification) new ossj.common.cbe.CharacteristicSpecificationImpl("privateField", "java.lang.String","The privateField of the Service");
        this.setCharacterizedBy(charac);
        javax.oss.cbe.CharacteristicValue[] characValue = new javax.oss.cbe.CharacteristicValue[2];
        characValue[0] = (javax.oss.cbe.CharacteristicValue) new ossj.common.cbe.CharacteristicValueImpl(charac[0].getName(), "the value0");
        characValue[1] = (javax.oss.cbe.CharacteristicValue) new ossj.common.cbe.CharacteristicValueImpl(charac[1].getName(), "the value1");
        this.setDescribedBy(characValue);
    }
    private static final String[] attributeNames = {
        MplsVpnServiceValue.VRF_NAME
    };
    
    private static final String[] settableAttributeNames = {
        MplsVpnServiceValue.VRF_NAME
    };
    
    //
    // Configuration of AttributeManager and AttributeAccess
    //
    protected void addAttributesTo(AttributeManager anAttributeManager) {
        if (MplsVpnServiceValueImpl.attributeNames != null) {
            anAttributeManager.addAttributes(this.attributeNames);
            super.addAttributesTo(anAttributeManager);
        }
    }
    
    protected void configureAttributes(AttributeManager anAttributeManager) {
        if (MplsVpnServiceValueImpl.settableAttributeNames != null) {
            anAttributeManager.setSettableAttributes(MplsVpnServiceValueImpl.settableAttributeNames);
            super.configureAttributes(anAttributeManager);
        }
    }
    
    /**
     * Holds the Attribute manager that manage the optional fields
     */
    private static AttributeManager attributemanager = null;
    
    protected AttributeManager getAttributeManager() {
        return attributemanager;
    }
    protected AttributeManager makeAttributeManager() {
        attributemanager = new AttributeManager();
        return attributemanager;
    }
    
    
    //==================================================================
    // FACTORIES AND ATTRIBUTE TYPE FOR ================================
    //==================================================================
    
    public com.infomodel.MplsVpnServiceKey makeMplsVpnServiceKey(){
        return (MplsVpnServiceKey) makeManagedEntityKey();
    }
    
    /**
     * Init the Map Attribute Name/Attribute Type
     * Init the enumeration Map
     */
    protected void initAttributeTypes(){
        String[] list = new String[1];
        list[0] = "java.lang.String";
        addAttributeTypes(MplsVpnServiceValue.VRF_NAME, list);
        super.initAttributeTypes();
    }
    
    private java.lang.String _mplsvpnservicevalueimpl_vrfName = null;
    
    
    /**
     * Changes the mplsVpnServiceKey to be equal to the given argument.
     *
     * This method support a null argument.
     *
     * @param value the new mplsVpnServiceKey for this object.
     * @exception java.lang.IllegalArgumentException - Is thrown to report
     * that a bad argument was provided to the method.
     */
    
    public void setMplsVpnServiceKey(com.infomodel.MplsVpnServiceKey value)
    throws java.lang.IllegalArgumentException    {
        setServiceKey(value);
    }
    
    
    /**
     * Returns this MplsVpnServiceValueImpl's mplsVpnServiceKey
     *
     * @return the mplsVpnServiceKey
     *
     */
    
    public com.infomodel.MplsVpnServiceKey getMplsVpnServiceKey()
    throws java.lang.IllegalStateException {
        return (com.infomodel.MplsVpnServiceKey)getServiceKey();
    }
    
    /**
     * Changes the vrfName to be equal to the given argument.
     *
     * This method support a null argument.
     *
     * @param value the new vrfName for this object.
     * @exception java.lang.IllegalArgumentException - Is thrown to report
     * that a bad argument was provided to the method.
     */
    
    public void setVrfName(java.lang.String value)
    throws java.lang.IllegalArgumentException    {
        setDirtyAttribute(MplsVpnServiceValue.VRF_NAME);
        _mplsvpnservicevalueimpl_vrfName = value;
    }
    
    
    /**
     * Returns this MplsVpnServiceValueImpl's vrfName
     *
     * @return the vrfName
     *
     */
    
    public java.lang.String getVrfName()
    throws java.lang.IllegalStateException {
        checkAttribute(MplsVpnServiceValue.VRF_NAME);
        return _mplsvpnservicevalueimpl_vrfName;
    }
    
    /**
     * Creates a new object of the same class and with the same contents as this object.
     * @return a clone of this instance.
     */
    public Object clone() {
        MplsVpnServiceValue val = null;
        val = (MplsVpnServiceValue)super.clone();
        
        if( isPopulated(MplsVpnServiceValue.VRF_NAME)) {
            if( this.getVrfName()!=null)
                val.setVrfName(((java.lang.String) new String( this.getVrfName())));
            else
                val.setVrfName( null );
        }
        
        return val;
    }
    
    /**
     * Checks whether two MplsVpnServiceValue are equal.
     * The result is true if and only if the argument is not null
     * and is an MplsVpnServiceValue object that has the arguments.
     *
     * @param value the Object to compare with this MplsVpnServiceValue
     * @return if the objects are equal; false otherwise.
     */
    
    public boolean equals(Object value) {
        if ( this == value ){ return true;}
        if ( (value != null) && ( value instanceof MplsVpnServiceValue)) {
            MplsVpnServiceValue argVal = (MplsVpnServiceValue) value;
            return Utils.compareAttributeAccess( this, argVal );
        }
        return false;
    }
    
}
