Teach RFC8040 restconf about actions
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / Rfc8040RestConfWiring.java
1 /*
2  * Copyright (c) 2019 Red Hat, 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.restconf.nb.rfc8040;
9
10 import javax.inject.Inject;
11 import javax.inject.Singleton;
12 import org.apache.aries.blueprint.annotation.service.Reference;
13 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
14 import org.opendaylight.restconf.nb.rfc8040.handlers.ActionServiceHandler;
15 import org.opendaylight.restconf.nb.rfc8040.handlers.DOMDataBrokerHandler;
16 import org.opendaylight.restconf.nb.rfc8040.handlers.DOMMountPointServiceHandler;
17 import org.opendaylight.restconf.nb.rfc8040.handlers.NotificationServiceHandler;
18 import org.opendaylight.restconf.nb.rfc8040.handlers.RpcServiceHandler;
19 import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
20 import org.opendaylight.restconf.nb.rfc8040.handlers.TransactionChainHandler;
21 import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.JSONRestconfServiceRfc8040Impl;
22 import org.opendaylight.restconf.nb.rfc8040.services.wrapper.ServicesWrapper;
23 import org.opendaylight.restconf.nb.rfc8040.web.WebInitializer;
24
25 /**
26  * Standalone wiring for RESTCONF.
27  *
28  * <p>This wiring alone is not sufficient; there are a few other singletons which
29  * need to be bound as well, incl. {@link RestconfApplication},
30  * {@link JSONRestconfServiceRfc8040Impl} &amp; {@link WebInitializer}; see the
31  * Rfc8040RestConfWiringTest for how to do this e.g. for Guice (this class can
32  * be used with another DI framework but needs the equivalent).
33  *
34  * @author Michael Vorburger.ch
35  */
36 @Singleton
37 public class Rfc8040RestConfWiring {
38     private final ServicesWrapper servicesWrapper;
39
40     @Inject
41     public Rfc8040RestConfWiring(final SchemaContextHandler schemaCtxHandler,
42             final DOMMountPointServiceHandler domMountPointServiceHandler,
43             final TransactionChainHandler transactionChainHandler,
44             final DOMDataBrokerHandler domDataBrokerHandler, final RpcServiceHandler rpcServiceHandler,
45             final ActionServiceHandler actionServiceHandler,
46             final NotificationServiceHandler notificationServiceHandler,
47             @Reference final DOMSchemaService domSchemaService) {
48         servicesWrapper = ServicesWrapper.newInstance(schemaCtxHandler, domMountPointServiceHandler,
49             transactionChainHandler, domDataBrokerHandler, rpcServiceHandler, actionServiceHandler,
50             notificationServiceHandler, domSchemaService);
51     }
52
53     public ServicesWrapper getServicesWrapper() {
54         return servicesWrapper;
55     }
56 }