Moved MD SAL from sal/yang-prototype to md-sal
[controller.git] / opendaylight / md-sal / sal-dom-demo / src / main / java / org / opendaylight / controller / sal / demo / DemoUtils.java
diff --git a/opendaylight/md-sal/sal-dom-demo/src/main/java/org/opendaylight/controller/sal/demo/DemoUtils.java b/opendaylight/md-sal/sal-dom-demo/src/main/java/org/opendaylight/controller/sal/demo/DemoUtils.java
new file mode 100644 (file)
index 0000000..3b04309
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * 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.controller.sal.demo;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Date;
+
+import org.opendaylight.controller.yang.common.QName;
+import org.opendaylight.controller.yang.data.api.Node;
+import org.opendaylight.controller.yang.data.util.Nodes;
+
+
+public class DemoUtils {
+
+    public static final URI namespace = uri("urn:cisco:prototype:sal:demo");
+    public static final Date revision = new Date();
+
+    public static final QName alertNotification = qName("alert");
+    public static final QName changeNotification = qName("change");
+
+    public static final QName contentNodeName = qName("content");
+
+    public static URI uri(String str) {
+        try {
+            return new URI(str);
+        } catch (URISyntaxException e) {
+            throw new IllegalArgumentException(e);
+        }
+    }
+
+    public static QName qName(String str) {
+        return new QName(namespace, revision, str);
+    }
+
+    public static Node<?> contentNode(String content) {
+        return Nodes.leafNode(contentNodeName, content);
+    }
+}