Author: richard.opalka(a)jboss.com
Date: 2009-05-25 04:30:30 -0400 (Mon, 25 May 2009)
New Revision: 10084
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceObjectFactory.java
Log:
[JBWS-2521] removing first hack (WIP)
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceObjectFactory.java
===================================================================
---
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceObjectFactory.java 2009-05-25
08:29:01 UTC (rev 10083)
+++
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceObjectFactory.java 2009-05-25
08:30:30 UTC (rev 10084)
@@ -23,11 +23,14 @@
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
-import org.apache.cxf.jaxws.ServiceImpl;
import org.jboss.wsf.spi.WSFException;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
-import javax.naming.*;
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
import javax.naming.spi.ObjectFactory;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
@@ -45,8 +48,6 @@
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.Hashtable;
-import java.util.LinkedList;
-import java.util.List;
import org.jboss.logging.Logger;
@@ -57,7 +58,7 @@
* @see ServiceReferenceable
*
* @author Thomas.Diesler(a)jboss.com
- * @since 06-Dec-2007
+ * @author Richard.Opalka(a)jboss.com
*/
public class ServiceObjectFactory implements ObjectFactory
{
@@ -83,6 +84,7 @@
* @see javax.naming.spi.NamingManager#getObjectInstance
* @see javax.naming.spi.NamingManager#getURLContext
*/
+ @SuppressWarnings(value="unchecked")
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable
environment) throws Exception
{
try
@@ -187,7 +189,7 @@
if ((serviceRef.getHandlerChain() != null) && (target instanceof
Service))
{
- Bus bus = getBus((Service)target);
+ Bus bus = BusFactory.getThreadDefaultBus();
((Service)target).setHandlerResolver(new HandlerResolverImpl(bus,
serviceRef.getHandlerChain(), target.getClass()));
}
@@ -244,43 +246,6 @@
}
}
- private Bus getBus(final Service service) throws Throwable
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null)
- {
- try
- {
- return AccessController.doPrivileged(new
PrivilegedExceptionAction<Bus>()
- {
- public Bus run() throws Exception
- {
- Field delegateField = findServiceDelegateField(service.getClass());
- if (delegateField != null)
- {
- delegateField.setAccessible(true);
- ServiceImpl serviceImpl = (ServiceImpl)delegateField.get(service);
- return serviceImpl.getBus();
- }
- throw new IllegalStateException("Bus not found");
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw e.getCause();
- }
- }
- Field delegateField = findServiceDelegateField(service.getClass());
- if (delegateField != null)
- {
- delegateField.setAccessible(true);
- ServiceImpl serviceImpl = (ServiceImpl)delegateField.get(service);
- return serviceImpl.getBus();
- }
- throw new IllegalStateException("Bus not found");
- }
-
private static Field findServiceDelegateField(Class<?> clazz)
{
while (clazz != null)
Show replies by date