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// SSrvDereg.java: Message class for SLP service deregistration request.
2N/A// Author: James Kempf
2N/A// Created On: Thu Oct 9 15:00:38 1997
2N/A// Last Modified By: James Kempf
2N/A// Last Modified On: Tue Oct 27 10:57:39 1998
2N/A// Update Count: 102
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/**
2N/A * The SSrvDereg class models the server side SLP service deregistration. The
2N/A * default class does SLPv2 deregs, but subclasses can do other versions
2N/A * by redefining the initialize() and makeReply() messages.
2N/A *
2N/A * @author James Kempf
2N/A */
2N/A
2N/Aclass SSrvDereg extends SrvLocMsgImpl {
2N/A
2N/A ServiceURL URL = null; // the service URL.
2N/A Hashtable URLSignature = null; // Authentication block.
2N/A Vector tags = null; // Vector of String
2N/A
2N/A // Construct a SSrvDereg from the input stream.
2N/A
2N/A SSrvDereg(SrvLocHeader hdr, DataInputStream dis)
2N/A throws ServiceLocationException, IOException {
2N/A
2N/A super(hdr, SrvLocHeader.SrvDereg);
2N/A
2N/A this.initialize(dis);
2N/A
2N/A }
2N/A
2N/A // Initialize the object.
2N/A
2N/A void initialize(DataInputStream dis)
2N/A throws ServiceLocationException, IOException {
2N/A
2N/A SLPServerHeaderV2 hdr = (SLPServerHeaderV2)getHeader();
2N/A StringBuffer buf = new StringBuffer();
2N/A
2N/A // Parse in scopes.
2N/A
2N/A hdr.parseScopesIn(dis);
2N/A
2N/A // Parse in the service URL.
2N/A
2N/A Hashtable ht = new Hashtable();
2N/A
2N/A URL =
2N/A hdr.parseServiceURLIn(dis,
2N/A ht,
2N/A ServiceLocationException.INVALID_REGISTRATION);
2N/A
2N/A URLSignature = (Hashtable)ht.get(URL);
2N/A
2N/A // Get the tag lists.
2N/A
2N/A hdr.getString(buf, dis);
2N/A
2N/A tags = hdr.parseCommaSeparatedListIn(buf.toString(), true);
2N/A
2N/A // If no tags, then set the tags vector to null. This indicates
2N/A // that the service: URL needs to be deregistered.
2N/A
2N/A if (tags.size() <= 0) {
2N/A tags = null;
2N/A
2N/A } else {
2N/A
2N/A // Unescape the tags.
2N/A
2N/A hdr.unescapeTags(tags);
2N/A
2N/A }
2N/A
2N/A // Construct description.
2N/A
2N/A hdr.constructDescription("SrvDereg",
2N/A " URL=``" + URL + "''\n" +
2N/A " tags=``" + tags + "''\n" +
2N/A " URL signature=" +
2N/A AuthBlock.desc(URLSignature) + "\n");
2N/A
2N/A }
2N/A
2N/A // Return a SrvAck. We ignore the existing flag, since in V2, fresh comes
2N/A // in. In this case, all we need to do is clone the header.
2N/A
2N/A SrvLocMsg makeReply() {
2N/A
2N/A SLPServerHeaderV2 hdr =
2N/A ((SLPServerHeaderV2)getHeader()).makeReplyHeader();
2N/A
2N/A // Construct description.
2N/A
2N/A hdr.constructDescription("SrvAck", "");
2N/A
2N/A return hdr;
2N/A
2N/A }
2N/A
2N/A}