private Reference cacheAndGet(final Reference instance) { cache.put(instance.getValue().getClass().getName(), instance); return instance; }
private static void injectServiceAndHandlerResources(Endpoint endpoint) { org.apache.cxf.endpoint.Endpoint ep = endpoint.getAttachment(org.apache.cxf.endpoint.Endpoint.class); if (ep != null) { @SuppressWarnings("rawtypes") List<Handler> chain = ((JaxWsEndpointImpl) ep).getJaxwsBinding().getHandlerChain(); if (chain != null) { for (Handler<?> handler : chain) { if (handler instanceof ConfigDelegateHandler) { handler = ((ConfigDelegateHandler<?>) handler).getDelegate(); } final Reference handlerReference = endpoint.getInstanceProvider().getInstance(handler.getClass().getName()); if (!handlerReference.isInitialized()) { final Object handlerInstance = handlerReference.getValue(); InjectionHelper.callPostConstructMethod(handlerInstance); handlerReference.setInitialized(); } } } } }
/** * Injects resources on target bean and calls post construct method. * Finally it registers target bean for predestroy phase. * * @param endpoint used for predestroy phase registration process * @param invocation current invocation */ @Override public void onEndpointInstantiated(final Endpoint endpoint, final Invocation invocation) { final Object _targetBean = this.getTargetBean(invocation); // TODO: refactor injection to AS IL final Reference reference = endpoint.getInstanceProvider().getInstance(_targetBean.getClass().getName()); final Object targetBean = reference.getValue(); InjectionHelper.injectWebServiceContext(targetBean, ThreadLocalAwareWebServiceContext.getInstance()); if (!reference.isInitialized()) { InjectionHelper.callPostConstructMethod(targetBean); reference.setInitialized(); } endpoint.addAttachment(PreDestroyHolder.class, new PreDestroyHolder(targetBean)); }
private Reference cacheAndGet(final Reference instance) { cache.put(instance.getValue().getClass().getName(), instance); return instance; }
private Reference cacheAndGet(final Reference instance) { cache.put(instance.getValue().getClass().getName(), instance); return instance; }
public static Reference newInitializedReference(final Reference reference) { if (reference == null) throw new IllegalArgumentException(); return newInitializedReference(reference.getValue()); }
public static Reference newUninitializedReference(final Reference reference) { if (reference == null) throw new IllegalArgumentException(); return newUninitializedReference(reference.getValue()); }
private Object getEndpointInstance() { synchronized(endpoint) { try { final String endpointClassName = endpoint.getTargetBeanName(); return endpoint.getInstanceProvider().getInstance(endpointClassName).getValue(); } catch (Exception ex) { throw new IllegalStateException(ex); } } }
private Handler getInstance(final HandlerInfo info) throws Exception { final Endpoint ep = EndpointAssociation.getEndpoint(); final Handler handler; if (ep != null) { handler = (Handler)ep.getInstanceProvider().getInstance(info.getHandlerClass().getName()).getValue(); } else { handler = (Handler)info.getHandlerClass().newInstance(); } return handler; }
@Override public synchronized Reference getInstance(final String className) { Reference instance = cache.get(className); if (instance != null) return instance; if (!className.equals(endpointClass)) { // handle JAXWS handler instantiation final ServiceName handlerComponentName = getHandlerComponentServiceName(className); final ServiceController<BasicComponent> handlerComponentController = getComponentController(handlerComponentName); if (handlerComponentController != null) { // we support initialization only on non system JAXWS handlers final BasicComponent handlerComponent = handlerComponentController.getValue(); final ComponentInstance handlerComponentInstance = handlerComponent.createInstance(delegate.getInstance(className).getValue()); final Object handlerInstance = handlerComponentInstance.getInstance(); // mark reference as initialized because JBoss server initialized it final Reference handlerReference = ReferenceFactory.newInitializedReference(handlerInstance); return cacheAndGet(handlerReference); } } // fallback for system JAXWS handlers final Reference fallbackInstance = delegate.getInstance(className); final Reference fallbackReference = ReferenceFactory.newUninitializedReference(fallbackInstance); return cacheAndGet(fallbackReference); }
@Override public synchronized Reference getInstance(final String className) { Reference instance = cache.get(className); if (instance != null) return instance; if (!className.equals(endpointClass)) { // handle JAXWS handler instantiation final ServiceName handlerComponentName = getHandlerComponentServiceName(className); final ServiceController<BasicComponent> handlerComponentController = getComponentController(handlerComponentName); if (handlerComponentController != null) { // we support initialization only on non system JAXWS handlers final BasicComponent handlerComponent = handlerComponentController.getValue(); final ComponentInstance handlerComponentInstance = handlerComponent.createInstance(delegate.getInstance(className).getValue()); final Object handlerInstance = handlerComponentInstance.getInstance(); // mark reference as initialized because JBoss server initialized it final Reference handlerReference = ReferenceFactory.newInitializedReference(handlerInstance); return cacheAndGet(handlerReference); } } // fallback for system JAXWS handlers final Reference fallbackInstance = delegate.getInstance(className); final Reference fallbackReference = ReferenceFactory.newUninitializedReference(fallbackInstance); return cacheAndGet(fallbackReference); }
@Override public synchronized Reference getInstance(final String className) { Reference instance = cache.get(className); if (instance != null) return instance; if (!className.equals(endpointClass)) { // handle JAXWS handler instantiation final ServiceName handlerComponentName = getHandlerComponentServiceName(className); final ServiceController<BasicComponent> handlerComponentController = getComponentController(handlerComponentName); if (handlerComponentController != null) { // we support initialization only on non system JAXWS handlers final BasicComponent handlerComponent = handlerComponentController.getValue(); final ComponentInstance handlerComponentInstance = handlerComponent.createInstance(delegate.getInstance(className).getValue()); final Object handlerInstance = handlerComponentInstance.getInstance(); // mark reference as initialized because JBoss server initialized it final Reference handlerReference = ReferenceFactory.newInitializedReference(handlerInstance); return cacheAndGet(handlerReference); } } // fallback for system JAXWS handlers final Reference fallbackInstance = delegate.getInstance(className); final Reference fallbackReference = ReferenceFactory.newUninitializedReference(fallbackInstance); return cacheAndGet(fallbackReference); }
_context = _publisher.publish(contextRoot, tccl, urlPatternToClassNameMap, wsMetadata, jbwsMetadata); for (org.jboss.wsf.spi.deployment.Endpoint ep : _context.getEndpoints()) { BaseWebService wsProvider = (BaseWebService)ep.getInstanceProvider().getInstance(BaseWebService.class.getName()).getValue(); wsProvider.setInvocationClassLoader(tccl);
BaseWebService wsProvider = (BaseWebService)ep.getInstanceProvider().getInstance(BaseWebService.class.getName()).getValue(); wsProvider.setInvocationClassLoader(tccl);