[jbossws-commits] JBossWS SVN: r10855 - in projects/jaxbintros/trunk: src/main/java/org/jboss/jaxb/intros and 1 other directory.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Wed Oct 7 13:24:33 EDT 2009
Author: alessio.soldano at jboss.com
Date: 2009-10-07 13:24:32 -0400 (Wed, 07 Oct 2009)
New Revision: 10855
Added:
projects/jaxbintros/trunk/src/main/java/org/jboss/jaxb/intros/BindingCustomizationFactory.java
Modified:
projects/jaxbintros/trunk/pom.xml
Log:
[JBAS-7319] Adding BindingCustomizationFactory + fixing dependencies in pom.xml
Modified: projects/jaxbintros/trunk/pom.xml
===================================================================
--- projects/jaxbintros/trunk/pom.xml 2009-10-07 16:37:16 UTC (rev 10854)
+++ projects/jaxbintros/trunk/pom.xml 2009-10-07 17:24:32 UTC (rev 10855)
@@ -46,24 +46,20 @@
<!-- Dependencies -->
<dependencies>
- <!-- provided apis -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>${commons.logging.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb.api.version}</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb.impl.version}</version>
- <scope>provided</scope>
</dependency>
<!-- test dependencies -->
Added: projects/jaxbintros/trunk/src/main/java/org/jboss/jaxb/intros/BindingCustomizationFactory.java
===================================================================
--- projects/jaxbintros/trunk/src/main/java/org/jboss/jaxb/intros/BindingCustomizationFactory.java (rev 0)
+++ projects/jaxbintros/trunk/src/main/java/org/jboss/jaxb/intros/BindingCustomizationFactory.java 2009-10-07 17:24:32 UTC (rev 10855)
@@ -0,0 +1,62 @@
+/*
+ * 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.jaxb.intros;
+
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.jaxb.intros.configmodel.JaxbIntros;
+
+import com.sun.xml.bind.api.JAXBRIContext;
+
+/**
+ * A factory class that creates BindingCustomization instances using JAXBIntros.
+ * This basically a convenient class for getting a binding customizations
+ * ready for being installed in a jaxb context while hiding the internals
+ * of jaxb-impl.
+ *
+ * @author alessio.soldano at jboss.com
+ * @since 07-Oct-2009
+ *
+ */
+public class BindingCustomizationFactory
+{
+ public static Map<String, Object> getBindingCustomization(InputStream introsConfigStream)
+ {
+ return getBindingCustomization(introsConfigStream, null);
+ }
+
+ public static Map<String, Object> getBindingCustomization(InputStream introsConfigStream, String namespace)
+ {
+ JaxbIntros jaxbIntros = IntroductionsConfigParser.parseConfig(introsConfigStream);
+ IntroductionsAnnotationReader annotationReader = new IntroductionsAnnotationReader(jaxbIntros);
+ String defaultNamespace = namespace != null ? namespace : jaxbIntros.getDefaultNamespace();
+ Map<String, Object> jaxbCustomizations = new HashMap<String, Object>();
+
+ jaxbCustomizations.put(JAXBRIContext.ANNOTATION_READER, annotationReader);
+ if(defaultNamespace != null) {
+ jaxbCustomizations.put(JAXBRIContext.DEFAULT_NAMESPACE_REMAP, defaultNamespace);
+ }
+ return jaxbCustomizations;
+ }
+}
Property changes on: projects/jaxbintros/trunk/src/main/java/org/jboss/jaxb/intros/BindingCustomizationFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
More information about the jbossws-commits
mailing list