Initial opendaylight infrastructure commit!!
[controller.git] / opendaylight / sal / yang-prototype / sal / sal-core-demo / src / main / java / org / opendaylight / controller / sal / demo / DemoUtils.java
1 /*\r
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
3  *\r
4  * This program and the accompanying materials are made available under the\r
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7  */\r
8 package org.opendaylight.controller.sal.demo;\r
9 \r
10 import java.net.URI;\r
11 import java.net.URISyntaxException;\r
12 import java.util.Date;\r
13 \r
14 import org.opendaylight.controller.data.util.Nodes;\r
15 import org.opendaylight.controller.yang.common.QName;\r
16 import org.opendaylight.controller.yang.data.api.Node;\r
17 \r
18 \r
19 public class DemoUtils {\r
20 \r
21     public static final URI namespace = uri("urn:cisco:prototype:sal:demo");\r
22     public static final Date revision = new Date();\r
23 \r
24     public static final QName alertNotification = qName("alert");\r
25     public static final QName changeNotification = qName("change");\r
26 \r
27     public static final QName contentNodeName = qName("content");\r
28 \r
29     public static URI uri(String str) {\r
30         try {\r
31             return new URI(str);\r
32         } catch (URISyntaxException e) {\r
33             throw new IllegalArgumentException(e);\r
34         }\r
35     }\r
36 \r
37     public static QName qName(String str) {\r
38         return new QName(namespace, revision, str);\r
39     }\r
40 \r
41     public static Node<?> contentNode(String content) {\r
42         return Nodes.leafNode(contentNodeName, content);\r
43     }\r
44 }\r