001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.messaging.async;
016    
017    import java.util.Map;
018    
019    /**
020     * @author Shuyang Zhou
021     */
022    public class AsyncAdviceConfigurator {
023    
024            public void afterPropertiesSet() {
025                    if (_asyncAdvice == null) {
026                            throw new IllegalArgumentException("Async advice is null");
027                    }
028    
029                    if (_defaultDestinationName == null) {
030                            throw new IllegalArgumentException(
031                                    "Default destination name is null");
032                    }
033    
034                    _asyncAdvice.setDefaultDestinationName(_defaultDestinationName);
035    
036                    if (_destinationNames != null) {
037                            _asyncAdvice.setDestinationNames(_destinationNames);
038                    }
039            }
040    
041            public void setAsyncAdvice(AsyncAdvice asyncAdvice) {
042                    _asyncAdvice = asyncAdvice;
043            }
044    
045            public void setDefaultDestinationName(String defaultDestinationName) {
046                    _defaultDestinationName = defaultDestinationName;
047            }
048    
049            public void setDestinationNames(Map<Class<?>, String> destinationNames) {
050                    _destinationNames = destinationNames;
051            }
052    
053            private AsyncAdvice _asyncAdvice;
054            private String _defaultDestinationName;
055            private Map<Class<?>, String> _destinationNames;
056    
057    }