public Subject getSecuritySubject() { Message msgContext = ThreadMessageContext.getMessageContext(); if (msgContext == null){ // message in thread context could be null if the user has // spun up a new thread inside their component implementation return null; } Subject subject = null; for (Object header : msgContext.getHeaders().values()){ if (header instanceof Subject){ subject = (Subject)header; break; } } return subject; }
/** * Sets the values of various headers in the response message */ private void setResponseHeaders() { // Is there an existing message context? Message msgContext = ThreadMessageContext.getMessageContext(); if( msgContext == null ) { // Create a message context msgContext = msgFactory.createMessage(); } // end if // Add in the header for the RelatesTo Message ID msgContext.getHeaders().put(Constants.RELATES_TO, messageID); ThreadMessageContext.setMessageContext(msgContext); } // end method setResponseHeaders
/** * @return */ public static RuntimeComponent getCurrentComponent() { Message message = ThreadMessageContext.getMessageContext(); if (message != null) { Endpoint to = message.getTo(); if (to == null) { return null; } RuntimeComponent component = (RuntimeComponent)message.getTo().getComponent(); return component; } return null; }
/** * @return */ public static RuntimeComponent getCurrentComponent() { Message message = ThreadMessageContext.getMessageContext(); if (message != null) { Endpoint to = message.getTo(); if (to == null) { return null; } RuntimeComponent component = (RuntimeComponent)message.getTo().getComponent(); return component; } return null; }
public String getServiceName() { Message msgContext = ThreadMessageContext.getMessageContext(); if (msgContext != null && msgContext.getTo() != null){ return msgContext.getTo().getService().getName(); } else { // message in thread context could be null (or the default message where to == null) // if the user has spun up a new thread inside their component implementation return null; } }
public <B> ServiceReference<B> getServiceReference() { Message msgContext = ThreadMessageContext.getMessageContext(); if (msgContext == null || msgContext.getTo() == null){ // message in thread context could be null (or the default message where to == null) // if the user has spun up a new thread inside their component implementation return null; } // FIXME: [rfeng] Is this the service reference matching the caller side? RuntimeEndpoint to = (RuntimeEndpoint) msgContext.getTo(); RuntimeComponent component = (RuntimeComponent) to.getComponent(); ServiceReference<B> callableReference = component.getComponentContext().getServiceReference(null, to); return callableReference; }
this.callbackEPRs = callbackEPRs; Message msgContext = ThreadMessageContext.getMessageContext();
@SuppressWarnings("unchecked") public <CB> ServiceReference<CB> getCallbackReference() { Message msgContext = ThreadMessageContext.getMessageContext(); if (msgContext == null || msgContext.getTo() == null){ // message in thread context could be null (or the default message where to == null) // if the user has spun up a new thread inside their component implementation return null; } Endpoint to = msgContext.getTo(); RuntimeComponentService service = (RuntimeComponentService) to.getService(); RuntimeComponentReference callbackReference = (RuntimeComponentReference)service.getCallbackReference(); if (callbackReference == null) { return null; } JavaInterface javaInterface = (JavaInterface) callbackReference.getInterfaceContract().getInterface(); Class<CB> javaClass = (Class<CB>)javaInterface.getJavaClass(); List<EndpointReference> wires = callbackReference.getEndpointReferences(); ServiceReferenceImpl ref = new CallbackServiceReferenceImpl(javaClass, wires); return ref; } }
msg.setBody(args); Message msgContext = ThreadMessageContext.getMessageContext();
msg.setBody(args); Message msgContext = ThreadMessageContext.getMessageContext();
msg.setBody(args); Message msgContext = ThreadMessageContext.getMessageContext();