[jbossws-commits] JBossWS SVN: r3756 - in branches/jbossws-2.0: build and 14 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Thu Jun 28 11:06:17 EDT 2007


Author: heiko.braun at jboss.com
Date: 2007-06-28 11:06:17 -0400 (Thu, 28 Jun 2007)
New Revision: 3756

Added:
   branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/BindingCustomization.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
Removed:
   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/utils/HashCodeUtil.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/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:
Introduce BindingCustomization API (See http://www.jboss.org/index.html?module=bb&op=viewtopic&t=111114)

Modified: branches/jbossws-2.0/build/ant.properties.example
===================================================================
--- branches/jbossws-2.0/build/ant.properties.example	2007-06-28 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/build/ant.properties.example	2007-06-28 15:06:17 UTC (rev 3756)
@@ -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.0.GA
+#jboss42.home=/home/tdiesler/svn/jbossas/branches/Branch_4_2/build/output/jboss-4.2.1.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.0.GA
+hudson.jboss42.build=jboss-4.2.1.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 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans-no-ejb3.xml	2007-06-28 15:06:17 UTC (rev 3756)
@@ -125,8 +125,7 @@
   <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="jaxbHandler">org.jboss.wsf.spi.binding.jaxb.JAXBContextCache</property>
+    <property name="lifecycleHandler">org.jboss.wsf.stack.jbws.LifecycleHandlerImpl</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 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native40.sar/jbossws.beans/META-INF/jboss-beans.xml	2007-06-28 15:06:17 UTC (rev 3756)
@@ -125,8 +125,7 @@
   <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="jaxbHandler">org.jboss.wsf.spi.binding.jaxb.JAXBContextCache</property>
+    <property name="lifecycleHandler">org.jboss.wsf.stack.jbws.LifecycleHandlerImpl</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 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native42.sar/jbossws.beans/META-INF/jboss-beans.xml	2007-06-28 15:06:17 UTC (rev 3756)
@@ -129,8 +129,7 @@
   <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="jaxbHandler">org.jboss.wsf.spi.binding.jaxb.JAXBContextCache</property>
+    <property name="lifecycleHandler">org.jboss.wsf.stack.jbws.LifecycleHandlerImpl</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 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/integration/native/src/main/resources/jbossws-native50.sar/META-INF/jbossws-beans.xml	2007-06-28 15:06:17 UTC (rev 3756)
@@ -52,7 +52,7 @@
     2) WebServiceDeployerJSE < WarDeployer 
     3) WebServiceMainDeployer
     
-    Each WebServiceDeployer has a number of DeployerHooks registerd with it 
+    Each WebServiceDeployer has a number of DeployerHooks registered with it
     
     - WebServiceDeployerEJB
       - WSDeployerHook_JAXRPC_EJB21
@@ -140,8 +140,7 @@
   <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="jaxbHandler">org.jboss.wsf.spi.binding.jaxb.JAXBContextCache</property>
+    <property name="lifecycleHandler">org.jboss.wsf.stack.jbws.LifecycleHandlerImpl</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/BindingCustomization.java
===================================================================
--- branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/BindingCustomization.java	                        (rev 0)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/BindingCustomization.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -0,0 +1,39 @@
+/*
+ * 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 at jboss.com
+ *         Created: Jun 28, 2007
+ */
+public abstract class BindingCustomization extends HashMap {
+      
+}


Property changes on: branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/binding/BindingCustomization.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

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 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/BasicEndpoint.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -21,17 +21,14 @@
  */
 package org.jboss.wsf.spi.deployment;
 
-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.binding.BindingCustomization;
 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.
  * 
@@ -49,10 +46,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()
    {
@@ -81,15 +78,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
       {
@@ -101,7 +98,7 @@
       }
       return beanClass;
    }
-   
+
    public ObjectName getName()
    {
       return name;
@@ -178,15 +175,33 @@
       this.invocationHandler = handler;
    }
 
-   public JAXBHandler getJAXBHandler()
+   public List<BindingCustomization> getBindingCustomizations()
    {
-      return jaxbHandler;
+      return Collections.unmodifiableList(bindingCustomizsations);
    }
 
-   public void setJAXBHandler(JAXBHandler jaxbHandler)
+   /* Get a concrete binding customization */
+   public BindingCustomization getBindingCustomization(BindingCustomization customization)
    {
+      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();
-      this.jaxbHandler = jaxbHandler;
+      bindingCustomizsations.add(customization);
    }
 
    public <T> T addAttachment(Class<T> key, Object value)
@@ -203,7 +218,7 @@
    {
       return (T)attachments.get(key);
    }
-   
+
    public Set<String> getProperties()
    {
       return properties.keySet();
@@ -234,9 +249,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 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -23,15 +23,15 @@
 
 // $Id$
 
-import java.util.Set;
-
-import javax.management.ObjectName;
-
-import org.jboss.wsf.spi.binding.jaxb.JAXBHandler;
+import org.jboss.wsf.spi.binding.BindingCustomization;
 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,13 +107,16 @@
 
    /** 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 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 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 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/EndpointHandlerDeployer.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -23,15 +23,14 @@
 
 //$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 
  *
@@ -42,7 +41,6 @@
 {
    private String requestHandler;
    private String lifecycleHandler;
-   private String jaxbHandler;
    private Map<String,String> invocationHandler;
 
    public void setLifecycleHandler(String handler)
@@ -60,11 +58,6 @@
       this.invocationHandler = handlers;
    }
 
-   public void setJaxbHandler(String jaxbHandler)
-   {
-      this.jaxbHandler = jaxbHandler;
-   }
-
    @Override
    public void create(Deployment dep)
    {
@@ -73,7 +66,6 @@
          ep.setRequestHandler(getRequestHandler(dep));
          ep.setLifecycleHandler(getLifecycleHandler(dep));
          ep.setInvocationHandler(getInvocationHandler(ep));
-         ep.setJAXBHandler(getJAXBHandler(dep));
       }
    }
 
@@ -103,19 +95,6 @@
       }
    }
 
-   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();

Deleted: 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	2007-06-28 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/utils/HashCodeUtil.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -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.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 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/jbossws-2.0.iws	2007-06-28 15:06:17 UTC (rev 3756)
@@ -162,7 +162,7 @@
           </provider>
         </entry>
       </file>
-      <file leaf-file-name="CustomizableJAXBContextFactory.java" pinned="false" current="true" current-in-tab="true">
+      <file leaf-file-name="CustomizableJAXBContextFactory.java" pinned="false" current="false" current-in-tab="false">
         <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,6 +171,17 @@
           </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">
@@ -1031,15 +1042,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="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">
@@ -1072,6 +1074,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="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 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -42,6 +42,7 @@
 import javax.xml.ws.WebServiceException;
 
 import org.w3c.dom.Element;
+import org.jboss.ws.core.jaxws.JAXBContextFactory;
 
 
 /**
@@ -66,12 +67,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
      *
@@ -79,10 +80,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) {
@@ -97,7 +98,7 @@
             throw new WebServiceException("Source did not contain W3CEndpointReference", e);
         }
     }
-    
+
     /**
      * {@inheritDoc}
      */
@@ -110,15 +111,11 @@
             throw new WebServiceException("Error marshalling W3CEndpointReference. ", e);
         }
     }
-    
+
     private static JAXBContext getW3CJaxbContext() {
-        try {
-            return JAXBContext.newInstance(W3CEndpointReference.class);
-        } catch (JAXBException e) {
-            throw new WebServiceException("Error creating JAXBContext for W3CEndpointReference. ", e);
-        }
+       return JAXBContextFactory.newInstance().createContext(new Class[] { W3CEndpointReference.class});        
     }
-    
+
     // private but necessary properties for databinding
     @XmlElement(name="Address",namespace=NS)
     private Address address;
@@ -130,8 +127,8 @@
     Map<QName,String> attributes;
     @XmlAnyElement
     List<Element> elements;
-    
-    
+
+
     private static class Address {
         protected Address() {}
         @XmlValue
@@ -139,8 +136,8 @@
         @XmlAnyAttribute
         Map<QName,String> attributes;
     }
-    
-    
+
+
     private static class Elements {
         protected Elements() {}
         @XmlAnyElement
@@ -148,6 +145,6 @@
         @XmlAnyAttribute
         Map<QName,String> attributes;
     }
-    
+
     protected static final String NS = "http://www.w3.org/2005/08/addressing";
 }

Added: 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	                        (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -0,0 +1,90 @@
+/*
+ * 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 at 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;
+   }
+}


Property changes on: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: 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	                        (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBBindingCustomization.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -0,0 +1,47 @@
+/*
+ * 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 at 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;
+
+
+}


Property changes on: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBBindingCustomization.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: 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	                        (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextCache.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -0,0 +1,89 @@
+/*
+ * 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 at 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();
+    }
+}
+


Property changes on: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextCache.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: 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	                        (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextCustomisation.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -0,0 +1,31 @@
+/*
+ * 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 at jboss.com
+ *         Created: Jun 27, 2007
+ */
+public class JAXBContextCustomisation extends HashMap {
+}


Property changes on: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextCustomisation.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: 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	                        (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -0,0 +1,56 @@
+/*
+ * 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 at 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


Property changes on: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

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 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -23,22 +23,20 @@
 
 // $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.
  *
@@ -66,11 +64,11 @@
          TypeMappingImpl typeMapping = serContext.getTypeMapping();
          Class javaType = typeMapping.getJavaType(xmlType);
 
-         JAXBContext jaxbContext = ((SerializationContextJAXWS)serContext).getJAXBContext(javaTypes);
-         
+         JAXBContext jaxbContext = getJAXBContext(javaTypes);
+
          Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
          unmarshaller.setAttachmentUnmarshaller( new AttachmentUnmarshallerImpl());
-         
+
          JAXBElement jbe = unmarshaller.unmarshal(xmlFragment, javaType);
          value = jbe.getValue();
 
@@ -84,6 +82,22 @@
 
    }
 
+   /**
+    * 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 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -23,6 +23,14 @@
 
 // $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;
@@ -31,15 +39,6 @@
 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.
  *
@@ -67,10 +66,9 @@
          // 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);
@@ -91,6 +89,22 @@
       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 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/SerializationContextJAXWS.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -39,16 +39,5 @@
  */
 public class SerializationContextJAXWS extends SerializationContext
 {
-   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);
-   }
+   public static final String JAXB_CONTEXT_TYPES = "org.jboss.ws.jaxb.context.types";   
 }

Added: 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	                        (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/utils/HashCodeUtil.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -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.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();
+   }
+}


Property changes on: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/utils/HashCodeUtil.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

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 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/acessor/JAXBAccessor.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -25,6 +25,7 @@
 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;
@@ -60,18 +61,8 @@
       }
 
       private AccessorFactory create(final Class 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;
-         }
+      {         
+         final JAXBRIContext ctx = (JAXBRIContext) JAXBContextFactory.newInstance().createContext(clazz);
 
          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 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -23,15 +23,11 @@
 
 // $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.
  *
@@ -40,7 +36,6 @@
  */
 public class ClientEndpointMetaData extends EndpointMetaData
 {
-   private JAXBHandler jaxbHandler = new JAXBContextCache();
    
    public ClientEndpointMetaData(ServiceMetaData service, QName qname, QName portTypeName, Type type)
    {
@@ -53,12 +48,6 @@
          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 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -23,25 +23,6 @@
 
 // $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;
@@ -52,21 +33,27 @@
 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.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.ws.metadata.config.*;
 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.
  *
@@ -144,6 +131,10 @@
 
    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;
@@ -324,7 +315,9 @@
       return type;
    }
 
-   public abstract JAXBContext getJAXBContext(Class[] javaTypes) throws JAXBException;
+   public List<BindingCustomization> getBindingCustomizations() {
+      return bindingCustomization;
+   }
 
    public String getAuthMethod()
    {
@@ -646,6 +639,11 @@
       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 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -23,17 +23,16 @@
 
 // $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.
  *
@@ -44,14 +43,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
@@ -187,11 +186,14 @@
    {
       this.secureWSDLAccess = secureWSDLAccess;
    }
-   
-   @Override
-   public JAXBContext getJAXBContext(Class[] javaTypes) throws JAXBException
+
+   /**
+    * Will be set through a deployment aspect
+    * @return List<BindingCustomization> of available customizations
+    */
+   public List<BindingCustomization> getBindingCustomizations()
    {
-      return endpoint.getJAXBHandler().getJAXBContext(javaTypes);
+      return endpoint.getBindingCustomizations();
    }
 
    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 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -23,14 +23,11 @@
 
 // $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 at jboss.org>Anil Saldhana
@@ -44,10 +41,4 @@
    {
       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

Added: 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	                        (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/binding/BindingCustomizationTestCase.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -0,0 +1,96 @@
+/*
+ * 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 at 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 (IllegalAccessError 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
+      }
+
+
+   }
+}


Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/binding/BindingCustomizationTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

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 15:02:00 UTC (rev 3755)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws871/JBWS871TestCase.java	2007-06-28 15:06:17 UTC (rev 3756)
@@ -39,6 +39,7 @@
 
 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
@@ -73,8 +74,8 @@
    public void testNullArray() throws Exception
    {
       Integer[] intArr = null;
-      
-      JAXBContext jbc = JAXBContext.newInstance(Integer[].class);
+
+      JAXBContext jbc = JAXBContextFactory.newInstance().createContext(Integer[].class);
       Marshaller m = jbc.createMarshaller();
       m.setProperty(Marshaller.JAXB_FRAGMENT, true);
       StringWriter strw = new StringWriter();
@@ -83,7 +84,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);
@@ -93,8 +94,8 @@
    public void testEmptyArray() throws Exception
    {
       Integer[] intArr = new Integer[0];
-      
-      JAXBContext jbc = JAXBContext.newInstance(Integer[].class);
+
+      JAXBContext jbc = JAXBContextFactory.newInstance().createContext(Integer[].class);
       Marshaller m = jbc.createMarshaller();
       m.setProperty(Marshaller.JAXB_FRAGMENT, true);
       StringWriter strw = new StringWriter();
@@ -103,7 +104,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);
@@ -113,8 +114,8 @@
    public void testSingleValueArray() throws Exception
    {
       Integer[] intArr = new Integer[] { new Integer(1) };
-      
-      JAXBContext jbc = JAXBContext.newInstance(Integer[].class);
+
+      JAXBContext jbc = JAXBContextFactory.newInstance().createContext(Integer[].class);
       Marshaller m = jbc.createMarshaller();
       m.setProperty(Marshaller.JAXB_FRAGMENT, true);
       StringWriter strw = new StringWriter();
@@ -123,7 +124,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);
@@ -133,8 +134,8 @@
    public void testMultipleValueArray() throws Exception
    {
       Integer[] intArr = new Integer[] { new Integer(1), new Integer(2), new Integer(3) };
-      
-      JAXBContext jbc = JAXBContext.newInstance(Integer[].class);
+
+      JAXBContext jbc = JAXBContextFactory.newInstance().createContext(Integer[].class);
       Marshaller m = jbc.createMarshaller();
       m.setProperty(Marshaller.JAXB_FRAGMENT, true);
       StringWriter strw = new StringWriter();
@@ -143,13 +144,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);




More information about the jbossws-commits mailing list