// Home | Go Back //

/*
 * Copyright (c) 2002-2003 iReasoning Inc. All Rights Reserved.
 * 
 * This SOURCE CODE FILE, which has been provided by iReasoning Inc. as part
 * of an iReasoning Software product for use ONLY by licensed users of the product,
 * includes CONFIDENTIAL and PROPRIETARY information of iReasoning Inc.  
 *
 * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS 
 * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
 * THE PRODUCT.
 *
 * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD IREASONING SOFTWARE, ITS
 * RELATED COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY
 * CLAIMS OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR
 * DISTRIBUTION OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES
 * ARISING OUT OF OR RESULTING FROM THE USE, MODIFICATION, OR
 * DISTRIBUTION OF PROGRAMS OR FILES CREATED FROM, BASED ON, AND/OR
 * DERIVED FROM THIS SOURCE CODE FILE.
 */

package agent.mib2;
import java.io.*;
import java.util.*;
import com.ireasoning.util.*;
import com.ireasoning.protocol.snmp.*;
import javax.management.*;

/**
 * Class represents system mib object in RFC1213_MIB
 */
public class SystemGroup extends SnmpBaseGroup implements SystemGroupMBean
{
    // SnmpOID: .1.3.6.1.2.1.1.1.0
    protected String _sysDescr = ""; // DEFVAL is "Test Agent Simulator"
    // SnmpOID: .1.3.6.1.2.1.1.2.0
    protected SnmpOID _sysObjectID = new SnmpOID();
    // SnmpOID: .1.3.6.1.2.1.1.3.0
    protected SnmpTimeTicks _sysUpTime = new SnmpTimeTicks();
    // SnmpOID: .1.3.6.1.2.1.1.4.0
    protected String _sysContact = "";
    // SnmpOID: .1.3.6.1.2.1.1.5.0
    protected String _sysName = "";
    // SnmpOID: .1.3.6.1.2.1.1.6.0
    protected String _sysLocation = "";
    // SnmpOID: .1.3.6.1.2.1.1.7.0
    protected int _sysServices = 0;
    
    /**
     * Constructor
     * @param root SnmpOID tree root
     * @param oid the SnmpOID of this group
     * @param args the objects passed from caller for Initialization purpose
     */
    public SystemGroup(OIDTreeNode root, String oid, Object [] args)
    {
        super(root, oid);
        // TODO: Add your implementation
    }
    
    /**
     * Gets new sysDescr value
     */
    public synchronized String getSysDescr()
    {
        // TODO: Add your implementation
        // New code
        if(this._sysDescr.length() == 0)
        {
           this._sysDescr = System.getProperty("os.name") + " " +
                System.getProperty("os.arch") + " " +
                System.getProperty("os.version");
        }
        return this._sysDescr;
    }
    
    /**
     * Sets new sysDescr value
     * @param value the new value
     */
    public synchronized void setSysDescr(String newValue)
    {
        // TODO: Add your implementation
        this._sysDescr = (String) newValue;
    }
    
    /**
     * Gets new sysObjectID value
     */
    public synchronized SnmpOID getSysObjectID()
    {
        // TODO: Add your implementation
        return this._sysObjectID;
    }
    
    /**
     * Sets new sysObjectID value
     * @param value the new value
     */
    public synchronized void setSysObjectID(SnmpOID newValue)
    {
        // TODO: Add your implementation
        this._sysObjectID = (SnmpOID) newValue;
    }
    
    /**
     * Gets new sysUpTime value
     */
    public synchronized SnmpTimeTicks getSysUpTime()
    {
        return new SnmpTimeTicks( SnmpBaseAgent.getSysUpTime() );
    }
    
    /**
     * Sets new sysUpTime value
     * @param value the new value
     */
    public synchronized void setSysUpTime(SnmpTimeTicks newValue)
    {
        // TODO: Add your implementation
        this._sysUpTime = (SnmpTimeTicks) newValue;
    }
    
    /**
     * Gets new sysContact value
     */
    public synchronized String getSysContact()
    {
        // TODO: Add your implementation
        return this._sysContact;
    }
    
    /**
     * Sets new sysContact value
     * @param value the new value
     */
    public synchronized void setSysContact(String newValue)
    {
        // TODO: Add your implementation
        this._sysContact = (String) newValue;
    }
    
    /**
     * Gets new sysName value
     */
    public synchronized String getSysName()
    {
        // TODO: Add your implementation
        // New code
        if(_sysName.length() == 0)
        {
            try
            {
                _sysName = (java.net.InetAddress.getLocalHost()).getHostName();
            } 
            catch(java.net.UnknownHostException e) 
            {
            }
        }
        return this._sysName;
    }
    
    /**
     * Sets new sysName value
     * @param value the new value
     */
    public synchronized void setSysName(String newValue)
    {
        // TODO: Add your implementation
        this._sysName = (String) newValue;
    }
    
    /**
     * Gets new sysLocation value
     */
    public synchronized String getSysLocation()
    {
        // TODO: Add your implementation
        return this._sysLocation;
    }
    
    /**
     * Sets new sysLocation value
     * @param value the new value
     */
    public synchronized void setSysLocation(String newValue)
    {
        // TODO: Add your implementation
        this._sysLocation = (String) newValue;
    }
    
    /**
     * Gets new sysServices value
     */
    public synchronized int getSysServices()
    {
        // TODO: Add your implementation
        return this._sysServices;
    }
    
    /**
     * Sets new sysServices value
     * @param value the new value
     */
    public synchronized void setSysServices(int newValue)
    {
        // TODO: Add your implementation
        this._sysServices = newValue ;
    }
    
}