2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 1999 by Sun Microsystems, Inc.
2N/A * All rights reserved.
2N/A *
2N/A */
2N/A
2N/A// ServerAttribute.java: Attribute created on the server side only.
2N/A// Author: James Kempf
2N/A// Created On: Thu Apr 23 08:53:49 1998
2N/A// Last Modified By: James Kempf
2N/A// Last Modified On: Fri May 1 10:35:22 1998
2N/A// Update Count: 9
2N/A//
2N/A
2N/Apackage com.sun.slp;
2N/A
2N/Aimport java.util.*;
2N/Aimport java.io.*;
2N/A
2N/A/**
2N/A * The ServerAttribute class models attributes on the server side.
2N/A * The primary difference is that values substitute AttributeString
2N/A * objects for String objects, so attributes compare according to the
2N/A * rules of SLP matching rather than by string equality. Also,
2N/A * an AttributeString object for the id is included, for pattern
2N/A * matching against the id.
2N/A *
2N/A * @author James Kempf
2N/A */
2N/A
2N/Aclass ServerAttribute extends ServiceLocationAttribute {
2N/A
2N/A // The id as an attribute string.
2N/A
2N/A AttributeString idPattern = null;
2N/A
2N/A // Construct a new ServerAttribute object. Substitute AttributeString
2N/A // objects for strings.
2N/A
2N/A ServerAttribute(String id_in, Vector values_in, Locale locale)
2N/A throws IllegalArgumentException {
2N/A
2N/A super(id_in, values_in);
2N/A
2N/A idPattern = new AttributeString(id, locale);
2N/A
2N/A // Substitute for string values.
2N/A
2N/A if (values != null) {
2N/A Object o = values.elementAt(0);
2N/A
2N/A if (o instanceof String) {
2N/A
2N/A int i, n = values.size();
2N/A
2N/A for (i = 0; i < n; i++) {
2N/A String s = (String)values.elementAt(i);
2N/A AttributeString as = new AttributeString(s, locale);
2N/A
2N/A values.setElementAt(as, i);
2N/A
2N/A }
2N/A }
2N/A }
2N/A }
2N/A
2N/A // Construct a ServerAttribute object from a ServiceLocationAttribute
2N/A // object.
2N/A
2N/A ServerAttribute(ServiceLocationAttribute attr, Locale locale) {
2N/A this(attr.id, attr.getValues(), locale);
2N/A
2N/A }
2N/A
2N/A // Get values by changing the attribute string objects into strings.
2N/A
2N/A public Vector getValues() {
2N/A Vector v = super.getValues();
2N/A
2N/A if ((v != null) &&
2N/A (v.elementAt(0) instanceof AttributeString)) {
2N/A
2N/A int i, n = v.size();
2N/A
2N/A for (i = 0; i < n; i++) {
2N/A v.setElementAt(v.elementAt(i).toString(), i);
2N/A
2N/A }
2N/A }
2N/A
2N/A return v;
2N/A
2N/A }
2N/A
2N/A}