1111 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 See the License for the specific language governing permissions and
1313 limitations under the License. */
14- package com .predic8 .membrane .annot .yaml ;
14+ package com .predic8 .membrane .annot .beanregistry ;
1515
1616import com .fasterxml .jackson .databind .JsonNode ;
17- import com .predic8 .membrane .annot .*;
18- import com .predic8 .membrane .annot .bean .*;
19-
20- import java .util .*;
17+ import com .predic8 .membrane .annot .yaml .WatchAction ;
2118
2219import static com .predic8 .membrane .annot .yaml .WatchAction .*;
2320
@@ -29,19 +26,12 @@ public class BeanDefinition {
2926 private final String namespace ;
3027 private final String uid ;
3128 private final JsonNode node ;
32- private final WatchAction action ;
3329 private final String kind ;
3430
35- /**
36- * Constructed bean after initialization.
37- */
38- private Object bean ;
39-
4031 /**
4132 * Only called from K8S.
4233 */
43- private BeanDefinition (WatchAction action , JsonNode node ) {
44- this .action = action ;
34+ private BeanDefinition (JsonNode node ) {
4535 this .node = node ;
4636 JsonNode metadata = node .get ("metadata" );
4737 var kind2 = node .get ("kind" ).asText ();
@@ -55,8 +45,8 @@ private BeanDefinition(WatchAction action, JsonNode node) {
5545 uid = metadata .get ("uid" ).asText ();
5646 }
5747
58- public static BeanDefinition create4Kubernetes (WatchAction action , JsonNode node ) {
59- return new BeanDefinition (action , node );
48+ public static BeanDefinitionChanged create4Kubernetes (WatchAction action , JsonNode node ) {
49+ return new BeanDefinitionChanged (action , new BeanDefinition ( node ) );
6050 }
6151
6252 public BeanDefinition (String kind , String name , String namespace , String uid , JsonNode node ) {
@@ -65,17 +55,12 @@ public BeanDefinition(String kind, String name, String namespace, String uid, Js
6555 this .namespace = namespace ;
6656 this .uid = uid ;
6757 this .node = node ;
68- this .action = ADDED ;
6958 }
7059
7160 public JsonNode getNode () {
7261 return node ;
7362 }
7463
75- public WatchAction getAction () {
76- return action ;
77- }
78-
7964 public String getNamespace () {
8065 return namespace ;
8166 }
@@ -92,15 +77,6 @@ public String getKind() {
9277 return kind ;
9378 }
9479
95- public Object getBean () {
96- return bean ;
97- }
98-
99- // TODO: Rest is immutable - can we make this also?
100- public void setBean (Object bean ) {
101- this .bean = bean ;
102- }
103-
10480 public String getScope () {
10581 JsonNode meta = node .get ("metadata" );
10682 if (meta == null )
@@ -124,15 +100,4 @@ public boolean isPrototype() {
124100 return PROTOTYPE .equals (getScope ());
125101 }
126102
127- public boolean isDeleted () {
128- return action == DELETED ;
129- }
130-
131- public boolean isModified () {
132- return action == MODIFIED ;
133- }
134-
135- public boolean isAdded () {
136- return action == ADDED ;
137- }
138103}
0 commit comments