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.core.BeanFactoryMessageChannelDestinationResolver; 18 19 import hunt.stomp.core.DestinationResolver; 20 21 // import hunt.framework.beans.BeansException; 22 // import hunt.framework.beans.factory.BeanFactory; 23 // import hunt.framework.beans.factory.BeanFactoryAware; 24 25 import hunt.stomp.MessageChannel; 26 27 28 /** 29 * An implementation of {@link DestinationResolver} that interprets a destination 30 * name as the bean name of a {@link MessageChannel} and looks up the bean in 31 * the configured {@link BeanFactory}. 32 * 33 * @author Mark Fisher 34 * @since 4.0 35 */ 36 class BeanFactoryMessageChannelDestinationResolver(T) 37 : DestinationResolver!(MessageChannel!(T)) { // , BeanFactoryAware 38 39 // private BeanFactory beanFactory; 40 41 42 // /** 43 // * A default constructor that can be used when the resolver itself is configured 44 // * as a Spring bean and will have the {@code BeanFactory} injected as a result 45 // * of ing having implemented {@link BeanFactoryAware}. 46 // */ 47 // BeanFactoryMessageChannelDestinationResolver() { 48 // } 49 50 // /** 51 // * A constructor that accepts a {@link BeanFactory} useful if instantiating this 52 // * resolver manually rather than having it defined as a Spring-managed bean. 53 // * @param beanFactory the bean factory to perform lookups against 54 // */ 55 // BeanFactoryMessageChannelDestinationResolver(BeanFactory beanFactory) { 56 // assert(beanFactory, "beanFactory must not be null"); 57 // this.beanFactory = beanFactory; 58 // } 59 60 61 // override 62 // void setBeanFactory(BeanFactory beanFactory) { 63 // this.beanFactory = beanFactory; 64 // } 65 66 67 // override 68 // MessageChannel resolveDestination(string name) { 69 // assert(this.beanFactory !is null, "No BeanFactory configured"); 70 // try { 71 // return this.beanFactory.getBean(name, MessageChannel.class); 72 // } 73 // catch (BeansException ex) { 74 // throw new DestinationResolutionException( 75 // "Failed to find MessageChannel bean with name '" ~ name ~ "'", ex); 76 // } 77 // } 78 79 }