3e2862ee7107816d123a585909daf5daa3f1d8c0
[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.restconf.common.context.InstanceIdentifierContext;
14 import org.opendaylight.restconf.common.context.NormalizedNodeContext;
15 import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
16
17 /**
18  * Common superclass for readers producing {@link NormalizedNodeContext}.
19  *
20  * @author Robert Varga
21  */
22 @Beta
23 public abstract class AbstractNormalizedNodeBodyReader
24         extends AbstractIdentifierAwareJaxRsProvider<NormalizedNodeContext> {
25     protected AbstractNormalizedNodeBodyReader(SchemaContextHandler schemaContextHandler) {
26         super(schemaContextHandler);
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 }