Author: thomas.diesler(a)jboss.com
Date: 2007-07-26 23:15:32 -0400 (Thu, 26 Jul 2007)
New Revision: 4012
Modified:
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicEndpoint.java
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicExtendible.java
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicService.java
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/binding/BindingCustomization.java
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Extendible.java
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Service.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBBindingCustomization.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java
trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/binding/BindingCustomizationTestCase.java
Log:
Use Extendible for BindingCustomizations
Modified:
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicEndpoint.java
===================================================================
---
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicEndpoint.java 2007-07-27
02:45:35 UTC (rev 4011)
+++
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicEndpoint.java 2007-07-27
03:15:32 UTC (rev 4012)
@@ -22,7 +22,6 @@
package org.jboss.wsf.framework.deployment;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import javax.management.ObjectName;
@@ -194,44 +193,45 @@
this.invocationHandler = handler;
}
- public List<BindingCustomization> getBindingCustomizations()
+ public EndpointMetrics getEndpointMetrics()
{
- return Collections.unmodifiableList(bindingCustomizsations);
+ return metrics;
}
- /* Get a concrete binding customization */
- public BindingCustomization getBindingCustomization(BindingCustomization
customization)
+ public void setEndpointMetrics(EndpointMetrics metrics)
{
- BindingCustomization match = null;
+ assertEndpointSetterAccess();
+ metrics.setEndpoint(this);
+ this.metrics = metrics;
- for (BindingCustomization bc : bindingCustomizsations)
- {
- if (bc.getClass().equals(customization.getClass()))
- {
- match = bc;
- }
- }
+ }
- return match;
+ @Override
+ public <T> T addAttachment(Class<T> clazz, Object obj)
+ {
+ assertEndpointSetterAccess();
+ return super.addAttachment(clazz, obj);
}
- public void addBindingCustomization(BindingCustomization customization)
+ @Override
+ public <T> T removeAttachment(Class<T> key)
{
assertEndpointSetterAccess();
- bindingCustomizsations.add(customization);
+ return super.removeAttachment(key);
}
- public EndpointMetrics getEndpointMetrics()
+ @Override
+ public void removeProperty(String key)
{
- return metrics;
+ assertEndpointSetterAccess();
+ super.removeProperty(key);
}
- public void setEndpointMetrics(EndpointMetrics metrics)
+ @Override
+ public void setProperty(String key, Object value)
{
assertEndpointSetterAccess();
- metrics.setEndpoint(this);
- this.metrics = metrics;
-
+ super.setProperty(key, value);
}
private void assertEndpointSetterAccess()
Modified:
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicExtendible.java
===================================================================
---
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicExtendible.java 2007-07-27
02:45:35 UTC (rev 4011)
+++
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicExtendible.java 2007-07-27
03:15:32 UTC (rev 4012)
@@ -23,6 +23,7 @@
//$Id: BasicDeploymentContext.java 3959 2007-07-20 14:44:19Z heiko.braun(a)jboss.com $
+import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -40,6 +41,11 @@
private Map<Class, Object> attachments = new HashMap<Class, Object>();
private Map<String, Object> properties = new HashMap<String, Object>();
+ public Collection<Object> getAttachments()
+ {
+ return attachments.values();
+ }
+
public <T> T getAttachment(Class<T> clazz)
{
return (T)attachments.get(clazz);
Modified:
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicService.java
===================================================================
---
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicService.java 2007-07-27
02:45:35 UTC (rev 4011)
+++
trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicService.java 2007-07-27
03:15:32 UTC (rev 4012)
@@ -78,21 +78,4 @@
{
this.contextRoot = contextRoot;
}
-
- public Endpoint getEndpointByName(String shortName)
- {
- if (shortName == null)
- throw new IllegalArgumentException("shortName cannot be null");
-
- Endpoint retEndpoint = null;
- for (Endpoint ep : endpoints)
- {
- if (ep.getShortName().equals(shortName))
- {
- retEndpoint = ep;
- break;
- }
- }
- return retEndpoint;
- }
}
Modified:
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/binding/BindingCustomization.java
===================================================================
---
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/binding/BindingCustomization.java 2007-07-27
02:45:35 UTC (rev 4011)
+++
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/binding/BindingCustomization.java 2007-07-27
03:15:32 UTC (rev 4012)
@@ -34,6 +34,7 @@
* @author Heiko.Braun(a)jboss.com
* Created: Jun 28, 2007
*/
-public abstract class BindingCustomization extends HashMap {
-
+public abstract class BindingCustomization extends HashMap
+{
+
}
Modified: trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java
===================================================================
---
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java 2007-07-27
02:45:35 UTC (rev 4011)
+++
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Endpoint.java 2007-07-27
03:15:32 UTC (rev 4012)
@@ -23,15 +23,12 @@
// $Id$
-import org.jboss.wsf.spi.binding.BindingCustomization;
+import javax.management.ObjectName;
+
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.
*
@@ -114,15 +111,6 @@
/** 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 endpoint metrics for this endpoint */
EndpointMetrics getEndpointMetrics();
Modified:
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Extendible.java
===================================================================
---
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Extendible.java 2007-07-27
02:45:35 UTC (rev 4011)
+++
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Extendible.java 2007-07-27
03:15:32 UTC (rev 4012)
@@ -23,6 +23,7 @@
//$Id: Deployment.java 3999 2007-07-26 11:33:20Z thomas.diesler(a)jboss.com $
+import java.util.Collection;
import java.util.Set;
/**
@@ -37,6 +38,9 @@
<T> T addAttachment(Class<T> key, Object value);
/** Get arbitrary attachments */
+ <T> Collection<T> getAttachments();
+
+ /** Get an arbitrary attachment */
<T> T getAttachment(Class<T> key);
/** Remove arbitrary attachments */
Modified: trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Service.java
===================================================================
---
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Service.java 2007-07-27
02:45:35 UTC (rev 4011)
+++
trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/Service.java 2007-07-27
03:15:32 UTC (rev 4012)
@@ -25,7 +25,6 @@
import java.util.List;
-
/**
* A general service deployment.
*
@@ -53,7 +52,4 @@
/** Set the context root for this service */
void setContextRoot(String contextRoot);
-
- /** Get the Endpoint for a give short name */
- Endpoint getEndpointByName(String shortName);
}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBBindingCustomization.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBBindingCustomization.java 2007-07-27
02:45:35 UTC (rev 4011)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/JAXBBindingCustomization.java 2007-07-27
03:15:32 UTC (rev 4012)
@@ -22,6 +22,7 @@
package org.jboss.ws.core.jaxws;
import org.jboss.wsf.spi.binding.BindingCustomization;
+
import com.sun.xml.bind.api.JAXBRIContext;
/**
@@ -32,8 +33,8 @@
* @author Heiko.Braun(a)jboss.com
* Created: Jun 28, 2007
*/
-public class JAXBBindingCustomization extends BindingCustomization {
-
+public class JAXBBindingCustomization extends BindingCustomization
+{
// Use an alternative RuntimeAnnotationReader implementation
public final static String ANNOTATION_READER = JAXBRIContext.ANNOTATION_READER;
@@ -42,6 +43,4 @@
// Enable the c14n marshalling support in the JAXBContext.
public final static String CANONICALIZATION_SUPPORT =
JAXBRIContext.CANONICALIZATION_SUPPORT;
-
-
}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2007-07-27
02:45:35 UTC (rev 4011)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2007-07-27
03:15:32 UTC (rev 4012)
@@ -136,10 +136,11 @@
// Get the URL pattern from the endpoint
String linkName = sepMetaData.getLinkName();
- if (linkName != null && dep.getService().getEndpointByName(linkName) !=
null)
+ if (linkName != null)
{
- Endpoint endpoint = dep.getService().getEndpointByName(linkName);
- urlPattern = endpoint.getURLPattern();
+ Endpoint endpoint = getEndpointByName(dep, linkName);
+ if (endpoint != null)
+ urlPattern = endpoint.getURLPattern();
}
// If not, derive the context root from the deployment
@@ -174,6 +175,23 @@
sepMetaData.setEndpointAddress(getServiceEndpointAddress(null, servicePath));
}
+ private Endpoint getEndpointByName(Deployment dep, String shortName)
+ {
+ if (shortName == null)
+ throw new IllegalArgumentException("shortName cannot be null");
+
+ Endpoint retEndpoint = null;
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ if (ep.getShortName().equals(shortName))
+ {
+ retEndpoint = ep;
+ break;
+ }
+ }
+ return retEndpoint;
+ }
+
public static ObjectName createServiceEndpointID(Deployment dep,
ServerEndpointMetaData sepMetaData)
{
String linkName = sepMetaData.getLinkName();
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2007-07-27
02:45:35 UTC (rev 4011)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2007-07-27
03:15:32 UTC (rev 4012)
@@ -23,6 +23,24 @@
// $Id$
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+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.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;
@@ -40,19 +58,16 @@
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.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
+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.common.JavaUtils;
import org.jboss.wsf.spi.binding.BindingCustomization;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
-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.
*
@@ -314,7 +329,8 @@
return type;
}
- public List<BindingCustomization> getBindingCustomizations() {
+ public Collection<BindingCustomization> getBindingCustomizations()
+ {
return bindingCustomization;
}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java 2007-07-27
02:45:35 UTC (rev 4011)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java 2007-07-27
03:15:32 UTC (rev 4012)
@@ -31,6 +31,9 @@
import javax.management.ObjectName;
import javax.xml.namespace.QName;
+
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
/**
@@ -191,9 +194,15 @@
* Will be set through a deployment aspect
* @return List<BindingCustomization> of available customizations
*/
- public List<BindingCustomization> getBindingCustomizations()
+ public Collection<BindingCustomization> getBindingCustomizations()
{
- return endpoint.getBindingCustomizations();
+ List<BindingCustomization> list = new
ArrayList<BindingCustomization>();
+ for (Object att : endpoint.getAttachments())
+ {
+ if (att instanceof BindingCustomization)
+ list.add((BindingCustomization)att);
+ }
+ return list;
}
public String toString()
Modified:
trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/binding/BindingCustomizationTestCase.java
===================================================================
---
trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/binding/BindingCustomizationTestCase.java 2007-07-27
02:45:35 UTC (rev 4011)
+++
trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/binding/BindingCustomizationTestCase.java 2007-07-27
03:15:32 UTC (rev 4012)
@@ -22,17 +22,15 @@
package org.jboss.test.ws.jaxws.binding;
import junit.framework.TestCase;
+
import org.jboss.ws.core.jaxws.JAXBBindingCustomization;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.binding.BindingCustomization;
import org.jboss.wsf.spi.deployment.DeploymentModelFactory;
import org.jboss.wsf.spi.deployment.Endpoint;
-import static org.jboss.wsf.spi.deployment.Endpoint.EndpointState;
+import org.jboss.wsf.spi.deployment.Endpoint.EndpointState;
-import java.util.Iterator;
-import java.util.List;
-
/**
* @author Heiko.Braun(a)jboss.com
* Created: Jun 28, 2007
@@ -54,13 +52,13 @@
Endpoint endpoint = deploymentModelFactory.createEndpoint();
JAXBBindingCustomization jaxbCustomization = new JAXBBindingCustomization();
jaxbCustomization.put(JAXBBindingCustomization.DEFAULT_NAMESPACE_REMAP,
"http://org.jboss.bindingCustomization");
- endpoint.addBindingCustomization(jaxbCustomization);
+ endpoint.addAttachment(BindingCustomization.class, jaxbCustomization);
// a started endpoint should deny customizations
try
{
endpoint.setState(EndpointState.STARTED);
- endpoint.addBindingCustomization(jaxbCustomization);
+ endpoint.addAttachment(BindingCustomization.class, jaxbCustomization);
fail("It should not be possible to change bindinig customizations on a
started endpoint");
}
@@ -75,26 +73,17 @@
Endpoint endpoint = deploymentModelFactory.createEndpoint();
JAXBBindingCustomization jaxbCustomization = new JAXBBindingCustomization();
jaxbCustomization.put(JAXBBindingCustomization.DEFAULT_NAMESPACE_REMAP,
"http://org.jboss.bindingCustomization");
- endpoint.addBindingCustomization(jaxbCustomization);
+ endpoint.addAttachment(BindingCustomization.class, 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;
- }
-
+ BindingCustomization knownCustomization =
endpoint.getAttachment(BindingCustomization.class);
assertNotNull(knownCustomization);
// however the iteratoion should be unmodifiable
try
{
- customizations.add( new JAXBBindingCustomization() );
+ endpoint.addAttachment(BindingCustomization.class, jaxbCustomization);
fail("Started Endpoints should only axpose read acccess to their binding
customizations");
}
catch (Exception e)