Author: thomas.diesler(a)jboss.com
Date: 2007-06-27 04:03:56 -0400 (Wed, 27 Jun 2007)
New Revision: 3742
Added:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/BasicJAXBHandler.java
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBContextCache.java
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBHandler.java
Removed:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/CachingJAXBContextFactory.java
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBContextFactory.java
Modified:
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans-no-ejb3.xml
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans.xml
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native42.sar/jbossws.beans/META-INF/jboss-beans.xml
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native50.sar/META-INF/jbossws-beans.xml
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicEndpoint.java
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/EndpointHandlerDeployer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/SerializationContextJAXWS.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java
Log:
Externalize JAXBHandler
Modified:
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans-no-ejb3.xml
===================================================================
---
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans-no-ejb3.xml 2007-06-27
07:27:56 UTC (rev 3741)
+++
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans-no-ejb3.xml 2007-06-27
08:03:56 UTC (rev 3742)
@@ -126,6 +126,7 @@
<bean name="WSEndpointHandlerDeployer"
class="org.jboss.wsf.spi.deployment.EndpointHandlerDeployer">
<property
name="requestHandler">org.jboss.wsf.stack.jbws.RequestHandlerImpl</property>
<property
name="lifecycleHandler">org.jboss.wsf.stack.jbws.LifecycleHandlerImpl</property>
+ <property
name="jaxbHandler">org.jboss.wsf.spi.binding.jaxb.JAXBContextCache</property>
<property name="invocationHandler">
<map keyClass="java.lang.String"
valueClass="java.lang.String">
<entry><key>JAXRPC_JSE</key><value>org.jboss.wsf.stack.jbws.ServiceLifecycleInvocationHandler</value></entry>
Modified:
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans.xml
===================================================================
---
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans.xml 2007-06-27
07:27:56 UTC (rev 3741)
+++
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans.xml 2007-06-27
08:03:56 UTC (rev 3742)
@@ -126,6 +126,7 @@
<bean name="WSEndpointHandlerDeployer"
class="org.jboss.wsf.spi.deployment.EndpointHandlerDeployer">
<property
name="requestHandler">org.jboss.wsf.stack.jbws.RequestHandlerImpl</property>
<property
name="lifecycleHandler">org.jboss.wsf.stack.jbws.LifecycleHandlerImpl</property>
+ <property
name="jaxbHandler">org.jboss.wsf.spi.binding.jaxb.JAXBContextCache</property>
<property name="invocationHandler">
<map keyClass="java.lang.String"
valueClass="java.lang.String">
<entry><key>JAXRPC_JSE</key><value>org.jboss.wsf.stack.jbws.ServiceLifecycleInvocationHandler</value></entry>
Modified:
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native42.sar/jbossws.beans/META-INF/jboss-beans.xml
===================================================================
---
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native42.sar/jbossws.beans/META-INF/jboss-beans.xml 2007-06-27
07:27:56 UTC (rev 3741)
+++
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native42.sar/jbossws.beans/META-INF/jboss-beans.xml 2007-06-27
08:03:56 UTC (rev 3742)
@@ -130,6 +130,7 @@
<bean name="WSEndpointHandlerDeployer"
class="org.jboss.wsf.spi.deployment.EndpointHandlerDeployer">
<property
name="requestHandler">org.jboss.wsf.stack.jbws.RequestHandlerImpl</property>
<property
name="lifecycleHandler">org.jboss.wsf.stack.jbws.LifecycleHandlerImpl</property>
+ <property
name="jaxbHandler">org.jboss.wsf.spi.binding.jaxb.JAXBContextCache</property>
<property name="invocationHandler">
<map keyClass="java.lang.String"
valueClass="java.lang.String">
<entry><key>JAXRPC_JSE</key><value>org.jboss.wsf.stack.jbws.ServiceLifecycleInvocationHandler</value></entry>
Modified:
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native50.sar/META-INF/jbossws-beans.xml
===================================================================
---
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native50.sar/META-INF/jbossws-beans.xml 2007-06-27
07:27:56 UTC (rev 3741)
+++
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native50.sar/META-INF/jbossws-beans.xml 2007-06-27
08:03:56 UTC (rev 3742)
@@ -141,6 +141,7 @@
<bean name="WSEndpointHandlerDeployer"
class="org.jboss.wsf.spi.deployment.EndpointHandlerDeployer">
<property
name="requestHandler">org.jboss.wsf.stack.jbws.RequestHandlerImpl</property>
<property
name="lifecycleHandler">org.jboss.wsf.stack.jbws.LifecycleHandlerImpl</property>
+ <property
name="jaxbHandler">org.jboss.wsf.spi.binding.jaxb.JAXBContextCache</property>
<property name="invocationHandler">
<map keyClass="java.lang.String"
valueClass="java.lang.String">
<entry><key>JAXRPC_JSE</key><value>org.jboss.wsf.stack.jbws.ServiceLifecycleInvocationHandler</value></entry>
Added:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/BasicJAXBHandler.java
===================================================================
---
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/BasicJAXBHandler.java
(rev 0)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/BasicJAXBHandler.java 2007-06-27
08:03:56 UTC (rev 3742)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.wsf.spi.binding.jaxb;
+
+// $Id: $
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+
+/**
+ * A basic JAXBHandler.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 26-Jun-2007
+ */
+public class BasicJAXBHandler implements JAXBHandler
+{
+ public JAXBContext getJAXBContext(Class[] javaTypes) throws JAXBException
+ {
+ JAXBContext ctx = JAXBContext.newInstance(javaTypes);
+ return ctx;
+ }
+}
Deleted:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/CachingJAXBContextFactory.java
===================================================================
---
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/CachingJAXBContextFactory.java 2007-06-27
07:27:56 UTC (rev 3741)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/CachingJAXBContextFactory.java 2007-06-27
08:03:56 UTC (rev 3742)
@@ -1,85 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.wsf.spi.binding.jaxb;
-
-// $Id: $
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-
-import org.jboss.wsf.spi.utils.HashCodeUtil;
-
-/**
- * Cache JAXBContext's.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 26-Jun-2007
- */
-public class CachingJAXBContextFactory implements JAXBContextFactory
-{
- private Map<Integer, JAXBContext> cache = new ConcurrentHashMap<Integer,
JAXBContext>();
-
- private JAXBContext get(Integer id)
- {
- return cache.get(id);
- }
-
- private void add(Integer id, JAXBContext context)
- {
- cache.put(id, context);
- }
-
- /**
- * Retrieve a cached JAXBContext instance.
- * If no instance is cached a new one will be created and registered.
- */
- public JAXBContext getInstance(Class[] classes) throws JAXBException
- {
- Integer id = buildId(classes);
- JAXBContext ctx = get(id);
- if (null == ctx)
- {
- ctx = JAXBContext.newInstance(classes);
- add(id, ctx);
- }
-
- return ctx;
- }
-
- private Integer buildId(Class[] classes)
- {
- int sum = HashCodeUtil.SEED;
- for (Class cls : classes)
- {
- sum = HashCodeUtil.hash(sum, cls.getName());
- }
- return new Integer(sum);
- }
-
- private Integer buildId(Class clazz)
- {
- return buildId(new Class[] { clazz });
- }
-}
Added:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBContextCache.java
===================================================================
---
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBContextCache.java
(rev 0)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBContextCache.java 2007-06-27
08:03:56 UTC (rev 3742)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.wsf.spi.binding.jaxb;
+
+// $Id: $
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+
+import org.jboss.wsf.spi.utils.HashCodeUtil;
+
+/**
+ * Cache JAXBContext's.
+ *
+ * @author Heiko.Braun(a)jboss.com
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 26-Jun-2007
+ */
+public class JAXBContextCache implements JAXBHandler
+{
+ private Map<Integer, JAXBContext> cache = new ConcurrentHashMap<Integer,
JAXBContext>();
+
+ private JAXBContext get(Integer id)
+ {
+ return cache.get(id);
+ }
+
+ private void add(Integer id, JAXBContext context)
+ {
+ cache.put(id, context);
+ }
+
+ /**
+ * Retrieve a cached JAXBContext instance.
+ * If no instance is cached a new one will be created and registered.
+ */
+ public JAXBContext getJAXBContext(Class[] javaTypes) throws JAXBException
+ {
+ Integer id = buildId(javaTypes);
+ JAXBContext ctx = get(id);
+ if (null == ctx)
+ {
+ ctx = JAXBContext.newInstance(javaTypes);
+ add(id, ctx);
+ }
+
+ return ctx;
+ }
+
+ private Integer buildId(Class[] classes)
+ {
+ int sum = HashCodeUtil.SEED;
+ for (Class cls : classes)
+ {
+ sum = HashCodeUtil.hash(sum, cls.getName());
+ }
+ return new Integer(sum);
+ }
+}
Deleted:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBContextFactory.java
===================================================================
---
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBContextFactory.java 2007-06-27
07:27:56 UTC (rev 3741)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBContextFactory.java 2007-06-27
08:03:56 UTC (rev 3742)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.wsf.spi.binding.jaxb;
-
-// $Id: $
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-
-/**
- * A factory for JAXBContext
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 26-Jun-2007
- */
-public interface JAXBContextFactory
-{
- /**
- * Retrieve a cached JAXBContext instance.
- * If no instance is cached a new one will be created and registered.
- */
- JAXBContext getInstance(Class[] classes) throws JAXBException;
-}
Copied:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBHandler.java
(from rev 3740,
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBContextFactory.java)
===================================================================
---
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBHandler.java
(rev 0)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBHandler.java 2007-06-27
08:03:56 UTC (rev 3742)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.wsf.spi.binding.jaxb;
+
+// $Id: $
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+
+/**
+ * A factory for JAXBContext
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 26-Jun-2007
+ */
+public interface JAXBHandler
+{
+ /** Get a JAXBContext instance.
+ */
+ JAXBContext getJAXBContext(Class[] javaTypes) throws JAXBException;
+}
Modified:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicEndpoint.java
===================================================================
---
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicEndpoint.java 2007-06-27
07:27:56 UTC (rev 3741)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicEndpoint.java 2007-06-27
08:03:56 UTC (rev 3742)
@@ -27,6 +27,7 @@
import javax.management.ObjectName;
+import org.jboss.wsf.spi.binding.jaxb.JAXBHandler;
import org.jboss.wsf.spi.invocation.InvocationHandler;
import org.jboss.wsf.spi.invocation.RequestHandler;
import org.jboss.wsf.spi.management.EndpointMetrics;
@@ -48,6 +49,7 @@
private RequestHandler requestHandler;
private InvocationHandler invocationHandler;
private LifecycleHandler lifecycleHandler;
+ private JAXBHandler jaxbHandler;
private Map<Class, Object> attachments = new HashMap<Class, Object>();
private Map<String, Object> properties = new HashMap<String, Object>();
private EndpointMetrics metrics;
@@ -167,6 +169,16 @@
this.invocationHandler = handler;
}
+ public JAXBHandler getJAXBHandler()
+ {
+ return jaxbHandler;
+ }
+
+ public void setJAXBHandler(JAXBHandler jaxbHandler)
+ {
+ this.jaxbHandler = jaxbHandler;
+ }
+
public <T> T addAttachment(Class<T> key, Object value)
{
return (T)attachments.put(key, value);
Modified:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java
===================================================================
---
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java 2007-06-27
07:27:56 UTC (rev 3741)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java 2007-06-27
08:03:56 UTC (rev 3742)
@@ -27,6 +27,7 @@
import javax.management.ObjectName;
+import org.jboss.wsf.spi.binding.jaxb.JAXBHandler;
import org.jboss.wsf.spi.invocation.InvocationHandler;
import org.jboss.wsf.spi.invocation.RequestHandler;
import org.jboss.wsf.spi.management.EndpointMetrics;
@@ -107,6 +108,12 @@
/** Set the endpoint bean invoker */
void setInvocationHandler(InvocationHandler invoker);
+ /** Get the JAXBHandler for this endpoint */
+ JAXBHandler getJAXBHandler();
+
+ /** Set the JAXBHandler for this endpoint */
+ void setJAXBHandler(JAXBHandler handler);
+
/** Get the endpoint metrics for this endpoint */
EndpointMetrics getEndpointMetrics();
Modified:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/EndpointHandlerDeployer.java
===================================================================
---
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/EndpointHandlerDeployer.java 2007-06-27
07:27:56 UTC (rev 3741)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/EndpointHandlerDeployer.java 2007-06-27
08:03:56 UTC (rev 3742)
@@ -25,6 +25,7 @@
import java.util.Map;
+import org.jboss.wsf.spi.binding.jaxb.JAXBHandler;
import org.jboss.wsf.spi.invocation.InvocationHandler;
import org.jboss.wsf.spi.invocation.RequestHandler;
import org.jboss.wsf.spi.metadata.j2ee.UnifiedApplicationMetaData;
@@ -41,6 +42,7 @@
{
private String requestHandler;
private String lifecycleHandler;
+ private String jaxbHandler;
private Map<String,String> invocationHandler;
public void setLifecycleHandler(String handler)
@@ -58,6 +60,11 @@
this.invocationHandler = handlers;
}
+ public void setJaxbHandler(String jaxbHandler)
+ {
+ this.jaxbHandler = jaxbHandler;
+ }
+
@Override
public void create(Deployment dep)
{
@@ -66,6 +73,7 @@
ep.setRequestHandler(getRequestHandler(dep));
ep.setLifecycleHandler(getLifecycleHandler(dep));
ep.setInvocationHandler(getInvocationHandler(ep));
+ ep.setJAXBHandler(getJAXBHandler(dep));
}
}
@@ -95,6 +103,19 @@
}
}
+ private JAXBHandler getJAXBHandler(Deployment dep)
+ {
+ try
+ {
+ Class<?> handlerClass = dep.getClassLoader().loadClass(jaxbHandler);
+ return (JAXBHandler)handlerClass.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Cannot load jaxb handler: " +
jaxbHandler);
+ }
+ }
+
private InvocationHandler getInvocationHandler(Endpoint ep)
{
Deployment dep = ep.getService().getDeployment();
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java 2007-06-27
07:27:56 UTC (rev 3741)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java 2007-06-27
08:03:56 UTC (rev 3742)
@@ -37,7 +37,7 @@
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.binding.TypeMappingImpl;
import org.jboss.ws.extensions.xop.jaxws.AttachmentUnmarshallerImpl;
-import org.jboss.wsf.spi.binding.jaxb.JAXBContextFactory;
+import org.jboss.wsf.spi.binding.jaxb.JAXBHandler;
/**
* A Deserializer that can handle complex types by delegating to JAXB.
@@ -66,8 +66,7 @@
TypeMappingImpl typeMapping = serContext.getTypeMapping();
Class javaType = typeMapping.getJavaType(xmlType);
- JAXBContextFactory jaxbFactory =
((SerializationContextJAXWS)serContext).getJAXBContextFactory();
- JAXBContext jaxbContext = jaxbFactory.getInstance(javaTypes);
+ JAXBContext jaxbContext =
((SerializationContextJAXWS)serContext).getJAXBContext(javaTypes);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
unmarshaller.setAttachmentUnmarshaller( new AttachmentUnmarshallerImpl());
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java 2007-06-27
07:27:56 UTC (rev 3741)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java 2007-06-27
08:03:56 UTC (rev 3742)
@@ -37,7 +37,7 @@
import org.jboss.ws.core.binding.ComplexTypeSerializer;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.extensions.xop.jaxws.AttachmentMarshallerImpl;
-import org.jboss.wsf.spi.binding.jaxb.JAXBContextFactory;
+import org.jboss.wsf.spi.binding.jaxb.JAXBHandler;
import org.w3c.dom.NamedNodeMap;
/**
@@ -69,8 +69,7 @@
Class actualType = value.getClass();
Class[] javaTypes = shouldFilter(actualType) ? new Class[]{expectedType} : new
Class[]{expectedType, actualType};
- JAXBContextFactory jaxbFactory =
((SerializationContextJAXWS)serContext).getJAXBContextFactory();
- JAXBContext jaxbContext = jaxbFactory.getInstance(javaTypes);
+ JAXBContext jaxbContext =
((SerializationContextJAXWS)serContext).getJAXBContext(javaTypes);
Marshaller marshaller = jaxbContext.createMarshaller();
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/SerializationContextJAXWS.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/SerializationContextJAXWS.java 2007-06-27
07:27:56 UTC (rev 3741)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/SerializationContextJAXWS.java 2007-06-27
08:03:56 UTC (rev 3742)
@@ -1,34 +1,35 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt 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.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ws.core.jaxws;
// $Id$
-import org.jboss.logging.Logger;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.wsf.spi.binding.jaxb.JAXBContextFactory;
/**
* The serialization context for JAXWS endpoints/clients
@@ -38,19 +39,16 @@
*/
public class SerializationContextJAXWS extends SerializationContext
{
- // provide logging
- private static final Logger log = Logger.getLogger(SerializationContextJAXWS.class);
-
public static final String JAXB_CONTEXT_TYPES =
"org.jboss.ws.jaxb.context.types";
/**
- * Access the JAXBContextFactory through the message context.
+ * Access the JAXBContext through the message context.
* The actual instance is assiciated with the EndpointMetaData.
*/
- public static JAXBContextFactory getJAXBContextFactory()
+ public static JAXBContext getJAXBContext(Class[] javaTypes) throws JAXBException
{
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
- return epMetaData.getJAXBContextFactory();
+ return epMetaData.getJAXBContext(javaTypes);
}
}
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2007-06-27
07:27:56 UTC (rev 3741)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2007-06-27
08:03:56 UTC (rev 3742)
@@ -23,10 +23,13 @@
// $Id$
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
import org.jboss.ws.metadata.config.ConfigurationProvider;
-import org.jboss.wsf.spi.binding.jaxb.CachingJAXBContextFactory;
+import org.jboss.wsf.spi.binding.jaxb.JAXBContextCache;
+import org.jboss.wsf.spi.binding.jaxb.JAXBHandler;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
/**
@@ -37,6 +40,8 @@
*/
public class ClientEndpointMetaData extends EndpointMetaData
{
+ private JAXBHandler jaxbHandler = new JAXBContextCache();
+
public ClientEndpointMetaData(ServiceMetaData service, QName qname, QName
portTypeName, Type type)
{
super(service, qname, portTypeName, type);
@@ -48,6 +53,12 @@
configFile = ConfigurationProvider.DEFAULT_JAXWS_CLIENT_CONFIG_FILE;
}
+ @Override
+ public JAXBContext getJAXBContext(Class[] javaTypes) throws JAXBException
+ {
+ return jaxbHandler.getJAXBContext(javaTypes);
+ }
+
public String toString()
{
StringBuilder buffer = new StringBuilder("\nClientEndpointMetaData:");
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2007-06-27
07:27:56 UTC (rev 3741)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2007-06-27
08:03:56 UTC (rev 3742)
@@ -36,6 +36,8 @@
import java.util.Set;
import javax.jws.soap.SOAPBinding.ParameterStyle;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.ws.Service.Mode;
@@ -61,8 +63,6 @@
import org.jboss.ws.metadata.config.ConfigurationProvider;
import org.jboss.ws.metadata.config.EndpointFeature;
import org.jboss.ws.metadata.config.JBossWSConfigFactory;
-import org.jboss.wsf.spi.binding.jaxb.CachingJAXBContextFactory;
-import org.jboss.wsf.spi.binding.jaxb.JAXBContextFactory;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
import org.jboss.wsf.spi.utils.JavaUtils;
@@ -142,8 +142,6 @@
private ConfigObservable configObservable = new ConfigObservable();
- protected JAXBContextFactory jaxbContextFactory = new CachingJAXBContextFactory();
-
private List<UnifiedPortComponentRefMetaData> serviceRefContrib = new
ArrayList<UnifiedPortComponentRefMetaData>();
public EndpointMetaData(ServiceMetaData service, QName portName, QName portTypeName,
Type type)
@@ -326,10 +324,7 @@
return type;
}
- public JAXBContextFactory getJAXBContextFactory()
- {
- return jaxbContextFactory;
- }
+ public abstract JAXBContext getJAXBContext(Class[] javaTypes) throws JAXBException;
public String getAuthMethod()
{
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java 2007-06-27
07:27:56 UTC (rev 3741)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java 2007-06-27
08:03:56 UTC (rev 3742)
@@ -24,11 +24,13 @@
// $Id$
import javax.management.ObjectName;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
import org.jboss.logging.Logger;
import org.jboss.ws.metadata.config.ConfigurationProvider;
-import org.jboss.wsf.spi.binding.jaxb.JAXBContextFactory;
+import org.jboss.wsf.spi.binding.jaxb.JAXBHandler;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
@@ -185,6 +187,12 @@
{
this.secureWSDLAccess = secureWSDLAccess;
}
+
+ @Override
+ public JAXBContext getJAXBContext(Class[] javaTypes) throws JAXBException
+ {
+ return endpoint.getJAXBHandler().getJAXBContext(javaTypes);
+ }
public String toString()
{
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java 2007-06-27
07:27:56 UTC (rev 3741)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java 2007-06-27
08:03:56 UTC (rev 3742)
@@ -23,10 +23,13 @@
// $Id$
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.wsf.spi.binding.jaxb.BasicJAXBHandler;
/**
* Tools Endpoint Metadata
@@ -41,4 +44,10 @@
{
super(service, portName, portTypeName, Type.JAXRPC);
}
+
+ @Override
+ public JAXBContext getJAXBContext(Class[] javaTypes) throws JAXBException
+ {
+ return new BasicJAXBHandler().getJAXBContext(javaTypes);
+ }
}
\ No newline at end of file