- @Override
- public StructuredData getModules(final String identifier, final UriInfo uriInfo) {
- Set<Module> modules = null;
- DOMMountPoint mountPoint = null;
- if (identifier.contains(ControllerContext.MOUNT)) {
- InstanceIdentifierContext mountPointIdentifier = this.controllerContext.toMountPointIdentifier(identifier);
- mountPoint = mountPointIdentifier.getMountPoint();
- modules = this.controllerContext.getAllModules(mountPoint);
- } else {
- throw new RestconfDocumentedException(
- "URI has bad format. If modules behind mount point should be showed, URI has to end with "
- + ControllerContext.MOUNT, ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE);
- }
-
- final List<Node<?>> modulesAsData = new ArrayList<Node<?>>();
- Module restconfModule = this.getRestconfModule();
- final DataSchemaNode moduleSchemaNode = controllerContext.getRestconfModuleRestConfSchemaNode(restconfModule,
- Draft02.RestConfModule.MODULE_LIST_SCHEMA_NODE);
-
- for (final Module module : modules) {
- modulesAsData.add(this.toModuleCompositeNode(module, moduleSchemaNode));
- }
-
- final DataSchemaNode modulesSchemaNode = controllerContext.getRestconfModuleRestConfSchemaNode(restconfModule,
- Draft02.RestConfModule.MODULES_CONTAINER_SCHEMA_NODE);
- QName qName = modulesSchemaNode.getQName();
- final CompositeNode modulesNode = NodeFactory.createImmutableCompositeNode(qName, null, modulesAsData);
- return new StructuredData(modulesNode, modulesSchemaNode, mountPoint, parsePrettyPrintParameter(uriInfo));
- }
-