3 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
11 package org.opendaylight.controller.cluster.datastore.node.utils;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
16 import java.util.HashSet;
18 import java.util.regex.Matcher;
19 import java.util.regex.Pattern;
21 public class AugmentationIdentifierGenerator {
22 private final String id;
23 private static final Pattern pattern = Pattern.compile("AugmentationIdentifier\\Q{\\EchildNames=\\Q[\\E(.*)\\Q]}\\E");
24 private final Matcher matcher;
25 private final boolean doesMatch;
27 public AugmentationIdentifierGenerator(String id){
29 matcher = pattern.matcher(this.id);
30 doesMatch = matcher.matches();
33 public boolean matches(){
37 public YangInstanceIdentifier.AugmentationIdentifier getPathArgument(){
38 Set<QName> childNames = new HashSet<QName>();
39 final String childQNames = matcher.group(1);
41 final String[] splitChildQNames = childQNames.split(",");
43 for(String name : splitChildQNames){
45 org.opendaylight.controller.cluster.datastore.node.utils.QNameFactory
46 .create(name.trim()));
49 return new YangInstanceIdentifier.AugmentationIdentifier(null, childNames);