11package io .javaoperatorsdk .operator .api .config ;
22
3- import java .util .Collections ;
43import java .util .Set ;
54
65import io .fabric8 .kubernetes .api .model .HasMetadata ;
76import io .javaoperatorsdk .operator .processing .event .source .ResourceEventFilter ;
87
98public class DefaultControllerConfiguration <R extends HasMetadata >
9+ extends DefaultResourceConfiguration <R , ControllerConfiguration <R >>
1010 implements ControllerConfiguration <R > {
1111
1212 private final String associatedControllerClassName ;
1313 private final String name ;
14- private final String crdName ;
1514 private final String finalizer ;
16- private final boolean generationAware ;
17- private final Set <String > namespaces ;
18- private final boolean watchAllNamespaces ;
1915 private final RetryConfiguration retryConfiguration ;
20- private final String labelSelector ;
2116 private final ResourceEventFilter <R , ControllerConfiguration <R >> resourceEventFilter ;
22- private final Class <R > resourceClass ;
23- private ConfigurationService service ;
17+ private final boolean generationAware ;
2418
2519 public DefaultControllerConfiguration (
2620 String associatedControllerClassName ,
2721 String name ,
28- String crdName ,
22+ String resourceName ,
2923 String finalizer ,
3024 boolean generationAware ,
3125 Set <String > namespaces ,
@@ -34,92 +28,50 @@ public DefaultControllerConfiguration(
3428 ResourceEventFilter <R , ControllerConfiguration <R >> resourceEventFilter ,
3529 Class <R > resourceClass ,
3630 ConfigurationService service ) {
31+ super (resourceName , resourceClass , namespaces , labelSelector , service );
3732 this .associatedControllerClassName = associatedControllerClassName ;
3833 this .name = name ;
39- this .crdName = crdName ;
4034 this .finalizer = finalizer ;
4135 this .generationAware = generationAware ;
42- this .namespaces =
43- namespaces != null ? Collections .unmodifiableSet (namespaces ) : Collections .emptySet ();
44- this .watchAllNamespaces = this .namespaces .isEmpty ();
4536 this .retryConfiguration =
4637 retryConfiguration == null
4738 ? ControllerConfiguration .super .getRetryConfiguration ()
4839 : retryConfiguration ;
49- this .labelSelector = labelSelector ;
5040 this .resourceEventFilter = resourceEventFilter ;
51- this .resourceClass =
52- resourceClass == null ? ControllerConfiguration .super .getResourceClass ()
53- : resourceClass ;
54- setConfigurationService (service );
5541 }
5642
5743 @ Override
5844 public String getName () {
5945 return name ;
6046 }
6147
62- @ Override
63- public String getResourceTypeName () {
64- return crdName ;
65- }
66-
6748 @ Override
6849 public String getFinalizer () {
6950 return finalizer ;
7051 }
7152
72- @ Override
73- public boolean isGenerationAware () {
74- return generationAware ;
75- }
76-
7753 @ Override
7854 public String getAssociatedReconcilerClassName () {
7955 return associatedControllerClassName ;
8056 }
8157
82- @ Override
83- public Set <String > getNamespaces () {
84- return namespaces ;
85- }
86-
87- @ Override
88- public boolean watchAllNamespaces () {
89- return watchAllNamespaces ;
90- }
91-
9258 @ Override
9359 public RetryConfiguration getRetryConfiguration () {
9460 return retryConfiguration ;
9561 }
9662
9763 @ Override
98- public ConfigurationService getConfigurationService () {
99- return service ;
100- }
101-
102- @ Override
103- public void setConfigurationService (ConfigurationService service ) {
104- if (this .service != null ) {
105- throw new RuntimeException ("A ConfigurationService is already associated with '" + name
106- + "' ControllerConfiguration. Cannot change it once set!" );
107- }
108- this .service = service ;
109- }
110-
111- @ Override
112- public String getLabelSelector () {
113- return labelSelector ;
64+ public boolean isGenerationAware () {
65+ return generationAware ;
11466 }
11567
11668 @ Override
117- public Class < R > getResourceClass () {
118- return resourceClass ;
69+ public ResourceEventFilter < R , ControllerConfiguration < R >> getEventFilter () {
70+ return resourceEventFilter ;
11971 }
12072
12173 @ Override
122- public ResourceEventFilter < R , ControllerConfiguration < R >> getEventFilter () {
123- return resourceEventFilter ;
74+ protected String identifierForException () {
75+ return "'" + name + "' ControllerConfiguration" ;
12476 }
12577}
0 commit comments