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  * SetProp.java
     26  */
     27 
     28 
     29 package com.sun.wbem.solarisprovider.srm;
     30 
     31 import javax.wbem.cim.*;
     32 
     33 /**
     34  * This is the base class for set property classes. Each
     35  * derived class can format a string into one CIM data format.
     36  * @author Sun Microsystems
     37  */
     38 abstract class SetProp implements PropertyAccessInterface {
     39 
     40     protected String	n;  // the property name
     41     protected String	vs; // property value as a string
     42 
     43     /**
     44      * Constructor
     45      * @param n - the name of this property
     46      */
     47     public SetProp(String  name) {
     48 	n = name;
     49     }
     50 
     51     /**
     52      * Set the property value. Depending of the action flag perform
     53      * the following actions:
     54      * CACHE: only save it in the vs variable
     55      * FLASH: format the value in vs variable and set it in ci instance
     56      * CHECK_WTHROUGH: save val in vs and check if it is deferent form
     57      * the property in ci instance, if so set a new property value.
     58      * @param ci a cim instance
     59      * @param action the action to be done: CACHE, FLASH or CHECK_WTHROUGH
     60      * @param val the property value
     61      */
     62     abstract public void set(CIMInstance  ci, byte action, String val);
     63 
     64     /**
     65      * Returns a formated name value string of this property
     66      * @return formated name value string of this property
     67      */
     68     public String toString() {
     69      	return (n + " " + vs + '\n');
     70     }
     71 
     72     /**
     73      * Returns value string of this property
     74      * @return value string of this property
     75      */
     76     public String getValue() {
     77      	return vs;
     78     }
     79 
     80 } // end class SetProp
     81