Move model.repo.util classes to model.repo.spi
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / repo / spi / SchemaSourceProvider.java
index a0a141bd3759f4f1a4dac00e3f3cb2706d1114bd..d5a7fbc9747333abee3cea1220f86eb239d75db5 100644 (file)
@@ -3,14 +3,14 @@
  *
  * 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/eplv10.html
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 package org.opendaylight.yangtools.yang.model.repo.spi;
 
 import com.google.common.annotations.Beta;
-import com.google.common.base.Optional;
 import com.google.common.util.concurrent.ListenableFuture;
-
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.model.repo.api.MissingSchemaSourceException;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 
@@ -29,21 +29,23 @@ public interface SchemaSourceProvider<T extends SchemaSourceRepresentation> {
      *
      * <ul>
      * <li> If the source identifier specifies a revision, this method returns either
-     * a representation of that particular revision, or report the identifier as absent
-     * by returning {@link Optional#absent()}.
+     * a representation of that particular revision or throw {@link MissingSchemaSourceException}.
      * <li> If the source identifier does not specify a revision, this method returns
-     * the newest available revision, or {@link Optional#absent()}.
+     * the newest available revision, or throws {@link MissingSchemaSourceException}.
+     * </ul>
      *
+     * <p>
      * In either case the returned representation is required to report a non-null
      * revision in the {@link SourceIdentifier} returned from
      * {@link SchemaSourceRepresentation#getIdentifier()}.
      *
+     * <p>
      * Implementations are not required to provide constant behavior in time, notably
      * this different invocation of this method may produce different results.
      *
      * @param sourceIdentifier source identifier
-     * @return source representation if supplied YANG module is available
-     *         {@link Optional#absent()} otherwise.
+     * @return future source representation, if supplied YANG module is available
+     * @throws NullPointerException if {@code sourceIdentifier} is null
      */
-    ListenableFuture<Optional<T>> getSource(SourceIdentifier sourceIdentifier);
+    @NonNull ListenableFuture<? extends T> getSource(@NonNull SourceIdentifier sourceIdentifier);
 }