import com.google.common.base.Optional;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
private DOMMountPointService mountService;
private final Map<YangInstanceIdentifier, Long> instanceIdToLongId = new TreeMap<>(
- new Comparator<YangInstanceIdentifier>() {
- @Override
- public int compare(final YangInstanceIdentifier o1, final YangInstanceIdentifier o2) {
- return o1.toString().compareToIgnoreCase(o2.toString());
- }
- });
+ (o1, o2) -> o1.toString().compareToIgnoreCase(o2.toString()));
private final Map<Long, YangInstanceIdentifier> longIdToInstanceId = new HashMap<>();
private final Object lock = new Object();
builder.append(moduleName);
builder.append(':');
}
- boolean first = true;
for (PathArgument arg : key.getPathArguments()) {
-
String name = arg.getNodeType().getLocalName();
- if (first) {
- first = false;
- } else {
- builder.append('/');
- }
- builder.append(name);
if (arg instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates) {
NodeIdentifierWithPredicates nodeId = (NodeIdentifierWithPredicates) arg;
for (Entry<QName, Object> entry : nodeId.getKeyValues().entrySet()) {
- builder.append('/').append(entry.getValue());
+ builder.append(entry.getValue()).append('/');
}
+ } else {
+ builder.append(name);
+ builder.append('/');
}
}
-
- return builder.append('/').toString();
+ return builder.toString();
}
private String getYangMountUrl(final YangInstanceIdentifier key) {
return null; // indicating not found.
}
SchemaContext context = getSchemaContext(iid);
- String urlPrefix = getYangMountUrl(iid);
if (context == null) {
return createResourceList();
}
dataStores.setDescription("Provides methods for accessing the data stores.");
dataStores.setPath(generatePath(uriInfo, DATASTORES_LABEL, DATASTORES_REVISION));
resources.add(dataStores);
+ String urlPrefix = getYangMountUrl(iid);
ResourceList list = super.getResourceListing(uriInfo, context, urlPrefix);
resources.addAll(list.getApis());
list.setApis(resources);
}
private ApiDeclaration generateDataStoreApiDoc(final UriInfo uriInfo, final String context) {
-
- ApiDeclaration declaration = super.createApiDeclaration(createBasePathFromUriInfo(uriInfo));
List<Api> apis = new LinkedList<>();
apis.add(createGetApi("config",
"Queries the config (startup) datastore on the mounted hosted.", context));
"Queries the operational (running) datastore on the mounted hosted.", context));
apis.add(createGetApi("operations",
"Queries the available operations (RPC calls) on the mounted hosted.", context));
+
+ ApiDeclaration declaration = super.createApiDeclaration(createBasePathFromUriInfo(uriInfo));
declaration.setApis(apis);
return declaration;