import javax.inject.Singleton;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.mdsal.dom.api.DOMDataBroker;
+import org.opendaylight.restconf.nb.rfc8040.URLConstants;
import org.opendaylight.restconf.server.spi.AbstractRestconfStreamRegistry;
import org.opendaylight.restconf.server.spi.RestconfStream;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.monitoring.rev170126.RestconfState;
@Inject
@Activate
public MdsalRestconfStreamRegistry(@Reference final DOMDataBroker dataBroker) {
+ super(URLConstants.STREAMS_SUBPATH);
this.dataBroker = requireNonNull(dataBroker);
}
import java.util.concurrent.ConcurrentMap;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.restconf.nb.rfc8040.URLConstants;
import org.opendaylight.restconf.server.api.ServerException;
import org.opendaylight.restconf.server.api.ServerRequest;
import org.opendaylight.restconf.server.spi.RestconfStream.EncodingName;
public static final QName LOCATION_QNAME = QName.create(Stream.QNAME, "location").intern();
private final ConcurrentMap<String, RestconfStream<?>> streams = new ConcurrentHashMap<>();
+ private final @NonNull String subpath;
+
+ protected AbstractRestconfStreamRegistry(final String subpath) {
+ if (subpath.isEmpty()) {
+ throw new IllegalArgumentException("empty subpath");
+ }
+ this.subpath = subpath;
+ }
@Override
public final @Nullable RestconfStream<?> lookupStream(final String name) {
* @param restconfURI request base URI, with trailing slash
* @throws IllegalArgumentException if the result would have been malformed
*/
- protected static final @NonNull String baseStreamLocation(final URI restconfURI) {
+ protected final @NonNull String baseStreamLocation(final URI restconfURI) {
var scheme = restconfURI.getScheme();
try {
return new URI(scheme, restconfURI.getRawUserInfo(), restconfURI.getHost(), restconfURI.getPort(),
- restconfURI.getPath() + URLConstants.STREAMS_SUBPATH, null, null)
+ restconfURI.getPath() + subpath, null, null)
.toString();
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Cannot derive streams location", e);