[jboss-cvs] JBossAS SVN: r98963 - in projects/jboss-jca/trunk: fungal/src/main/java/org/jboss/jca/fungal/deployment and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Jan 2 10:07:15 EST 2010


Author: jesper.pedersen
Date: 2010-01-02 10:07:15 -0500 (Sat, 02 Jan 2010)
New Revision: 98963

Added:
   projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/EntryType.java
   projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/KeyType.java
   projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/ListType.java
   projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/MapType.java
   projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/NullType.java
   projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/SetType.java
   projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/ThisType.java
   projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/ValueType.java
Modified:
   projects/jboss-jca/trunk/doc/developerguide/en/modules/fungal.xml
   projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/Unmarshaller.java
   projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/DeploymentDeployer.java
   projects/jboss-jca/trunk/fungal/src/main/resources/deployment.xsd
Log:
[JBJCA-250] Support collection deployment types

Modified: projects/jboss-jca/trunk/doc/developerguide/en/modules/fungal.xml
===================================================================
--- projects/jboss-jca/trunk/doc/developerguide/en/modules/fungal.xml	2010-01-01 07:10:47 UTC (rev 98962)
+++ projects/jboss-jca/trunk/doc/developerguide/en/modules/fungal.xml	2010-01-02 15:07:15 UTC (rev 98963)
@@ -91,6 +91,26 @@
           <code>&lt;depends&gt;</code>
           <para>defines an explicit dependency to another bean.</para>
         </listitem>
+        <listitem>
+          <code>&lt;map&gt;</code>
+          <para>defines a map data structure.</para>
+        </listitem>
+        <listitem>
+          <code>&lt;list&gt;</code>
+          <para>defines a list data structure.</para>
+        </listitem>
+        <listitem>
+          <code>&lt;set&gt;</code>
+          <para>defines a set data structure.</para>
+        </listitem>
+        <listitem>
+          <code>&lt;null&gt;</code>
+          <para>defines a null value.</para>
+        </listitem>
+        <listitem>
+          <code>&lt;this&gt;</code>
+          <para>defines a reference to the object instance.</para>
+        </listitem>
       </itemizedlist>
 
       <para>In order to define locations relative to the install root of the JBoss JCA

Added: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/EntryType.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/EntryType.java	                        (rev 0)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/EntryType.java	2010-01-02 15:07:15 UTC (rev 98963)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.fungal.deployment;
+
+/**
+ * Represents an entry
+ */
+public class EntryType
+{
+   private KeyType key;
+   private ValueType value;
+   
+   /**
+    * Constructor
+    */
+   public EntryType()
+   {
+      key = null;
+      value = null;
+   }
+
+   /**
+    * Get the key
+    * @return The value
+    */
+   public KeyType getKey()
+   {
+      return key;
+   }
+   
+   /**
+    * Set the key
+    * @param value The value
+    */
+   public void setKey(KeyType value)
+   {
+      key = value;
+   }
+
+   /**
+    * Get the value
+    * @return The value
+    */
+   public ValueType getValue()
+   {
+      return value;
+   }
+   
+   /**
+    * Set the value
+    * @param value The value
+    */
+   public void setValue(ValueType value)
+   {
+      this.value = value;
+   }
+}

Added: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/KeyType.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/KeyType.java	                        (rev 0)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/KeyType.java	2010-01-02 15:07:15 UTC (rev 98963)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.fungal.deployment;
+
+/**
+ * Represents a key element
+ */
+public class KeyType
+{
+   private String value;
+
+   /**
+    * Constructor
+    */
+   public KeyType()
+   {
+      value = null;
+   }
+
+   /**
+    * Get the value
+    * @return The value
+    */
+   public String getValue()
+   {
+      return value;
+   }
+
+   /**
+    * Set the value
+    * @param value The value
+    */
+   public void setValue(String value)
+   {
+      this.value = value;
+   }
+}

Added: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/ListType.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/ListType.java	                        (rev 0)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/ListType.java	2010-01-02 15:07:15 UTC (rev 98963)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.fungal.deployment;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * Represents a list
+ */
+public class ListType
+{
+   private List<ValueType> value;
+   private String clazz;
+   private String elementClass;
+   
+   /**
+    * Constructor
+    */
+   public ListType()
+   {
+      value = null;
+      clazz = null;
+      elementClass = null;
+   }
+
+   /**
+    * Get the values
+    * @return The value
+    */
+   public List<ValueType> getValue()
+   {
+      if (value == null)
+         value = new ArrayList<ValueType>(1);
+
+      return value;
+   }
+
+   /**
+    * Get the class
+    * @return The value
+    */
+   public String getClazz()
+   {
+      return clazz;
+   }
+   
+   /**
+    * Set the class
+    * @param value The value
+    */
+   public void setClazz(String value)
+   {
+      clazz = value;
+   }
+
+   /**
+    * Get the element class
+    * @return The value
+    */
+   public String getElementClass()
+   {
+      return elementClass;
+   }
+
+   /**
+    * Set the element class
+    * @param value The value
+    */
+   public void setElementClass(String value)
+   {
+      elementClass = value;
+   }
+}

Added: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/MapType.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/MapType.java	                        (rev 0)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/MapType.java	2010-01-02 15:07:15 UTC (rev 98963)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.fungal.deployment;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * Represents a map
+ */
+public class MapType
+{
+   private List<EntryType> entry;
+   private String clazz;
+   private String keyClass;
+   private String valueClass;
+   
+   /**
+    * Constructor
+    */
+   public MapType()
+   {
+      entry = null;
+      clazz = null;
+      keyClass = null;
+      valueClass = null;
+   }
+
+   /**
+    * Get the entries
+    * @return The value
+    */
+   public List<EntryType> getEntry()
+   {
+      if (entry == null)
+         entry = new ArrayList<EntryType>(1);
+
+      return entry;
+   }
+
+   /**
+    * Get the class
+    * @return The value
+    */
+   public String getClazz()
+   {
+      return clazz;
+   }
+   
+   /**
+    * Set the class
+    * @param value The value
+    */
+   public void setClazz(String value)
+   {
+      clazz = value;
+   }
+
+   /**
+    * Get the key class
+    * @return The value
+    */
+   public String getKeyClass()
+   {
+      return keyClass;
+   }
+
+   /**
+    * Set the key class
+    * @param value The value
+    */
+   public void setKeyClass(String value)
+   {
+      keyClass = value;
+   }
+
+   /**
+    * Get the value class
+    * @return The value
+    */
+   public String getValueClass()
+   {
+      return valueClass;
+   }
+
+   /**
+    * Set the value class
+    * @param value The value
+    */
+   public void setValueClass(String value)
+   {
+      valueClass = value;
+   }
+}

Added: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/NullType.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/NullType.java	                        (rev 0)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/NullType.java	2010-01-02 15:07:15 UTC (rev 98963)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.fungal.deployment;
+
+/**
+ * Represents a null element
+ */
+public class NullType
+{
+
+   /**
+    * Constructor
+    */
+   public NullType()
+   {
+   }
+}

Added: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/SetType.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/SetType.java	                        (rev 0)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/SetType.java	2010-01-02 15:07:15 UTC (rev 98963)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.fungal.deployment;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * Represents a set
+ */
+public class SetType
+{
+   private List<ValueType> value;
+   private String clazz;
+   private String elementClass;
+   
+   /**
+    * Constructor
+    */
+   public SetType()
+   {
+      value = null;
+      clazz = null;
+      elementClass = null;
+   }
+
+   /**
+    * Get the values
+    * @return The value
+    */
+   public List<ValueType> getValue()
+   {
+      if (value == null)
+         value = new ArrayList<ValueType>(1);
+
+      return value;
+   }
+
+   /**
+    * Get the class
+    * @return The value
+    */
+   public String getClazz()
+   {
+      return clazz;
+   }
+   
+   /**
+    * Set the class
+    * @param value The value
+    */
+   public void setClazz(String value)
+   {
+      clazz = value;
+   }
+
+   /**
+    * Get the element class
+    * @return The value
+    */
+   public String getElementClass()
+   {
+      return elementClass;
+   }
+
+   /**
+    * Set the element class
+    * @param value The value
+    */
+   public void setElementClass(String value)
+   {
+      elementClass = value;
+   }
+}

Added: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/ThisType.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/ThisType.java	                        (rev 0)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/ThisType.java	2010-01-02 15:07:15 UTC (rev 98963)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.fungal.deployment;
+
+/**
+ * Represents a this element
+ */
+public class ThisType
+{
+
+   /**
+    * Constructor
+    */
+   public ThisType()
+   {
+   }
+}

Modified: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/Unmarshaller.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/Unmarshaller.java	2010-01-01 07:10:47 UTC (rev 98962)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/Unmarshaller.java	2010-01-02 15:07:15 UTC (rev 98963)
@@ -186,7 +186,7 @@
       }
 
       if (!"bean".equals(xmlStreamReader.getLocalName()))
-         throw new XMLStreamException("url tag not completed");
+         throw new XMLStreamException("bean tag not completed");
 
       return result;
    }
@@ -234,7 +234,7 @@
       }
 
       if (!"constructor".equals(xmlStreamReader.getLocalName()))
-         throw new XMLStreamException("url tag not completed");
+         throw new XMLStreamException("constructor tag not completed");
 
       return result;
    }
@@ -265,7 +265,7 @@
       }
 
       if (!"parameter".equals(xmlStreamReader.getLocalName()))
-         throw new XMLStreamException("url tag not completed");
+         throw new XMLStreamException("parameter tag not completed");
 
       return result;
    }
@@ -303,7 +303,25 @@
                String name = xmlStreamReader.getLocalName();
 
                if ("inject".equals(name))
+               {
                   result.getContent().add(readInject(xmlStreamReader));
+               }
+               else if ("set".equals(name))
+               {
+                  result.getContent().add(readSet(xmlStreamReader));
+               }
+               else if ("list".equals(name))
+               {
+                  result.getContent().add(readList(xmlStreamReader));
+               }
+               else if ("null".equals(name))
+               {
+                  result.getContent().add(readNull(xmlStreamReader));
+               }
+               else if ("this".equals(name))
+               {
+                  result.getContent().add(readThis(xmlStreamReader));
+               }
 
                break;
 
@@ -319,7 +337,7 @@
       }
 
       if (!"property".equals(xmlStreamReader.getLocalName()))
-         throw new XMLStreamException("url tag not completed");
+         throw new XMLStreamException("property tag not completed");
 
       return result;
    }
@@ -365,7 +383,7 @@
       }
 
       if (!"inject".equals(xmlStreamReader.getLocalName()))
-         throw new XMLStreamException("url tag not completed");
+         throw new XMLStreamException("inject tag not completed");
 
       return result;
    }
@@ -398,8 +416,313 @@
       }
 
       if (!"depends".equals(xmlStreamReader.getLocalName()))
-         throw new XMLStreamException("url tag not completed");
+         throw new XMLStreamException("depends tag not completed");
 
       return result;
    }
+
+   /**
+    * Read: <map>
+    * @param xmlStreamReader The XML stream
+    * @return The map
+    * @exception XMLStreamException Thrown if an exception occurs
+    */
+   private MapType readMap(XMLStreamReader xmlStreamReader) throws XMLStreamException
+   {
+      MapType result = new MapType();
+
+      for (int i = 0; i < xmlStreamReader.getAttributeCount(); i++)
+      {
+         String name = xmlStreamReader.getAttributeLocalName(i);
+         if ("keyClass".equals(name))
+         {
+            result.setKeyClass(xmlStreamReader.getAttributeValue(i));
+         }
+         else if ("valueClass".equals(name))
+         {
+            result.setValueClass(xmlStreamReader.getAttributeValue(i));
+         }
+         else if ("class".equals(name))
+         {
+            result.setClazz(xmlStreamReader.getAttributeValue(i));
+         }
+      }
+
+      int eventCode = xmlStreamReader.next();
+
+      while (eventCode != XMLStreamReader.END_ELEMENT)
+      {
+         switch (eventCode)
+         {
+            case XMLStreamReader.START_ELEMENT :
+               String name = xmlStreamReader.getLocalName();
+
+               if ("entry".equals(name))
+                  result.getEntry().add(readEntry(xmlStreamReader));
+
+               break;
+
+            default :
+         }
+
+         eventCode = xmlStreamReader.next();
+      }
+
+      if (!"map".equals(xmlStreamReader.getLocalName()))
+         throw new XMLStreamException("map tag not completed");
+
+      return result;
+   }
+
+   /**
+    * Read: <set>
+    * @param xmlStreamReader The XML stream
+    * @return The set
+    * @exception XMLStreamException Thrown if an exception occurs
+    */
+   private SetType readSet(XMLStreamReader xmlStreamReader) throws XMLStreamException
+   {
+      SetType result = new SetType();
+
+      for (int i = 0; i < xmlStreamReader.getAttributeCount(); i++)
+      {
+         String name = xmlStreamReader.getAttributeLocalName(i);
+         if ("elementClass".equals(name))
+         {
+            result.setElementClass(xmlStreamReader.getAttributeValue(i));
+         }
+         else if ("class".equals(name))
+         {
+            result.setClazz(xmlStreamReader.getAttributeValue(i));
+         }
+      }
+
+      int eventCode = xmlStreamReader.next();
+
+      while (eventCode != XMLStreamReader.END_ELEMENT)
+      {
+         switch (eventCode)
+         {
+            case XMLStreamReader.START_ELEMENT :
+               String name = xmlStreamReader.getLocalName();
+
+               if ("value".equals(name))
+                  result.getValue().add(readValue(xmlStreamReader));
+
+               break;
+
+            default :
+         }
+
+         eventCode = xmlStreamReader.next();
+      }
+
+      if (!"set".equals(xmlStreamReader.getLocalName()))
+         throw new XMLStreamException("set tag not completed");
+
+      return result;
+   }
+
+   /**
+    * Read: <list>
+    * @param xmlStreamReader The XML stream
+    * @return The list
+    * @exception XMLStreamException Thrown if an exception occurs
+    */
+   private ListType readList(XMLStreamReader xmlStreamReader) throws XMLStreamException
+   {
+      ListType result = new ListType();
+
+      for (int i = 0; i < xmlStreamReader.getAttributeCount(); i++)
+      {
+         String name = xmlStreamReader.getAttributeLocalName(i);
+         if ("elementClass".equals(name))
+         {
+            result.setElementClass(xmlStreamReader.getAttributeValue(i));
+         }
+         else if ("class".equals(name))
+         {
+            result.setClazz(xmlStreamReader.getAttributeValue(i));
+         }
+      }
+
+      int eventCode = xmlStreamReader.next();
+
+      while (eventCode != XMLStreamReader.END_ELEMENT)
+      {
+         switch (eventCode)
+         {
+            case XMLStreamReader.START_ELEMENT :
+               String name = xmlStreamReader.getLocalName();
+
+               if ("value".equals(name))
+                  result.getValue().add(readValue(xmlStreamReader));
+
+               break;
+
+            default :
+         }
+
+         eventCode = xmlStreamReader.next();
+      }
+
+      if (!"list".equals(xmlStreamReader.getLocalName()))
+         throw new XMLStreamException("list tag not completed");
+
+      return result;
+   }
+
+   /**
+    * Read: <entry>
+    * @param xmlStreamReader The XML stream
+    * @return The entry
+    * @exception XMLStreamException Thrown if an exception occurs
+    */
+   private EntryType readEntry(XMLStreamReader xmlStreamReader) throws XMLStreamException
+   {
+      EntryType result = new EntryType();
+
+      int eventCode = xmlStreamReader.next();
+
+      while (eventCode != XMLStreamReader.END_ELEMENT)
+      {
+         switch (eventCode)
+         {
+            case XMLStreamReader.START_ELEMENT :
+               String name = xmlStreamReader.getLocalName();
+
+               if ("key".equals(name))
+               {
+                  result.setKey(readKey(xmlStreamReader));
+               }
+               else if ("value".equals(name))
+               {
+                  result.setValue(readValue(xmlStreamReader));
+               }
+
+               break;
+
+            default :
+         }
+
+         eventCode = xmlStreamReader.next();
+      }
+
+      if (!"map".equals(xmlStreamReader.getLocalName()))
+         throw new XMLStreamException("map tag not completed");
+
+      return result;
+   }
+
+   /**
+    * Read: <key>
+    * @param xmlStreamReader The XML stream
+    * @return The key
+    * @exception XMLStreamException Thrown if an exception occurs
+    */
+   private KeyType readKey(XMLStreamReader xmlStreamReader) throws XMLStreamException
+   {
+      KeyType result = new KeyType();
+
+      int eventCode = xmlStreamReader.next();
+
+      while (eventCode != XMLStreamReader.END_ELEMENT)
+      {
+         switch (eventCode)
+         {
+            case XMLStreamReader.CHARACTERS :
+               result.setValue(xmlStreamReader.getText());
+
+               break;
+
+            default :
+         }
+
+         eventCode = xmlStreamReader.next();
+      }
+
+      if (!"key".equals(xmlStreamReader.getLocalName()))
+         throw new XMLStreamException("key tag not completed");
+
+      return result;
+   }
+
+   /**
+    * Read: <value>
+    * @param xmlStreamReader The XML stream
+    * @return The value
+    * @exception XMLStreamException Thrown if an exception occurs
+    */
+   private ValueType readValue(XMLStreamReader xmlStreamReader) throws XMLStreamException
+   {
+      ValueType result = new ValueType();
+
+      int eventCode = xmlStreamReader.next();
+
+      while (eventCode != XMLStreamReader.END_ELEMENT)
+      {
+         switch (eventCode)
+         {
+            case XMLStreamReader.CHARACTERS :
+               result.setValue(xmlStreamReader.getText());
+
+               break;
+
+            default :
+         }
+
+         eventCode = xmlStreamReader.next();
+      }
+
+      if (!"value".equals(xmlStreamReader.getLocalName()))
+         throw new XMLStreamException("value tag not completed");
+
+      return result;
+   }
+
+   /**
+    * Read: <null>
+    * @param xmlStreamReader The XML stream
+    * @return The null
+    * @exception XMLStreamException Thrown if an exception occurs
+    */
+   private NullType readNull(XMLStreamReader xmlStreamReader) throws XMLStreamException
+   {
+      NullType result = new NullType();
+
+      int eventCode = xmlStreamReader.next();
+
+      while (eventCode != XMLStreamReader.END_ELEMENT)
+      {
+         eventCode = xmlStreamReader.next();
+      }
+
+      if (!"null".equals(xmlStreamReader.getLocalName()))
+         throw new XMLStreamException("null tag not completed");
+
+      return result;
+   }
+
+   /**
+    * Read: <this>
+    * @param xmlStreamReader The XML stream
+    * @return The this
+    * @exception XMLStreamException Thrown if an exception occurs
+    */
+   private ThisType readThis(XMLStreamReader xmlStreamReader) throws XMLStreamException
+   {
+      ThisType result = new ThisType();
+
+      int eventCode = xmlStreamReader.next();
+
+      while (eventCode != XMLStreamReader.END_ELEMENT)
+      {
+         eventCode = xmlStreamReader.next();
+      }
+
+      if (!"this".equals(xmlStreamReader.getLocalName()))
+         throw new XMLStreamException("this tag not completed");
+
+      return result;
+   }
 }

Added: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/ValueType.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/ValueType.java	                        (rev 0)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/deployment/ValueType.java	2010-01-02 15:07:15 UTC (rev 98963)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.fungal.deployment;
+
+/**
+ * Represents a value element
+ */
+public class ValueType
+{
+   private String value;
+
+   /**
+    * Constructor
+    */
+   public ValueType()
+   {
+      value = null;
+   }
+
+   /**
+    * Get the value
+    * @return The value
+    */
+   public String getValue()
+   {
+      return value;
+   }
+
+   /**
+    * Set the value
+    * @param value The value
+    */
+   public void setValue(String value)
+   {
+      this.value = value;
+   }
+}

Modified: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/DeploymentDeployer.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/DeploymentDeployer.java	2010-01-01 07:10:47 UTC (rev 98962)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/DeploymentDeployer.java	2010-01-02 15:07:15 UTC (rev 98963)
@@ -29,9 +29,17 @@
 import org.jboss.jca.fungal.deployment.BeanType;
 import org.jboss.jca.fungal.deployment.ConstructorType;
 import org.jboss.jca.fungal.deployment.DependsType;
+import org.jboss.jca.fungal.deployment.EntryType;
 import org.jboss.jca.fungal.deployment.InjectType;
+import org.jboss.jca.fungal.deployment.KeyType;
+import org.jboss.jca.fungal.deployment.ListType;
+import org.jboss.jca.fungal.deployment.MapType;
+import org.jboss.jca.fungal.deployment.NullType;
 import org.jboss.jca.fungal.deployment.PropertyType;
+import org.jboss.jca.fungal.deployment.SetType;
+import org.jboss.jca.fungal.deployment.ThisType;
 import org.jboss.jca.fungal.deployment.Unmarshaller;
+import org.jboss.jca.fungal.deployment.ValueType;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -39,10 +47,12 @@
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Future;
@@ -389,7 +399,9 @@
                   args = new Object[ct.getParameter().size()];
                   for (int i = 0; i < ct.getParameter().size(); i++)
                   {
-                     args[i] = getValue(ct.getParameter().get(i).getValue(), factoryMethod.getParameterTypes()[i]);
+                     args[i] = getValue(ct.getParameter().get(i).getValue(), 
+                                        factoryMethod.getParameterTypes()[i],
+                                        cl);
                   }
                }
                else
@@ -405,8 +417,9 @@
 
                         for (int i = 0; i < ct.getParameter().size(); i++)
                         {
-                           args[i] = 
-                              getValue(ct.getParameter().get(i).getValue(), factoryMethod.getParameterTypes()[i]);
+                           args[i] = getValue(ct.getParameter().get(i).getValue(),
+                                              factoryMethod.getParameterTypes()[i],
+                                              cl);
                         }
 
                         factoryMethod = m;
@@ -473,11 +486,14 @@
        * Get a value from a string
        * @param s The string representation
        * @param clz The class
+       * @param cl The class loader
        * @return The value
        * @exception Exception If the string cant be converted
        */
-      private Object getValue(String s, Class<?> clz) throws Exception
+      private Object getValue(String s, Class<?> clz, ClassLoader cl) throws Exception
       {
+         s = getSubstitutionValue(s);
+
          if (clz.equals(String.class))
          {
             return s;
@@ -518,6 +534,10 @@
          {
             return InetAddress.getByName(s);
          }
+         else if (clz.equals(Class.class))
+         {
+            return Class.forName(s, true, cl);
+         }
          
          throw new Exception("Unknown class " + clz.getName() + " for " + s);
       }
@@ -529,6 +549,7 @@
        * @param cl The classloader
        * @exception Exception Thrown if an error occurs
        */
+      @SuppressWarnings("unchecked") 
       private void setBeanProperty(Object instance, PropertyType pt, ClassLoader cl) throws Exception
       {
          String name = "set" + pt.getName().substring(0, 1).toUpperCase(Locale.US) + pt.getName().substring(1);
@@ -602,49 +623,103 @@
                parameterValue = injectionObject;
             }
          }
-         else
+         else if (element instanceof MapType)
          {
-            if (parameterClass.equals(String.class))
+            MapType mt = (MapType)element;
+
+            Map map = null;
+            
+            if (mt.getClazz() == null)
             {
-               parameterValue = getSubstitutionValue((String)element);
+               map = new HashMap();
             }
-            else if (parameterClass.equals(byte.class) || parameterClass.equals(Byte.class))
+            else
             {
-               parameterValue = Byte.valueOf(getSubstitutionValue((String)element));
+               Class mapClass = Class.forName(mt.getClazz(), true, cl);
+               map = (Map)mapClass.newInstance();
             }
-            else if (parameterClass.equals(short.class) || parameterClass.equals(Short.class))
+
+            Class keyClass = Class.forName(mt.getKeyClass(), true, cl);
+            Class valueClass = Class.forName(mt.getValueClass(), true, cl);
+
+            for (EntryType et : mt.getEntry())
             {
-               parameterValue = Short.valueOf(getSubstitutionValue((String)element));
+               Object key = getValue(et.getKey().getValue(), keyClass, cl);
+               Object value = getValue(et.getValue().getValue(), valueClass, cl);
+
+               map.put(key, value);
             }
-            else if (parameterClass.equals(int.class) || parameterClass.equals(Integer.class))
+
+            parameterValue = map;
+         }
+         else if (element instanceof ListType)
+         {
+            ListType lt = (ListType)element;
+
+            List list = null;
+            
+            if (lt.getClazz() == null)
             {
-               parameterValue = Integer.valueOf(getSubstitutionValue((String)element));
+               list = new ArrayList();
             }
-            else if (parameterClass.equals(long.class) || parameterClass.equals(Long.class))
+            else
             {
-               parameterValue = Long.valueOf(getSubstitutionValue((String)element));
+               Class listClass = Class.forName(lt.getClazz(), true, cl);
+               list = (List)listClass.newInstance();
             }
-            else if (parameterClass.equals(float.class) || parameterClass.equals(Float.class))
+
+            Class elementClass = Class.forName(lt.getElementClass(), true, cl);
+
+            for (ValueType vt : lt.getValue())
             {
-               parameterValue = Float.valueOf(getSubstitutionValue((String)element));
+               Object value = getValue(vt.getValue(), elementClass, cl);
+               list.add(value);
             }
-            else if (parameterClass.equals(double.class) || parameterClass.equals(Double.class))
+
+            parameterValue = list;
+         }
+         else if (element instanceof SetType)
+         {
+            SetType st = (SetType)element;
+
+            Set set = null;
+            
+            if (st.getClazz() == null)
             {
-               parameterValue = Double.valueOf(getSubstitutionValue((String)element));
+               set = new HashSet();
             }
-            else if (parameterClass.equals(boolean.class) || parameterClass.equals(Boolean.class))
+            else
             {
-               parameterValue = Boolean.valueOf(getSubstitutionValue((String)element));
+               Class setClass = Class.forName(st.getClazz(), true, cl);
+               set = (Set)setClass.newInstance();
             }
-            else if (parameterClass.equals(char.class) || parameterClass.equals(Character.class))
+
+            Class elementClass = Class.forName(st.getElementClass(), true, cl);
+
+            for (ValueType vt : st.getValue())
             {
-               parameterValue = Character.valueOf((getSubstitutionValue((String)element)).charAt(0));
+               Object value = getValue(vt.getValue(), elementClass, cl);
+               set.add(value);
             }
-            else if (parameterClass.equals(InetAddress.class))
-            {
-               parameterValue = InetAddress.getByName(getSubstitutionValue((String)element));
-            }
+
+            parameterValue = set;
          }
+         else if (element instanceof NullType)
+         {
+            parameterValue = null;
+         }
+         else if (element instanceof ThisType)
+         {
+            parameterValue = instance;
+         }
+         else if (element instanceof ValueType)
+         {
+            parameterValue = getValue(((ValueType)element).getValue(), parameterClass, cl);
+         }
+         else
+         {
+            parameterValue = getValue((String)element, parameterClass, cl);
+         }
 
          if (parameterValue == null)
             throw new Exception("No parameter value assigned for class " + parameterClass.getName() + 

Modified: projects/jboss-jca/trunk/fungal/src/main/resources/deployment.xsd
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/resources/deployment.xsd	2010-01-01 07:10:47 UTC (rev 98962)
+++ projects/jboss-jca/trunk/fungal/src/main/resources/deployment.xsd	2010-01-02 15:07:15 UTC (rev 98963)
@@ -18,6 +18,12 @@
    <xsd:complexType name="propertyType" mixed="true">
      <xsd:sequence>
        <xsd:element name="inject" type="injectType" maxOccurs="1" minOccurs="0"/>
+       <xsd:element name="list" type="listType" maxOccurs="1" minOccurs="0"/>
+       <xsd:element name="set" type="setType" maxOccurs="1" minOccurs="0"/>
+       <xsd:element name="map" type="mapType" maxOccurs="1" minOccurs="0"/>
+       <xsd:element name="value" type="valueType" maxOccurs="1" minOccurs="0"/>
+       <xsd:element name="null" type="nullType" maxOccurs="1" minOccurs="0"/>
+       <xsd:element name="this" type="thisType" maxOccurs="1" minOccurs="0"/>
      </xsd:sequence>
      <xsd:attribute name="name" type="xsd:token" use="required"/>
      <xsd:attribute name="class" type="xsd:token"/>
@@ -36,10 +42,42 @@
      <xsd:sequence>
        <xsd:element name="parameter" type="parameterType" maxOccurs="unbounded" minOccurs="0"/>
      </xsd:sequence>
-     <xsd:attribute name="factoryMethod" type="xsd:token" use="required"/>
-     <xsd:attribute name="factoryClass" type="xsd:token" use="required"/>
+     <xsd:attribute name="factoryMethod" type="xsd:token"/>
+     <xsd:attribute name="factoryClass" type="xsd:token"/>
    </xsd:complexType>
 
+   <xsd:complexType name="mapType">
+     <xsd:sequence>
+       <xsd:element name="entry" type="entryType" maxOccurs="unbounded" minOccurs="0"/>
+     </xsd:sequence>
+     <xsd:attribute name="class" type="xsd:token"/>
+     <xsd:attribute name="keyClass" type="xsd:token" use="required"/>
+     <xsd:attribute name="valueClass" type="xsd:token" use="required"/>
+   </xsd:complexType>
+
+   <xsd:complexType name="entryType">
+     <xsd:sequence>
+       <xsd:element name="key" type="keyType"/>
+       <xsd:element name="value" type="valueType"/>
+     </xsd:sequence>
+   </xsd:complexType>
+
+   <xsd:complexType name="setType">
+     <xsd:sequence>
+       <xsd:element name="value" type="valueType" maxOccurs="unbounded" minOccurs="0"/>
+     </xsd:sequence>
+     <xsd:attribute name="class" type="xsd:token"/>
+     <xsd:attribute name="elementClass" type="xsd:token" use="required"/>
+   </xsd:complexType>
+
+   <xsd:complexType name="listType">
+     <xsd:sequence>
+       <xsd:element name="value" type="valueType" maxOccurs="unbounded" minOccurs="0"/>
+     </xsd:sequence>
+     <xsd:attribute name="class" type="xsd:token"/>
+     <xsd:attribute name="elementClass" type="xsd:token" use="required"/>
+   </xsd:complexType>
+
    <xsd:complexType name="parameterType">
      <xsd:simpleContent>
        <xsd:extension base="xsd:token">
@@ -54,6 +92,24 @@
      </xsd:simpleContent>
    </xsd:complexType>
 
+   <xsd:complexType name="keyType">
+     <xsd:simpleContent>
+       <xsd:extension base="xsd:token">
+       </xsd:extension>
+     </xsd:simpleContent>
+   </xsd:complexType>
+
+   <xsd:complexType name="valueType">
+     <xsd:simpleContent>
+       <xsd:extension base="xsd:token">
+       </xsd:extension>
+     </xsd:simpleContent>
+   </xsd:complexType>
+
+   <xsd:complexType name="thisType"/>
+
+   <xsd:complexType name="nullType"/>
+
    <xsd:element name="deployment">
      <xsd:complexType>
        <xsd:sequence>




More information about the jboss-cvs-commits mailing list