// Path: src/main/java/ch/rasc/wampspring/message/PubSubMessage.java
// public abstract class PubSubMessage extends WampMessage {
// 
// 	private String topicURI;
// 
// 	protected PubSubMessage(WampMessageType type) {
// 		super(type);
// 	}
// 
// 	public PubSubMessage(WampMessageType type, String topicURI) {
// 		super(type);
// 		this.topicURI = topicURI;
// 	}
// 
// 	public String getTopicURI() {
// 		return this.topicURI;
// 	}
// 
// 	protected void setTopicURI(String topicURI) {
// 		this.topicURI = topicURI;
// 	}
// 
// 	@Override
// 	public String getDestination() {
// 		return this.topicURI;
// 	}
// }
// 
// Path: src/main/java/ch/rasc/wampspring/message/SubscribeMessage.java
// public class SubscribeMessage extends PubSubMessage {
// 
// 	public SubscribeMessage(String topicURI) {
// 		super(WampMessageType.SUBSCRIBE, topicURI);
// 	}
// 
// 	public SubscribeMessage(JsonParser jp) throws IOException {
// 		this(jp, null);
// 	}
// 
// 	public SubscribeMessage(JsonParser jp, WampSession wampSession) throws IOException {
// 		super(WampMessageType.SUBSCRIBE);
// 
// 		if (jp.nextToken() != JsonToken.VALUE_STRING) {
// 			throw new IOException();
// 		}
// 		setTopicURI(replacePrefix(jp.getValueAsString(), wampSession));
// 	}
// 
// 	@Override
// 	public String toJson(JsonFactory jsonFactory) throws IOException {
// 		try (StringWriter sw = new StringWriter();
// 				JsonGenerator jg = jsonFactory.createGenerator(sw)) {
// 			jg.writeStartArray();
// 			jg.writeNumber(getTypeId());
// 			jg.writeString(getTopicURI());
// 			jg.writeEndArray();
// 			jg.close();
// 			return sw.toString();
// 		}
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return "SubscribeMessage [topicURI=" + getTopicURI() + "]";
// 	}
// 
// }
// 
// Path: src/main/java/ch/rasc/wampspring/message/UnsubscribeMessage.java
// public class UnsubscribeMessage extends PubSubMessage {
// 
// 	private boolean cleanup = false;
// 
// 	public UnsubscribeMessage(String topicURI) {
// 		super(WampMessageType.UNSUBSCRIBE, topicURI);
// 	}
// 
// 	public UnsubscribeMessage(JsonParser jp) throws IOException {
// 		this(jp, null);
// 	}
// 
// 	public UnsubscribeMessage(JsonParser jp, WampSession wampSession) throws IOException {
// 		super(WampMessageType.UNSUBSCRIBE);
// 		if (jp.nextToken() != JsonToken.VALUE_STRING) {
// 			throw new IOException();
// 		}
// 		setTopicURI(replacePrefix(jp.getValueAsString(), wampSession));
// 	}
// 
// 	/**
// 	 * Creates an internal unsubscribe message. The system creates this message when the
// 	 * WebSocket session ends and sends it to the subscribed message handlers for cleaning
// 	 * up
// 	 *
// 	 * @param sessionId the WebSocket session id
// 	 **/
// 	public static UnsubscribeMessage createCleanupMessage(WebSocketSession session) {
// 		UnsubscribeMessage msg = new UnsubscribeMessage("**");
// 
// 		msg.setWebSocketSessionId(session.getId());
// 		msg.setPrincipal(session.getPrincipal());
// 		msg.setWampSession(new WampSession(session));
// 
// 		msg.cleanup = true;
// 
// 		return msg;
// 	}
// 
// 	public boolean isCleanup() {
// 		return this.cleanup;
// 	}
// 
// 	@Override
// 	public String toJson(JsonFactory jsonFactory) throws IOException {
// 		try (StringWriter sw = new StringWriter();
// 				JsonGenerator jg = jsonFactory.createGenerator(sw)) {
// 			jg.writeStartArray();
// 			jg.writeNumber(getTypeId());
// 			jg.writeString(getTopicURI());
// 			jg.writeEndArray();
// 			jg.close();
// 			return sw.toString();
// 		}
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return "UnsubscribeMessage [topicURI=" + getTopicURI() + "]";
// 	}
// 
// }


import java.util.Set;
import ch.rasc.wampspring.message.PubSubMessage;
import ch.rasc.wampspring.message.SubscribeMessage;
import ch.rasc.wampspring.message.UnsubscribeMessage;
/**
 * Copyright 2002-2014 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package ch.rasc.wampspring.broker;



/**
 * @author Rossen Stoyanchev
 * @author Ralph Schaer
 */
public interface SubscriptionRegistry {

	/**
	 * Register a subscription represented by the given message.
	 * @param subscribeMessage the subscription request
	 */
	void registerSubscription(SubscribeMessage subscribeMessage);

	/**
	 * Unregister a subscription.
	 * @param unsubscribeMessage the request to unsubscribe
	 */
// Path: src/main/java/ch/rasc/wampspring/message/PubSubMessage.java
// public abstract class PubSubMessage extends WampMessage {
// 
// 	private String topicURI;
// 
// 	protected PubSubMessage(WampMessageType type) {
// 		super(type);
// 	}
// 
// 	public PubSubMessage(WampMessageType type, String topicURI) {
// 		super(type);
// 		this.topicURI = topicURI;
// 	}
// 
// 	public String getTopicURI() {
// 		return this.topicURI;
// 	}
// 
// 	protected void setTopicURI(String topicURI) {
// 		this.topicURI = topicURI;
// 	}
// 
// 	@Override
// 	public String getDestination() {
// 		return this.topicURI;
// 	}
// }
// 
// Path: src/main/java/ch/rasc/wampspring/message/SubscribeMessage.java
// public class SubscribeMessage extends PubSubMessage {
// 
// 	public SubscribeMessage(String topicURI) {
// 		super(WampMessageType.SUBSCRIBE, topicURI);
// 	}
// 
// 	public SubscribeMessage(JsonParser jp) throws IOException {
// 		this(jp, null);
// 	}
// 
// 	public SubscribeMessage(JsonParser jp, WampSession wampSession) throws IOException {
// 		super(WampMessageType.SUBSCRIBE);
// 
// 		if (jp.nextToken() != JsonToken.VALUE_STRING) {
// 			throw new IOException();
// 		}
// 		setTopicURI(replacePrefix(jp.getValueAsString(), wampSession));
// 	}
// 
// 	@Override
// 	public String toJson(JsonFactory jsonFactory) throws IOException {
// 		try (StringWriter sw = new StringWriter();
// 				JsonGenerator jg = jsonFactory.createGenerator(sw)) {
// 			jg.writeStartArray();
// 			jg.writeNumber(getTypeId());
// 			jg.writeString(getTopicURI());
// 			jg.writeEndArray();
// 			jg.close();
// 			return sw.toString();
// 		}
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return "SubscribeMessage [topicURI=" + getTopicURI() + "]";
// 	}
// 
// }
// 
// Path: src/main/java/ch/rasc/wampspring/message/UnsubscribeMessage.java
// public class UnsubscribeMessage extends PubSubMessage {
// 
// 	private boolean cleanup = false;
// 
// 	public UnsubscribeMessage(String topicURI) {
// 		super(WampMessageType.UNSUBSCRIBE, topicURI);
// 	}
// 
// 	public UnsubscribeMessage(JsonParser jp) throws IOException {
// 		this(jp, null);
// 	}
// 
// 	public UnsubscribeMessage(JsonParser jp, WampSession wampSession) throws IOException {
// 		super(WampMessageType.UNSUBSCRIBE);
// 		if (jp.nextToken() != JsonToken.VALUE_STRING) {
// 			throw new IOException();
// 		}
// 		setTopicURI(replacePrefix(jp.getValueAsString(), wampSession));
// 	}
// 
// 	/**
// 	 * Creates an internal unsubscribe message. The system creates this message when the
// 	 * WebSocket session ends and sends it to the subscribed message handlers for cleaning
// 	 * up
// 	 *
// 	 * @param sessionId the WebSocket session id
// 	 **/
// 	public static UnsubscribeMessage createCleanupMessage(WebSocketSession session) {
// 		UnsubscribeMessage msg = new UnsubscribeMessage("**");
// 
// 		msg.setWebSocketSessionId(session.getId());
// 		msg.setPrincipal(session.getPrincipal());
// 		msg.setWampSession(new WampSession(session));
// 
// 		msg.cleanup = true;
// 
// 		return msg;
// 	}
// 
// 	public boolean isCleanup() {
// 		return this.cleanup;
// 	}
// 
// 	@Override
// 	public String toJson(JsonFactory jsonFactory) throws IOException {
// 		try (StringWriter sw = new StringWriter();
// 				JsonGenerator jg = jsonFactory.createGenerator(sw)) {
// 			jg.writeStartArray();
// 			jg.writeNumber(getTypeId());
// 			jg.writeString(getTopicURI());
// 			jg.writeEndArray();
// 			jg.close();
// 			return sw.toString();
// 		}
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return "UnsubscribeMessage [topicURI=" + getTopicURI() + "]";
// 	}
// 
// }


// Path: src/main/java/ch/rasc/wampspring/broker/SubscriptionRegistry.java
import java.util.Set;
import ch.rasc.wampspring.message.PubSubMessage;
import ch.rasc.wampspring.message.SubscribeMessage;
import ch.rasc.wampspring.message.UnsubscribeMessage;

/**
 * Copyright 2002-2014 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package ch.rasc.wampspring.broker;



/**
 * @author Rossen Stoyanchev
 * @author Ralph Schaer
 */
public interface SubscriptionRegistry {

	/**
	 * Register a subscription represented by the given message.
	 * @param subscribeMessage the subscription request
	 */
	void registerSubscription(SubscribeMessage subscribeMessage);

	/**
	 * Unregister a subscription.
	 * @param unsubscribeMessage the request to unsubscribe
	 */
	void unregisterSubscription(UnsubscribeMessage unsubscribeMessage);