7d6b76715d9e123cf8f4fdb1fb444f306731b0fa
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / services / wrapper / ServicesNotifWrapper.java
1 /*
2  * Copyright (c) 2020 Lumina Networks, Inc. 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.services.wrapper;
9
10 import javax.ws.rs.Path;
11 import javax.ws.rs.core.UriInfo;
12 import org.glassfish.jersey.media.sse.EventOutput;
13 import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfDataStreamService;
14 import org.opendaylight.restconf.nb.rfc8040.rests.services.impl.RestconfDataStreamServiceImpl;
15 import org.opendaylight.restconf.nb.rfc8040.streams.sse.SSEInitializer;
16
17 /**
18  * Wrapper for service.
19  * <ul>
20  * <li>{@link RestconfDataStreamService}
21  * </ul>
22  */
23 @Path("/")
24 public final class ServicesNotifWrapper implements RestconfDataStreamService {
25
26     private final RestconfDataStreamService delegRestStream;
27
28     private ServicesNotifWrapper(RestconfDataStreamService delegRestStream) {
29         this.delegRestStream = delegRestStream;
30     }
31
32     public static ServicesNotifWrapper newInstance(SSEInitializer configuration) {
33         RestconfDataStreamService delegRestStream = new RestconfDataStreamServiceImpl(configuration);
34         return new ServicesNotifWrapper(delegRestStream);
35     }
36
37     @Override
38     public EventOutput getSSE(String identifier, UriInfo uriInfo) {
39         return this.delegRestStream.getSSE(identifier, uriInfo);
40     }
41 }