001/** 002 * Copyright 2010-2014 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.common.util.spring.service; 017 018import java.util.List; 019import java.util.Map; 020 021import org.kuali.common.util.CollectionUtils; 022 023public class SpringContext { 024 025 public SpringContext(Map<String, Object> beans, Class<?> annotatedClass) { 026 this(beans, CollectionUtils.asList(annotatedClass), (String) null); 027 } 028 029 public SpringContext(Map<String, Object> beans, Class<?> annotatedClass, String activeProfile) { 030 this(beans, CollectionUtils.asList(annotatedClass), null, CollectionUtils.toEmptyList(activeProfile)); 031 } 032 033 public SpringContext(Map<String, Object> beans, List<Class<?>> annotatedClasses, String activeProfile) { 034 this(beans, annotatedClasses, null, CollectionUtils.toEmptyList(activeProfile)); 035 } 036 037 public SpringContext(PropertySourceContext propertySourceContext) { 038 this((Class<?>) null, propertySourceContext); 039 } 040 041 public SpringContext() { 042 this((Class<?>) null); 043 } 044 045 public SpringContext(Class<?> annotatedClass) { 046 this(CollectionUtils.asList(annotatedClass)); 047 } 048 049 public SpringContext(Class<?> annotatedClass, PropertySourceContext propertySourceContext) { 050 this(CollectionUtils.asList(annotatedClass), propertySourceContext); 051 } 052 053 public SpringContext(List<Class<?>> annotatedClasses) { 054 this(annotatedClasses, null); 055 } 056 057 public SpringContext(List<Class<?>> annotatedClasses, PropertySourceContext propertySourceContext) { 058 this(null, annotatedClasses, propertySourceContext); 059 } 060 061 public SpringContext(Map<String, Object> contextBeans, List<Class<?>> annotatedClasses, PropertySourceContext propertySourceContext) { 062 this(contextBeans, annotatedClasses, propertySourceContext, null); 063 } 064 065 public SpringContext(Map<String, Object> contextBeans, List<Class<?>> annotatedClasses, PropertySourceContext propertySourceContext, List<String> activeProfiles) { 066 this.contextBeans = contextBeans; 067 this.annotatedClasses = annotatedClasses; 068 this.propertySourceContext = propertySourceContext; 069 this.activeProfiles = activeProfiles; 070 } 071 072 String id; 073 String displayName; 074 List<String> locations; 075 List<Class<?>> annotatedClasses; 076 Map<String, Object> contextBeans; 077 PropertySourceContext propertySourceContext; 078 List<String> activeProfiles; 079 List<String> defaultProfiles; 080 081 @Deprecated 082 List<String> beanNames; 083 084 @Deprecated 085 List<Object> beans; 086 087 public List<String> getLocations() { 088 return locations; 089 } 090 091 public void setLocations(List<String> locations) { 092 this.locations = locations; 093 } 094 095 public List<Class<?>> getAnnotatedClasses() { 096 return annotatedClasses; 097 } 098 099 public void setAnnotatedClasses(List<Class<?>> annotatedClasses) { 100 this.annotatedClasses = annotatedClasses; 101 } 102 103 @Deprecated 104 public List<String> getBeanNames() { 105 return beanNames; 106 } 107 108 @Deprecated 109 public void setBeanNames(List<String> beanNames) { 110 this.beanNames = beanNames; 111 } 112 113 @Deprecated 114 public List<Object> getBeans() { 115 return beans; 116 } 117 118 @Deprecated 119 public void setBeans(List<Object> beans) { 120 this.beans = beans; 121 } 122 123 public PropertySourceContext getPropertySourceContext() { 124 return propertySourceContext; 125 } 126 127 public void setPropertySourceContext(PropertySourceContext propertySourceContext) { 128 this.propertySourceContext = propertySourceContext; 129 } 130 131 public String getId() { 132 return id; 133 } 134 135 public void setId(String id) { 136 this.id = id; 137 } 138 139 public String getDisplayName() { 140 return displayName; 141 } 142 143 public void setDisplayName(String displayName) { 144 this.displayName = displayName; 145 } 146 147 public List<String> getActiveProfiles() { 148 return activeProfiles; 149 } 150 151 public void setActiveProfiles(List<String> activeProfiles) { 152 this.activeProfiles = activeProfiles; 153 } 154 155 public List<String> getDefaultProfiles() { 156 return defaultProfiles; 157 } 158 159 public void setDefaultProfiles(List<String> defaultProfiles) { 160 this.defaultProfiles = defaultProfiles; 161 } 162 163 public Map<String, Object> getContextBeans() { 164 return contextBeans; 165 } 166 167 public void setContextBeans(Map<String, Object> contextBeans) { 168 this.contextBeans = contextBeans; 169 } 170 171}