[vicky@dhcp1-67 deployers]$ svn diff RARParserDeployer.java
Index: RARParserDeployer.java
===================================================================
--- RARParserDeployer.java      (revision 73827)
+++ RARParserDeployer.java      (working copy)
@@ -21,10 +21,17 @@
  */
 package org.jboss.resource.deployers;
 
-import org.jboss.deployers.vfs.spi.deployer.ObjectModelFactoryDeployer;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+
+import org.jboss.deployers.vfs.spi.deployer.MultipleObjectModelFactoryDeployer;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.resource.deployment.JBossRAObjectModelFactory;
 import org.jboss.resource.deployment.ResourceAdapterObjectModelFactory;
 import org.jboss.resource.metadata.ConnectorMetaData;
+import org.jboss.resource.metadata.JBossRAMetaData;
+import org.jboss.resource.metadata.RARDeploymentMetaData;
 import org.jboss.resource.metadata.repository.JCAMetaDataRepository;
 import org.jboss.virtual.VirtualFile;
 import org.jboss.xb.binding.ObjectModelFactory;
@@ -33,20 +40,36 @@
  * RARParserDeployer.
  * 
  * @author <a href="adrian@jboss.com">Adrian Brock</a>
+ * @author <a href="vicky.kak@jboss.com">Vicky Kak</a>
  * @version $Revision: 1.1 $
  */
-public class RARParserDeployer extends ObjectModelFactoryDeployer<ConnectorMetaData>
+public class RARParserDeployer extends MultipleObjectModelFactoryDeployer<RARDeploymentMetaData>
 {
    /** The metadata repsoitory */
    private JCAMetaDataRepository metaDataRepository;
-      
+   
+   /** JEE specific RAR DD name */
+   private static String jeeSpecRarDD = "ra.xml";
+   
+   /** Jboss specific RAR DD name */
+   private static String jbossRarDD = "jboss-ra.xml";
+        
+   private JBossRAMetaData jbossSpecificMetaData;
+   
+   private static Map<String, Class<?>> getCustomMappings()
+   {
+      Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
+      mappings.put(jeeSpecRarDD, ConnectorMetaData.class);
+      mappings.put(jbossRarDD, JBossRAMetaData.class);
+      return mappings;
+   }
+   
    /**
     * Create a new RARParserDeployer.
     */
    public RARParserDeployer()
-   {
-      super(ConnectorMetaData.class);
-      setName("ra.xml");
+   {      
+         super(RARDeploymentMetaData.class, getCustomMappings()); 
    }
 
    public JCAMetaDataRepository getMetaDataRepository()
@@ -58,20 +81,43 @@
    {
       this.metaDataRepository = metaDataRepository;
    }
-
-   protected ObjectModelFactory getObjectModelFactory(ConnectorMetaData root)
-   {
-      return new ResourceAdapterObjectModelFactory();
+   
+   protected  <U> ObjectModelFactory getObjectModelFactory(Class<U> expectedType, String fileName, U root)
+   {              
+         if(jeeSpecRarDD.equals(fileName))
+         {                
+                 return new ResourceAdapterObjectModelFactory();
+         }
+         else if(jbossRarDD.equals(fileName))
+         { 
+                 return new JBossRAObjectModelFactory();
+         }
+         else
+         {
+                 return null;
+         }
    }
-
-   @Override
-   protected void init(VFSDeploymentUnit unit, ConnectorMetaData cmd, VirtualFile file) throws Exception
-   {
-      cmd.setURL(file.toURL());
-      VFSDeploymentUnit parent = unit.getParent();
-      String name = unit.getSimpleName();
-      if( parent != null )
-         name = parent.getSimpleName() + "#" + name;
-      metaDataRepository.addConnectorMetaData(name, cmd);
+                
+   protected  RARDeploymentMetaData mergeMetaData(VFSDeploymentUnit unit, Map<Class<?>, List<Object>> metadata) throws Exception
+   {      
+          RARDeploymentMetaData deployment = new RARDeploymentMetaData();
+          
+          // Getting the List of MetaData Objects
+          List<Object> cmdInstances = metadata.get(ConnectorMetaData.class);
+          if(cmdInstances != null && !cmdInstances.isEmpty())
+                  deployment.setConnectorMetaData(ConnectorMetaData.class.cast(cmdInstances.get(0)));
+          
+          List<Object> jmdInstances = metadata.get(JBossRAMetaData.class);
+          if(jmdInstances != null && !jmdInstances.isEmpty())
+                  deployment.setRaXmlMetaData(JBossRAMetaData.class.cast(jmdInstances.get(0)));
+          
+          VFSDeploymentUnit parent = unit.getParent();
+          String name = unit.getSimpleName();
+          if( parent != null )
+                  name = parent.getSimpleName() + "#" + name;     
+          VirtualFile file = unit.getMetaDataFile(jeeSpecRarDD);          
+          deployment.getConnectorMetaData().setURL(file.toURL());
+          metaDataRepository.addConnectorMetaData(name, deployment.getConnectorMetaData());                       
+          return deployment;      
    }
 }

