1 /*
2  * Copyright 2002-2017 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 module hunt.stomp.simp.config.AbstractBrokerRegistration;
18 
19 import hunt.stomp.MessageChannel;
20 
21 import hunt.stomp.simp.broker.AbstractBrokerMessageHandler;
22 
23 
24 /**
25  * Base class for message broker registration classes.
26  *
27  * @author Rossen Stoyanchev
28  * @since 4.0
29  */
30 abstract class AbstractBrokerRegistration {
31 
32 	private SubscribableChannel clientInboundChannel;
33 
34 	private MessageChannel clientOutboundChannel;
35 
36 	private string[] destinationPrefixes;
37 
38 
39 	this(SubscribableChannel clientInboundChannel,
40 			MessageChannel clientOutboundChannel, string[] destinationPrefixes) {
41 
42 		assert(clientOutboundChannel, "'clientInboundChannel' must not be null");
43 		assert(clientOutboundChannel, "'clientOutboundChannel' must not be null");
44 
45 		this.clientInboundChannel = clientInboundChannel;
46 		this.clientOutboundChannel = clientOutboundChannel;
47 
48 		this.destinationPrefixes = (destinationPrefixes !is null ?
49 				destinationPrefixes : []);
50 	}
51 
52 
53 	protected SubscribableChannel getClientInboundChannel() {
54 		return this.clientInboundChannel;
55 	}
56 
57 	protected MessageChannel getClientOutboundChannel() {
58 		return this.clientOutboundChannel;
59 	}
60 
61 	protected string[] getDestinationPrefixes() {
62 		return this.destinationPrefixes;
63 	}
64 
65 
66 	protected abstract AbstractBrokerMessageHandler 
67 		getMessageHandler(SubscribableChannel brokerChannel);
68 
69 }