88import io .javaoperatorsdk .operator .processing .event .source .controller .ResourceEventFilter ;
99
1010public class DefaultControllerConfiguration <R extends HasMetadata >
11+ extends DefaultResourceConfiguration <R >
1112 implements ControllerConfiguration <R > {
1213
1314 private final String associatedControllerClassName ;
1415 private final String name ;
1516 private final String crdName ;
1617 private final String finalizer ;
1718 private final boolean generationAware ;
18- private final Set <String > namespaces ;
19- private final boolean watchAllNamespaces ;
2019 private final RetryConfiguration retryConfiguration ;
21- private final String labelSelector ;
2220 private final ResourceEventFilter <R > resourceEventFilter ;
23- private final Class <R > resourceClass ;
2421 private final List <DependentResource > dependents ;
25- private ConfigurationService service ;
2622
2723 // NOSONAR constructor is meant to provide all information
2824 public DefaultControllerConfiguration (
@@ -38,23 +34,18 @@ public DefaultControllerConfiguration(
3834 Class <R > resourceClass ,
3935 ConfigurationService service ,
4036 List <DependentResource > dependents ) {
37+ super (labelSelector , resourceClass , namespaces );
4138 this .associatedControllerClassName = associatedControllerClassName ;
4239 this .name = name ;
4340 this .crdName = crdName ;
4441 this .finalizer = finalizer ;
4542 this .generationAware = generationAware ;
46- this .namespaces =
47- namespaces != null ? Collections .unmodifiableSet (namespaces ) : Collections .emptySet ();
48- this .watchAllNamespaces = this .namespaces .isEmpty ();
4943 this .retryConfiguration =
5044 retryConfiguration == null
5145 ? ControllerConfiguration .super .getRetryConfiguration ()
5246 : retryConfiguration ;
53- this .labelSelector = labelSelector ;
5447 this .resourceEventFilter = resourceEventFilter ;
55- this .resourceClass =
56- resourceClass == null ? ControllerConfiguration .super .getResourceClass ()
57- : resourceClass ;
48+
5849 setConfigurationService (service );
5950 this .dependents = dependents != null ? dependents : Collections .emptyList ();
6051 }
@@ -84,43 +75,19 @@ public String getAssociatedReconcilerClassName() {
8475 return associatedControllerClassName ;
8576 }
8677
87- @ Override
88- public Set <String > getNamespaces () {
89- return namespaces ;
90- }
91-
92- @ Override
93- public boolean watchAllNamespaces () {
94- return watchAllNamespaces ;
95- }
96-
9778 @ Override
9879 public RetryConfiguration getRetryConfiguration () {
9980 return retryConfiguration ;
10081 }
10182
102- @ Override
103- public ConfigurationService getConfigurationService () {
104- return service ;
105- }
10683
10784 @ Override
10885 public void setConfigurationService (ConfigurationService service ) {
109- if (this . service != null ) {
86+ if (getConfigurationService () != null ) {
11087 throw new IllegalStateException ("A ConfigurationService is already associated with '" + name
11188 + "' ControllerConfiguration. Cannot change it once set!" );
11289 }
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 );
12491 }
12592
12693 @ Override
0 commit comments