Macro.java revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* ident "%Z%%M% %I% %E% SMI"
*
* Copyright 1998-2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/**
* Macro is a simple data class which encapsulates a macro record in
* the dhcptab. See dhcptab(4) for the gory details on macros.
* @see DhcptabRecord
* @see Option
*/
private boolean valueClean = false;
// Definition for attribute limits
public final static short MAX_NAME_SIZE = 128;
// Value used to edit a boolean symbol of a macro
// Serialization id for this class
static final long serialVersionUID = -5255083189703724489L;
public Macro() {
}
this();
}
}
throws ValidationException {
this();
}
throw new ValidationException(msg);
}
}
throws ValidationException {
boolean inQuote = false;
boolean inEscape = false;
char c;
// State list for parsing machine
int START = 0;
int NAME = 1;
int VALUE = 2;
// Start of expansion
throw new ValidationException(msg);
}
// Name of symbol
if (c == '=') {
} else if (!edit && (c == ':')) {
if (!validate) {
} else {
}
} else {
}
// Value of symbol
if (inEscape) {
inEscape = false;
} else if (c == '\\') {
inEscape = true;
} else if (c == '"') {
} else if (inQuote) {
} else if (!edit && (c == ':')) {
if (!validate) {
} else {
}
} else {
}
}
}
if (edit) {
valueClean = false;
} else {
throw new ValidationException(msg);
}
valueClean = true;
}
}
throws ValidationException {
}
/**
* Common method used to set an option value for the macro.
* @param symbol name of the option
* @param value the option value(if any)
* @param edit flag indicating that this is an edit of and existing option
*/
throws ValidationException {
if (edit) {
if (index == -1) {
throw new ValidationException(msg);
}
} else {
if (option instanceof BogusOptionValue) {
throw new ValidationException(msg);
} else if (!(option instanceof BooleanOptionValue)) {
throw new ValidationException(msg);
}
}
if (option instanceof BogusOptionValue) {
throw new ValidationException(msg);
} else if (!(option instanceof BooleanOptionValue)) {
throw new ValidationException(msg);
}
if (index == -1) {
} else {
// nothing to do - option already turned on
}
} else {
if (option instanceof BogusOptionValue) {
throw new ValidationException(msg);
throw new ValidationException(msg);
}
if (index == -1) {
} else {
}
}
}
throws ValidationException {
}
throws ValidationException {
}
// Useful for creating options when standard code values are known.
//
// XXX
// NOTE!!! Do not use this method for now. We need to resolve whether or
// not all standard options are going to have unique codes. Today, they do
// not. We include internal options as standard and set their codes to 0.
//
value));
}
boolean first;
if (!valueClean) {
// Construct a new value
if (v == null) {
continue; // Ignore an empty position
}
}
try {
} catch (ValidationException ex) {
// Shouldn't happen; ignore it
}
valueClean = true;
}
return super.getValue();
}
public Enumeration elements() {
}
public OptionValue [] getOptions() {
return optArray;
}
return v;
}
}
return null;
}
int index = -1;
boolean found = false;
index++;
found = true;
}
}
if (!found) {
index = -1;
}
return index;
}
}
}
}
public int optionCount() {
}
public void deleteOptionAt(int index) {
return;
}
}
}
// Make a copy of this macro
}
return m;
}
}
// Verify that the options contained in this macro are all valid
public void validate() throws ValidationException {
if (!v.isValid()) {
throw new ValidationException(v.getName());
}
}
}
}