/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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
*/
/*
* Copyright (c) 1999 by Sun Microsystems, Inc.
* All rights reserved.
*
*/
// AttributeDescriptor.java: Describes an SLP attribute.
// Author: James Kempf
// Created On: Thu Jun 19 10:38:01 1997
// Last Modified By: James Kempf
// Last Modified On: Tue Jun 2 13:29:08 1998
// Update Count: 29
//
/**
* The instances of the AttributeDescriptor class
* return information on a particular service location attribute. This
* information is primarily for GUI tools. Programmatic attribute
* verification should be done through the ServiceLocationAttributeVerifier.
*
* @author James Kempf
*
*/
class AttributeDescriptor
extends Object
implements ServiceLocationAttributeDescriptor {
// Indicates byte array type.
private boolean isMultivalued = false;
private boolean isOptional = false;
private boolean requiresExplicitMatch = false;
private boolean isLiteral = false;
private boolean isKeyword = false;
/**
* Return the attribute's id.
*
* @return A String with the attribute's id.
*/
return id;
}
/**
* Return the fully qualified Java type of the attribute. SLP types
* are translated into Java types as follows:
*
* STRING java.lang.String
* INTEGER java.lang.Integer
* BOOLEAN java.lang.Boolean
* OPAQUE [B (i.e. array of byte, byte[]);
* KEYWORD null string, ""
*
* @return A String containing the Java type name for the attribute values.
*/
return valueType;
}
/**
* Return attribute's help text.
*
* @return A String containing the attribute's help text.
*/
return description;
}
/**
* Return an Enumeration of allowed values for the attribute type.
* For keyword attributes returns null. For no allowed values
* (i.e. unrestricted) returns an empty Enumeration. Small memory
* implementations may want to parse values on demand rather
* than at the time the descriptor is created.
*
* @return An Enumeration of allowed values for the attribute or
* null if the attribute is keyword.
*/
if (getIsKeyword()) {
return null;
} else {
return allowedValues.elements();
}
}
/**
* Return an Enumeration of default values for the attribute type.
* For keyword attributes returns null. For no allowed values
* (i.e. unrestricted) returns an empty Enumeration. Small memory
* implementations may want to parse values on demand rather
* than at the time the descriptor is created.
*
* @return An Enumeration of default values for the attribute or
* null if the attribute is keyword.
*/
if (getIsKeyword()) {
return null;
} else {
return defaultValues.elements();
}
}
/**
* Returns true if the "M" flag is set.
*
* @return True if the "M" flag is set.
*/
final public boolean getIsMultivalued() {
return isMultivalued;
}
/**
* Returns true if the "O" flag is set.
*
* @return True if the "O" flag is set.
*/
final public boolean getIsOptional() {
return isOptional;
}
/**
* Returns true if the "X" flag is set.
*
* @return True if the "X" flag is set.
*/
final public boolean getRequiresExplicitMatch() {
return requiresExplicitMatch;
}
/**
* Returns true if the "L" flag is set.
*
* @return True if the "L" flag is set.
*/
final public boolean getIsLiteral() {
return isLiteral;
}
/**
* Returns true if the attribute is a keyword attribute.
*
* @return True if the attribute is a keyword attribute
*/
final public boolean getIsKeyword() {
return isKeyword;
}
//
// Package private interface for setting properties.
//
/**
* Set the attribute's id.
*
* @param nid New id string
*/
}
/**
* Set the fully qualified Java type of the attribute. We don't check
* the argument here, assuming that the caller has taken care of it.
*
* @param nvt New value type.
*/
}
/**
* Set attribute's help text.
*
* @param ndes A String containing the attribute's help text.
*/
description = ndes;
}
/**
* Set the allowed values for an attribute.
*
* @param nnv A vector of allowed values for the attribute.
*/
allowedValues = nnv;
}
/**
* Set the default values for an attribute.
*
* @param nnv A vector of default values for the attribute.
*/
defaultValues = nnv;
}
/**
* Set the isMultivalued flag.
*
* @param flag New multivalued flag.
*/
}
/**
* Set the isOptional flag.
*
* @param flag New optional flag.
*/
isOptional = flag;
}
/**
* Set the requiresExplicitMatch flag.
*
* @param flag New explicit match flag.
*/
}
/**
* Set the isLiteral flag.
*
* @param flag New literal flag.
*/
}
/**
* Set the keyword attribute flag.
*
* @param flag New keyword attribute flag.
*/
}
/**
* Format a string with the id and all the fields.
*
*/
ret +=
"defaultValues:" +
"\n";
ret +=
"allowedValues:" +
"\n";
ret += "requiresExplicitMatch:" +
return ret;
}
// Formats an array of bytes for opaque, rather than just the address.
for (i = 0; i < n; i++) {
for (j = 0; j < m; j++) {
}
}
}
}