Map<String, ModuleMXBeanEntry> result = new HashMap<>();
for (AugmentationSchema augmentation : currentModule.getAugmentations()) {
- Set<DataSchemaNode> childNodes = augmentation.getChildNodes();
+ Collection<DataSchemaNode> childNodes = augmentation.getChildNodes();
if (areAllChildrenChoiceCaseNodes(childNodes)) {
for (ChoiceCaseNode childCase : castChildNodesToChoiceCases(childNodes)) {
// TODO refactor, extract to standalone builder class
return moduleIdentities;
}
- private Collection<ChoiceCaseNode> castChildNodesToChoiceCases(final Set<DataSchemaNode> childNodes) {
+ private Collection<ChoiceCaseNode> castChildNodesToChoiceCases(final Collection<DataSchemaNode> childNodes) {
return Collections2.transform(childNodes, new Function<DataSchemaNode, ChoiceCaseNode>() {
@Nullable
@Override
});
}
- private boolean areAllChildrenChoiceCaseNodes(final Set<DataSchemaNode> childNodes) {
+ private boolean areAllChildrenChoiceCaseNodes(final Iterable<DataSchemaNode> childNodes) {
for (DataSchemaNode childNode : childNodes) {
if (childNode instanceof ChoiceCaseNode == false) {
return false;
* @return either choiceCaseNode or its only child container
*/
private <HAS_CHILDREN_AND_QNAME extends DataNodeContainer & SchemaNode> HAS_CHILDREN_AND_QNAME getDataNodeContainer(final ChoiceCaseNode choiceCaseNode) {
- Set<DataSchemaNode> childNodes = choiceCaseNode.getChildNodes();
+ Collection<DataSchemaNode> childNodes = choiceCaseNode.getChildNodes();
if (childNodes.size() == 1) {
DataSchemaNode onlyChild = childNodes.iterator().next();
if (onlyChild instanceof ContainerSchemaNode) {
final TypeProviderWrapper typeProviderWrapper, final Map<QName, ServiceInterfaceEntry> qNamesToSIEs,
final SchemaContext schemaContext, final String packageName) {
Map<String, AttributeIfc> yangToAttributes = new HashMap<>();
- Set<DataSchemaNode> childNodes = dataNodeContainer.getChildNodes();
- for (DataSchemaNode attrNode : childNodes) {
+ for (DataSchemaNode attrNode : dataNodeContainer.getChildNodes()) {
AttributeIfc attributeValue = getAttributeValue(attrNode, currentModule, qNamesToSIEs, typeProviderWrapper,
schemaContext, packageName);
yangToAttributes.put(attributeValue.getAttributeYangName(), attributeValue);
}
}
- private static Collection<DataSchemaNode> sortAttributes(final Set<DataSchemaNode> childNodes) {
+ private static Collection<DataSchemaNode> sortAttributes(final Collection<DataSchemaNode> childNodes) {
final TreeSet<DataSchemaNode> dataSchemaNodes = new TreeSet<>(new Comparator<DataSchemaNode>() {
@Override
public int compare(final DataSchemaNode o1, final DataSchemaNode o2) {
import java.lang.reflect.Method;
import java.util.AbstractMap.SimpleEntry;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
return Iterables.filter(augmentations, new Predicate<AugmentationSchema>() {
@Override
public boolean apply(final AugmentationSchema schema) {
- final Set<DataSchemaNode> childNodes = schema.getChildNodes();
- return !schema.getChildNodes().isEmpty()
- && module.equals(Iterables.get(childNodes, 0).getQName().getModule());
+ final Collection<DataSchemaNode> childNodes = schema.getChildNodes();
+ return !childNodes.isEmpty() && module.equals(Iterables.get(childNodes, 0).getQName().getModule());
}
});
}
}
private static DataSchemaNode searchInChoices(final DataNodeContainer node, final QName arg) {
- Set<DataSchemaNode> children = node.getChildNodes();
- for (DataSchemaNode child : children) {
+ for (DataSchemaNode child : node.getChildNodes()) {
if (child instanceof ChoiceNode) {
ChoiceNode choiceNode = (ChoiceNode) child;
DataSchemaNode potential = searchInCases(choiceNode, arg);
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
this.qName = Preconditions.checkNotNull(qName, "qName");
}
- public NodeContainerProxy(final QName qName, final Set<DataSchemaNode> childNodes) {
+ public NodeContainerProxy(final QName qName, final Collection<DataSchemaNode> childNodes) {
this(qName, asMap(childNodes));
}
- private static Map<QName, DataSchemaNode> asMap(final Set<DataSchemaNode> childNodes) {
+ private static Map<QName, DataSchemaNode> asMap(final Collection<DataSchemaNode> childNodes) {
final Map<QName, DataSchemaNode> mapped = Maps.newHashMap();
for (final DataSchemaNode childNode : childNodes) {
mapped.put(childNode.getQName(), childNode);
import java.io.StringWriter;
import java.util.Collections;
import java.util.List;
-import java.util.Set;
/*
* Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
factory.setIgnoringComments(true);
}
- private static DataSchemaNode findChildNode(Set<DataSchemaNode> children,
+ private static DataSchemaNode findChildNode(Iterable<DataSchemaNode> children,
String name) {
List<DataNodeContainer> containers = Lists.newArrayList();
+ childNodeName);
}
- static DataSchemaNode findChildNode(final Set<DataSchemaNode> children, final String name) {
+ static DataSchemaNode findChildNode(final Iterable<DataSchemaNode> children, final String name) {
List<DataNodeContainer> containers = Lists.newArrayList();
for (DataSchemaNode dataSchemaNode : children) {
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.net.URI;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
final Set<QName> foundLists = new HashSet<>();
- Set<DataSchemaNode> parentSchemaChildNodes = parentSchema == null ? Collections.<DataSchemaNode> emptySet()
+ Collection<DataSchemaNode> parentSchemaChildNodes = parentSchema == null ? Collections.<DataSchemaNode> emptySet()
: parentSchema.getChildNodes();
for (Node<?> child : parent.getValue()) {
}
}
- private static DataSchemaNode findFirstSchemaForNode(final Node<?> node, final Set<DataSchemaNode> dataSchemaNode) {
+ private static DataSchemaNode findFirstSchemaForNode(final Node<?> node, final Iterable<DataSchemaNode> dataSchemaNode) {
for (DataSchemaNode dsn : dataSchemaNode) {
if (node.getNodeType().equals(dsn.getQName())) {
return dsn;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.Iterables;
+
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URLDecoder;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+
import javax.ws.rs.core.Response.Status;
+
import org.opendaylight.controller.sal.core.api.mount.MountInstance;
import org.opendaylight.controller.sal.core.api.mount.MountService;
import org.opendaylight.controller.sal.rest.api.Draft02;
private void collectInstanceDataNodeContainers(final List<DataSchemaNode> potentialSchemaNodes,
final DataNodeContainer container, final String name) {
- Set<DataSchemaNode> childNodes = container.getChildNodes();
-
Predicate<DataSchemaNode> filter = new Predicate<DataSchemaNode>() {
@Override
public boolean apply(final DataSchemaNode node) {
}
};
- Iterable<DataSchemaNode> nodes = Iterables.filter(childNodes, filter);
+ Iterable<DataSchemaNode> nodes = Iterables.filter(container.getChildNodes(), filter);
// Can't combine this loop with the filter above because the filter is
// lazily-applied by Iterables.filter.
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
List<Api> apis = new ArrayList<Api>();
- Set<DataSchemaNode> dataSchemaNodes = m.getChildNodes();
+ Collection<DataSchemaNode> dataSchemaNodes = m.getChildNodes();
_logger.debug("child nodes size [{}]", dataSchemaNodes.size());
for (DataSchemaNode node : dataSchemaNodes) {
if ((node instanceof ListSchemaNode) || (node instanceof ContainerSchemaNode)) {
apis.add(api);
if ((node instanceof ListSchemaNode) || (node instanceof ContainerSchemaNode)) {
DataNodeContainer schemaNode = (DataNodeContainer) node;
- Set<DataSchemaNode> dataSchemaNodes = schemaNode.getChildNodes();
- for (DataSchemaNode childNode : dataSchemaNodes) {
+ for (DataSchemaNode childNode : schemaNode.getChildNodes()) {
// We don't support going to leaf nodes today. Only lists and
// containers.
if (childNode instanceof ListSchemaNode || childNode instanceof ContainerSchemaNode) {
JSONException {
String moduleName = module.getName();
- Set<DataSchemaNode> childNodes = module.getChildNodes();
- for (DataSchemaNode childNode : childNodes) {
+ for (DataSchemaNode childNode : module.getChildNodes()) {
JSONObject configModuleJSON = null;
JSONObject operationalModuleJSON = null;
String containerDescription = container.getDescription();
moduleJSON.put(DESCRIPTION_KEY, containerDescription);
- Set<DataSchemaNode> containerChildren = container.getChildNodes();
- JSONObject properties = processChildren(containerChildren, moduleName, models, isConfig);
+ JSONObject properties = processChildren(container.getChildNodes(), moduleName, models, isConfig);
moduleJSON.put(PROPERTIES_KEY, properties);
return moduleJSON;
}
- private JSONObject processChildren(Set<DataSchemaNode> nodes, String moduleName,
+ private JSONObject processChildren(Iterable<DataSchemaNode> nodes, String moduleName,
JSONObject models) throws JSONException, IOException {
return processChildren(nodes, moduleName, models, null);
}
* @throws JSONException
* @throws IOException
*/
- private JSONObject processChildren(Set<DataSchemaNode> nodes, String moduleName,
+ private JSONObject processChildren(Iterable<DataSchemaNode> nodes, String moduleName,
JSONObject models, Boolean isConfig) throws JSONException, IOException {
JSONObject properties = new JSONObject();
private JSONObject processListSchemaNode(ListSchemaNode listNode, String moduleName,
JSONObject models, Boolean isConfig) throws JSONException, IOException {
- Set<DataSchemaNode> listChildren = listNode.getChildNodes();
String fileName = (BooleanUtils.isNotFalse(isConfig)?OperationBuilder.CONFIG:OperationBuilder.OPERATIONAL) +
listNode.getQName().getLocalName();
- JSONObject childSchemaProperties = processChildren(listChildren, moduleName, models);
+ JSONObject childSchemaProperties = processChildren(listNode.getChildNodes(), moduleName, models);
JSONObject childSchema = getSchemaTemplate();
childSchema.put(TYPE_KEY, OBJECT_TYPE);
childSchema.put(PROPERTIES_KEY, childSchemaProperties);
import com.google.common.base.Preconditions;
import java.util.Collections;
import java.util.Iterator;
-import java.util.Set;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
public class OutputDefinition implements Iterable<DataSchemaNode> {
public static final OutputDefinition EMPTY_OUTPUT = new OutputDefinition(Collections.<DataSchemaNode>emptySet());
- private final Set<DataSchemaNode> childNodes;
+ private final Iterable<DataSchemaNode> childNodes;
- public OutputDefinition(final Set<DataSchemaNode> childNodes) {
+ public OutputDefinition(final Iterable<DataSchemaNode> childNodes) {
this.childNodes = childNodes;
}