Author: richard.opalka(a)jboss.com
Date: 2010-10-14 10:37:53 -0400 (Thu, 14 Oct 2010)
New Revision: 13125
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/serviceref/DefaultServiceRefHandler.java
Log:
refactoring
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/serviceref/DefaultServiceRefHandler.java
===================================================================
---
framework/trunk/src/main/java/org/jboss/wsf/framework/serviceref/DefaultServiceRefHandler.java 2010-10-14
14:28:59 UTC (rev 13124)
+++
framework/trunk/src/main/java/org/jboss/wsf/framework/serviceref/DefaultServiceRefHandler.java 2010-10-14
14:37:53 UTC (rev 13125)
@@ -21,8 +21,6 @@
*/
package org.jboss.wsf.framework.serviceref;
-import java.lang.reflect.AnnotatedElement;
-
import javax.naming.Context;
import javax.naming.NamingException;
@@ -46,45 +44,40 @@
*/
public class DefaultServiceRefHandler implements ServiceRefHandler
{
- private static final ServiceRefBinderFactory serviceRefBindingFactory;
-
- static
+ public void bindServiceRef(final Context encCtx, final String encName, final
UnifiedVirtualFile ignored,
+ final ClassLoader loader, ServiceRefMetaData serviceRefMD) throws
NamingException
{
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- serviceRefBindingFactory = spiProvider.getSPI(ServiceRefBinderFactory.class);
+ final UnifiedServiceRefMetaData serviceRefUMDM = (UnifiedServiceRefMetaData)
serviceRefMD;
+ final Type bindingType = getServiceRefType(serviceRefUMDM, loader);
+
+ this.getBinder(bindingType).setupServiceRef(encCtx, encName, serviceRefUMDM,
loader);
}
private ServiceRefBinder getBinder(final Type binderType)
{
+ final SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ final ServiceRefBinderFactory serviceRefBindingFactory =
spiProvider.getSPI(ServiceRefBinderFactory.class);
+
return serviceRefBindingFactory.newServiceRefBinder(binderType);
}
- public void bindServiceRef(Context encCtx, String encName, UnifiedVirtualFile ignored,
ClassLoader loader, ServiceRefMetaData serviceRefMD) throws NamingException
+ private Type getServiceRefType(final UnifiedServiceRefMetaData serviceRef, final
ClassLoader loader)
{
- final UnifiedServiceRefMetaData serviceRefUMDM =
(UnifiedServiceRefMetaData)serviceRefMD;
- final Type bindingType = getServiceRefType(serviceRefUMDM, loader);
-
- this.getBinder(bindingType).setupServiceRef(encCtx, encName, serviceRefUMDM,
loader);
- }
-
- private Type getServiceRefType(UnifiedServiceRefMetaData serviceRef, ClassLoader
loader) throws NamingException
- {
- // The service-ref-type is JAXWS specific
- String serviceRefType = serviceRef.getServiceRefType();
- if (serviceRefType != null || serviceRef.getAnnotatedElement() != null)
+ // Both service-ref-type and annotated element are JAXWS specific
+ if (serviceRef.getServiceRefType() != null || serviceRef.getAnnotatedElement() !=
null)
return Type.JAXWS;
// The mapping-file is JAXRPC specific
if (serviceRef.getMappingFile() != null)
return Type.JAXRPC;
- String serviceInterfaceName = serviceRef.getServiceInterface();
+ final String serviceInterfaceName = serviceRef.getServiceInterface();
if (serviceInterfaceName == null)
throw new IllegalStateException("<service-interface> cannot be
null");
try
{
- Class<?> siClass = loader.loadClass(serviceInterfaceName);
+ final Class<?> siClass = loader.loadClass(serviceInterfaceName);
if (javax.xml.ws.Service.class.isAssignableFrom(siClass))
return Type.JAXWS;
else if (javax.xml.rpc.Service.class.isAssignableFrom(siClass))
Show replies by date