[jboss-cvs] JBossAS SVN: r102296 - in branches/Branch_Hornet_Temporary_2/hornetq-int/src: resources and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 11 12:01:21 EST 2010


Author: clebert.suconic at jboss.com
Date: 2010-03-11 12:01:20 -0500 (Thu, 11 Mar 2010)
New Revision: 102296

Added:
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQConfigParserDeployer.java
Removed:
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQConfigMultiParserDeployer.java
Modified:
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQJMSParserDeployer.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/resources/hornetq-deployers-jboss-beans.xml
Log:
tweaks

Deleted: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQConfigMultiParserDeployer.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQConfigMultiParserDeployer.java	2010-03-11 16:34:07 UTC (rev 102295)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQConfigMultiParserDeployer.java	2010-03-11 17:01:20 UTC (rev 102296)
@@ -1,93 +0,0 @@
-package org.jboss.as.integration.hornetq.deployers;
-
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.deployers.vfs.spi.deployer.MultipleVFSParsingDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.logging.Logger;
-import org.jboss.virtual.VirtualFile;
-
-import org.hornetq.core.config.Configuration;
-import org.hornetq.core.deployers.impl.FileConfigurationParser;
-
-/**
- * This Deployer will take a hornetq-configuration.xml parse the Configuration
- * and attach the Configuration output into the deployment unit. Another
- * deployer that takes Configuration as an input will then take over and install
- * the queues at the proper places.
- *
- * @author <mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
- * @author <mailto:ales.justin at jboss.org">Ales Justin</a>
- * @see org.jboss.as.integration.hornetq.deployers.HornetQJMSRealDeployer
- */
-public class HornetQConfigMultiParserDeployer extends MultipleVFSParsingDeployer<Configuration>
-{
-   private static final Logger log = Logger.getLogger(HornetQConfigMultiParserDeployer.class);
-   private final FileConfigurationParser parser;
-
-   public HornetQConfigMultiParserDeployer(final Set<String> names)
-   {
-      super(Configuration.class, mappings(names));
-      this.parser = new FileConfigurationParser();
-      this.setNames(names);
-   }
-
-   protected static Map<String, Class<?>> mappings(Set<String> names)
-   {
-      if (names == null || names.isEmpty())
-         throw new IllegalArgumentException("Null or empty names: " + names);
-
-      Map<String, Class<?>> mappings = new HashMap<String, Class<?>>(names.size());
-      for (String name : names)
-      {
-         mappings.put(name, Configuration.class); // all are mapped to Configuration
-      }
-      return mappings;
-   }
-
-   @Override
-   @SuppressWarnings("unchecked")
-   protected Object parse(Class expectedType, VirtualFile file, Object root) throws Exception
-   {
-      InputStream deploymentStream = openStreamAndValidate(file);
-      try
-      {
-         Configuration config = parser.parseMainConfig(deploymentStream);
-         // TODO: this should be log.debug after merge
-         log.info("Main Config = " + config);
-         return config;
-      }
-      finally
-      {
-         try
-         {
-            deploymentStream.close();
-         }
-         catch (Exception ignored)
-         {
-         }
-      }
-   }
-
-   @Override
-   protected Configuration mergeMetaData(VFSDeploymentUnit unit, Map<Class<?>, List<Object>> metadata) throws Exception
-   {
-      List<Object> instances = metadata.get(Configuration.class); // we should only have Configuration instances
-      if (instances.size() == 1)
-      {
-         return (Configuration) instances.get(0);
-      }
-      else
-      {
-         for (int i = 0; i < instances.size(); i++)
-         {
-            unit.getTransientManagedObjects().addAttachment(Configuration.class.getName() + "#" + (i + 1), instances.get(i));
-         }
-         return null;
-      }
-   }
-}
\ No newline at end of file

Added: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQConfigParserDeployer.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQConfigParserDeployer.java	                        (rev 0)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQConfigParserDeployer.java	2010-03-11 17:01:20 UTC (rev 102296)
@@ -0,0 +1,66 @@
+package org.jboss.as.integration.hornetq.deployers;
+
+import java.io.InputStream;
+
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.deployers.impl.FileConfigurationParser;
+import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * This Deployer will take a hornetq-configuration.xml parse the Configuration
+ * and attach the Configuration output into the deployment unit. Another
+ * deployer that takes Configuration as an input will then take over and install
+ * the queues at the proper places.
+ * 
+ * @see HornetQJMSRealDeployer
+ * 
+ * @author <mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * 
+ */
+public class HornetQConfigParserDeployer extends AbstractVFSParsingDeployer<Configuration>
+{
+
+   private static final Logger log = Logger.getLogger(HornetQConfigParserDeployer.class);
+
+   private final FileConfigurationParser parser;
+
+   public HornetQConfigParserDeployer(final String name)
+   {
+      super(Configuration.class);
+
+      this.parser = new FileConfigurationParser();
+      
+      this.setSuffix(name);
+   }
+   
+   
+
+   @Override
+   protected Configuration parse(VFSDeploymentUnit unit, VirtualFile file, Configuration root) throws Exception
+   {
+
+      InputStream deploymentStream = null;
+
+      try
+      {
+         deploymentStream = file.openStream();
+         Configuration config = parser.parseMainConfig(deploymentStream);
+         
+         //TODO: Make this debug
+         log.info("Main Config = " + config);
+
+         return config;
+      } finally
+      {
+         try
+         {
+            deploymentStream.close();
+         } catch (Exception ignored)
+         {
+         }
+      }
+   }
+}

Modified: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQJMSParserDeployer.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQJMSParserDeployer.java	2010-03-11 16:34:07 UTC (rev 102295)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQJMSParserDeployer.java	2010-03-11 17:01:20 UTC (rev 102296)
@@ -74,7 +74,6 @@
             deploymentStream = file.openStream();
             JMSConfiguration config = jmsConfigParser.parseConfiguration(deploymentStream);
             log.info("Config = " + config);
-
             return config;
         } finally
         {

Modified: branches/Branch_Hornet_Temporary_2/hornetq-int/src/resources/hornetq-deployers-jboss-beans.xml
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/resources/hornetq-deployers-jboss-beans.xml	2010-03-11 16:34:07 UTC (rev 102295)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/resources/hornetq-deployers-jboss-beans.xml	2010-03-11 17:01:20 UTC (rev 102296)
@@ -1,28 +1,29 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <deployment xmlns="urn:jboss:bean-deployer:2.0">
+   <bean name="HornetQConfigParserDeployerFile1" class="org.jboss.as.integration.hornetq.deployers.HornetQConfigParserDeployer">
+        <constructor>
+         <parameter>hornetq-configuration.xml</parameter>
+      </constructor>
+   </bean>
 
-   <bean name="HornetQConfigParserDeployerFile" class="org.jboss.as.integration.hornetq.deployers.HornetQConfigMultiParserDeployer">
+   <bean name="HornetQConfigParserDeployerFile2" class="org.jboss.as.integration.hornetq.deployers.HornetQConfigParserDeployer">
         <constructor>
-         <parameter>
-             <set elementClass="java.lang.String">
-                <value>hornetq-configuration.xml</value>
-                <value>hornetq-queues.xml</value>
-             </set>
-         </parameter>
+         <parameter>hornetq-queues.xml</parameter>
       </constructor>
    </bean>
-
+   
    <bean name="HornetQCoreConfigRealDeployer" class="org.jboss.as.integration.hornetq.deployers.HornetQCoreConfigRealDeployer"/>
 
    <bean name="HornetQJMSParserDeployer" class="org.jboss.as.integration.hornetq.deployers.HornetQJMSParserDeployer">
       <property name="mgtObjectCreator"><inject bean="HornetQManagedObjectCreator" /></property>
    </bean>
+   
 
    <bean name="HornetQJMSRealDeployer" class="org.jboss.as.integration.hornetq.deployers.HornetQJMSRealDeployer">
        <demand>HornetQDestinationCreator</demand>
    </bean>
-   
+
    <!-- Destination creator for HornetQ
         This gets "automagically" injected into CreateDestinationDeployer Bean at ejb-deployer-jboss.xml through incallback and uncallback
     -->
@@ -45,9 +46,10 @@
 		<constructor><parameter><inject bean="ManagedObjectFactory" /></parameter></constructor>
         <demand>HornetQDestinationCreator</demand>
 	</bean>
-
+	
    <bean name="JMSQueueManageMO" class="org.jboss.as.integration.hornetq.management.jms.QueueManageImplMO">
       <constructor><parameter><inject bean="HornetQServer" /></parameter></constructor>
       <demand>JMSServerManager</demand>
    </bean>
+
 </deployment>
\ No newline at end of file




More information about the jboss-cvs-commits mailing list