Added serializer/deserializer for JSON/XML
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / sal / restconf / impl / RestconfImpl.xtend
1 package org.opendaylight.controller.sal.restconf.impl
2
3 import org.opendaylight.yangtools.yang.data.api.CompositeNode
4 import org.opendaylight.controller.sal.rest.api.RestconfService
5
6 class RestconfImpl implements RestconfService {
7     
8     val static RestconfImpl INSTANCE = new RestconfImpl
9
10     @Property
11     BrokerFacade broker
12
13     @Property
14     extension ControllerContext controllerContext
15     
16     private new() {
17         if (INSTANCE != null) {
18             throw new IllegalStateException("Already instantiated");
19         }
20     }
21     
22     static def getInstance() {
23         return INSTANCE
24     }
25
26     override readAllData() {
27 //        return broker.readOperationalData("".toInstanceIdentifier.getInstanceIdentifier);
28         throw new UnsupportedOperationException("TODO: auto-generated method stub")
29     }
30
31     override getModules() {
32         throw new UnsupportedOperationException("TODO: auto-generated method stub")
33     }
34
35     override getRoot() {
36         throw new UnsupportedOperationException("TODO: auto-generated method stub")
37
38     }
39
40     override readData(String identifier) {
41         val instanceIdentifierWithSchemaNode = identifier.toInstanceIdentifier
42         val data = broker.readOperationalData(instanceIdentifierWithSchemaNode.getInstanceIdentifier);
43         return new StructuredData(data, instanceIdentifierWithSchemaNode.schemaNode)
44     }
45
46     override createConfigurationData(String identifier, CompositeNode payload) {
47 //        return broker.commitConfigurationDataCreate(identifier.toInstanceIdentifier.getInstanceIdentifier, payload);
48         throw new UnsupportedOperationException("TODO: auto-generated method stub")
49     }
50
51     override updateConfigurationData(String identifier, CompositeNode payload) {
52 //        return broker.commitConfigurationDataCreate(identifier.toInstanceIdentifier.getInstanceIdentifier, payload);
53         throw new UnsupportedOperationException("TODO: auto-generated method stub")
54     }
55
56     override invokeRpc(String identifier, CompositeNode payload) {
57         val rpcResult = broker.invokeRpc(identifier.toRpcQName, payload);
58         return new StructuredData(rpcResult.result, identifier.toInstanceIdentifier.getSchemaNode)
59     }
60
61 }