Remove DOMRpcRouterServices
[mdsal.git] / dom / mdsal-dom-broker / src / main / java / org / opendaylight / mdsal / dom / broker / DOMRpcRouter.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.mdsal.dom.broker;
9
10 import static com.google.common.base.Preconditions.checkArgument;
11 import static com.google.common.base.Verify.verifyNotNull;
12 import static java.util.Objects.requireNonNull;
13
14 import com.google.common.annotations.VisibleForTesting;
15 import com.google.common.collect.ClassToInstanceMap;
16 import com.google.common.collect.Collections2;
17 import com.google.common.collect.ImmutableClassToInstanceMap;
18 import com.google.common.collect.ImmutableList;
19 import com.google.common.collect.ImmutableSet;
20 import com.google.common.collect.ImmutableTable;
21 import com.google.common.collect.MapDifference;
22 import com.google.common.collect.MapDifference.ValueDifference;
23 import com.google.common.collect.Maps;
24 import com.google.common.collect.Sets;
25 import com.google.common.util.concurrent.Futures;
26 import com.google.common.util.concurrent.ListenableFuture;
27 import com.google.common.util.concurrent.ThreadFactoryBuilder;
28 import java.util.ArrayList;
29 import java.util.Collection;
30 import java.util.HashSet;
31 import java.util.List;
32 import java.util.Map;
33 import java.util.Map.Entry;
34 import java.util.Set;
35 import java.util.concurrent.ExecutorService;
36 import java.util.concurrent.Executors;
37 import java.util.concurrent.ThreadFactory;
38 import javax.annotation.PreDestroy;
39 import javax.inject.Inject;
40 import javax.inject.Singleton;
41 import org.checkerframework.checker.lock.qual.GuardedBy;
42 import org.eclipse.jdt.annotation.NonNull;
43 import org.eclipse.jdt.annotation.NonNullByDefault;
44 import org.opendaylight.mdsal.dom.api.DOMActionAvailabilityExtension;
45 import org.opendaylight.mdsal.dom.api.DOMActionAvailabilityExtension.AvailabilityListener;
46 import org.opendaylight.mdsal.dom.api.DOMActionImplementation;
47 import org.opendaylight.mdsal.dom.api.DOMActionInstance;
48 import org.opendaylight.mdsal.dom.api.DOMActionNotAvailableException;
49 import org.opendaylight.mdsal.dom.api.DOMActionProviderService;
50 import org.opendaylight.mdsal.dom.api.DOMActionResult;
51 import org.opendaylight.mdsal.dom.api.DOMActionService;
52 import org.opendaylight.mdsal.dom.api.DOMActionServiceExtension;
53 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
54 import org.opendaylight.mdsal.dom.api.DOMRpcAvailabilityListener;
55 import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier;
56 import org.opendaylight.mdsal.dom.api.DOMRpcImplementation;
57 import org.opendaylight.mdsal.dom.api.DOMRpcImplementationNotAvailableException;
58 import org.opendaylight.mdsal.dom.api.DOMRpcImplementationRegistration;
59 import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
60 import org.opendaylight.mdsal.dom.api.DOMRpcResult;
61 import org.opendaylight.mdsal.dom.api.DOMRpcService;
62 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
63 import org.opendaylight.mdsal.dom.spi.AbstractDOMRpcImplementationRegistration;
64 import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
65 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
66 import org.opendaylight.yangtools.concepts.AbstractRegistration;
67 import org.opendaylight.yangtools.concepts.ListenerRegistration;
68 import org.opendaylight.yangtools.concepts.ObjectRegistration;
69 import org.opendaylight.yangtools.concepts.Registration;
70 import org.opendaylight.yangtools.yang.common.QName;
71 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
72 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
73 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
74 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener;
75 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
76 import org.osgi.service.component.annotations.Activate;
77 import org.osgi.service.component.annotations.Component;
78 import org.osgi.service.component.annotations.Deactivate;
79 import org.osgi.service.component.annotations.Reference;
80 import org.slf4j.Logger;
81 import org.slf4j.LoggerFactory;
82
83 @Singleton
84 @Component(service = DOMRpcRouter.class)
85 public final class DOMRpcRouter extends AbstractRegistration implements EffectiveModelContextListener {
86     private static final Logger LOG = LoggerFactory.getLogger(DOMRpcRouter.class);
87     private static final ThreadFactory THREAD_FACTORY = new ThreadFactoryBuilder().setNameFormat(
88             "DOMRpcRouter-listener-%s").setDaemon(true).build();
89
90     private final ExecutorService listenerNotifier = Executors.newSingleThreadExecutor(THREAD_FACTORY);
91     private final @NonNull DOMActionProviderService actionProviderService = new ActionProviderServiceFacade();
92     private final @NonNull DOMActionService actionService = new ActionServiceFacade();
93     private final @NonNull DOMRpcProviderService rpcProviderService = new RpcProviderServiceFacade();
94     private final @NonNull DOMRpcService rpcService = new RpcServiceFacade();
95
96     @GuardedBy("this")
97     private ImmutableList<RegImpl<?>> listeners = ImmutableList.of();
98
99     @GuardedBy("this")
100     private ImmutableList<ActionRegistration<?>> actionListeners = ImmutableList.of();
101
102     private volatile DOMRpcRoutingTable routingTable = DOMRpcRoutingTable.EMPTY;
103
104     private volatile DOMActionRoutingTable actionRoutingTable = DOMActionRoutingTable.EMPTY;
105
106     private Registration listenerRegistration;
107
108     @Deprecated
109     @VisibleForTesting
110     // FIXME: 9.0.0: make this constructor package-private
111     public DOMRpcRouter() {
112
113     }
114
115     @Inject
116     @Activate
117     public DOMRpcRouter(@Reference final DOMSchemaService schemaService) {
118         listenerRegistration = schemaService.registerSchemaContextListener(this);
119         LOG.info("DOM RPC/Action router started");
120     }
121
122     @Deprecated(forRemoval = true)
123     public static DOMRpcRouter newInstance(final DOMSchemaService schemaService) {
124         return new DOMRpcRouter(schemaService);
125     }
126
127     @PreDestroy
128     @Deactivate
129     public void shutdown() {
130         close();
131     }
132
133     public @NonNull DOMActionService actionService() {
134         return actionService;
135     }
136
137     public @NonNull DOMActionProviderService actionProviderService() {
138         return actionProviderService;
139     }
140
141     public @NonNull DOMRpcService rpcService() {
142         return rpcService;
143     }
144
145     public @NonNull DOMRpcProviderService rpcProviderService() {
146         return rpcProviderService;
147     }
148
149     private synchronized void removeRpcImplementation(final DOMRpcImplementation implementation,
150             final Set<DOMRpcIdentifier> rpcs) {
151         final DOMRpcRoutingTable oldTable = routingTable;
152         final DOMRpcRoutingTable newTable = (DOMRpcRoutingTable) oldTable.remove(implementation, rpcs);
153         routingTable = newTable;
154
155         listenerNotifier.execute(() -> notifyRemoved(newTable, implementation));
156     }
157
158     private synchronized void removeRpcImplementations(
159             final ImmutableTable<QName, YangInstanceIdentifier, DOMRpcImplementation> implTable) {
160         final DOMRpcRoutingTable oldTable = routingTable;
161         final DOMRpcRoutingTable newTable = (DOMRpcRoutingTable) oldTable.removeAll(implTable);
162         routingTable = newTable;
163
164         listenerNotifier.execute(() -> notifyRemoved(newTable, implTable.values()));
165     }
166
167     private synchronized void removeActionImplementation(final DOMActionImplementation implementation,
168             final Set<DOMActionInstance> actions) {
169         final DOMActionRoutingTable oldTable = actionRoutingTable;
170         final DOMActionRoutingTable newTable = (DOMActionRoutingTable) oldTable.remove(implementation, actions);
171         actionRoutingTable = newTable;
172
173         listenerNotifier.execute(() -> notifyActionChanged(newTable, implementation));
174     }
175
176     private synchronized void removeListener(final ListenerRegistration<? extends DOMRpcAvailabilityListener> reg) {
177         listeners = ImmutableList.copyOf(Collections2.filter(listeners, input -> !reg.equals(input)));
178     }
179
180     private synchronized void removeActionListener(final ListenerRegistration<? extends AvailabilityListener> reg) {
181         actionListeners = ImmutableList.copyOf(Collections2.filter(actionListeners, input -> !reg.equals(input)));
182     }
183
184     private synchronized void notifyAdded(final DOMRpcRoutingTable newTable, final DOMRpcImplementation impl) {
185         for (RegImpl<?> l : listeners) {
186             l.addRpc(newTable, impl);
187         }
188     }
189
190     private synchronized void notifyAdded(final DOMRpcRoutingTable newTable,
191             final Collection<? extends DOMRpcImplementation> impls) {
192         for (RegImpl<?> l : listeners) {
193             for (DOMRpcImplementation impl : impls) {
194                 l.addRpc(newTable, impl);
195             }
196         }
197     }
198
199     private synchronized void notifyRemoved(final DOMRpcRoutingTable newTable, final DOMRpcImplementation impl) {
200         for (RegImpl<?> l : listeners) {
201             l.removeRpc(newTable, impl);
202         }
203     }
204
205     private synchronized void notifyRemoved(final DOMRpcRoutingTable newTable,
206             final Collection<? extends DOMRpcImplementation> impls) {
207         for (RegImpl<?> l : listeners) {
208             for (DOMRpcImplementation impl : impls) {
209                 l.removeRpc(newTable, impl);
210             }
211         }
212     }
213
214     private synchronized void notifyActionChanged(final DOMActionRoutingTable newTable,
215             final DOMActionImplementation impl) {
216         for (ActionRegistration<?> l : actionListeners) {
217             l.actionChanged(newTable, impl);
218         }
219     }
220
221     @Override
222     public synchronized void onModelContextUpdated(final EffectiveModelContext newModelContext) {
223         final DOMRpcRoutingTable oldTable = routingTable;
224         final DOMRpcRoutingTable newTable = (DOMRpcRoutingTable) oldTable.setSchemaContext(newModelContext);
225         routingTable = newTable;
226
227         final DOMActionRoutingTable oldActionTable = actionRoutingTable;
228         final DOMActionRoutingTable newActionTable =
229                 (DOMActionRoutingTable) oldActionTable.setSchemaContext(newModelContext);
230         actionRoutingTable = newActionTable;
231     }
232
233     @Override
234     protected void removeRegistration() {
235         if (listenerRegistration != null) {
236             listenerRegistration.close();
237             listenerRegistration = null;
238         }
239         listenerNotifier.shutdown();
240         LOG.info("DOM RPC/Action router stopped");
241     }
242
243     @VisibleForTesting
244     synchronized List<?> listeners() {
245         return listeners;
246     }
247
248     @VisibleForTesting
249     synchronized List<?> actionListeners() {
250         return actionListeners;
251     }
252
253     @VisibleForTesting
254     DOMRpcRoutingTable routingTable() {
255         return routingTable;
256     }
257
258     private static final class RegImpl<T extends DOMRpcAvailabilityListener> extends AbstractListenerRegistration<T> {
259         private Map<QName, Set<YangInstanceIdentifier>> prevRpcs;
260         private DOMRpcRouter router;
261
262         RegImpl(final DOMRpcRouter router, final T listener, final Map<QName, Set<YangInstanceIdentifier>> rpcs) {
263             super(listener);
264             this.router = requireNonNull(router);
265             prevRpcs = requireNonNull(rpcs);
266         }
267
268         @Override
269         protected void removeRegistration() {
270             router.removeListener(this);
271             router = null;
272         }
273
274         void initialTable() {
275             final List<DOMRpcIdentifier> added = new ArrayList<>();
276             for (Entry<QName, Set<YangInstanceIdentifier>> e : prevRpcs.entrySet()) {
277                 added.addAll(Collections2.transform(e.getValue(), i -> DOMRpcIdentifier.create(e.getKey(), i)));
278             }
279             if (!added.isEmpty()) {
280                 getInstance().onRpcAvailable(added);
281             }
282         }
283
284         void addRpc(final DOMRpcRoutingTable newTable, final DOMRpcImplementation impl) {
285             final T l = getInstance();
286             if (!l.acceptsImplementation(impl)) {
287                 return;
288             }
289
290             final Map<QName, Set<YangInstanceIdentifier>> rpcs = verifyNotNull(newTable.getOperations(l));
291             final MapDifference<QName, Set<YangInstanceIdentifier>> diff = Maps.difference(prevRpcs, rpcs);
292
293             final List<DOMRpcIdentifier> added = new ArrayList<>();
294             for (Entry<QName, Set<YangInstanceIdentifier>> e : diff.entriesOnlyOnRight().entrySet()) {
295                 added.addAll(Collections2.transform(e.getValue(), i -> DOMRpcIdentifier.create(e.getKey(), i)));
296             }
297             for (Entry<QName, ValueDifference<Set<YangInstanceIdentifier>>> e : diff.entriesDiffering().entrySet()) {
298                 for (YangInstanceIdentifier i : Sets.difference(e.getValue().rightValue(), e.getValue().leftValue())) {
299                     added.add(DOMRpcIdentifier.create(e.getKey(), i));
300                 }
301             }
302
303             prevRpcs = rpcs;
304             if (!added.isEmpty()) {
305                 l.onRpcAvailable(added);
306             }
307         }
308
309         void removeRpc(final DOMRpcRoutingTable newTable, final DOMRpcImplementation impl) {
310             final T l = getInstance();
311             if (!l.acceptsImplementation(impl)) {
312                 return;
313             }
314
315             final Map<QName, Set<YangInstanceIdentifier>> rpcs = verifyNotNull(newTable.getOperations(l));
316             final MapDifference<QName, Set<YangInstanceIdentifier>> diff = Maps.difference(prevRpcs, rpcs);
317
318             final List<DOMRpcIdentifier> removed = new ArrayList<>();
319             for (Entry<QName, Set<YangInstanceIdentifier>> e : diff.entriesOnlyOnLeft().entrySet()) {
320                 removed.addAll(Collections2.transform(e.getValue(), i -> DOMRpcIdentifier.create(e.getKey(), i)));
321             }
322             for (Entry<QName, ValueDifference<Set<YangInstanceIdentifier>>> e : diff.entriesDiffering().entrySet()) {
323                 for (YangInstanceIdentifier i : Sets.difference(e.getValue().leftValue(), e.getValue().rightValue())) {
324                     removed.add(DOMRpcIdentifier.create(e.getKey(), i));
325                 }
326             }
327
328             prevRpcs = rpcs;
329             if (!removed.isEmpty()) {
330                 l.onRpcUnavailable(removed);
331             }
332         }
333     }
334
335     private static final class ActionRegistration<T extends AvailabilityListener>
336         extends AbstractListenerRegistration<T> {
337
338         private Map<Absolute, Set<DOMDataTreeIdentifier>> prevActions;
339         private DOMRpcRouter router;
340
341         ActionRegistration(final DOMRpcRouter router, final T listener,
342                 final Map<Absolute, Set<DOMDataTreeIdentifier>> actions) {
343             super(listener);
344             this.router = requireNonNull(router);
345             prevActions = requireNonNull(actions);
346         }
347
348         @Override
349         protected void removeRegistration() {
350             router.removeActionListener(this);
351             router = null;
352         }
353
354         void initialTable() {
355             final List<DOMActionInstance> added = new ArrayList<>();
356             for (Entry<Absolute, Set<DOMDataTreeIdentifier>> e : prevActions.entrySet()) {
357                 added.addAll(Collections2.transform(e.getValue(), i -> DOMActionInstance.of(e.getKey(), i)));
358             }
359             if (!added.isEmpty()) {
360                 getInstance().onActionsChanged(ImmutableSet.of(), ImmutableSet.copyOf(added));
361             }
362         }
363
364         void actionChanged(final DOMActionRoutingTable newTable, final DOMActionImplementation impl) {
365             final T l = getInstance();
366             if (!l.acceptsImplementation(impl)) {
367                 return;
368             }
369
370             final Map<Absolute, Set<DOMDataTreeIdentifier>> actions = verifyNotNull(newTable.getOperations(l));
371             final MapDifference<Absolute, Set<DOMDataTreeIdentifier>> diff = Maps.difference(prevActions, actions);
372
373             final Set<DOMActionInstance> removed = new HashSet<>();
374             final Set<DOMActionInstance> added = new HashSet<>();
375
376             for (Entry<Absolute, Set<DOMDataTreeIdentifier>> e : diff.entriesOnlyOnLeft().entrySet()) {
377                 removed.addAll(Collections2.transform(e.getValue(), i -> DOMActionInstance.of(e.getKey(), i)));
378             }
379
380             for (Entry<Absolute, Set<DOMDataTreeIdentifier>> e : diff.entriesOnlyOnRight().entrySet()) {
381                 added.addAll(Collections2.transform(e.getValue(), i -> DOMActionInstance.of(e.getKey(), i)));
382             }
383
384             for (Entry<Absolute, ValueDifference<Set<DOMDataTreeIdentifier>>> e : diff.entriesDiffering().entrySet()) {
385                 for (DOMDataTreeIdentifier i : Sets.difference(e.getValue().leftValue(), e.getValue().rightValue())) {
386                     removed.add(DOMActionInstance.of(e.getKey(), i));
387                 }
388
389                 for (DOMDataTreeIdentifier i : Sets.difference(e.getValue().rightValue(), e.getValue().leftValue())) {
390                     added.add(DOMActionInstance.of(e.getKey(), i));
391                 }
392             }
393
394             prevActions = actions;
395             if (!removed.isEmpty() || !added.isEmpty()) {
396                 l.onActionsChanged(removed, added);
397             }
398         }
399     }
400
401     @NonNullByDefault
402     private final class ActionAvailabilityFacade implements DOMActionAvailabilityExtension {
403         @Override
404         public <T extends AvailabilityListener> ListenerRegistration<T> registerAvailabilityListener(final T listener) {
405             synchronized (DOMRpcRouter.this) {
406                 final ActionRegistration<T> ret = new ActionRegistration<>(DOMRpcRouter.this, listener,
407                     actionRoutingTable.getOperations(listener));
408                 actionListeners = ImmutableList.<ActionRegistration<?>>builder()
409                     .addAll(actionListeners)
410                     .add(ret)
411                     .build();
412
413                 listenerNotifier.execute(ret::initialTable);
414                 return ret;
415             }
416         }
417     }
418
419     @NonNullByDefault
420     private final class ActionServiceFacade implements DOMActionService {
421         private final ClassToInstanceMap<DOMActionServiceExtension> extensions = ImmutableClassToInstanceMap.of(
422             DOMActionAvailabilityExtension.class, new ActionAvailabilityFacade());
423
424         @Override
425         public ClassToInstanceMap<DOMActionServiceExtension> getExtensions() {
426             return extensions;
427         }
428
429         @Override
430         public ListenableFuture<? extends DOMActionResult> invokeAction(final Absolute type,
431                 final DOMDataTreeIdentifier path, final ContainerNode input) {
432             final YangInstanceIdentifier pathRoot = path.getRootIdentifier();
433             checkArgument(!pathRoot.isEmpty(), "Action path must not be empty");
434
435             final DOMActionRoutingTableEntry entry = (DOMActionRoutingTableEntry) actionRoutingTable.getEntry(type);
436             return entry != null ? OperationInvocation.invoke(entry, type, path, requireNonNull(input))
437                 : Futures.immediateFailedFuture(
438                     new DOMActionNotAvailableException("No implementation of Action %s available", type));
439         }
440     }
441
442     @NonNullByDefault
443     private final class ActionProviderServiceFacade implements DOMActionProviderService {
444         @Override
445         public <T extends DOMActionImplementation> ObjectRegistration<T> registerActionImplementation(
446                 final T implementation, final Set<DOMActionInstance> instances) {
447             checkArgument(!instances.isEmpty(), "Instances must not be empty");
448
449             synchronized (DOMRpcRouter.this) {
450                 final DOMActionRoutingTable oldTable = actionRoutingTable;
451                 final DOMActionRoutingTable newTable = (DOMActionRoutingTable) oldTable.add(implementation, instances);
452                 actionRoutingTable = newTable;
453
454                 listenerNotifier.execute(() -> notifyActionChanged(newTable, implementation));
455             }
456
457             return new AbstractObjectRegistration<>(implementation) {
458                 @Override
459                 protected void removeRegistration() {
460                     removeActionImplementation(getInstance(), instances);
461                 }
462             };
463         }
464     }
465
466     private final class RpcServiceFacade implements DOMRpcService {
467         @Override
468         public ListenableFuture<? extends DOMRpcResult> invokeRpc(final QName type, final ContainerNode input) {
469             final AbstractDOMRpcRoutingTableEntry entry = (AbstractDOMRpcRoutingTableEntry) routingTable.getEntry(type);
470             if (entry == null) {
471                 return Futures.immediateFailedFuture(
472                     new DOMRpcImplementationNotAvailableException("No implementation of RPC %s available", type));
473             }
474
475             return OperationInvocation.invoke(entry, requireNonNull(input));
476         }
477
478         @Override
479         public <T extends DOMRpcAvailabilityListener> ListenerRegistration<T> registerRpcListener(final T listener) {
480             synchronized (DOMRpcRouter.this) {
481                 final RegImpl<T> ret = new RegImpl<>(DOMRpcRouter.this, listener, routingTable.getOperations(listener));
482                 listeners = ImmutableList.<RegImpl<?>>builder().addAll(listeners).add(ret).build();
483
484                 listenerNotifier.execute(ret::initialTable);
485                 return ret;
486             }
487         }
488     }
489
490     private final class RpcProviderServiceFacade implements DOMRpcProviderService {
491         @Override
492         public <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T> registerRpcImplementation(
493                 final T implementation, final DOMRpcIdentifier... rpcs) {
494             return registerRpcImplementation(implementation, ImmutableSet.copyOf(rpcs));
495         }
496
497         @Override
498         public <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T> registerRpcImplementation(
499                 final T implementation, final Set<DOMRpcIdentifier> rpcs) {
500
501             synchronized (DOMRpcRouter.this) {
502                 final DOMRpcRoutingTable oldTable = routingTable;
503                 final DOMRpcRoutingTable newTable = (DOMRpcRoutingTable) oldTable.add(implementation, rpcs);
504                 routingTable = newTable;
505
506                 listenerNotifier.execute(() -> notifyAdded(newTable, implementation));
507             }
508
509             return new AbstractDOMRpcImplementationRegistration<>(implementation) {
510                 @Override
511                 protected void removeRegistration() {
512                     removeRpcImplementation(getInstance(), rpcs);
513                 }
514             };
515         }
516
517         @Override
518         public org.opendaylight.yangtools.concepts.Registration registerRpcImplementations(
519                 final Map<DOMRpcIdentifier, DOMRpcImplementation> map) {
520             checkArgument(!map.isEmpty());
521
522             final var builder = ImmutableTable.<QName, YangInstanceIdentifier, DOMRpcImplementation>builder();
523             for (var entry : map.entrySet()) {
524                 final var id = entry.getKey();
525                 builder.put(id.getType(), id.getContextReference(), entry.getValue());
526             }
527             final var implTable = builder.build();
528
529             synchronized (DOMRpcRouter.this) {
530                 final DOMRpcRoutingTable oldTable = routingTable;
531                 final DOMRpcRoutingTable newTable = (DOMRpcRoutingTable) oldTable.addAll(implTable);
532                 routingTable = newTable;
533
534                 listenerNotifier.execute(() -> notifyAdded(newTable, implTable.values()));
535             }
536
537             return new AbstractRegistration() {
538                 @Override
539                 protected void removeRegistration() {
540                     removeRpcImplementations(implTable);
541                 }
542             };
543         }
544     }
545 }