Author: richard.opalka(a)jboss.com
Date: 2010-10-14 06:40:06 -0400 (Thu, 14 Oct 2010)
New Revision: 13118
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
09:39:53 UTC (rev 13117)
+++
framework/trunk/src/main/java/org/jboss/wsf/framework/serviceref/DefaultServiceRefHandler.java 2010-10-14
10:40:06 UTC (rev 13118)
@@ -26,7 +26,6 @@
import javax.naming.Context;
import javax.naming.NamingException;
-import org.jboss.logging.Logger;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
@@ -42,52 +41,37 @@
*
* @author Thomas.Diesler(a)jboss.org
* @author Heiko.Braun(a)jboss.com
- *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
* @since 04-Nov-2006
*/
public class DefaultServiceRefHandler implements ServiceRefHandler
{
- // logging support
- private static Logger log = Logger.getLogger(DefaultServiceRefHandler.class);
+ private static final ServiceRefBinderFactory serviceRefBindingFactory;
- private ServiceRefBinder getJaxrpcBinder()
+ static
{
SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- return
spiProvider.getSPI(ServiceRefBinderFactory.class).newServiceRefBinder(Type.JAXRPC);
+ serviceRefBindingFactory = spiProvider.getSPI(ServiceRefBinderFactory.class);
}
- private ServiceRefBinder getJaxwsBinder()
+ private ServiceRefBinder getBinder(final Type binderType)
{
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- return
spiProvider.getSPI(ServiceRefBinderFactory.class).newServiceRefBinder(Type.JAXWS);
+ return serviceRefBindingFactory.newServiceRefBinder(binderType);
}
- public void bindServiceRef(Context encCtx, String encName, UnifiedVirtualFile vfsRoot,
ClassLoader loader, ServiceRefMetaData sref) throws NamingException
+ public void bindServiceRef(Context encCtx, String encName, UnifiedVirtualFile
deleteme, ClassLoader loader, ServiceRefMetaData sref) throws NamingException
{
- if (sref.isProcessed())
+ final UnifiedServiceRefMetaData serviceRef = (UnifiedServiceRefMetaData)sref;
+ final Type bindingType = getServiceRefType(serviceRef, loader);
+ if (bindingType == Type.JAXRPC)
{
- log.debug("Attempt to rebind the service-ref: " +
sref.getServiceRefName());
- return;
+ this.getBinder(bindingType).setupServiceRef(encCtx, encName, null, serviceRef,
loader);
}
-
- UnifiedServiceRefMetaData serviceRef = (UnifiedServiceRefMetaData)sref;
- serviceRef.setVfsRoot(vfsRoot);
- try
+ else
{
- if (getServiceRefType(serviceRef, loader) == Type.JAXRPC)
- {
- getJaxrpcBinder().setupServiceRef(encCtx, encName, null, serviceRef,
loader);
- }
- else
- {
- AnnotatedElement anElement = (AnnotatedElement)sref.getAnnotatedElement();
- getJaxwsBinder().setupServiceRef(encCtx, encName, anElement, serviceRef,
loader);
- }
+ AnnotatedElement anElement = (AnnotatedElement)sref.getAnnotatedElement();
+ this.getBinder(bindingType).setupServiceRef(encCtx, encName, anElement,
serviceRef, loader);
}
- finally
- {
- sref.setProcessed(true);
- }
}
private Type getServiceRefType(UnifiedServiceRefMetaData serviceRef, ClassLoader
loader) throws NamingException