+++ /dev/null
-/*
- * Copyright (c) 2015 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.yang.parser.repo;
-
-import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
-import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
-
-public abstract class AbstractYangTextSchemaSourceRegistration extends AbstractObjectRegistration<YangTextSchemaSource>
- implements YangTextSchemaSourceRegistration {
- protected AbstractYangTextSchemaSourceRegistration(final YangTextSchemaSource instance) {
- super(instance);
- }
-}
*/
package org.opendaylight.yangtools.yang.parser.repo;
-import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Objects.requireNonNull;
import com.google.common.annotations.Beta;
* Register a {@link YangTextSchemaSource}.
*
* @param source YANG text source
- * @return a YangTextSchemaSourceRegistration
+ * @return a {@link Registration}
* @throws YangSyntaxErrorException When the YANG file is syntactically invalid
* @throws IOException when the URL is not readable
* @throws SchemaSourceException When parsing encounters general error
+ * @throws NullPointerException if {@code source} is {@code null}
*/
- public @NonNull YangTextSchemaSourceRegistration registerSource(final @NonNull YangTextSchemaSource source)
+ public @NonNull Registration registerSource(final @NonNull YangTextSchemaSource source)
throws SchemaSourceException, IOException, YangSyntaxErrorException {
- checkArgument(source != null);
-
final var ast = TextToIRTransformer.transformText(source);
LOG.trace("Resolved source {} to source {}", source, ast);
LOG.debug("Added source {} to schema context requirements", parsedId);
version = new Object();
- return new AbstractYangTextSchemaSourceRegistration(text) {
+ return new AbstractRegistration() {
@Override
protected void removeRegistration() {
synchronized (YangTextSchemaContextResolver.this) {
* @throws YangSyntaxErrorException When the YANG file is syntactically invalid
* @throws IOException when the URL is not readable
* @throws SchemaSourceException When parsing encounters general error
+ * @throws NullPointerException if {@code url} is {@code null}
*/
- public @NonNull YangTextSchemaSourceRegistration registerSource(final @NonNull URL url)
+ public @NonNull Registration registerSource(final @NonNull URL url)
throws SchemaSourceException, IOException, YangSyntaxErrorException {
- checkArgument(url != null, "Supplied URL must not be null");
-
final String path = url.getPath();
final String fileName = path.substring(path.lastIndexOf('/') + 1);
return registerSource(YangTextSchemaSource.forURL(url, guessSourceIdentifier(fileName)));
+++ /dev/null
-/*
- * Copyright (c) 2015 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.yang.parser.repo;
-
-import org.opendaylight.yangtools.concepts.ObjectRegistration;
-import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
-
-public interface YangTextSchemaSourceRegistration extends ObjectRegistration<YangTextSchemaSource> {
- @Override
- void close();
-}