Merge "Added generated code compilation test."
authorTony Tkacik <ttkacik@cisco.com>
Wed, 9 Oct 2013 11:13:47 +0000 (11:13 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 9 Oct 2013 11:13:47 +0000 (11:13 +0000)
concepts/pom.xml
concepts/src/main/java/org/opendaylight/yangtools/concepts/AbstractRegistration.java [new file with mode: 0644]
concepts/src/main/java/org/opendaylight/yangtools/concepts/Builder.java
concepts/src/main/java/org/opendaylight/yangtools/concepts/Identifiable.java
concepts/src/main/java/org/opendaylight/yangtools/concepts/Identifier.java
concepts/src/main/java/org/opendaylight/yangtools/concepts/ListenerRegistration.java [new file with mode: 0644]
concepts/src/main/java/org/opendaylight/yangtools/concepts/Mutable.java
concepts/src/main/java/org/opendaylight/yangtools/concepts/Namespace.java
concepts/src/main/java/org/opendaylight/yangtools/concepts/OrderedSet.java
concepts/src/main/java/org/opendaylight/yangtools/concepts/Path.java
concepts/src/main/java/org/opendaylight/yangtools/concepts/Registration.java

index d7bcfd52c426acb9e86974215c53e66205934106..890c508d9b2573aaac09b66d8e52870f2fba61e3 100644 (file)
@@ -1,22 +1,22 @@
-<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">
-
-    <parent>
-        <groupId>org.opendaylight.yangtools</groupId>
-        <artifactId>yangtools</artifactId>
-        <version>0.1.1-SNAPSHOT</version>
-    </parent>
-    <packaging>bundle</packaging>
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>concepts</artifactId>
-    <name>Concepts</name>
-    <description>Java binding for YANG</description>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-            </plugin>
-        </plugins>
-    </build>
-</project>
+<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">\r
+\r
+    <parent>\r
+        <groupId>org.opendaylight.yangtools</groupId>\r
+        <artifactId>yangtools</artifactId>\r
+        <version>0.1.1-SNAPSHOT</version>\r
+    </parent>\r
+    <packaging>bundle</packaging>\r
+    <modelVersion>4.0.0</modelVersion>\r
+    <artifactId>concepts</artifactId>\r
+    <name>Concepts</name>\r
+    <description>Java binding for YANG</description>\r
+\r
+    <build>\r
+        <plugins>\r
+            <plugin>\r
+                <groupId>org.apache.felix</groupId>\r
+                <artifactId>maven-bundle-plugin</artifactId>\r
+            </plugin>\r
+        </plugins>\r
+    </build>\r
+</project>\r
diff --git a/concepts/src/main/java/org/opendaylight/yangtools/concepts/AbstractRegistration.java b/concepts/src/main/java/org/opendaylight/yangtools/concepts/AbstractRegistration.java
new file mode 100644 (file)
index 0000000..24b43dd
--- /dev/null
@@ -0,0 +1,38 @@
+package org.opendaylight.yangtools.concepts;\r
+\r
+/**\r
+ * Utility registration handle. It is a convenience for register-style method\r
+ * which can return an AutoCloseable realized by a subclass of this class.\r
+ * Invoking the close() method triggers unregistration of the state the method\r
+ * installed.\r
+ */\r
+public abstract class AbstractRegistration<T> implements Registration<T> {\r
+\r
+    private boolean closed = false;\r
+    private final T instance;\r
+\r
+    public AbstractRegistration(T instance) {\r
+        this.instance = instance;\r
+    }\r
+\r
+    @Override\r
+    public T getInstance() {\r
+        return instance;\r
+    }\r
+\r
+    /**\r
+     * Remove the state referenced by this registration. This method is\r
+     * guaranteed to be called at most once. The referenced state must be\r
+     * retained until this method is invoked.\r
+     */\r
+    protected abstract void removeRegistration();\r
+\r
+    @Override\r
+    public void close() throws Exception {\r
+        if (!closed) {\r
+            closed = true;\r
+            removeRegistration();\r
+        }\r
+    }\r
+\r
+}\r
index dd5859d661f7fd9584a6443a2b1afed8a747aa04..df2fe2912583b7cb9c00725cd1e92d9c50334531 100644 (file)
@@ -1,19 +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.concepts;
-
-/**
- * Builder object which produces a product.
- * 
- * @param <P> Product of builder
- * 
- * @author Tony Tkacik <ttkacik@cisco.com>
- */
-public interface Builder<P> extends Mutable {
-    P toInstance();
-}
+/*\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.concepts;\r
+\r
+/**\r
+ * Builder object which produces a product.\r
+ * \r
+ * @param <P> Product of builder\r
+ * \r
+ * @author Tony Tkacik <ttkacik@cisco.com>\r
+ */\r
+public interface Builder<P> extends Mutable {\r
+    P toInstance();\r
+}\r
index aea084c53803e9b3b5b06b3893d6fc081e92d87f..185a2106f143b21f934921ce6463ada036882472 100644 (file)
@@ -1,12 +1,12 @@
-/*
- * 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.concepts;
-
-public interface Identifiable<T> {
-    T getIdentifier();
-}
+/*\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.concepts;\r
+\r
+public interface Identifiable<T> {\r
+    T getIdentifier();\r
+}\r
index 148865b850cec84120517d8a6451e66072b6d441..715e798a8d227406b3ef57e49b6fd54cbf589e89 100644 (file)
@@ -1,21 +1,21 @@
-/*
- * 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.concepts;
-
-import java.io.Serializable;
-
-/**
- * General identifier interface. It is primarily a marker for all things that
- * identify concepts -- such as names, addresses, classes, etc. We do not
- * require too much, just that the identifiers are serializable (and this
- * transferable).
- */
-public interface Identifier extends Serializable, Immutable {
-
-}
-
+/*\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.concepts;\r
+\r
+import java.io.Serializable;\r
+\r
+/**\r
+ * General identifier interface. It is primarily a marker for all things that\r
+ * identify concepts -- such as names, addresses, classes, etc. We do not\r
+ * require too much, just that the identifiers are serializable (and this\r
+ * transferable).\r
+ */\r
+public interface Identifier extends Serializable, Immutable {\r
+\r
+}\r
+\r
diff --git a/concepts/src/main/java/org/opendaylight/yangtools/concepts/ListenerRegistration.java b/concepts/src/main/java/org/opendaylight/yangtools/concepts/ListenerRegistration.java
new file mode 100644 (file)
index 0000000..793e03c
--- /dev/null
@@ -0,0 +1,7 @@
+package org.opendaylight.yangtools.concepts;\r
+\r
+import java.util.EventListener;\r
+\r
+public interface ListenerRegistration<T extends EventListener> extends Registration<T> {\r
+\r
+}\r
index 60c10352df54531df49221d6f312319d99b9f6bc..40266a09473a18d00b3759d439b4d3a7dcab5159 100644 (file)
@@ -1,21 +1,21 @@
-/*
- * 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.concepts;
-
-/**
- * Mutable object - object may change it's state during lifecycle.
- * 
- * This interface is mutually exclusive with {@link Immutable}  and other
- * {@link MutationBehaviour}s.
- * 
- * @author Tony Tkacik <ttkacik@cisco.com>
- *
- */
-public interface Mutable extends MutationBehaviour<Mutable>{
-    
-}
+/*\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.concepts;\r
+\r
+/**\r
+ * Mutable object - object may change it's state during lifecycle.\r
+ * \r
+ * This interface is mutually exclusive with {@link Immutable}  and other\r
+ * {@link MutationBehaviour}s.\r
+ * \r
+ * @author Tony Tkacik <ttkacik@cisco.com>\r
+ *\r
+ */\r
+public interface Mutable extends MutationBehaviour<Mutable>{\r
+    \r
+}\r
index cb759c05c32908614ac2387253e83f1b454b4342..b66c1c3397f63766bdd1273843978845bfb97848 100644 (file)
@@ -1,12 +1,12 @@
-package org.opendaylight.yangtools.concepts;
-
-import java.util.Set;
-
-public interface Namespace<K,V> {
-    
-    V get(K key);
-    
-    Namespace<K,V> getParent();
-    Set<Namespace<K,V>> getSubnamespaces();
-    Namespace<K,V> getSubnamespace(V key);
-}
+package org.opendaylight.yangtools.concepts;\r
+\r
+import java.util.Set;\r
+\r
+public interface Namespace<K,V> {\r
+    \r
+    V get(K key);\r
+    \r
+    Namespace<K,V> getParent();\r
+    Set<Namespace<K,V>> getSubnamespaces();\r
+    Namespace<K,V> getSubnamespace(V key);\r
+}\r
index 99745b20033b36dde091d3bc6e9fe593af6188c6..af5c094e054d2356d980b087822f554701c4b632 100644 (file)
@@ -1,9 +1,9 @@
-package org.opendaylight.yangtools.concepts;
-import java.util.List;
-import java.util.Set;
-
-
-public interface OrderedSet<E> extends Set<E>,List<E> {
-
-    
-}
+package org.opendaylight.yangtools.concepts;\r
+import java.util.List;\r
+import java.util.Set;\r
+\r
+\r
+public interface OrderedSet<E> extends Set<E>,List<E> {\r
+\r
+    \r
+}\r
index d73326432d5f97eb6d2279e91de3b9c80cc7fd5d..1da31e858ba6c31e782bd81d99954b623a3815fd 100644 (file)
@@ -1,13 +1,13 @@
-/*
- * 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.concepts;
-
-public interface Path<P extends Path<P>> {
-
-    boolean contains(P other);
-}
+/*\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.concepts;\r
+\r
+public interface Path<P extends Path<P>> {\r
+\r
+    boolean contains(P other);\r
+}\r
index f6b842421ad247e4c160bab932651652354ba7e8..369ff5366401408dc0deaba35fc22315f1c2cee2 100644 (file)
@@ -1,14 +1,20 @@
-/*
- * 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.concepts;
-
-public interface Registration<T> {
-
-    T getInstance();
-    void unregister();
-}
+/*\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.concepts;\r
+\r
+public interface Registration<T> extends AutoCloseable {\r
+\r
+    T getInstance();\r
+\r
+    /**\r
+     * Unregisters object\r
+     * \r
+     */\r
+    @Override\r
+    public void close() throws Exception;\r
+}\r