001 /* 002 * Copyright (c) 2005 Your Corporation. All Rights Reserved. 003 */ 004 package org.activemq.transport.stomp; 005 006 import org.activemq.message.ActiveMQDestination; 007 008 import java.io.DataInput; 009 import java.io.IOException; 010 import java.util.Properties; 011 012 public class Unsubscribe implements Command 013 { 014 private static final HeaderParser parser = new HeaderParser(); 015 private final StompWireFormat format; 016 017 Unsubscribe(StompWireFormat format) 018 { 019 this.format = format; 020 } 021 022 public PacketEnvelope build(String commandLine, DataInput in) throws IOException 023 { 024 Properties headers = parser.parse(in); 025 while (in.readByte() == 0) {} 026 027 String dest_name = headers.getProperty(Stomp.Headers.Unsubscribe.DESTINATION); 028 ActiveMQDestination destination = DestinationNamer.convert(dest_name); 029 030 Subscription s = format.getSubscriptionFor(destination); 031 return new PacketEnvelope(s.close(), headers); 032 } 033 }