83aa43b484aa8b3fe23d23882d56d0dca15e4d4a
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / jersey / providers / spi / AbstractNormalizedNodeBodyReader.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies, s.r.o. 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.jersey.providers.spi;
9
10 import com.google.common.annotations.Beta;
11 import javax.ws.rs.core.Request;
12 import javax.ws.rs.core.UriInfo;
13 import org.opendaylight.mdsal.dom.api.DOMMountPointService;
14 import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
15 import org.opendaylight.restconf.common.context.NormalizedNodeContext;
16 import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
17
18 /**
19  * Common superclass for readers producing {@link NormalizedNodeContext}.
20  */
21 @Beta
22 public abstract class AbstractNormalizedNodeBodyReader
23         extends AbstractIdentifierAwareJaxRsProvider<NormalizedNodeContext> {
24     protected AbstractNormalizedNodeBodyReader(final SchemaContextHandler schemaContextHandler,
25             final DOMMountPointService mountPointService) {
26         super(schemaContextHandler, mountPointService);
27     }
28
29     public final void injectParams(final UriInfo uriInfo, final Request request) {
30         setUriInfo(uriInfo);
31         setRequest(request);
32     }
33
34     @Override
35     protected final NormalizedNodeContext emptyBody(final InstanceIdentifierContext<?> path) {
36         return new NormalizedNodeContext(path, null);
37     }
38 }