Home | History | Annotate | Download | only in srm
      1 /*
      2  * CDDL HEADER START
      3  *
      4  * The contents of this file are subject to the terms of the
      5  * Common Development and Distribution License (the "License").
      6  * You may not use this file except in compliance with the License.
      7  *
      8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9  * or http://www.opensolaris.org/os/licensing.
     10  * See the License for the specific language governing permissions
     11  * and limitations under the License.
     12  *
     13  * When distributing Covered Code, include this CDDL HEADER in each
     14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15  * If applicable, add the following below this CDDL HEADER, with the
     16  * fields enclosed by brackets "[]" replaced with your own identifying
     17  * information: Portions Copyright [yyyy] [name of copyright owner]
     18  *
     19  * CDDL HEADER END
     20  */
     21 /*
     22  * Copyright (c) 2001 by Sun Microsystems, Inc.
     23  * All rights reserved.
     24  *
     25  * ActiveUserModel.java
     26  */
     27 
     28 package com.sun.wbem.solarisprovider.srm;
     29 
     30 import javax.wbem.cim.*;
     31 
     32 import java.util.LinkedHashMap;
     33 
     34 
     35 /**
     36  * Data model of an active user that is actively running on an OperatingSystem.
     37  * It encapsulates a CIM instance of the Solaris_ActiveUser class.
     38  * @author Sun Microsystems
     39  */
     40 public class ActiveUserModel extends SRMProviderDataModel
     41 	implements SRMProviderProperties, Solaris_ActiveUserProperties {
     42 
     43     /**
     44      * Construct an active user model and set the user id property
     45      * to uidStr.
     46      * @param	uidStr the user id as a string
     47      */
     48     public ActiveUserModel(String uidStr) {
     49 	name = uidStr;
     50     }
     51 
     52     /**
     53      * Returns the string value of this object
     54      */
     55     public String toString() {
     56 	return "\nUser ID " + name + '\n' + super.toString();
     57     }
     58 
     59     protected void setCIMInstance(boolean newInstance) {
     60 	setStrProp(newInstance, CSCREATIONCLASSNAME, SOLARIS_COMPUTERSYSTEM);
     61 	setStrProp(newInstance, CSNAME, csName);
     62 	setStrProp(newInstance, OSCREATIONCLASSNAME, SOLARIS_OPERATINGSYSTEM);
     63 	setStrProp(newInstance, OSNAME, osName);
     64 	setStrProp(newInstance, CREATIONCLASSNAME, SOLARIS_ACTIVEUSER);
     65     }
     66 
     67     protected void setOpPropertiesVector() {
     68 	opProperties.add(new CIMProperty(CSCREATIONCLASSNAME,
     69 	    new CIMValue(SOLARIS_COMPUTERSYSTEM)));
     70 	opProperties.add(new CIMProperty(CSNAME, new CIMValue(csName)));
     71 	opProperties.add(new CIMProperty(OSCREATIONCLASSNAME,
     72 	    new CIMValue(SOLARIS_OPERATINGSYSTEM)));
     73 	opProperties.add(new CIMProperty(OSNAME, new CIMValue(osName)));
     74 	opProperties.add(new CIMProperty(USERID, new CIMValue(name)));
     75     }
     76 
     77     protected void initKeyValTable() {
     78 	keyValTab = new LinkedHashMap(2);
     79 	keyValTab.put(USERID_KEY, new SetUI32Prop(USERID));
     80 	keyValTab.put(USERNAME_KEY, new SetStringProp(USERNAME));
     81     }
     82 
     83 } // end class ActiveUserModel
     84