2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.restconf.common.wrapper.services;
10 import javax.ws.rs.Path;
11 import javax.ws.rs.core.Response;
12 import javax.ws.rs.core.UriInfo;
13 import org.opendaylight.netconf.md.sal.rest.schema.SchemaExportContext;
14 import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
15 import org.opendaylight.netconf.sal.restconf.impl.PATCHContext;
16 import org.opendaylight.netconf.sal.restconf.impl.PATCHStatusContext;
17 import org.opendaylight.restconf.handlers.DOMDataBrokerHandler;
18 import org.opendaylight.restconf.handlers.DOMMountPointServiceHandler;
19 import org.opendaylight.restconf.handlers.RpcServiceHandler;
20 import org.opendaylight.restconf.handlers.SchemaContextHandler;
21 import org.opendaylight.restconf.handlers.TransactionChainHandler;
22 import org.opendaylight.restconf.rest.services.api.Draft15BaseServicesWrapper;
23 import org.opendaylight.restconf.rest.services.api.RestconfModulesService;
24 import org.opendaylight.restconf.rest.services.api.RestconfOperationsService;
25 import org.opendaylight.restconf.rest.services.api.RestconfSchemaService;
26 import org.opendaylight.restconf.rest.services.api.RestconfStreamsService;
27 import org.opendaylight.restconf.rest.services.impl.RestconfModulesServiceImpl;
28 import org.opendaylight.restconf.rest.services.impl.RestconfOperationsServiceImpl;
29 import org.opendaylight.restconf.rest.services.impl.RestconfSchemaServiceImpl;
30 import org.opendaylight.restconf.rest.services.impl.RestconfStreamsServiceImpl;
31 import org.opendaylight.restconf.restful.services.api.Draft15TransactionServicesWrapper;
32 import org.opendaylight.restconf.restful.services.api.RestconfDataService;
33 import org.opendaylight.restconf.restful.services.api.RestconfInvokeOperationsService;
34 import org.opendaylight.restconf.restful.services.api.RestconfStreamsSubscriptionService;
35 import org.opendaylight.restconf.restful.services.impl.RestconfDataServiceImpl;
36 import org.opendaylight.restconf.restful.services.impl.RestconfInvokeOperationsServiceImpl;
37 import org.opendaylight.restconf.restful.services.impl.RestconfStreamsSubscriptionServiceImpl;
40 * Wrapper for services:
42 * <li>{@link Draft15BaseServicesWrapper}
43 * <li>{@link Draft15TransactionServicesWrapper}
48 public class Draft15ServicesWrapperImpl implements Draft15BaseServicesWrapper, Draft15TransactionServicesWrapper {
50 private RestconfDataService delegRestconfDataService;
51 private RestconfInvokeOperationsService delegRestconfInvokeOpsService;
52 private RestconfStreamsSubscriptionService delegRestconfSubscrService;
53 private RestconfModulesService delegRestModService;
54 private RestconfOperationsService delegRestOpsService;
55 private RestconfStreamsService delegRestStrsService;
56 private RestconfSchemaService delegRestSchService;
58 private Draft15ServicesWrapperImpl() {
61 private static class InstanceHolder {
62 public static final Draft15ServicesWrapperImpl INSTANCE = new Draft15ServicesWrapperImpl();
65 public static Draft15ServicesWrapperImpl getInstance() {
66 return InstanceHolder.INSTANCE;
70 public NormalizedNodeContext getModules(final UriInfo uriInfo) {
71 return this.delegRestModService.getModules(uriInfo);
75 public NormalizedNodeContext getModules(final String identifier, final UriInfo uriInfo) {
76 return this.delegRestModService.getModules(identifier, uriInfo);
80 public NormalizedNodeContext getModule(final String identifier, final UriInfo uriInfo) {
81 return this.delegRestModService.getModule(identifier, uriInfo);
85 public NormalizedNodeContext getOperations(final UriInfo uriInfo) {
86 return this.delegRestOpsService.getOperations(uriInfo);
90 public NormalizedNodeContext getOperations(final String identifier, final UriInfo uriInfo) {
91 return this.delegRestOpsService.getOperations(identifier, uriInfo);
95 public NormalizedNodeContext getAvailableStreams(final UriInfo uriInfo) {
96 return this.delegRestStrsService.getAvailableStreams(uriInfo);
100 public SchemaExportContext getSchema(final String mountAndModuleId) {
101 return this.delegRestSchService.getSchema(mountAndModuleId);
105 public Response readData(final String identifier, final UriInfo uriInfo) {
106 return this.delegRestconfDataService.readData(identifier, uriInfo);
110 public Response putData(final String identifier, final NormalizedNodeContext payload) {
111 return this.delegRestconfDataService.putData(identifier, payload);
115 public Response postData(final String identifier, final NormalizedNodeContext payload, final UriInfo uriInfo) {
116 return this.delegRestconfDataService.postData(identifier, payload, uriInfo);
120 public Response postData(final NormalizedNodeContext payload, final UriInfo uriInfo) {
121 return this.delegRestconfDataService.postData(payload, uriInfo);
125 public Response deleteData(final String identifier) {
126 return this.delegRestconfDataService.deleteData(identifier);
130 public PATCHStatusContext patchData(final String identifier, final PATCHContext context, final UriInfo uriInfo) {
131 return this.delegRestconfDataService.patchData(identifier, context, uriInfo);
135 public PATCHStatusContext patchData(final PATCHContext context, final UriInfo uriInfo) {
136 return this.delegRestconfDataService.patchData(context, uriInfo);
140 public NormalizedNodeContext invokeRpc(final String identifier, final NormalizedNodeContext payload,
141 final UriInfo uriInfo) {
142 return this.delegRestconfInvokeOpsService.invokeRpc(identifier, payload, uriInfo);
146 public Response subscribeToStream(final String identifier, final UriInfo uriInfo) {
147 return this.delegRestconfSubscrService.subscribeToStream(identifier, uriInfo);
150 public void setHandlers(final SchemaContextHandler schemaCtxHandler,
151 final DOMMountPointServiceHandler domMountPointServiceHandler,
152 final TransactionChainHandler transactionChainHandler, final DOMDataBrokerHandler domDataBrokerHandler,
153 final RpcServiceHandler rpcServiceHandler) {
154 this.delegRestModService = new RestconfModulesServiceImpl(schemaCtxHandler, domMountPointServiceHandler);
155 this.delegRestOpsService = new RestconfOperationsServiceImpl(schemaCtxHandler, domMountPointServiceHandler);
156 this.delegRestSchService = new RestconfSchemaServiceImpl(schemaCtxHandler, domMountPointServiceHandler);
157 this.delegRestStrsService = new RestconfStreamsServiceImpl(schemaCtxHandler);
158 this.delegRestconfDataService = new RestconfDataServiceImpl(schemaCtxHandler, transactionChainHandler);
159 this.delegRestconfInvokeOpsService = new RestconfInvokeOperationsServiceImpl(rpcServiceHandler,
161 this.delegRestconfSubscrService = new RestconfStreamsSubscriptionServiceImpl(domDataBrokerHandler);