From dbf4d76f186b4e81fa2df5884beb359352926f41 Mon Sep 17 00:00:00 2001 From: Tony Tkacik Date: Wed, 2 Oct 2013 19:52:57 +0200 Subject: [PATCH] Added documentation to yang-binding, updated dependencies. Change-Id: I1ed36c8539b496a44595f8895737accc7c77d8b8 Signed-off-by: Tony Tkacik --- yang/yang-binding/pom.xml | 4 ++ .../yangtools/yang/binding/Augmentable.java | 47 ++++++++++++++----- .../yangtools/yang/binding/Augmentation.java | 29 +++++++----- .../yangtools/yang/binding/BaseIdentity.java | 38 +++++++++------ .../yangtools/yang/binding/DataObject.java | 31 +++++++----- .../yangtools/yang/binding/DataRoot.java | 4 ++ .../yangtools/yang/binding/Identifiable.java | 4 +- .../yangtools/yang/binding/Identifier.java | 3 +- .../yang/binding/InstanceIdentifier.java | 30 ++++++++---- .../yang/binding/NotificationListener.java | 4 +- .../binding/annotations/RoutingContext.java | 9 ++++ 11 files changed, 137 insertions(+), 66 deletions(-) diff --git a/yang/yang-binding/pom.xml b/yang/yang-binding/pom.xml index 2d51f451da..4401c8a920 100644 --- a/yang/yang-binding/pom.xml +++ b/yang/yang-binding/pom.xml @@ -18,5 +18,9 @@ concepts 0.1.1-SNAPSHOT + + org.opendaylight.yangtools + yang-common + diff --git a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Augmentable.java b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Augmentable.java index c7e109dc0f..340bd5b46d 100644 --- a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Augmentable.java +++ b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Augmentable.java @@ -1,13 +1,34 @@ -/* - * Copyright (c) 2013 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.binding; - -public interface Augmentable { - - > E getAugmentation(Class augmentationType); -} +/* + * Copyright (c) 2013 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.binding; + +/** + * Augmentable (extensible) object which could carry additional data defined by + * third-party extension, without introducing conflict between various + * extension. + * + * This interface uses extended version of ExtensibleInterface pattern which + * also adds marker interface for augmentations (extensions) - + * {@link Augmentable} + * + * @author Tony Tkacik + * @param + * Base class which should implements this interface and is target + * for augmentation. + */ +public interface Augmentable { + + /** + * Returns instance of augmentation. + * + * @param augmentationType + * Type of augmentation to be returned. + * @return instance of augmentation. + */ + > E getAugmentation(Class augmentationType); +} diff --git a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Augmentation.java b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Augmentation.java index 65ca94cf7e..ad8401b0a7 100644 --- a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Augmentation.java +++ b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Augmentation.java @@ -1,12 +1,17 @@ -/* - * Copyright (c) 2013 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.binding; - -public interface Augmentation { - -} +/* + * Copyright (c) 2013 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.binding; + +/** + * Augmentation (extension) of other interface + * + * @param Class to which this implementation is extension. + */ +public interface Augmentation { + +} diff --git a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/BaseIdentity.java b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/BaseIdentity.java index 94c03117d0..0c4a7beaf1 100644 --- a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/BaseIdentity.java +++ b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/BaseIdentity.java @@ -1,15 +1,23 @@ -/* - * Copyright (c) 2013 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.binding; - -public abstract class BaseIdentity { - - protected BaseIdentity() { - } - -} +/* + * Copyright (c) 2013 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.binding; + +/** + * Base Identity + * + */ +public abstract class BaseIdentity { + + public final static BaseIdentity INSTANCE = new BaseIdentity() { + }; + + protected BaseIdentity() { + + } + +} diff --git a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/DataObject.java b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/DataObject.java index 31d547ffb2..d51572e2d8 100644 --- a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/DataObject.java +++ b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/DataObject.java @@ -1,12 +1,19 @@ -/* - * Copyright (c) 2013 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.binding; - -public interface DataObject { - -} +/* + * Copyright (c) 2013 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.binding; + +/** + * Data container is an interface which has structured contents. + * + * + * @author Tony Tkacik + * + */ +public interface DataObject { + +} diff --git a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/DataRoot.java b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/DataRoot.java index 81d19657c8..5882b5159e 100644 --- a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/DataRoot.java +++ b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/DataRoot.java @@ -7,6 +7,10 @@ */ package org.opendaylight.yangtools.yang.binding; +/** + * Data Root of YANG module + * + */ public interface DataRoot { } diff --git a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Identifiable.java b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Identifiable.java index 4eb04e4dc6..9f32c0f24f 100644 --- a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Identifiable.java +++ b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Identifiable.java @@ -2,9 +2,7 @@ package org.opendaylight.yangtools.yang.binding; /** - * Object is uniquely identifiable in its scope by key - * - * + * Identifiable object, which could be identified by it's key * * @author ttkacik * diff --git a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Identifier.java b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Identifier.java index bdc386d7ea..c9bd129414 100644 --- a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Identifier.java +++ b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Identifier.java @@ -4,9 +4,10 @@ package org.opendaylight.yangtools.yang.binding; * * Object is unique identifier for another object * - * @author ttkacik + * * * @param Class of object for which this object is identifier + * @author ttkacik */ public interface Identifier> { diff --git a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/InstanceIdentifier.java b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/InstanceIdentifier.java index 221bdc48f2..283889fe60 100644 --- a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/InstanceIdentifier.java +++ b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/InstanceIdentifier.java @@ -13,10 +13,11 @@ import java.util.List; import org.opendaylight.yangtools.concepts.Builder; import org.opendaylight.yangtools.concepts.Immutable; -import org.opendaylight.yangtools.concepts.Mutable; /** - * Uniquely identifies instance of data tree. + * Uniquely identifies data location in the overall of data tree + * modeled by YANG. + * * */ public final class InstanceIdentifier implements Immutable { @@ -52,13 +53,11 @@ public final class InstanceIdentifier implements Immutable { } /** - * Path argument of instance identifier. - * + * Path argument of {@link InstanceIdentifier}. + *

* Interface which implementations are used as path components of the - * instance path. - * - * @author ttkacik - * + * path in overall data tree. + * */ public interface PathArgument { @@ -166,11 +165,24 @@ public final class InstanceIdentifier implements Immutable { return new BuilderImpl(); } - private static class BuilderImpl implements InstanceIdentifierBuilder { + public static InstanceIdentifierBuilder builder(InstanceIdentifier basePath) { + return new BuilderImpl(basePath.path); + } + + private static final class BuilderImpl implements InstanceIdentifierBuilder { private List path; private Class target = null; + public BuilderImpl() { + this.path = new ArrayList<>(); + } + + + public BuilderImpl(List prefix) { + this.path = new ArrayList<>(prefix); + } + @Override public InstanceIdentifier toInstance() { List immutablePath = Collections.unmodifiableList(new ArrayList(path)); diff --git a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/NotificationListener.java b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/NotificationListener.java index fbf27e4b8f..6916a55662 100644 --- a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/NotificationListener.java +++ b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/NotificationListener.java @@ -7,10 +7,12 @@ */ package org.opendaylight.yangtools.yang.binding; +import java.util.EventListener; + /** * Marker interface for generated notification listener interfaces * */ -public interface NotificationListener { +public interface NotificationListener extends EventListener { } diff --git a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/annotations/RoutingContext.java b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/annotations/RoutingContext.java index 5a3af9bceb..76dac87131 100644 --- a/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/annotations/RoutingContext.java +++ b/yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/annotations/RoutingContext.java @@ -1,10 +1,19 @@ package org.opendaylight.yangtools.yang.binding.annotations; +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; import org.opendaylight.yangtools.yang.binding.BaseIdentity; + @Inherited +@Documented +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) public @interface RoutingContext { Class value(); -- 2.36.6