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  * ActiveProjectModel.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 a Solaris project.
37  * It encapsulates a CIM instance of the Solaris_ActiveProject class.
38  * @author Sun Microsystems
39  */
40 
41 public class ActiveProjectModel extends SRMProviderDataModel
42 	implements SRMProviderProperties, Solaris_ActiveProjectProperties {
43 
44     /**
45      * Construct an active project model and set the project name property
46      * to projName.
47      * @param   projName the project name
48      */
ActiveProjectModel(String projName)49     public ActiveProjectModel(String projName) {
50 	name = projName;
51     }
52 
53     /**
54      * Returns the string value of this object
55      */
toString()56     public String toString() {
57 	return "Project: " + name + "\n" + super.toString();
58     }
59 
setOpPropertiesVector()60     protected void setOpPropertiesVector() {
61 	opProperties.add(new CIMProperty(CSCREATIONCLASSNAME,
62 	    new CIMValue(SOLARIS_COMPUTERSYSTEM)));
63 	opProperties.add(new CIMProperty(CSNAME, new CIMValue(csName)));
64 	opProperties.add(new CIMProperty(OSCREATIONCLASSNAME,
65 	    new CIMValue(SOLARIS_OPERATINGSYSTEM)));
66 	opProperties.add(new CIMProperty(OSNAME, new CIMValue(osName)));
67 	opProperties.add(new CIMProperty(PROJECTNAME, new CIMValue(name)));
68     }
69 
setCIMInstance(boolean newInstance)70     protected void setCIMInstance(boolean newInstance) {
71 	setStrProp(newInstance, CSCREATIONCLASSNAME, SOLARIS_COMPUTERSYSTEM);
72 	setStrProp(newInstance, CSNAME, csName);
73 	setStrProp(newInstance, OSCREATIONCLASSNAME, SOLARIS_OPERATINGSYSTEM);
74 	setStrProp(newInstance, OSNAME, osName);
75 	setStrProp(newInstance, CREATIONCLASSNAME, SOLARIS_ACTIVEPROJECT);
76     }
77 
initKeyValTable()78     protected void initKeyValTable() {
79 	keyValTab = new LinkedHashMap(2);
80 	keyValTab.put(PROJECTID_KEY, new SetUI32Prop(PROJECTID));
81 	keyValTab.put(PROJECTNAME_KEY, new SetStringProp(PROJECTNAME));
82     }
83 
84 } // end class ActiveProjectModel
85