1 /*
2  * Copyright 2002-2018 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.ChannelRegistration;
18 
19 
20 import hunt.stomp.support.ChannelInterceptor;
21 // import hunt.framework.scheduling.concurrent.ThreadPoolTaskExecutor;
22 
23 /**
24  * A registration class for customizing the configuration for a
25  * {@link hunt.stomp.MessageChannel}.
26  *
27  * @author Rossen Stoyanchev
28  * @since 4.0
29  */
30 class ChannelRegistration {
31 	
32 	// private TaskExecutorRegistration registration;
33 
34 	private ChannelInterceptor[] interceptors;
35 
36 
37 	/**
38 	 * Configure the thread pool backing this message channel.
39 	 */
40 	// TaskExecutorRegistration taskExecutor() {
41 	// 	return taskExecutor(null);
42 	// }
43 
44 	/**
45 	 * Configure the thread pool backing this message channel using a custom
46 	 * ThreadPoolTaskExecutor.
47 	 * @param taskExecutor the executor to use (or {@code null} for a default executor)
48 	 */
49 	// TaskExecutorRegistration taskExecutor(ThreadPoolTaskExecutor taskExecutor) {
50 	// 	if (this.registration is null) {
51 	// 		this.registration = (taskExecutor !is null ? new TaskExecutorRegistration(taskExecutor) :
52 	// 				new TaskExecutorRegistration());
53 	// 	}
54 	// 	return this.registration;
55 	// }
56 
57 	/**
58 	 * Configure the given interceptors for this message channel,
59 	 * adding them to the channel's current list of interceptors.
60 	 * @since 4.3.12
61 	 */
62 	ChannelRegistration addInterceptors(ChannelInterceptor[] interceptors... ) {
63 		this.interceptors ~= interceptors.dup;
64 		return this;
65 	}
66 
67 	/**
68 	 * Configure interceptors for the message channel.
69 	 * @deprecated as of 4.3.12, in favor of {@link #interceptors(ChannelInterceptor...)}
70 	 */
71 	// @Deprecated
72 	// ChannelRegistration setInterceptors(ChannelInterceptor[] interceptors... ) {
73 	// 	if (interceptors !is null) {
74 	// 		this.interceptors ~= interceptors;
75 	// 	}
76 	// 	return this;
77 	// }
78 
79 
80 	bool hasTaskExecutor() {
81 		// return (this.registration !is null);
82 		return false;
83 	}
84 
85 	bool hasInterceptors() {
86 		return !this.interceptors.length > 0;
87 	}
88 
89 	ChannelInterceptor[] getInterceptors() {
90 		return this.interceptors;
91 	}
92 
93 }