private Interceptor getInterceptor() { // lazy load the interceptor as it may not have been added when the instance was created in the wire attacher if (interceptor == null) { interceptor = wire.getInvocationChains().iterator().next().getHeadInterceptor(); } return interceptor; } }
/** * Constructor. * * @param manager the ZeroMQ Context manager * @param address the address to receive messages on * @param chains the invocation chains for dispatching invocations * @param socketType the socket type as defined by ZeroMQ * @param metadata metadata * @param executorService the executor for scheduling work * @param monitor the monitor */ public AbstractReceiver(ContextManager manager, SocketAddress address, List<InvocationChain> chains, int socketType, ZeroMQMetadata metadata, ExecutorService executorService, MessagingMonitor monitor) { this.manager = manager; this.address = address; this.executorService = executorService; this.interceptors = new Interceptor[chains.size()]; for (int i = 0, chainsSize = chains.size(); i < chainsSize; i++) { InvocationChain chain = chains.get(i); interceptors[i] = chain.getHeadInterceptor(); } this.socketType = socketType; this.metadata = metadata; this.monitor = monitor; }
protected void invokeBusinessLogic(MessageContext messageCtx) throws AxisFault { Interceptor head = invocationChain.getHeadInterceptor(); OMElement bodyContent = ServiceProxyHelper.getInBodyContent(messageCtx); Object[] args = bodyContent == null ? null : new Object[]{bodyContent};
public Object invoke(Method method, Object[] args) throws Throwable { InvocationChain invocationChain = chains.get(method.getName()); if (invocationChain == null) { throw new ServiceRuntimeException("Unknown resource method: " + method.toString()); } WorkContext context = WorkContextCache.getThreadWorkContext(); // work context set previously in RsContainer Message message = MessageCache.getAndResetMessage(); try { if (authenticate) { authenticate(context); } message.setWorkContext(context); message.setBody(args); if (invocationChain != null) { Interceptor headInterceptor = invocationChain.getHeadInterceptor(); Message ret = headInterceptor.invoke(message); if (ret.isFault()) { return handleFault(ret); } else { return ret.getBody(); } } else { return null; } } catch (RuntimeException e) { throw new InvocationTargetException(e); } finally { message.reset(); } }
public void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage) throws AxisFault { Interceptor head = invocationChain.getHeadInterceptor(); OMElement bodyContent = ServiceProxyHelper.getInBodyContent(inMessage); Object[] args = bodyContent == null ? null : new Object[]{bodyContent};
public void attach(JUnitSourceDefinition source, PhysicalTargetDefinition target, Wire wire) throws WiringException { String testName = source.getTestName(); ContextConfiguration configuration = source.getConfiguration(); if (configuration != null) { if (authenticationService == null) { throw new WiringException("Security information set for the test but a security extension has not been installed in the runtime"); } // configuration an authentication interceptor to set the subject on the work context for (InvocationChain chain : wire.getInvocationChains()) { Interceptor next = chain.getHeadInterceptor(); String username = configuration.getUsername(); String password = configuration.getPassword(); AuthenticatingInterceptor interceptor = new AuthenticatingInterceptor(username, password, authenticationService, next); chain.addInterceptor(0, interceptor); } } holder.add(testName, wire); }