[jboss-svn-commits] JBL Code SVN: r15516 - in labs/jbossesb/trunk/product/services/soap: src/main/java/org/jboss and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Oct 2 17:16:19 EDT 2007


Author: tfennelly
Date: 2007-10-02 17:16:19 -0400 (Tue, 02 Oct 2007)
New Revision: 15516

Added:
   labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/wsf/
   labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/wsf/spi/
   labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/wsf/spi/deployment/
   labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/wsf/spi/deployment/JAXBIntrosCustomizationsDeployer.java
Modified:
   labs/jbossesb/trunk/product/services/soap/build.xml
Log:
Sorry.  Forgot to commit these classes earlier.  Were part of the JAXB Intros codebase, but were deleted when copied over to the JBossWS repo area.

Modified: labs/jbossesb/trunk/product/services/soap/build.xml
===================================================================
--- labs/jbossesb/trunk/product/services/soap/build.xml	2007-10-02 18:52:32 UTC (rev 15515)
+++ labs/jbossesb/trunk/product/services/soap/build.xml	2007-10-02 21:16:19 UTC (rev 15516)
@@ -8,6 +8,9 @@
     <path id="classpath">
         <path refid="base-classpath" />
 
+        <!-- JAXB Intros... -->
+        <fileset dir="../../lib/ext" includes="jboss-jaxb-intros.jar"/>
+
         <!-- Adding the Smooks jars... -->
         <fileset dir="../smooks/lib/ext" includes="*.jar"/>
     </path>

Added: labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/wsf/spi/deployment/JAXBIntrosCustomizationsDeployer.java
===================================================================
--- labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/wsf/spi/deployment/JAXBIntrosCustomizationsDeployer.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/wsf/spi/deployment/JAXBIntrosCustomizationsDeployer.java	2007-10-02 21:16:19 UTC (rev 15516)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.wsf.spi.deployment;
+
+import org.jboss.jaxb.intros.configmodel.JaxbIntros;
+import org.jboss.jaxb.intros.IntroductionsConfigParser;
+import org.jboss.jaxb.intros.IntroductionsAnnotationReader;
+import org.jboss.wsf.spi.binding.BindingCustomization;
+import org.jboss.ws.core.jaxws.JAXBBindingCustomization;
+import org.jboss.ws.integration.UnifiedVirtualFile;
+import org.apache.log4j.Logger;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import com.sun.xml.bind.api.JAXBRIContext;
+
+/**
+ * Deployer for {@link BindingCustomization BindingCustomizations} for JAXB
+ * Introductions.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class JAXBIntrosCustomizationsDeployer extends AbstractDeployer {
+
+    private static Logger logger = Logger.getLogger(JAXBIntrosCustomizationsDeployer.class);
+    private static final String META_INF_JAXB_INTROS_XML = "META-INF/jaxb-intros.xml";
+
+    public void create(Deployment deployment) {
+        UnifiedVirtualFile virtualFile = deployment.getRootFile();
+        InputStream introsConfigStream = null;
+
+        try {
+            URLClassLoader classLoader = new URLClassLoader(new URL[] {virtualFile.toURL()});
+            introsConfigStream = classLoader.getResource(META_INF_JAXB_INTROS_XML).openStream();
+        } catch (Exception e) {
+            logger.info("[" + deployment.getService().getContextRoot() + "] No JAXB Introductions Configurations specified (" + META_INF_JAXB_INTROS_XML + ").");
+            return;
+        }
+
+        try {
+            if(introsConfigStream != null) {
+                JaxbIntros jaxbIntros = IntroductionsConfigParser.parseConfig(introsConfigStream);
+                IntroductionsAnnotationReader annotationReader = new IntroductionsAnnotationReader(jaxbIntros);
+                String defaultNamespace = jaxbIntros.getDefaultNamespace();
+                BindingCustomization jaxbCustomizations = new JAXBBindingCustomization();
+
+                jaxbCustomizations.put(JAXBRIContext.ANNOTATION_READER, annotationReader);
+                if(defaultNamespace != null) {
+                    jaxbCustomizations.put(JAXBRIContext.DEFAULT_NAMESPACE_REMAP, defaultNamespace);
+                }
+
+                for (Endpoint endpoint : deployment.getService().getEndpoints()) {
+                    endpoint.addBindingCustomization(jaxbCustomizations);
+                }
+            }
+        } finally {
+            if(introsConfigStream != null) {
+                try {
+                    introsConfigStream.close();
+                } catch (IOException e) {
+                    logger.error("[" + deployment.getService().getContextRoot() + "] Error closing JAXB Introductions Configurations stream " + META_INF_JAXB_INTROS_XML + ".", e);
+                }
+            }
+        }
+    }
+}


Property changes on: labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/wsf/spi/deployment/JAXBIntrosCustomizationsDeployer.java
___________________________________________________________________
Name: svn:eol-style
   + native




More information about the jboss-svn-commits mailing list