<module>yang</module>\r
<module>code-generator</module>\r
<module>model</module>\r
+ <module>restconf</module>\r
<!-- module>third-party</module -->\r
</modules>\r
\r
<parent>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools</artifactId>
- <version>0.5-SNAPSHOT</version>
+ <version>0.1.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<modules>
- <module>restconf-common</module>
- <module>restconf-jaxrs-api</module>
- <module>restconf-util</module>
+ <module>restconf-client-api</module>
</modules>
<dependencyManagement>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-common</artifactId>
- <version>${project.version}</version>
+ <version>0.5.9-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-data-api</artifactId>
- <version>${project.version}</version>
+ <version>0.5.9-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-data-util</artifactId>
- <version>${project.version}</version>
+ <artifactId>yang-data-impl</artifactId>
+ <version>0.5.9-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-model-api</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-model-util</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-binding</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-parser-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-parser-impl
- </artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-maven-plugin</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-maven-plugin-spi</artifactId>
- <version>${project.version}</version>
+ <version>0.6.0-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
<target>1.7</target>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
- <version>2.9.1</version>
<configuration>
<stylesheet>maven</stylesheet>
</configuration>
<artifactId>maven-bundle-plugin</artifactId>
<version>${maven.bundle.version}</version>
<extensions>true</extensions>
- <executions>
- <execution>
- <id>bundle-manifest</id>
- <phase>process-classes</phase>
- <goals>
- <goal>manifest</goal>
- </goals>
- </execution>
- </executions>
</plugin>
<plugin>
<groupId>org.eclipse.m2e</groupId>
</plugins>
</reporting>
- <version>0.1.0-SNAPSHOT</version>
+ <version>0.2.0-SNAPSHOT</version>
</project>
--- /dev/null
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>restconf-parent</artifactId>
+ <version>0.2.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>restconf-client-api</artifactId>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-binding</artifactId>
+ </dependency>
+ </dependencies>
+</project>
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.restconf.client.api;
+
+import java.util.Set;
+
+import org.opendaylight.yangtools.restconf.client.api.data.ConfigurationDatastore;
+import org.opendaylight.yangtools.restconf.client.api.data.OperationalDatastore;
+import org.opendaylight.yangtools.restconf.client.api.event.EventStreamInfo;
+import org.opendaylight.yangtools.restconf.client.api.event.ListenableEventStreamContext;
+import org.opendaylight.yangtools.restconf.client.api.rpc.RpcServiceContext;
+import org.opendaylight.yangtools.yang.binding.RpcService;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+public interface RestconfClientContext extends AutoCloseable {
+ /**
+ * Returns a set of {@link RpcServiceContext} which provides invocation
+ * handling for RPCs supported by the backing server.
+ *
+ * @return Future representing the asynchronous call to fetch the information.
+ */
+ ListenableFuture<Set<Class<? extends RpcService>>> getRpcServices();
+ <T extends RpcService> RpcServiceContext<T> getRpcServiceContext(Class<T> rpcService);
+
+ ListenableFuture<Set<EventStreamInfo>> getAvailableEventStreams();
+ ListenableEventStreamContext getEventStreamContext(EventStreamInfo info);
+
+ ConfigurationDatastore getConfigurationDatastore();
+ OperationalDatastore getOperationalDatastore();
+
+ @Override
+ void close();
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.restconf.client.api;
+
+import java.net.URL;
+
+/**
+ * An interface for acquiring #{@link RestconfClientContext} instances.
+ */
+public interface RestconfClientContextFactory {
+ /**
+ * Get a #{@link RestconfClientContext} attached to the server pointed to by an URL.
+ * @param baseUrl URL pointer to the backend server
+ * @return RestconfClientContext attached to the backend server.
+ * @throws UnsupportedProtocolException if the factory cannot handle the protocol specified in the URL.
+ */
+ RestconfClientContext getRestconfClientContext(URL baseUrl) throws UnsupportedProtocolException;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.restconf.client.api;
+
+public class UnsupportedProtocolException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public UnsupportedProtocolException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public UnsupportedProtocolException(final String message) {
+ super(message);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.restconf.client.api.data;
+
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+public interface ConfigurationDatastore extends Datastore {
+ ListenableFuture<RpcResult<Boolean>> deleteData(InstanceIdentifier<?> path);
+ ListenableFuture<RpcResult<Boolean>> putData(InstanceIdentifier<?> path);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.restconf.client.api.data;
+
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.ListenableFuture;
+
+public interface Datastore {
+
+ /**
+ * Reads data from data store and return's result in future.
+ *
+ * This call is equivalent to invocation of {@link #readData(InstanceIdentifier, RetrievalStrategy)}
+ * with {@link DefaultRetrievalStrategy.Default}.
+ *
+ * @param path InstanceIdentifier representing path in YANG schema to be retrieved.
+ * @return Future promising the data requested. If the requested data are not present returns value of {@link Optional#absent()}.
+ *
+ */
+ <T extends DataObject> ListenableFuture<Optional<T>> readData(InstanceIdentifier<T> path);
+
+ /**
+ * Reads data from data store and return's result in future.
+ *
+ * @param path Representing path in YANG schema to be retrieved.
+ * @param strategy Strategy which should be used to retrieve data
+ * @return Future promising the data requested. If the requested data are not present returns value of {@link Optional#absent()}.
+ *
+ */
+ <T extends DataObject> ListenableFuture<Optional<T>> readData(InstanceIdentifier<T> path, RetrievalStrategy strategy);
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.restconf.client.api.data;
+
+/**
+ * Default retrieval strategy, letting the server decide what to do exactly.
+ */
+public final class DefaultRetrievalStrategy implements RetrievalStrategy {
+ private static final class Holder {
+ private static final DefaultRetrievalStrategy INSTANCE = new DefaultRetrievalStrategy();
+ }
+
+ private DefaultRetrievalStrategy() {
+
+ }
+
+ public static DefaultRetrievalStrategy getInstance() {
+ return Holder.INSTANCE;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.restconf.client.api.data;
+
+/**
+ * A retrieval strategy which places an upper bound on the depth of the tree
+ * returned by the query.
+ */
+public interface LimitedDepthRetrievalStrategy extends RetrievalStrategy {
+ /**
+ * @return maximum three depth
+ */
+ int getDepthLimit();
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.restconf.client.api.data;
+
+public interface OperationalDatastore extends Datastore {
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.restconf.client.api.data;
+
+/**
+ * Marker interface common to all data retrieval strategies. A retrieval strategy specifies
+ * details how the result of a read operation are to be retrieved from the server.
+ */
+public interface RetrievalStrategy {
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.restconf.client.api.event;
+
+import java.util.Date;
+
+import org.opendaylight.yangtools.yang.binding.Notification;
+
+public interface EventReplay<T extends Notification> {
+ Date getEventTime();
+ Class<T> getEventType();
+ T getEvent();
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.restconf.client.api.event;
+
+import java.util.Date;
+
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.ListenableFuture;
+
+public interface EventStreamContext extends AutoCloseable {
+ ListenableFuture<Optional<EventStreamReplay>> getReplay(Optional<Date> startTime, Optional<Date> endTime);
+
+ @Override
+ void close();
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.restconf.client.api.event;
+
+import java.util.Date;
+
+import org.opendaylight.yangtools.concepts.Identifiable;
+
+public interface EventStreamInfo extends Identifiable<String> {
+
+ /**
+ *
+ * @return name of event stream.
+ */
+ @Override
+ public String getIdentifier();
+
+ public String getDescription();
+
+ boolean isReplaySupported();
+
+ Date getReplayLogCreationTime();
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.restconf.client.api.event;
+
+import java.util.Date;
+
+import com.google.common.base.Optional;
+
+public interface EventStreamReplay extends Iterable<EventReplay<?>> {
+ String getStreamIdentifier();
+ Optional<Date> getStartTime();
+ Optional<Date> getEndTime();
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.restconf.client.api.event;
+
+import java.util.Date;
+
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.NotificationListener;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * An #{@link EventStreamContext} which supports dispatching events to one or more listeners.
+ */
+public interface ListenableEventStreamContext extends EventStreamContext {
+ /**
+ * Register a new listener to which events will be delivered until the returned registration is not closed.
+ *
+ * @param listener New listener
+ * @return Listener registration handle
+ */
+ <T extends NotificationListener> ListenerRegistration<T> registerNotificationListener(T listener);
+
+ /**
+ * Subscribe to the underlying event stream. Equivalent to {@link #startListeningWithReplay(Optional, Optional)} with
+ * both arguments being Optional.absent().
+ *
+ * @return Future representing the asynchronous request for subscription.
+ * @throws IllegalStateException if the event stream is currently being listened on
+ */
+ ListenableFuture<RpcResult<Void>> startListening();
+
+ /**
+ * Subscribe to the underlying event stream and attempt to replay events between startTime.
+ *
+ * @param startTime Start time. If present, required to be in the past. Omitting this parameter results
+ * in the server going as far as possible.
+ * @param endTime End time. If present, required to be later than start time.
+ * @return Future representing the asynchronous request for subscription.
+ * @throws IllegalStateException if the event stream is currently being listened on
+ */
+ ListenableFuture<RpcResult<Void>> startListeningWithReplay(Optional<Date> startTime, Optional<Date> endTime);
+
+ /**
+ * Stop listening to the underlying event stream.
+ * @throws IllegalStateException if the event stream is currently not being listened on
+ */
+ void stopListening();
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.restconf.client.api.rpc;
+
+import org.opendaylight.yangtools.yang.binding.RpcService;
+
+public interface RpcServiceContext<T extends RpcService> extends AutoCloseable {
+ T getRpcService();
+
+ @Override
+ void close();
+}