[jboss-svn-commits] JBL Code SVN: r23491 - in labs/jbossesb/workspace/skeagh: examples/helloworld and 2 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Oct 17 08:03:10 EDT 2008


Author: tfennelly
Date: 2008-10-17 08:03:10 -0400 (Fri, 17 Oct 2008)
New Revision: 23491

Modified:
   labs/jbossesb/workspace/skeagh/container/osgi/pom.xml
   labs/jbossesb/workspace/skeagh/examples/helloworld/config.properties
   labs/jbossesb/workspace/skeagh/examples/helloworld/pom.xml
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DigestUtil.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/DefaultConfigurationDigesterTest.java
Log:
cleaning up some Exports

Modified: labs/jbossesb/workspace/skeagh/container/osgi/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/pom.xml	2008-10-17 09:30:23 UTC (rev 23490)
+++ labs/jbossesb/workspace/skeagh/container/osgi/pom.xml	2008-10-17 12:03:10 UTC (rev 23491)
@@ -40,7 +40,6 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
-                        <Export-Package>org.jboss.esb.test</Export-Package>
                         <Private-Package>org.jboss.esb.osgi</Private-Package>
                         <Import-Package>org.jboss.esb.api.*, *;resolution:=optional</Import-Package> <!-- TODO: Replace global import with explicit package imports? -->
                         <Bundle-Activator>org.jboss.esb.osgi.EsbServiceDeploymentActivator</Bundle-Activator>

Modified: labs/jbossesb/workspace/skeagh/examples/helloworld/config.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/helloworld/config.properties	2008-10-17 09:30:23 UTC (rev 23490)
+++ labs/jbossesb/workspace/skeagh/examples/helloworld/config.properties	2008-10-17 12:03:10 UTC (rev 23491)
@@ -35,6 +35,7 @@
  "file:${apache.m2.path}/felix/org.apache.felix.shell/1.0.2/org.apache.felix.shell-1.0.2.jar" \
  "file:${apache.m2.path}/felix/org.apache.felix.shell.tui/1.0.2/org.apache.felix.shell.tui-1.0.2.jar" \
  "file:${apache.m2.path}/geronimo/specs/geronimo-jms_1.1_spec/1.1.1/geronimo-jms_1.1_spec-1.1.1.jar" \
+ "file:${jbossesb.m2.path}/jbossesb-api/5.0-SNAPSHOT/jbossesb-api-5.0-SNAPSHOT.jar" \
  "file:${jbossesb.m2.path}/jbossesb-osgi-runtime/5.0-SNAPSHOT/jbossesb-osgi-runtime-5.0-SNAPSHOT.jar" \
  "file:${jbossesb.m2.path}/jbossesb-routing-jms/5.0-SNAPSHOT/jbossesb-routing-jms-5.0-SNAPSHOT.jar" \
  "file:${jbossesb.m2.path}/jbossesb-examples-helloworld/5.0-SNAPSHOT/jbossesb-examples-helloworld-5.0-SNAPSHOT.jar"

Modified: labs/jbossesb/workspace/skeagh/examples/helloworld/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/helloworld/pom.xml	2008-10-17 09:30:23 UTC (rev 23490)
+++ labs/jbossesb/workspace/skeagh/examples/helloworld/pom.xml	2008-10-17 12:03:10 UTC (rev 23491)
@@ -77,7 +77,7 @@
 		<!-- JBossESB OSGi bundle -->
         <dependency>
             <groupId>jboss.jbossesb</groupId>
-            <artifactId>jbossesb-osgi-api</artifactId>
+            <artifactId>jbossesb-api</artifactId>
             <version>${jboss.esb.version}</version>
         </dependency>
 		<dependency>
@@ -86,7 +86,7 @@
 			<version>${jboss.esb.version}</version>
 		</dependency>
 
-		<!-- JBossESB JMS Souting bundle -->
+		<!-- JBossESB JMS Routing bundle -->
 		<dependency>
 			<groupId>jboss.jbossesb</groupId>
 			<artifactId>jbossesb-routing-jms</artifactId>

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DigestUtil.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DigestUtil.java	2008-10-17 09:30:23 UTC (rev 23490)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DigestUtil.java	2008-10-17 12:03:10 UTC (rev 23491)
@@ -151,27 +151,34 @@
      */
     public static Map<String, Object> digestElement(final Element configurationElement, final ResourceLocator resourceLocator) throws IOException, SAXException
     {
+        JavaResult result = new JavaResult();
         Smooks smooks = getSmooksInstance(configurationElement, resourceLocator);
-        JavaResult result = new JavaResult();
 
         if (smooks != null)
         {
-            ExecutionContext execContext = smooks.createExecutionContext();
-
-            if (reportPath != null)
+            try
             {
+                ExecutionContext execContext = smooks.createExecutionContext();
 
-                File reportPathFile = new File(reportPath);
-                File tsReportPathFile = new File(reportPathFile.getParentFile(), Long.toString(System.currentTimeMillis()) + "-" + reportPathFile.getName());
+                if (reportPath != null)
+                {
 
-                execContext.setEventListener(new HtmlReportGenerator(new FileWriter(tsReportPathFile)));
-            }
+                    File reportPathFile = new File(reportPath);
+                    File tsReportPathFile = new File(reportPathFile.getParentFile(), Long.toString(System.currentTimeMillis()) + "-" + reportPathFile.getName());
 
-            // store the resource locator in the Smooks execution context so that it
-            // can be used by the visitor methods.
-            execContext.setAttribute(ResourceLocator.class, resourceLocator);
+                    execContext.setEventListener(new HtmlReportGenerator(new FileWriter(tsReportPathFile)));
+                }
 
-            smooks.filter(new DOMSource(configurationElement), result, execContext);
+                // store the resource locator in the Smooks execution context so that it
+                // can be used by the visitor methods.
+                execContext.setAttribute(ResourceLocator.class, resourceLocator);
+
+                smooks.filter(new DOMSource(configurationElement), result, execContext);
+            }
+            finally
+            {
+                smooks.close();
+            }
         }
 
         return result.getResultMap();
@@ -189,33 +196,59 @@
     private static Smooks getSmooksInstance(final Element element, final ResourceLocator resourceLocator) throws IOException, SAXException
     {
         Smooks smooks = new Smooks();
-        Set<URI> namespaces = new LinkedHashSet<URI>();
 
-        XMLParseUtils.gatherElementNamespaces(element, namespaces);
+        try
+        {
+            Set<URI> namespaces = new LinkedHashSet<URI>();
 
-        for (URI namespace : namespaces)
+            XMLParseUtils.gatherElementNamespaces(element, namespaces);
+
+            for (URI namespace : namespaces)
+            {
+                SmooksResourceConfigurationList configList = null;
+                /*
+                 * This storing/setting/restoring of the context classloader is done to enable Smooks to
+                 * find classes and resources.
+                 * This is a temporary solution. /Daniel 2008-10-09
+                 */
+                ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+                try
+                {
+                    Thread.currentThread().setContextClassLoader(Smooks.class.getClassLoader());
+                    configList = getNamespaceConfig(namespace, resourceLocator);
+                }
+                finally
+                {
+                    Thread.currentThread().setContextClassLoader(contextClassLoader);
+                }
+
+                if (configList != null)
+                {
+                    smooks.getApplicationContext().getStore().addSmooksResourceConfigurationList(configList);
+                }
+            }
+        }
+        catch (Throwable t)
         {
-            SmooksResourceConfigurationList configList = null;
-            /*
-             * This storing/setting/restoring of the context classloader is done to enable Smooks to
-             * find classes and resources.
-             * This is a temporary solution. /Daniel 2008-10-09
-             */
-            ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
             try
             {
-                Thread.currentThread().setContextClassLoader(Smooks.class.getClassLoader());
-                configList = getNamespaceConfig(namespace, resourceLocator);
+                if (t instanceof IOException)
+                {
+                    throw (IOException) t;
+                }
+                else if (t instanceof SAXException)
+                {
+                    throw (SAXException) t;
+                }
+                else
+                {
+                    throw (SAXException) new SAXException("Unexpected exception while creating Smooks instance for digesting ESB configuration.").initCause(t);                    
+                }
             }
             finally
             {
-                Thread.currentThread().setContextClassLoader(contextClassLoader);
+                smooks.close();
             }
-
-            if (configList != null)
-            {
-                smooks.getApplicationContext().getStore().addSmooksResourceConfigurationList(configList);
-            }
         }
 
         return smooks;

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/DefaultConfigurationDigesterTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/DefaultConfigurationDigesterTest.java	2008-10-17 09:30:23 UTC (rev 23490)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/DefaultConfigurationDigesterTest.java	2008-10-17 12:03:10 UTC (rev 23491)
@@ -19,14 +19,12 @@
  */
 package org.jboss.esb.deploy.config;
 
+import org.jboss.esb.api.message.MessageProcessor;
+import org.jboss.esb.api.service.ServiceMEP;
+import org.jboss.esb.api.service.ServiceName;
 import org.jboss.esb.deploy.DefaultResourceLocator;
 import org.jboss.esb.deploy.DeploymentException;
 import org.jboss.esb.deploy.config.digest.DefaultConfigurationDigester;
-import org.jboss.esb.deploy.config.digest.DigestUtil;
-import org.jboss.esb.api.message.MessageProcessor;
-import org.jboss.esb.api.service.ServiceName;
-import org.jboss.esb.api.service.ServiceMEP;
-import org.junit.After;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
@@ -505,10 +503,4 @@
         DefaultConfigurationDigester digester = new DefaultConfigurationDigester(new DefaultResourceLocator());
         return digester.digest(getClass().getResourceAsStream(config));
     }
-
-    @After
-    public void tearDown() throws Exception
-    {
-        DigestUtil.setReportPath(null);
-    }
 }




More information about the jboss-svn-commits mailing list