Author: brett
Date: Tue Jul  8 04:04:59 2014
New Revision: 1608654

URL: http://svn.apache.org/r1608654
Log:
[NPANDAY-505] support recursive registry lookups

Modified:
    
incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/WinRegistry.java

Modified: 
incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/WinRegistry.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/WinRegistry.java?rev=1608654&r1=1608653&r2=1608654&view=diff
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/WinRegistry.java
 (original)
+++ 
incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/WinRegistry.java
 Tue Jul  8 04:04:59 2014
@@ -30,6 +30,8 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.prefs.Preferences;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 public class WinRegistry
     implements WindowsRegistryAccessProvider
@@ -70,6 +72,8 @@ public class WinRegistry
 
     private static Method regDeleteValue = null;
 
+    private static Pattern REGISTRY_REFERENCE_REGEX = Pattern.compile( 
"\\$\\(Registry:([A-Z_]+)\\\\(.*)@(.*)\\)" );
+
     static
     {
         try
@@ -516,9 +520,12 @@ public class WinRegistry
 
         try
         {
-            return WinRegistry.readString(
-                registryHKey.getHKey(), key, valueName
-            );
+            String value = WinRegistry.readString( registryHKey.getHKey(), 
key, valueName );
+            Matcher m = REGISTRY_REFERENCE_REGEX.matcher(value);
+            if (m.matches()) {
+                value = getValue(RegistryHKey.tryGetFromName(m.group(1)), 
m.group(2), m.group(3));
+            }
+            return value;
         }
         catch ( InvocationTargetException e )
         {


Reply via email to