|
1 | 1 | package io.javaoperatorsdk.operator.api.config;
|
2 | 2 |
|
3 |
| -import java.util.Collections; |
4 |
| -import java.util.Set; |
5 |
| - |
6 | 3 | import io.fabric8.kubernetes.client.CustomResource;
|
| 4 | +import java.util.Set; |
7 | 5 |
|
| 6 | +/** |
| 7 | + * @deprecated use {@link DefaultControllerConfiguration} instead |
| 8 | + * @param <R> |
| 9 | + */ |
| 10 | +@Deprecated |
8 | 11 | public class AbstractControllerConfiguration<R extends CustomResource<?, ?>>
|
9 |
| - implements ControllerConfiguration<R> { |
10 |
| - |
11 |
| - private final String associatedControllerClassName; |
12 |
| - private final String name; |
13 |
| - private final String crdName; |
14 |
| - private final String finalizer; |
15 |
| - private final boolean generationAware; |
16 |
| - private final Set<String> namespaces; |
17 |
| - private final boolean watchAllNamespaces; |
18 |
| - private final RetryConfiguration retryConfiguration; |
19 |
| - private final String labelSelector; |
20 |
| - private Class<R> customResourceClass; |
21 |
| - private ConfigurationService service; |
22 |
| - |
23 |
| - public AbstractControllerConfiguration( |
24 |
| - String associatedControllerClassName, |
25 |
| - String name, |
26 |
| - String crdName, |
27 |
| - String finalizer, |
28 |
| - boolean generationAware, |
29 |
| - Set<String> namespaces, |
30 |
| - RetryConfiguration retryConfiguration, |
31 |
| - String labelSelector, |
32 |
| - Class<R> customResourceClass, |
33 |
| - ConfigurationService service) { |
34 |
| - this.associatedControllerClassName = associatedControllerClassName; |
35 |
| - this.name = name; |
36 |
| - this.crdName = crdName; |
37 |
| - this.finalizer = finalizer; |
38 |
| - this.generationAware = generationAware; |
39 |
| - this.namespaces = |
40 |
| - namespaces != null ? Collections.unmodifiableSet(namespaces) : Collections.emptySet(); |
41 |
| - this.watchAllNamespaces = this.namespaces.isEmpty(); |
42 |
| - this.retryConfiguration = |
43 |
| - retryConfiguration == null |
44 |
| - ? ControllerConfiguration.super.getRetryConfiguration() |
45 |
| - : retryConfiguration; |
46 |
| - this.labelSelector = labelSelector; |
47 |
| - this.customResourceClass = |
48 |
| - customResourceClass == null ? ControllerConfiguration.super.getCustomResourceClass() |
49 |
| - : customResourceClass; |
50 |
| - setConfigurationService(service); |
51 |
| - } |
| 12 | + extends DefaultControllerConfiguration<R> { |
52 | 13 |
|
53 |
| - /** |
54 |
| - * @deprecated use |
55 |
| - * {@link #AbstractControllerConfiguration(String, String, String, String, boolean, Set, RetryConfiguration, String, Class, ConfigurationService)} |
56 |
| - * instead |
57 |
| - */ |
58 | 14 | @Deprecated
|
59 |
| - public AbstractControllerConfiguration( |
60 |
| - String associatedControllerClassName, |
61 |
| - String name, |
62 |
| - String crdName, |
63 |
| - String finalizer, |
64 |
| - boolean generationAware, |
| 15 | + public AbstractControllerConfiguration(String associatedControllerClassName, String name, |
| 16 | + String crdName, String finalizer, boolean generationAware, |
65 | 17 | Set<String> namespaces,
|
66 | 18 | RetryConfiguration retryConfiguration) {
|
67 |
| - this(associatedControllerClassName, name, crdName, finalizer, generationAware, namespaces, |
68 |
| - retryConfiguration, null, null, null); |
69 |
| - } |
70 |
| - |
71 |
| - @Override |
72 |
| - public String getName() { |
73 |
| - return name; |
74 |
| - } |
75 |
| - |
76 |
| - @Override |
77 |
| - public String getCRDName() { |
78 |
| - return crdName; |
79 |
| - } |
80 |
| - |
81 |
| - @Override |
82 |
| - public String getFinalizer() { |
83 |
| - return finalizer; |
84 |
| - } |
85 |
| - |
86 |
| - @Override |
87 |
| - public boolean isGenerationAware() { |
88 |
| - return generationAware; |
| 19 | + super(associatedControllerClassName, name, crdName, finalizer, generationAware, namespaces, |
| 20 | + retryConfiguration); |
89 | 21 | }
|
90 | 22 |
|
91 |
| - @Override |
92 |
| - public String getAssociatedControllerClassName() { |
93 |
| - return associatedControllerClassName; |
94 |
| - } |
95 |
| - |
96 |
| - @Override |
97 |
| - public Set<String> getNamespaces() { |
98 |
| - return namespaces; |
99 |
| - } |
100 |
| - |
101 |
| - @Override |
102 |
| - public boolean watchAllNamespaces() { |
103 |
| - return watchAllNamespaces; |
104 |
| - } |
105 |
| - |
106 |
| - @Override |
107 |
| - public RetryConfiguration getRetryConfiguration() { |
108 |
| - return retryConfiguration; |
109 |
| - } |
110 |
| - |
111 |
| - @Override |
112 |
| - public ConfigurationService getConfigurationService() { |
113 |
| - return service; |
114 |
| - } |
115 |
| - |
116 |
| - @Override |
117 |
| - public void setConfigurationService(ConfigurationService service) { |
118 |
| - if (this.service != null) { |
119 |
| - throw new RuntimeException("A ConfigurationService is already associated with '" + name |
120 |
| - + "' ControllerConfiguration. Cannot change it once set!"); |
121 |
| - } |
122 |
| - this.service = service; |
123 |
| - } |
124 |
| - |
125 |
| - @Override |
126 |
| - public String getLabelSelector() { |
127 |
| - return labelSelector; |
128 |
| - } |
129 |
| - |
130 |
| - @Override |
131 |
| - public Class<R> getCustomResourceClass() { |
132 |
| - return customResourceClass; |
| 23 | + public AbstractControllerConfiguration(String associatedControllerClassName, String name, |
| 24 | + String crdName, String finalizer, boolean generationAware, |
| 25 | + Set<String> namespaces, |
| 26 | + RetryConfiguration retryConfiguration, String labelSelector, |
| 27 | + Class<R> customResourceClass, |
| 28 | + ConfigurationService service) { |
| 29 | + super(associatedControllerClassName, name, crdName, finalizer, generationAware, namespaces, |
| 30 | + retryConfiguration, labelSelector, customResourceClass, service); |
133 | 31 | }
|
134 | 32 | }
|
0 commit comments