8
8
import io .javaoperatorsdk .operator .processing .event .source .controller .ResourceEventFilter ;
9
9
10
10
public class DefaultControllerConfiguration <R extends HasMetadata >
11
+ extends DefaultResourceConfiguration <R >
11
12
implements ControllerConfiguration <R > {
12
13
13
14
private final String associatedControllerClassName ;
14
15
private final String name ;
15
16
private final String crdName ;
16
17
private final String finalizer ;
17
18
private final boolean generationAware ;
18
- private final Set <String > namespaces ;
19
- private final boolean watchAllNamespaces ;
20
19
private final RetryConfiguration retryConfiguration ;
21
- private final String labelSelector ;
22
20
private final ResourceEventFilter <R > resourceEventFilter ;
23
- private final Class <R > resourceClass ;
24
21
private final List <DependentResource > dependents ;
25
- private ConfigurationService service ;
26
22
27
23
// NOSONAR constructor is meant to provide all information
28
24
public DefaultControllerConfiguration (
@@ -38,23 +34,18 @@ public DefaultControllerConfiguration(
38
34
Class <R > resourceClass ,
39
35
ConfigurationService service ,
40
36
List <DependentResource > dependents ) {
37
+ super (labelSelector , resourceClass , namespaces );
41
38
this .associatedControllerClassName = associatedControllerClassName ;
42
39
this .name = name ;
43
40
this .crdName = crdName ;
44
41
this .finalizer = finalizer ;
45
42
this .generationAware = generationAware ;
46
- this .namespaces =
47
- namespaces != null ? Collections .unmodifiableSet (namespaces ) : Collections .emptySet ();
48
- this .watchAllNamespaces = this .namespaces .isEmpty ();
49
43
this .retryConfiguration =
50
44
retryConfiguration == null
51
45
? ControllerConfiguration .super .getRetryConfiguration ()
52
46
: retryConfiguration ;
53
- this .labelSelector = labelSelector ;
54
47
this .resourceEventFilter = resourceEventFilter ;
55
- this .resourceClass =
56
- resourceClass == null ? ControllerConfiguration .super .getResourceClass ()
57
- : resourceClass ;
48
+
58
49
setConfigurationService (service );
59
50
this .dependents = dependents != null ? dependents : Collections .emptyList ();
60
51
}
@@ -84,43 +75,19 @@ public String getAssociatedReconcilerClassName() {
84
75
return associatedControllerClassName ;
85
76
}
86
77
87
- @ Override
88
- public Set <String > getNamespaces () {
89
- return namespaces ;
90
- }
91
-
92
- @ Override
93
- public boolean watchAllNamespaces () {
94
- return watchAllNamespaces ;
95
- }
96
-
97
78
@ Override
98
79
public RetryConfiguration getRetryConfiguration () {
99
80
return retryConfiguration ;
100
81
}
101
82
102
- @ Override
103
- public ConfigurationService getConfigurationService () {
104
- return service ;
105
- }
106
83
107
84
@ Override
108
85
public void setConfigurationService (ConfigurationService service ) {
109
- if (this . service != null ) {
86
+ if (getConfigurationService () != null ) {
110
87
throw new IllegalStateException ("A ConfigurationService is already associated with '" + name
111
88
+ "' ControllerConfiguration. Cannot change it once set!" );
112
89
}
113
- this .service = service ;
114
- }
115
-
116
- @ Override
117
- public String getLabelSelector () {
118
- return labelSelector ;
119
- }
120
-
121
- @ Override
122
- public Class <R > getResourceClass () {
123
- return resourceClass ;
90
+ super .setConfigurationService (service );
124
91
}
125
92
126
93
@ Override
0 commit comments