Added documentation to yang-binding, updated dependencies.
authorTony Tkacik <ttkacik@cisco.com>
Wed, 2 Oct 2013 17:52:57 +0000 (19:52 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Wed, 2 Oct 2013 17:52:57 +0000 (19:52 +0200)
Change-Id: I1ed36c8539b496a44595f8895737accc7c77d8b8
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
yang/yang-binding/pom.xml
yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Augmentable.java
yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Augmentation.java
yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/BaseIdentity.java
yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/DataObject.java
yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/DataRoot.java
yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Identifiable.java
yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Identifier.java
yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/InstanceIdentifier.java
yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/NotificationListener.java
yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/annotations/RoutingContext.java

index 2d51f451da3b69c3c23757fc3106ffee1ead660a..4401c8a9205bdd638fa184265911e065c3294253 100644 (file)
@@ -18,5 +18,9 @@
             <artifactId>concepts</artifactId>\r
             <version>0.1.1-SNAPSHOT</version>\r
         </dependency>\r
+        <dependency>\r
+            <groupId>org.opendaylight.yangtools</groupId>\r
+            <artifactId>yang-common</artifactId>\r
+        </dependency>\r
     </dependencies>\r
 </project>\r
index c7e109dc0fad86dbc30791ead110d9c642f2b9b0..340bd5b46dd2811fd0ba60cf247dad2fe12475fd 100644 (file)
@@ -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<T> {
-
-    <E extends Augmentation<T>> E getAugmentation(Class<E> augmentationType);
-}
+/*\r
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+package org.opendaylight.yangtools.yang.binding;\r
+\r
+/**\r
+ * Augmentable (extensible) object which could carry additional data defined by\r
+ * third-party extension, without introducing conflict between various\r
+ * extension.\r
+ * \r
+ * This interface uses extended version of ExtensibleInterface pattern which\r
+ * also adds marker interface for augmentations (extensions) -\r
+ * {@link Augmentable}\r
+ * \r
+ * @author Tony Tkacik <ttkacik@cisco.com>\r
+ * @param <T>\r
+ *            Base class which should implements this interface and is target\r
+ *            for augmentation.\r
+ */\r
+public interface Augmentable<T> {\r
+\r
+    /**\r
+     * Returns instance of augmentation.\r
+     * \r
+     * @param augmentationType\r
+     *            Type of augmentation to be returned.\r
+     * @return instance of augmentation.\r
+     */\r
+    <E extends Augmentation<T>> E getAugmentation(Class<E> augmentationType);\r
+}\r
index 65ca94cf7e44b4bccd476391787a9dafe1998d27..ad8401b0a7ec5ed7f7ec965cb41565ade14d3b9a 100644 (file)
@@ -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<T> {
-
-}
+/*\r
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+package org.opendaylight.yangtools.yang.binding;\r
+\r
+/**\r
+ * Augmentation (extension) of other interface\r
+ *\r
+ * @param <T> Class to which this implementation is extension.\r
+ */\r
+public interface Augmentation<T> {\r
+\r
+}\r
index 94c03117d087dfd6ff6f3fcc390e8df57918564b..0c4a7beaf121b63fce087df6454a13829425cade 100644 (file)
@@ -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() {
-    }
-
-}
+/*\r
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+package org.opendaylight.yangtools.yang.binding;\r
+\r
+/**\r
+ * Base Identity\r
+ * \r
+ */\r
+public abstract class BaseIdentity {\r
+\r
+    public final static BaseIdentity INSTANCE = new BaseIdentity() {\r
+    };\r
+\r
+    protected BaseIdentity() {\r
+\r
+    }\r
+\r
+}\r
index 31d547ffb277e426401c94c6ffdde98204356ce6..d51572e2d89ee3fb4645ffb7a2e3022311b35506 100644 (file)
@@ -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 {
-
-}
+/*\r
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+package org.opendaylight.yangtools.yang.binding;\r
+\r
+/**\r
+ * Data container is an interface which has structured contents.\r
+ * \r
+ * \r
+ * @author Tony Tkacik <ttkacik@cisco.com>\r
+ *\r
+ */\r
+public interface DataObject {\r
+\r
+}\r
index 81d19657c8b03f36696496142b36885bc5f9eec2..5882b5159e4b221990a6dd58d677e248baed78f8 100644 (file)
@@ -7,6 +7,10 @@
  */\r
 package org.opendaylight.yangtools.yang.binding;\r
 \r
+/**\r
+ * Data Root of YANG module\r
+ * \r
+ */\r
 public interface DataRoot {\r
 \r
 }\r
index 4eb04e4dc67c09a7c5d10948ebbf5c176e5f76f1..9f32c0f24f3a69d32aa2f10fdc3bad5360389b50 100644 (file)
@@ -2,9 +2,7 @@ package org.opendaylight.yangtools.yang.binding;
 \r
 \r
 /**\r
- * Object is uniquely identifiable in its scope by key\r
- * \r
- * \r
+ * Identifiable object, which could be identified by it's key\r
  * \r
  * @author ttkacik\r
  *\r
index bdc386d7ea3bd2c3ca1840a95f5bf6d3796e3374..c9bd129414fae462a1bbfe0db6a46b444df6e720 100644 (file)
@@ -4,9 +4,10 @@ package org.opendaylight.yangtools.yang.binding;
  * \r
  * Object is unique identifier for another object\r
  * \r
- * @author ttkacik\r
+ *\r
  *\r
  * @param <T> Class of object for which this object is identifier\r
+ * @author ttkacik\r
  */\r
 public interface Identifier<T extends Identifiable<?>> {\r
 \r
index 221bdc48f26e4f5d9b8a4d35e8035723ba7b8144..283889fe605988c1d5016ee6f5ba93c184e1ae57 100644 (file)
@@ -13,10 +13,11 @@ import java.util.List;
 \r
 import org.opendaylight.yangtools.concepts.Builder;\r
 import org.opendaylight.yangtools.concepts.Immutable;\r
-import org.opendaylight.yangtools.concepts.Mutable;\r
 \r
 /**\r
- * Uniquely identifies instance of data tree.\r
+ * Uniquely identifies data location in the overall of data tree \r
+ * modeled by YANG.\r
+ * \r
  * \r
  */\r
 public final class InstanceIdentifier implements Immutable {\r
@@ -52,13 +53,11 @@ public final class InstanceIdentifier implements Immutable {
     }\r
 \r
     /**\r
-     * Path argument of instance identifier.\r
-     * \r
+     * Path argument of {@link InstanceIdentifier}.\r
+     * <p>\r
      * Interface which implementations are used as path components of the\r
-     * instance path.\r
-     * \r
-     * @author ttkacik\r
-     * \r
+     * path in overall data tree.\r
+     *\r
      */\r
     public interface PathArgument {\r
 \r
@@ -166,11 +165,24 @@ public final class InstanceIdentifier implements Immutable {
         return new BuilderImpl();\r
     }\r
 \r
-    private static class BuilderImpl implements InstanceIdentifierBuilder {\r
+    public static InstanceIdentifierBuilder builder(InstanceIdentifier basePath) {\r
+        return new BuilderImpl(basePath.path);\r
+    }\r
+\r
+    private static final class BuilderImpl implements InstanceIdentifierBuilder {\r
 \r
         private List<PathArgument> path;\r
         private Class<? extends DataObject> target = null;\r
 \r
+        public BuilderImpl() {\r
+            this.path = new ArrayList<>();\r
+        }\r
+        \r
+\r
+        public BuilderImpl(List<? extends PathArgument> prefix) {\r
+            this.path = new ArrayList<>(prefix);\r
+        }\r
+\r
         @Override\r
         public InstanceIdentifier toInstance() {\r
             List<PathArgument> immutablePath = Collections.unmodifiableList(new ArrayList<PathArgument>(path));\r
index fbf27e4b8f0fb2f3d605b132b5a690b8b0ac2f19..6916a55662401880102dcf6673a2896d45412a5b 100644 (file)
@@ -7,10 +7,12 @@
  */\r
 package org.opendaylight.yangtools.yang.binding;\r
 \r
+import java.util.EventListener;\r
+\r
 /**\r
  * Marker interface for generated notification listener interfaces\r
  *\r
  */\r
-public interface NotificationListener {\r
+public interface NotificationListener extends EventListener {\r
 \r
 }\r
index 5a3af9bceb011a6e41a89a7edcdeebf0ea74d96f..76dac8713109307a1594c0916e03c6f8ae05fcc3 100644 (file)
@@ -1,10 +1,19 @@
 package org.opendaylight.yangtools.yang.binding.annotations;\r
 \r
+import java.lang.annotation.Documented;\r
+import java.lang.annotation.ElementType;\r
 import java.lang.annotation.Inherited;\r
+import java.lang.annotation.Retention;\r
+import java.lang.annotation.RetentionPolicy;\r
+import java.lang.annotation.Target;\r
 \r
 import org.opendaylight.yangtools.yang.binding.BaseIdentity;\r
 \r
+\r
 @Inherited\r
+@Documented\r
+@Target(ElementType.METHOD)\r
+@Retention(RetentionPolicy.RUNTIME)\r
 public @interface RoutingContext {\r
 \r
     Class<? extends BaseIdentity> value();\r