[jboss-cvs] JBossAS SVN: r112089 - branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/deployment.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 17 16:37:07 EDT 2011


Author: jesper.pedersen
Date: 2011-08-17 16:37:07 -0400 (Wed, 17 Aug 2011)
New Revision: 112089

Modified:
   branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/deployment/Injection.java
Log:
[JBPAPP-6855] Add java.util.Properties support to Injection

Modified: branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/deployment/Injection.java
===================================================================
--- branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/deployment/Injection.java	2011-08-17 20:15:23 UTC (rev 112088)
+++ branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/deployment/Injection.java	2011-08-17 20:37:07 UTC (rev 112089)
@@ -28,6 +28,8 @@
 import java.lang.reflect.Method;
 import java.net.InetAddress;
 import java.util.Locale;
+import java.util.Properties;
+import java.util.StringTokenizer;
 
 /**
  * Injection utility which can inject values into objects. This file is a copy
@@ -279,6 +281,30 @@
          {
             v = Class.forName(substituredValue, true, cl);
          }
+         else if (clz.equals(Properties.class))
+         {
+            Properties p = new Properties();
+            StringTokenizer st = new StringTokenizer(substituredValue, ",");
+
+            while (st.hasMoreTokens())
+            {
+               String token = st.nextToken();
+               int index = token.indexOf("=");
+
+               if (index != -1)
+               {
+                  String key = token.substring(0, index);
+                  String value = "";
+
+                  if (index < token.length())
+                     value = token.substring(index + 1);
+
+                  p.setProperty(key, value);
+               }
+            }
+
+            v = p;
+         }
          else
          {
             try



More information about the jboss-cvs-commits mailing list