usr/src/cmd/wbem/provider/com/sun/wbem/solarisprovider/srm/SetProp.java
author Mark J. Nelson <Mark.J.Nelson@Sun.COM>
Wed, 06 Aug 2008 16:29:39 -0600
changeset 7298 b69e27387f74
parent 0 68f95e015346
permissions -rw-r--r--
6733918 Teamware has retired, please welcome your new manager, Mercurial 4758439 some files use "current date" sccs keywords 6560843 asm sources should not rely on .file "%M%" for naming STT_FILE symbols 6560958 Solaris:: perl modules should not use SCCS keywords in version information 6729074 webrev doesn't deal well with remote ssh hg parents
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
     1
/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
     2
 * CDDL HEADER START
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
     3
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
7298
b69e27387f74 6733918 Teamware has retired, please welcome your new manager, Mercurial
Mark J. Nelson <Mark.J.Nelson@Sun.COM>
parents: 0
diff changeset
     5
 * Common Development and Distribution License (the "License").
b69e27387f74 6733918 Teamware has retired, please welcome your new manager, Mercurial
Mark J. Nelson <Mark.J.Nelson@Sun.COM>
parents: 0
diff changeset
     6
 * You may not use this file except in compliance with the License.
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
     7
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    11
 * and limitations under the License.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    12
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    18
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    19
 * CDDL HEADER END
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    20
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    21
/*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    22
 * Copyright (c) 2001 by Sun Microsystems, Inc.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    23
 * All rights reserved.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    24
 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    25
 * SetProp.java
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    26
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    27
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    28
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    29
package com.sun.wbem.solarisprovider.srm;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    30
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    31
import javax.wbem.cim.*;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    32
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    33
/**
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    34
 * This is the base class for set property classes. Each
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    35
 * derived class can format a string into one CIM data format.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    36
 * @author Sun Microsystems
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    37
 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    38
abstract class SetProp implements PropertyAccessInterface {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    39
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    40
    protected String	n;  // the property name
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    41
    protected String	vs; // property value as a string
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    42
    
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    43
    /**
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    44
     * Constructor
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    45
     * @param n - the name of this property
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    46
     */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    47
    public SetProp(String  name) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    48
	n = name;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    49
    }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    50
    
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    51
    /**
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    52
     * Set the property value. Depending of the action flag perform
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    53
     * the following actions:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    54
     * CACHE: only save it in the vs variable
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    55
     * FLASH: format the value in vs variable and set it in ci instance
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    56
     * CHECK_WTHROUGH: save val in vs and check if it is deferent form 
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    57
     * the property in ci instance, if so set a new property value.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    58
     * @param ci a cim instance
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    59
     * @param action the action to be done: CACHE, FLASH or CHECK_WTHROUGH
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    60
     * @param val the property value
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    61
     */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    62
    abstract public void set(CIMInstance  ci, byte action, String val);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    63
    
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    64
    /**
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    65
     * Returns a formated name value string of this property
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    66
     * @return formated name value string of this property
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    67
     */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    68
    public String toString() {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    69
     	return (n + " " + vs + '\n');
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    70
    }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    71
    
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    72
    /**
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    73
     * Returns value string of this property
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    74
     * @return value string of this property
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    75
     */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    76
    public String getValue() {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    77
     	return vs;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    78
    }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    79
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
    80
} // end class SetProp