Author: thomas.diesler(a)jboss.com
Date: 2007-06-29 04:18:16 -0400 (Fri, 29 Jun 2007)
New Revision: 3760
Added:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/
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
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/utils/HashCodeUtil.java
Removed:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/BindingCustomization.java
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
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBBindingCustomization.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextCache.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextCustomisation.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/utils/HashCodeUtil.java
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/binding/BindingCustomizationTestCase.java
Modified:
branches/jbossws-2.0/build/ant.properties.example
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-2.0.iws
branches/jbossws-2.0/jbossws-core/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/TypeMappingImpl.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/acessor/JAXBAccessor.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
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws871/JBWS871TestCase.java
Log:
Rollback invalid change due to numerous compile issues
svn merge -r3758:3755
https://svn.jboss.org/repos/jbossws/branches/jbossws-2.0
Modified: branches/jbossws-2.0/build/ant.properties.example
===================================================================
--- branches/jbossws-2.0/build/ant.properties.example 2007-06-28 20:22:16 UTC (rev 3759)
+++ branches/jbossws-2.0/build/ant.properties.example 2007-06-29 08:18:16 UTC (rev 3760)
@@ -5,7 +5,7 @@
# Optional JBoss Home
#jboss50.home=/home/tdiesler/svn/jbossas/trunk/build/output/jboss-5.0.0.Beta3
-#jboss42.home=/home/tdiesler/svn/jbossas/branches/Branch_4_2/build/output/jboss-4.2.1.GA
+#jboss42.home=/home/tdiesler/svn/jbossas/branches/Branch_4_2/build/output/jboss-4.2.0.GA
#jboss40.home=/home/tdiesler/svn/jbossas/branches/Branch_4_0/build/output/jboss-4.0.5.SP1-ejb3
# The JBoss server under test. This can be [jboss50|jboss42|jboss40]
@@ -37,7 +37,7 @@
hudson.jboss50.rev=HEAD
hudson.jboss42.url=https://svn.jboss.org/repos/jbossas/branches/Branch_4_2
-hudson.jboss42.build=jboss-4.2.1.GA
+hudson.jboss42.build=jboss-4.2.0.GA
hudson.jboss42.rev=HEAD
hudson.jboss40.url=https://svn.jboss.org/repos/jbossas/branches/Branch_4_0
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-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans-no-ejb3.xml 2007-06-29
08:18:16 UTC (rev 3760)
@@ -125,7 +125,8 @@
<bean name="WSEagerInitializeDeployer"
class="org.jboss.wsf.stack.jbws.EagerInitializeDeployer"/>
<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="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-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans.xml 2007-06-29
08:18:16 UTC (rev 3760)
@@ -125,7 +125,8 @@
<bean name="WSEagerInitializeDeployer"
class="org.jboss.wsf.stack.jbws.EagerInitializeDeployer"/>
<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="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-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native42.sar/jbossws.beans/META-INF/jboss-beans.xml 2007-06-29
08:18:16 UTC (rev 3760)
@@ -129,7 +129,8 @@
<bean name="WSEagerInitializeDeployer"
class="org.jboss.wsf.stack.jbws.EagerInitializeDeployer"/>
<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="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-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native50.sar/META-INF/jbossws-beans.xml 2007-06-29
08:18:16 UTC (rev 3760)
@@ -52,7 +52,7 @@
2) WebServiceDeployerJSE < WarDeployer
3) WebServiceMainDeployer
- Each WebServiceDeployer has a number of DeployerHooks registered with it
+ Each WebServiceDeployer has a number of DeployerHooks registerd with it
- WebServiceDeployerEJB
- WSDeployerHook_JAXRPC_EJB21
@@ -140,7 +140,8 @@
<bean name="WSEagerInitializeDeployer"
class="org.jboss.wsf.stack.jbws.EagerInitializeDeployer"/>
<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="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>
Deleted:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/BindingCustomization.java
===================================================================
---
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/BindingCustomization.java 2007-06-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/BindingCustomization.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -1,39 +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;
-
-import java.util.HashMap;
-
-/**
- * Allows introduction of arbitrary binding customization properties.<p>
- * This may be different between stacks and addresses meta data binding
- * (i.e JSR-181 to UnifiedMetaData) as well as JAVA to XML binding operations.
- * <p>
- * Supported properties need to be documented in subclasses.
- *
- *
- * @author Heiko.Braun(a)jboss.com
- * Created: Jun 28, 2007
- */
-public abstract class BindingCustomization extends HashMap {
-
-}
Copied: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb
(from rev 3755,
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb)
Deleted:
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 2007-06-28
15:02:00 UTC (rev 3755)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/BasicJAXBHandler.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -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 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;
- }
-}
Copied:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/BasicJAXBHandler.java
(from rev 3755,
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-29
08:18:16 UTC (rev 3760)
@@ -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/JAXBContextCache.java
===================================================================
---
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBContextCache.java 2007-06-28
15:02:00 UTC (rev 3755)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBContextCache.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -1,81 +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 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);
- }
-}
Copied:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBContextCache.java
(from rev 3755,
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-29
08:18:16 UTC (rev 3760)
@@ -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/JAXBHandler.java
===================================================================
---
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBHandler.java 2007-06-28
15:02:00 UTC (rev 3755)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBHandler.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -1,40 +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 JAXBHandler
-{
- /** Get a JAXBContext instance.
- */
- JAXBContext getJAXBContext(Class[] javaTypes) throws JAXBException;
-}
Copied:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBHandler.java
(from rev 3755,
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/jaxb/JAXBHandler.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-29
08:18:16 UTC (rev 3760)
@@ -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-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicEndpoint.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -21,14 +21,17 @@
*/
package org.jboss.wsf.spi.deployment;
-import org.jboss.wsf.spi.binding.BindingCustomization;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+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;
-import javax.management.ObjectName;
-import java.util.*;
-
/**
* A general JAXWS endpoint.
*
@@ -46,10 +49,10 @@
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;
- private List<BindingCustomization> bindingCustomizsations = new
ArrayList<BindingCustomization>();
public BasicEndpoint()
{
@@ -78,15 +81,15 @@
this.targetBean = targetBean;
}
- public Class getTargetBeanClass()
+ public Class getTargetBeanClass()
{
if (targetBean == null)
throw new IllegalStateException("Target bean not set");
-
+
ClassLoader classLoader = service.getDeployment().getClassLoader();
if (classLoader == null)
throw new IllegalStateException("Deployment classloader not set");
-
+
Class beanClass;
try
{
@@ -98,7 +101,7 @@
}
return beanClass;
}
-
+
public ObjectName getName()
{
return name;
@@ -175,33 +178,15 @@
this.invocationHandler = handler;
}
- public List<BindingCustomization> getBindingCustomizations()
+ public JAXBHandler getJAXBHandler()
{
- return Collections.unmodifiableList(bindingCustomizsations);
+ return jaxbHandler;
}
- /* Get a concrete binding customization */
- public BindingCustomization getBindingCustomization(BindingCustomization
customization)
+ public void setJAXBHandler(JAXBHandler jaxbHandler)
{
- BindingCustomization match = null;
-
- Iterator<BindingCustomization> it = bindingCustomizsations.iterator();
- while(it.hasNext())
- {
- BindingCustomization bc = it.next();
- if(bc.getClass().equals(customization.getClass()))
- {
- match = bc;
- }
- }
-
- return match;
- }
-
- public void addBindingCustomization(BindingCustomization customization)
- {
assertEndpointSetterAccess();
- bindingCustomizsations.add(customization);
+ this.jaxbHandler = jaxbHandler;
}
public <T> T addAttachment(Class<T> key, Object value)
@@ -218,7 +203,7 @@
{
return (T)attachments.get(key);
}
-
+
public Set<String> getProperties()
{
return properties.keySet();
@@ -249,9 +234,9 @@
assertEndpointSetterAccess();
metrics.setEndpoint(this);
this.metrics = metrics;
-
+
}
-
+
private void assertEndpointSetterAccess()
{
if (state == EndpointState.STARTED)
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-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -23,15 +23,15 @@
// $Id$
-import org.jboss.wsf.spi.binding.BindingCustomization;
+import java.util.Set;
+
+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;
-import javax.management.ObjectName;
-import java.util.List;
-import java.util.Set;
-
/**
* A general JAXWS endpoint.
*
@@ -107,16 +107,13 @@
/** Set the endpoint bean invoker */
void setInvocationHandler(InvocationHandler invoker);
-
- /** Get all binding customizations for this endpoint */
- List<BindingCustomization> getBindingCustomizations();
-
- /* Get a concrete binding customization */
- BindingCustomization getBindingCustomization(BindingCustomization
bindingCustomization);
-
- /** Add a binding customization to this endpoint*/
- void addBindingCustomization (BindingCustomization bindingCustomization);
-
+
+ /** 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-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/EndpointHandlerDeployer.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -23,14 +23,15 @@
//$Id$
+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;
import org.jboss.wsf.spi.metadata.j2ee.UnifiedBeanMetaData;
import org.jboss.wsf.spi.metadata.j2ee.UnifiedMessageDrivenMetaData;
-import java.util.Map;
-
/**
* A deployer that assigns the handlers to the Endpoint
*
@@ -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();
Copied:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/utils/HashCodeUtil.java
(from rev 3755,
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/utils/HashCodeUtil.java)
===================================================================
---
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/utils/HashCodeUtil.java
(rev 0)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/utils/HashCodeUtil.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -0,0 +1,146 @@
+/*
+ * 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.utils;
+
+import java.lang.reflect.Array;
+
+/**
+ * Collected methods which allow easy implementation of
<code>hashCode</code>.
+ *
+ * Example use case:
+ * <pre>
+ * public int hashCode(){
+ * int result = HashCodeUtil.SEED;
+ * //collect the contributions of various fields
+ * result = HashCodeUtil.hash(result, fPrimitive);
+ * result = HashCodeUtil.hash(result, fObject);
+ * result = HashCodeUtil.hash(result, fArray);
+ * return result;
+ * }
+ * </pre>
+ */
+public final class HashCodeUtil
+{
+
+ /**
+ * An initial value for a <code>hashCode</code>, to which is added
contributions
+ * from fields. Using a non-zero value decreases collisons of
<code>hashCode</code>
+ * values.
+ */
+ public static final int SEED = 23;
+
+ /**
+ * booleans.
+ */
+ public static int hash(int aSeed, boolean aBoolean)
+ {
+ return firstTerm(aSeed) + (aBoolean ? 1 : 0);
+ }
+
+ /**
+ * chars.
+ */
+ public static int hash(int aSeed, char aChar)
+ {
+ return firstTerm(aSeed) + (int)aChar;
+ }
+
+ /**
+ * ints.
+ */
+ public static int hash(int aSeed, int aInt)
+ {
+ /*
+ * Implementation Note
+ * Note that byte and short are handled by this method, through
+ * implicit conversion.
+ */
+ return firstTerm(aSeed) + aInt;
+ }
+
+ /**
+ * longs.
+ */
+ public static int hash(int aSeed, long aLong)
+ {
+ return firstTerm(aSeed) + (int)(aLong ^ (aLong >>> 32));
+ }
+
+ /**
+ * floats.
+ */
+ public static int hash(int aSeed, float aFloat)
+ {
+ return hash(aSeed, Float.floatToIntBits(aFloat));
+ }
+
+ /**
+ * doubles.
+ */
+ public static int hash(int aSeed, double aDouble)
+ {
+ return hash(aSeed, Double.doubleToLongBits(aDouble));
+ }
+
+ /**
+ * <code>aObject</code> is a possibly-null object field, and possibly an
array.
+ *
+ * If <code>aObject</code> is an array, then each element may be a
primitive
+ * or a possibly-null object.
+ */
+ public static int hash(int aSeed, Object aObject)
+ {
+ int result = aSeed;
+ if (aObject == null)
+ {
+ result = hash(result, 0);
+ }
+ else if (!isArray(aObject))
+ {
+ result = hash(result, aObject.hashCode());
+ }
+ else
+ {
+ int length = Array.getLength(aObject);
+ for (int idx = 0; idx < length; ++idx)
+ {
+ Object item = Array.get(aObject, idx);
+ //recursive call!
+ result = hash(result, item);
+ }
+ }
+ return result;
+ }
+
+ /// PRIVATE ///
+ private static final int fODD_PRIME_NUMBER = 37;
+
+ private static int firstTerm(int aSeed)
+ {
+ return fODD_PRIME_NUMBER * aSeed;
+ }
+
+ private static boolean isArray(Object aObject)
+ {
+ return aObject.getClass().isArray();
+ }
+}
Modified: branches/jbossws-2.0/jbossws-2.0.iws
===================================================================
--- branches/jbossws-2.0/jbossws-2.0.iws 2007-06-28 20:22:16 UTC (rev 3759)
+++ branches/jbossws-2.0/jbossws-2.0.iws 2007-06-29 08:18:16 UTC (rev 3760)
@@ -162,7 +162,7 @@
</provider>
</entry>
</file>
- <file leaf-file-name="CustomizableJAXBContextFactory.java"
pinned="false" current="false" current-in-tab="false">
+ <file leaf-file-name="CustomizableJAXBContextFactory.java"
pinned="false" current="true" current-in-tab="true">
<entry
file="file://$PROJECT_DIR$/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.java">
<provider selected="true"
editor-type-id="text-editor">
<state line="46" column="43"
selection-start="1842" selection-end="1872"
vertical-scroll-proportion="0.45023698">
@@ -171,17 +171,6 @@
</provider>
</entry>
</file>
- <file leaf-file-name="BasicEndpoint.java" pinned="false"
current="true" current-in-tab="true">
- <entry
file="file://$PROJECT_DIR$/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicEndpoint.java">
- <provider selected="true"
editor-type-id="text-editor">
- <state line="202" column="35"
selection-start="5267" selection-end="5267"
vertical-scroll-proportion="4.312796">
- <folding>
- <element signature="imports" expanded="true"
/>
- </folding>
- </state>
- </provider>
- </entry>
- </file>
</leaf>
</component>
<component name="FindManager">
@@ -1042,6 +1031,15 @@
</state>
</provider>
</entry>
+ <entry
file="file://$PROJECT_DIR$/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicEndpoint.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="50" column="36"
selection-start="1972" selection-end="1972"
vertical-scroll-proportion="0.6350711">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
+ </state>
+ </provider>
+ </entry>
<entry
file="file://$PROJECT_DIR$/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java">
<provider selected="true" editor-type-id="text-editor">
<state line="40" column="17"
selection-start="1544" selection-end="1544"
vertical-scroll-proportion="-0.3127962">
@@ -1074,15 +1072,6 @@
</state>
</provider>
</entry>
- <entry
file="file://$PROJECT_DIR$/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicEndpoint.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="202" column="35"
selection-start="5267" selection-end="5267"
vertical-scroll-proportion="4.312796">
- <folding>
- <element signature="imports" expanded="true" />
- </folding>
- </state>
- </provider>
- </entry>
</component>
</project>
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java 2007-06-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -42,7 +42,6 @@
import javax.xml.ws.WebServiceException;
import org.w3c.dom.Element;
-import org.jboss.ws.core.jaxws.JAXBContextFactory;
/**
@@ -67,12 +66,12 @@
@XmlRootElement(name="EndpointReference",namespace=W3CEndpointReference.NS)
@XmlType(name="EndpointReferenceType",namespace=W3CEndpointReference.NS)
public final class W3CEndpointReference extends EndpointReference {
-
+
private final static JAXBContext w3cjc = getW3CJaxbContext();
protected W3CEndpointReference() {
}
-
+
/**
* construct an EPR from infoset representation
*
@@ -80,10 +79,10 @@
* instance consistent with the W3C WS-Addressing Core
* recommendation.
*
- * @throws WebServiceException
+ * @throws WebServiceException
* If the source does NOT contain a valid W3C WS-Addressing
* EndpointReference.
- * @throws NullPointerException
+ * @throws NullPointerException
* If the <code>null</code> <code>source</code> value is
given
*/
public W3CEndpointReference(Source source) {
@@ -98,7 +97,7 @@
throw new WebServiceException("Source did not contain
W3CEndpointReference", e);
}
}
-
+
/**
* {@inheritDoc}
*/
@@ -111,11 +110,15 @@
throw new WebServiceException("Error marshalling W3CEndpointReference.
", e);
}
}
-
+
private static JAXBContext getW3CJaxbContext() {
- return JAXBContextFactory.newInstance().createContext(new Class[] {
W3CEndpointReference.class});
+ try {
+ return JAXBContext.newInstance(W3CEndpointReference.class);
+ } catch (JAXBException e) {
+ throw new WebServiceException("Error creating JAXBContext for
W3CEndpointReference. ", e);
+ }
}
-
+
// private but necessary properties for databinding
@XmlElement(name="Address",namespace=NS)
private Address address;
@@ -127,8 +130,8 @@
Map<QName,String> attributes;
@XmlAnyElement
List<Element> elements;
-
-
+
+
private static class Address {
protected Address() {}
@XmlValue
@@ -136,8 +139,8 @@
@XmlAnyAttribute
Map<QName,String> attributes;
}
-
-
+
+
private static class Elements {
protected Elements() {}
@XmlAnyElement
@@ -145,6 +148,6 @@
@XmlAnyAttribute
Map<QName,String> attributes;
}
-
+
protected static final String NS = "http://www.w3.org/2005/08/addressing";
}
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/TypeMappingImpl.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/TypeMappingImpl.java 2007-06-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/binding/TypeMappingImpl.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -53,7 +53,7 @@
import org.jboss.ws.core.jaxrpc.binding.QNameSerializerFactory;
import org.jboss.ws.core.jaxrpc.binding.SimpleDeserializerFactory;
import org.jboss.ws.core.jaxrpc.binding.SimpleSerializerFactory;
-import org.jboss.ws.core.utils.HashCodeUtil;
+import org.jboss.wsf.spi.utils.HashCodeUtil;
import org.jboss.wsf.spi.utils.JavaUtils;
/**
Deleted:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.java 2007-06-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -1,90 +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.ws.core.jaxws;
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.wsf.spi.binding.BindingCustomization;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import java.util.Iterator;
-
-/**
- * The default factory checks if a {@link JAXBBindingCustomization} exists
- * and uses it to customize the JAXBContext that will be created.
- *
- * @see org.jboss.wsf.spi.deployment.Endpoint
- * @see org.jboss.wsf.spi.binding.BindingCustomization
- * @see JAXBBindingCustomization
- *
- * @see JAXBContext#newInstance(Class...)
- * @see JAXBContext#newInstance(String, ClassLoader,
java.util.Map<java.lang.String,?>)
- *
- * @author Heiko.Braun(a)jboss.com
- * Created: Jun 26, 2007
- */
-public class CustomizableJAXBContextFactory extends JAXBContextFactory
-{
- public JAXBContext createContext(Class[] clazzes) throws WSException
- {
- try
- {
- BindingCustomization customization = getCustomization();
- if(null == customization)
- return JAXBContext.newInstance(clazzes);
- else
- return JAXBContext.newInstance(clazzes, customization);
- }
- catch (JAXBException e) {
- throw new WSException("Failed to create JAXBContext", e);
- }
- }
-
- public JAXBContext createContext(Class clazz) throws WSException
- {
- return createContext(new Class[] {clazz});
- }
-
- private BindingCustomization getCustomization()
- {
- BindingCustomization customization = null;
-
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- if(msgContext!=null) // may not be available anytime
- {
- Iterator<BindingCustomization> it =
msgContext.getEndpointMetaData().getBindingCustomizations().iterator();
- while(it.hasNext())
- {
- BindingCustomization current = it.next();
- if(current instanceof JAXBBindingCustomization)
- {
- customization = current;
- break;
- }
- }
- }
-
- return customization;
- }
-}
Deleted:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBBindingCustomization.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBBindingCustomization.java 2007-06-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBBindingCustomization.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -1,47 +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.ws.core.jaxws;
-
-import org.jboss.wsf.spi.binding.BindingCustomization;
-import com.sun.xml.bind.api.JAXBRIContext;
-
-/**
- * Supported JAXB 2.1 customizations.
- *
- * @see org.jboss.wsf.spi.deployment.Endpoint
- *
- * @author Heiko.Braun(a)jboss.com
- * Created: Jun 28, 2007
- */
-public class JAXBBindingCustomization extends BindingCustomization {
-
- // Use an alternative RuntimeAnnotationReader implementation
- public final static String ANNOTATION_READER = JAXBRIContext.ANNOTATION_READER;
-
- // Reassign the default namespace URI to something else at the runtime
- public final static String DEFAULT_NAMESPACE_REMAP =
JAXBRIContext.DEFAULT_NAMESPACE_REMAP;
-
- // Enable the c14n marshalling support in the JAXBContext.
- public final static String CANONICALIZATION_SUPPORT =
JAXBRIContext.CANONICALIZATION_SUPPORT;
-
-
-}
Deleted:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextCache.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextCache.java 2007-06-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextCache.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -1,89 +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.ws.core.jaxws;
-
-// $Id$
-
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.core.utils.HashCodeUtil;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-
-import javax.xml.bind.JAXBContext;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Cache JAXBContext's.
- *
- * @author Heiko.Braun(a)jboss.org
- * @since 26.01.2007
- */
-public class JAXBContextCache
-{
- private Map<Integer, JAXBContext> cache = new ConcurrentHashMap<Integer,
JAXBContext>();
-
- public JAXBContext get(Class[] clazzes)
- {
- Integer id = buildId(clazzes);
- return get(id);
- }
-
- public void add(Class[] clazzes, JAXBContext context)
- {
- Integer id = buildId(clazzes);
- add(id, context);
- }
-
- private JAXBContext get(Integer id)
- {
- return cache.get(id);
- }
-
- private void add(Integer id, JAXBContext context)
- {
- cache.put(id, context);
- }
-
- private static Integer buildId(Class[] classes)
- {
- int sum = HashCodeUtil.SEED;
- for (Class cls : classes)
- {
- sum = HashCodeUtil.hash(sum, cls.getName());
- }
- return sum;
- }
-
- /**
- * Access the JAXBContext cache through the message context.
- * The actual instance is assiciated with the EndpointMetaData.
- * @return JAXBContextCache
- */
- public static JAXBContextCache getContextCache()
- {
- CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
- EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
- return epMetaData.getJaxbCache();
- }
-}
-
Deleted:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextCustomisation.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextCustomisation.java 2007-06-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextCustomisation.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -1,31 +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.ws.core.jaxws;
-
-import java.util.HashMap;
-
-/**
- * @author Heiko.Braun(a)jboss.com
- * Created: Jun 27, 2007
- */
-public class JAXBContextCustomisation extends HashMap {
-}
Deleted:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java 2007-06-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -1,56 +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.ws.core.jaxws;
-
-import org.jboss.ws.WSException;
-import org.jboss.wsf.spi.utils.ServiceLoader;
-
-import javax.xml.bind.JAXBContext;
-
-/**
- * Creates JAXBContext's.<p>
- *
- * @author Heiko.Braun(a)jboss.com
- * Created: Jun 26, 2007
- */
-public abstract class JAXBContextFactory {
-
- public final static String DEFAULT_JAXB_CONTEXT_FACTORY =
"org.jboss.ws.core.jaxws.CustomizableJAXBContextFactory";
-
- public abstract JAXBContext createContext(Class[] clazzes) throws WSException;
-
- public abstract JAXBContext createContext(Class clazz) throws WSException;
-
- /**
- * Retrieve JAXBContextFactory instance through the {@link ServiceLoader}.
- * Defaults to {@link CustomizableJAXBContextFactory}
- * @return JAXBContextFactory
- */
- public static JAXBContextFactory newInstance()
- {
- return (JAXBContextFactory)ServiceLoader.loadService(
- JAXBContextFactory.class.getName(),
- DEFAULT_JAXB_CONTEXT_FACTORY
- );
- }
-}
-
\ No newline at end of file
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-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -23,20 +23,22 @@
// $Id$
-import org.jboss.ws.extensions.xop.jaxws.AttachmentUnmarshallerImpl;
-import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.TypeMappingImpl;
-import org.jboss.ws.core.binding.ComplexTypeDeserializer;
-import org.jboss.ws.core.binding.SerializationContext;
-import org.jboss.logging.Logger;
-
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.namespace.QName;
import javax.xml.transform.Source;
import javax.xml.ws.WebServiceException;
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.ComplexTypeDeserializer;
+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.JAXBHandler;
+
/**
* A Deserializer that can handle complex types by delegating to JAXB.
*
@@ -64,11 +66,11 @@
TypeMappingImpl typeMapping = serContext.getTypeMapping();
Class javaType = typeMapping.getJavaType(xmlType);
- JAXBContext jaxbContext = getJAXBContext(javaTypes);
-
+ JAXBContext jaxbContext =
((SerializationContextJAXWS)serContext).getJAXBContext(javaTypes);
+
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
unmarshaller.setAttachmentUnmarshaller( new AttachmentUnmarshallerImpl());
-
+
JAXBElement jbe = unmarshaller.unmarshal(xmlFragment, javaType);
value = jbe.getValue();
@@ -82,22 +84,6 @@
}
- /**
- * Retrieve JAXBContext from cache or create new one and cache it.
- * @param types
- * @return JAXBContext
- */
- private JAXBContext getJAXBContext(Class[] types){
- JAXBContextCache cache = JAXBContextCache.getContextCache();
- JAXBContext context = cache.get(types);
- if(null==context)
- {
- context = JAXBContextFactory.newInstance().createContext(types);
- cache.add(types, context);
- }
- return context;
- }
-
// 4.21 Conformance (Marshalling failure): If an error occurs when using the supplied
JAXBContext to marshall
// a request or unmarshall a response, an implementation MUST throw a
WebServiceException whose
// cause is set to the original JAXBException.
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-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -23,14 +23,6 @@
// $Id$
-import org.jboss.logging.Logger;
-import org.jboss.ws.extensions.xop.jaxws.AttachmentMarshallerImpl;
-import org.jboss.ws.core.binding.BindingException;
-import org.jboss.ws.core.binding.ComplexTypeSerializer;
-import org.jboss.ws.core.binding.SerializationContext;
-import org.jboss.ws.core.binding.BufferedStreamResult;
-import org.w3c.dom.NamedNodeMap;
-
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Marshaller;
@@ -39,6 +31,15 @@
import javax.xml.transform.Result;
import javax.xml.ws.WebServiceException;
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.binding.BindingException;
+import org.jboss.ws.core.binding.BufferedStreamResult;
+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.JAXBHandler;
+import org.w3c.dom.NamedNodeMap;
+
/**
* A Serializer that can handle complex types by delegating to JAXB.
*
@@ -66,9 +67,10 @@
// This should be more efficient and accurate than searching the type mapping
Class expectedType = serContext.getJavaType();
Class actualType = value.getClass();
- Class[] types = shouldFilter(actualType) ? new Class[]{expectedType} : new
Class[]{expectedType, actualType};
- JAXBContext jaxbContext = getJAXBContext(types);
+ Class[] javaTypes = shouldFilter(actualType) ? new Class[]{expectedType} : new
Class[]{expectedType, actualType};
+ JAXBContext jaxbContext =
((SerializationContextJAXWS)serContext).getJAXBContext(javaTypes);
+
Marshaller marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
@@ -89,22 +91,6 @@
return result;
}
- /**
- * Retrieve JAXBContext from cache or create new one and cache it.
- * @param types
- * @return JAXBContext
- */
- private JAXBContext getJAXBContext(Class[] types){
- JAXBContextCache cache = JAXBContextCache.getContextCache();
- JAXBContext context = cache.get(types);
- if(null==context)
- {
- context = JAXBContextFactory.newInstance().createContext(types);
- cache.add(types, context);
- }
- return context;
- }
-
// Remove this when we add a XMLGregorianCalendar Serializer
private boolean shouldFilter(Class<?> actualType)
{
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-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/SerializationContextJAXWS.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -39,5 +39,16 @@
*/
public class SerializationContextJAXWS extends SerializationContext
{
- public static final String JAXB_CONTEXT_TYPES =
"org.jboss.ws.jaxb.context.types";
+ public static final String JAXB_CONTEXT_TYPES =
"org.jboss.ws.jaxb.context.types";
+
+ /**
+ * Access the JAXBContext through the message context.
+ * The actual instance is assiciated with the EndpointMetaData.
+ */
+ public static JAXBContext getJAXBContext(Class[] javaTypes) throws JAXBException
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
+ return epMetaData.getJAXBContext(javaTypes);
+ }
}
Deleted:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/utils/HashCodeUtil.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/utils/HashCodeUtil.java 2007-06-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/utils/HashCodeUtil.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -1,146 +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.ws.core.utils;
-
-import java.lang.reflect.Array;
-
-/**
- * Collected methods which allow easy implementation of
<code>hashCode</code>.
- *
- * Example use case:
- * <pre>
- * public int hashCode(){
- * int result = HashCodeUtil.SEED;
- * //collect the contributions of various fields
- * result = HashCodeUtil.hash(result, fPrimitive);
- * result = HashCodeUtil.hash(result, fObject);
- * result = HashCodeUtil.hash(result, fArray);
- * return result;
- * }
- * </pre>
- */
-public final class HashCodeUtil
-{
-
- /**
- * An initial value for a <code>hashCode</code>, to which is added
contributions
- * from fields. Using a non-zero value decreases collisons of
<code>hashCode</code>
- * values.
- */
- public static final int SEED = 23;
-
- /**
- * booleans.
- */
- public static int hash(int aSeed, boolean aBoolean)
- {
- return org.jboss.ws.core.utils.HashCodeUtil.firstTerm(aSeed) + (aBoolean ? 1 : 0);
- }
-
- /**
- * chars.
- */
- public static int hash(int aSeed, char aChar)
- {
- return org.jboss.ws.core.utils.HashCodeUtil.firstTerm(aSeed) + (int)aChar;
- }
-
- /**
- * ints.
- */
- public static int hash(int aSeed, int aInt)
- {
- /*
- * Implementation Note
- * Note that byte and short are handled by this method, through
- * implicit conversion.
- */
- return org.jboss.ws.core.utils.HashCodeUtil.firstTerm(aSeed) + aInt;
- }
-
- /**
- * longs.
- */
- public static int hash(int aSeed, long aLong)
- {
- return org.jboss.ws.core.utils.HashCodeUtil.firstTerm(aSeed) + (int)(aLong ^ (aLong
>>> 32));
- }
-
- /**
- * floats.
- */
- public static int hash(int aSeed, float aFloat)
- {
- return org.jboss.ws.core.utils.HashCodeUtil.hash(aSeed,
Float.floatToIntBits(aFloat));
- }
-
- /**
- * doubles.
- */
- public static int hash(int aSeed, double aDouble)
- {
- return org.jboss.ws.core.utils.HashCodeUtil.hash(aSeed,
Double.doubleToLongBits(aDouble));
- }
-
- /**
- * <code>aObject</code> is a possibly-null object field, and possibly an
array.
- *
- * If <code>aObject</code> is an array, then each element may be a
primitive
- * or a possibly-null object.
- */
- public static int hash(int aSeed, Object aObject)
- {
- int result = aSeed;
- if (aObject == null)
- {
- result = org.jboss.ws.core.utils.HashCodeUtil.hash(result, 0);
- }
- else if (!org.jboss.ws.core.utils.HashCodeUtil.isArray(aObject))
- {
- result = org.jboss.ws.core.utils.HashCodeUtil.hash(result, aObject.hashCode());
- }
- else
- {
- int length = Array.getLength(aObject);
- for (int idx = 0; idx < length; ++idx)
- {
- Object item = Array.get(aObject, idx);
- //recursive call!
- result = org.jboss.ws.core.utils.HashCodeUtil.hash(result, item);
- }
- }
- return result;
- }
-
- /// PRIVATE ///
- private static final int fODD_PRIME_NUMBER = 37;
-
- private static int firstTerm(int aSeed)
- {
- return org.jboss.ws.core.utils.HashCodeUtil.fODD_PRIME_NUMBER * aSeed;
- }
-
- private static boolean isArray(Object aObject)
- {
- return aObject.getClass().isArray();
- }
-}
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/acessor/JAXBAccessor.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/acessor/JAXBAccessor.java 2007-06-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/acessor/JAXBAccessor.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -25,7 +25,6 @@
import javax.xml.namespace.QName;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxws.JAXBContextFactory;
import org.jboss.ws.metadata.umdm.Accessor;
import org.jboss.ws.metadata.umdm.AccessorFactory;
import org.jboss.ws.metadata.umdm.AccessorFactoryCreator;
@@ -61,8 +60,18 @@
}
private AccessorFactory create(final Class clazz)
- {
- final JAXBRIContext ctx = (JAXBRIContext)
JAXBContextFactory.newInstance().createContext(clazz);
+ {
+ final JAXBRIContext ctx;
+ try
+ {
+ ctx = (JAXBRIContext)JAXBRIContext.newInstance(new Class[] { clazz });
+ }
+ catch (JAXBException e)
+ {
+ WSException ex = new WSException(e.getMessage());
+ ex.setStackTrace(e.getStackTrace());
+ throw ex;
+ }
return new AccessorFactory()
{
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-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -23,11 +23,15 @@
// $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.JAXBContextCache;
+import org.jboss.wsf.spi.binding.jaxb.JAXBHandler;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
-import javax.xml.namespace.QName;
-
/**
* Client side endpoint meta data.
*
@@ -36,6 +40,7 @@
*/
public class ClientEndpointMetaData extends EndpointMetaData
{
+ private JAXBHandler jaxbHandler = new JAXBContextCache();
public ClientEndpointMetaData(ServiceMetaData service, QName qname, QName
portTypeName, Type 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-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -23,6 +23,25 @@
// $Id$
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Observable;
+import java.util.Properties;
+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;
+
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
@@ -33,27 +52,21 @@
import org.jboss.ws.core.jaxrpc.binding.JBossXBSerializerFactory;
import org.jboss.ws.core.jaxrpc.binding.SOAPArrayDeserializerFactory;
import org.jboss.ws.core.jaxrpc.binding.SOAPArraySerializerFactory;
-import org.jboss.ws.core.jaxws.JAXBContextCache;
-import org.jboss.ws.core.jaxws.JAXBContextFactory;
import org.jboss.ws.core.jaxws.JAXBDeserializerFactory;
import org.jboss.ws.core.jaxws.JAXBSerializerFactory;
import org.jboss.ws.core.jaxws.client.DispatchBinding;
import org.jboss.ws.core.soap.Style;
import org.jboss.ws.core.soap.Use;
import org.jboss.ws.integration.UnifiedVirtualFile;
-import org.jboss.ws.metadata.config.*;
+import org.jboss.ws.metadata.config.CommonConfig;
+import org.jboss.ws.metadata.config.Configurable;
+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.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
import org.jboss.wsf.spi.utils.JavaUtils;
-import org.jboss.wsf.spi.binding.BindingCustomization;
-import javax.jws.soap.SOAPBinding.ParameterStyle;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.ParameterMode;
-import javax.xml.ws.Service.Mode;
-import java.lang.reflect.Method;
-import java.util.*;
-
/**
* A Service component describes a set of endpoints.
*
@@ -131,10 +144,6 @@
private List<UnifiedPortComponentRefMetaData> serviceRefContrib = new
ArrayList<UnifiedPortComponentRefMetaData>();
- private JAXBContextCache jaxbCache = new JAXBContextCache();
-
- private List<BindingCustomization> bindingCustomization = new
ArrayList<BindingCustomization>();
-
public EndpointMetaData(ServiceMetaData service, QName portName, QName portTypeName,
Type type)
{
this.serviceMetaData = service;
@@ -315,9 +324,7 @@
return type;
}
- public List<BindingCustomization> getBindingCustomizations() {
- return bindingCustomization;
- }
+ public abstract JAXBContext getJAXBContext(Class[] javaTypes) throws JAXBException;
public String getAuthMethod()
{
@@ -639,11 +646,6 @@
configObservable.addObserver(observer);
}
- public JAXBContextCache getJaxbCache()
- {
- return jaxbCache;
- }
-
public String getConfigFile()
{
return this.configFile;
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-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -23,16 +23,17 @@
// $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.JAXBHandler;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
-import org.jboss.wsf.spi.binding.BindingCustomization;
-import javax.management.ObjectName;
-import javax.xml.namespace.QName;
-import java.util.List;
-
/**
* Client side endpoint meta data.
*
@@ -43,14 +44,14 @@
public class ServerEndpointMetaData extends EndpointMetaData
{
protected static final Logger log = Logger.getLogger(ServerEndpointMetaData.class);
-
+
public static final String SEPID_DOMAIN = "jboss.ws";
public static final String SEPID_PROPERTY_CONTEXT = "context";
public static final String SEPID_PROPERTY_ENDPOINT = "endpoint";
-
+
// The associated SPI endpoint
private Endpoint endpoint;
-
+
// The REQUIRED link name
private String linkName;
// Legacy JSR-109 port component name
@@ -186,14 +187,11 @@
{
this.secureWSDLAccess = secureWSDLAccess;
}
-
- /**
- * Will be set through a deployment aspect
- * @return List<BindingCustomization> of available customizations
- */
- public List<BindingCustomization> getBindingCustomizations()
+
+ @Override
+ public JAXBContext getJAXBContext(Class[] javaTypes) throws JAXBException
{
- return endpoint.getBindingCustomizations();
+ 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-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -23,11 +23,14 @@
// $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;
-import javax.xml.namespace.QName;
-
/**
* Tools Endpoint Metadata
* @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
@@ -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
Deleted:
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/binding/BindingCustomizationTestCase.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/binding/BindingCustomizationTestCase.java 2007-06-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/binding/BindingCustomizationTestCase.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -1,96 +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.test.ws.jaxws.binding;
-
-import junit.framework.TestCase;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.BasicEndpoint;
-import org.jboss.ws.core.jaxws.JAXBBindingCustomization;
-
-import static org.jboss.wsf.spi.deployment.Endpoint.EndpointState;
-import org.jboss.wsf.spi.binding.BindingCustomization;
-
-import java.util.List;
-import java.util.Iterator;
-
-/**
- * @author Heiko.Braun(a)jboss.com
- * Created: Jun 28, 2007
- */
-public class BindingCustomizationTestCase extends TestCase {
-
- public void testCustomizationWriteAccess() throws Exception
- {
- Endpoint endpoint = new BasicEndpoint();
- JAXBBindingCustomization jaxbCustomization = new JAXBBindingCustomization();
- jaxbCustomization.put(JAXBBindingCustomization.DEFAULT_NAMESPACE_REMAP,
"http://org.jboss.bindingCustomization");
- endpoint.addBindingCustomization(jaxbCustomization);
-
- // a started endpoint should deny customizations
- try
- {
- endpoint.setState(EndpointState.STARTED);
- endpoint.addBindingCustomization(jaxbCustomization);
-
- fail("It should not be possible to change bindinig customizations on a
started endpoint");
- }
- catch (Exception e)
- {
- // all fine, this should happen
- }
- }
-
- public void testCustomizationReadAccess() throws Exception
- {
- Endpoint endpoint = new BasicEndpoint();
- JAXBBindingCustomization jaxbCustomization = new JAXBBindingCustomization();
- jaxbCustomization.put(JAXBBindingCustomization.DEFAULT_NAMESPACE_REMAP,
"http://org.jboss.bindingCustomization");
- endpoint.addBindingCustomization(jaxbCustomization);
- endpoint.setState(EndpointState.STARTED);
-
- // read a single customization
- List<BindingCustomization> customizations =
endpoint.getBindingCustomizations();
-
- BindingCustomization knownCustomization = null;
- Iterator<BindingCustomization> it = customizations.iterator();
- while(it.hasNext())
- {
- knownCustomization = it.next();
- break;
- }
-
- assertNotNull(knownCustomization);
-
- // however the iteratoion should be unmodifiable
- try
- {
- customizations.add( new JAXBBindingCustomization() );
- fail("Started Endpoints should only axpose read acccess to their binding
customizations");
- }
- catch (Exception e)
- {
- // all fine, we'd expect this
- }
-
-
- }
-}
Modified:
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws871/JBWS871TestCase.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws871/JBWS871TestCase.java 2007-06-28
20:22:16 UTC (rev 3759)
+++
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws871/JBWS871TestCase.java 2007-06-29
08:18:16 UTC (rev 3760)
@@ -39,7 +39,6 @@
import org.jboss.wsf.spi.test.JBossWSTest;
import org.jboss.wsf.spi.test.JBossWSTestSetup;
-import org.jboss.ws.core.jaxws.JAXBContextFactory;
/**
* Arrays with JSR181 endpoints
@@ -74,8 +73,8 @@
public void testNullArray() throws Exception
{
Integer[] intArr = null;
-
- JAXBContext jbc = JAXBContextFactory.newInstance().createContext(Integer[].class);
+
+ JAXBContext jbc = JAXBContext.newInstance(Integer[].class);
Marshaller m = jbc.createMarshaller();
m.setProperty(Marshaller.JAXB_FRAGMENT, true);
StringWriter strw = new StringWriter();
@@ -84,7 +83,7 @@
String xmlFragment = strw.toString();
// <myarr xsi:nil="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
// System.out.println(xmlFragment);
-
+
Unmarshaller um = jbc.createUnmarshaller();
Source source = new StreamSource(new
ByteArrayInputStream(xmlFragment.getBytes()));
JAXBElement jbel = um.unmarshal(source, Integer[].class);
@@ -94,8 +93,8 @@
public void testEmptyArray() throws Exception
{
Integer[] intArr = new Integer[0];
-
- JAXBContext jbc = JAXBContextFactory.newInstance().createContext(Integer[].class);
+
+ JAXBContext jbc = JAXBContext.newInstance(Integer[].class);
Marshaller m = jbc.createMarshaller();
m.setProperty(Marshaller.JAXB_FRAGMENT, true);
StringWriter strw = new StringWriter();
@@ -104,7 +103,7 @@
String xmlFragment = strw.toString();
// <myarr/>
// System.out.println(xmlFragment);
-
+
Unmarshaller um = jbc.createUnmarshaller();
Source source = new StreamSource(new
ByteArrayInputStream(xmlFragment.getBytes()));
JAXBElement jbel = um.unmarshal(source, Integer[].class);
@@ -114,8 +113,8 @@
public void testSingleValueArray() throws Exception
{
Integer[] intArr = new Integer[] { new Integer(1) };
-
- JAXBContext jbc = JAXBContextFactory.newInstance().createContext(Integer[].class);
+
+ JAXBContext jbc = JAXBContext.newInstance(Integer[].class);
Marshaller m = jbc.createMarshaller();
m.setProperty(Marshaller.JAXB_FRAGMENT, true);
StringWriter strw = new StringWriter();
@@ -124,7 +123,7 @@
String xmlFragment = strw.toString();
// <myarr><item>1</item></myarr>
// System.out.println(xmlFragment);
-
+
Unmarshaller um = jbc.createUnmarshaller();
Source source = new StreamSource(new
ByteArrayInputStream(xmlFragment.getBytes()));
JAXBElement jbel = um.unmarshal(source, Integer[].class);
@@ -134,8 +133,8 @@
public void testMultipleValueArray() throws Exception
{
Integer[] intArr = new Integer[] { new Integer(1), new Integer(2), new Integer(3)
};
-
- JAXBContext jbc = JAXBContextFactory.newInstance().createContext(Integer[].class);
+
+ JAXBContext jbc = JAXBContext.newInstance(Integer[].class);
Marshaller m = jbc.createMarshaller();
m.setProperty(Marshaller.JAXB_FRAGMENT, true);
StringWriter strw = new StringWriter();
@@ -144,13 +143,13 @@
String xmlFragment = strw.toString();
//
<myarr><item>1</item><item>2</item><item>3</item></myarr>
// System.out.println(xmlFragment);
-
+
Unmarshaller um = jbc.createUnmarshaller();
Source source = new StreamSource(new
ByteArrayInputStream(xmlFragment.getBytes()));
JAXBElement jbel = um.unmarshal(source, Integer[].class);
assertEquals(intArr, jbel.getValue());
}
-
+
public void testEchoNullArray() throws Exception
{
Integer[] outArr = endpoint.intArr("null", null);