Decouple config and netconf subsystems.
[controller.git] / opendaylight / config / config-manager-facade-xml / src / main / java / org / opendaylight / controller / config / facade / xml / rpc / RuntimeRpcElementResolved.java
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.controller.netconf.confignetconfconnector.operations.runtimerpc;
+package org.opendaylight.controller.config.facade.xml.rpc;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
@@ -18,8 +18,7 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import javax.management.ObjectName;
 import org.opendaylight.controller.config.api.jmx.ObjectNameUtil;
-import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;
-import org.opendaylight.controller.netconf.confignetconfconnector.mapping.rpc.ModuleRpcs;
+import org.opendaylight.controller.config.util.xml.XmlMappingConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.Modules;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.modules.Module;
 
@@ -34,7 +33,7 @@ public final class RuntimeRpcElementResolved {
     private final Map<String, String> additionalAttributes;
 
     private RuntimeRpcElementResolved(String namespace, String moduleName, String instanceName, String runtimeBeanName,
-            Map<String, String> additionalAttributes) {
+                                      Map<String, String> additionalAttributes) {
         this.moduleName = Preconditions.checkNotNull(moduleName, "Module name");
         this.instanceName =  Preconditions.checkNotNull(instanceName, "Instance name");
         this.additionalAttributes = additionalAttributes;
@@ -89,10 +88,10 @@ public final class RuntimeRpcElementResolved {
             "/" + getRegExForPrefixedName(Modules.QNAME.getLocalName())+ "/" + getRegExForPrefixedName(Module.QNAME.getLocalName())
 
                     + "\\["
-                    + "(?<key1>" + getRegExForPrefixedName(XmlNetconfConstants.TYPE_KEY) + "|" + getRegExForPrefixedName(XmlNetconfConstants.NAME_KEY) + ")"
+                    + "(?<key1>" + getRegExForPrefixedName(XmlMappingConstants.TYPE_KEY) + "|" + getRegExForPrefixedName(XmlMappingConstants.NAME_KEY) + ")"
                     + "=('|\")?(?<value1>[^'\"\\]]+)('|\")?"
                     + "( and |\\]\\[)"
-                    + "(?<key2>" + getRegExForPrefixedName(XmlNetconfConstants.TYPE_KEY) + "|" + getRegExForPrefixedName(XmlNetconfConstants.NAME_KEY) + ")"
+                    + "(?<key2>" + getRegExForPrefixedName(XmlMappingConstants.TYPE_KEY) + "|" + getRegExForPrefixedName(XmlMappingConstants.NAME_KEY) + ")"
                     + "=('|\")?(?<value2>[^'\"\\]]+)('|\")?"
                     + "\\]"
 
@@ -120,7 +119,8 @@ public final class RuntimeRpcElementResolved {
         Matcher matcher = xpathPattern.matcher(xpath);
         Preconditions.checkState(matcher.matches(),
                 "Node %s with value '%s' not in required form on rpc element %s, required format is %s",
-                RuntimeRpc.CONTEXT_INSTANCE, xpath, elementName, xpathPatternBlueprint);
+                //TODO refactor this string, and/or unify with RPR.CONTEXT_INSTANCE from netconf
+                "context-instance", xpath, elementName, xpathPatternBlueprint);
 
         PatternGroupResolver groups = new PatternGroupResolver(matcher.group("key1"), matcher.group("value1"),
                 matcher.group("value2"), matcher.group("additional"));
@@ -148,11 +148,11 @@ public final class RuntimeRpcElementResolved {
         }
 
         String getModuleName() {
-            return key1.contains(XmlNetconfConstants.TYPE_KEY) ? value1 : value2;
+            return key1.contains(XmlMappingConstants.TYPE_KEY) ? value1 : value2;
         }
 
         String getInstanceName() {
-            return key1.contains(XmlNetconfConstants.NAME_KEY) ? value1 : value2;
+            return key1.contains(XmlMappingConstants.NAME_KEY) ? value1 : value2;
         }