1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package org.identityconnectors.framework.impl.api;
24
25 import java.util.HashMap;
26 import java.util.Map;
27 import java.util.Set;
28
29 import org.identityconnectors.common.CollectionUtil;
30 import org.identityconnectors.common.pooling.ObjectPoolConfiguration;
31 import org.identityconnectors.framework.api.APIConfiguration;
32 import org.identityconnectors.framework.api.ResultsHandlerConfiguration;
33 import org.identityconnectors.framework.api.operations.APIOperation;
34
35
36 public class APIConfigurationImpl implements APIConfiguration {
37
38
39
40
41
42
43
44 private ObjectPoolConfiguration _connectorPoolConfiguration;
45
46 private ResultsHandlerConfiguration _resultsHandlerConfiguration;
47
48 private boolean _isConnectorPoolingSupported;
49
50 private ConfigurationPropertiesImpl _configurationProperties;
51
52
53
54
55 private int _bufferSize = 100;
56
57
58
59
60 private Map<Class<? extends APIOperation>, Integer> _timeoutMap
61 = new HashMap<Class<? extends APIOperation>, Integer>();
62
63
64
65
66 private Set<Class<? extends APIOperation>> _supportedOperations;
67
68
69
70
71
72
73 private transient AbstractConnectorInfo _connectorInfo;
74
75
76
77
78
79
80 public AbstractConnectorInfo getConnectorInfo() {
81 return _connectorInfo;
82 }
83
84 public void setConnectorInfo(AbstractConnectorInfo connectorInfo) {
85 _connectorInfo = connectorInfo;
86 }
87
88 public void setConnectorPoolingSupported(boolean supported) {
89 _isConnectorPoolingSupported = supported;
90 }
91
92 public void setConnectorPoolConfiguration(ObjectPoolConfiguration config) {
93 _connectorPoolConfiguration = config;
94 }
95
96 public void setConfigurationProperties(ConfigurationPropertiesImpl properties) {
97 if (_configurationProperties != null) {
98 _configurationProperties.setParent(null);
99 }
100 _configurationProperties = properties;
101 if (_configurationProperties != null) {
102 _configurationProperties.setParent(this);
103 }
104 }
105
106
107 public Map<Class<? extends APIOperation>, Integer> getTimeoutMap() {
108 return _timeoutMap;
109 }
110
111 public void setTimeoutMap(Map<Class<? extends APIOperation>, Integer> map) {
112 _timeoutMap = map;
113 }
114
115 public void setSupportedOperations(Set<Class<? extends APIOperation>> op) {
116 _supportedOperations = op;
117 }
118
119
120
121
122
123
124
125
126
127 public boolean isConnectorPoolingSupported() {
128 return _isConnectorPoolingSupported;
129 }
130
131
132
133
134 public ObjectPoolConfiguration getConnectorPoolConfiguration() {
135 if (_connectorPoolConfiguration == null) {
136 _connectorPoolConfiguration = new ObjectPoolConfiguration();
137 }
138 return _connectorPoolConfiguration;
139 }
140
141
142
143
144 public ConfigurationPropertiesImpl getConfigurationProperties() {
145 return _configurationProperties;
146 }
147
148
149
150
151 public int getTimeout(Class<? extends APIOperation> operation) {
152 Integer ret = this._timeoutMap.get(operation);
153 if (ret == null) {
154
155 ret = APIOperation.NO_TIMEOUT;
156 }
157 return ret;
158 }
159
160
161
162
163 public Set<Class<? extends APIOperation>> getSupportedOperations() {
164 return CollectionUtil.newReadOnlySet(_supportedOperations);
165 }
166
167
168
169
170 public void setTimeout(Class<? extends APIOperation> operation,
171 int timeout) {
172 this._timeoutMap.put(operation, timeout);
173 }
174
175
176
177
178 public void setProducerBufferSize(int size) {
179 this._bufferSize = size;
180 }
181
182
183
184
185 public int getProducerBufferSize() {
186 return this._bufferSize;
187 }
188
189
190
191
192 public ResultsHandlerConfiguration getResultsHandlerConfiguration() {
193 if (null == _resultsHandlerConfiguration) {
194 _resultsHandlerConfiguration = new ResultsHandlerConfiguration();
195 }
196 return _resultsHandlerConfiguration;
197 }
198
199 public void setResultsHandlerConfiguration(ResultsHandlerConfiguration config) {
200 this._resultsHandlerConfiguration = config;
201 }
202 }