Package org.objectweb.celtix.context

Examples of org.objectweb.celtix.context.ObjectMessageContext


        return fObjMsgContext.isDone();
    }

    public synchronized T get() throws InterruptedException, ExecutionException {
        if (result == null) {
            ObjectMessageContext ctx = fObjMsgContext.get();
            result = cls.cast(ctx.getReturn());
            Throwable t = ctx.getException();
            if (t != null) {
                if (WebServiceException.class.isAssignableFrom(t.getClass())) {
                    throw new ExecutionException(t);
                } else {
                    throw new ExecutionException(new WebServiceException(t));
View Full Code Here


   
    public T get(long timeout, TimeUnit unit)
        throws InterruptedException, ExecutionException, TimeoutException {
        if (result == null) {
            ObjectMessageContext ctx = fObjMsgContext.get(timeout, unit);
            result = cls.cast(ctx.getReturn());
            Throwable t = ctx.getException();
            if (t != null) {
                if (WebServiceException.class.isAssignableFrom(t.getClass())) {
                    throw new ExecutionException(t);
                } else {
                    throw new ExecutionException(new WebServiceException(t));
View Full Code Here

        assertNotNull(clientBinding.createObjectContext());
    }
   
    public void testInvokeOneWay() throws Exception {
        TestClientBinding clientBinding = new TestClientBinding(bus, epr);
        ObjectMessageContext objContext = clientBinding.createObjectContext();
        assertNotNull(objContext);
        Method method = SOAPMessageUtil.getMethod(Greeter.class, "greetMe");
       
        String arg0 = new String("TestSOAPInputPMessage");
        objContext.setMessageObjects(arg0);
       
        clientBinding.invokeOneWay(objContext,
                                   new JAXBDataBindingCallback(method,
                                                               DataBindingCallback.Mode.PARTS, null));       
    }
View Full Code Here

     * schedule the next transmission
     *
     * @param context
     */
    public void addUnacknowledged(SourceSequence seq, RMMessage msg) {
        ObjectMessageContext clone = getHandler().getBinding().createObjectContext();
        clone.putAll(msg.getContext());
        getRetransmissionQueue().cacheUnacknowledged(clone);
        getHandler().getStore().persistOutgoing(seq, msg);
    }
View Full Code Here

        RMStore store = handler.getStore();
        for (SourceSequence seq : seqs) {
            Collection<RMMessage> msgs  = store.getMessages(seq.getIdentifier(), true);
            LOG.fine("Recovered " + msgs.size() + " messages for this sequence");
            for (RMMessage msg : msgs) {
                ObjectMessageContext objCtx = new ObjectMessageContextImpl();
                objCtx.putAll(msg.getContext());
                cacheUnacknowledged(objCtx);
                LOG.fine("cached unacknowledged message nr: " + msg.getMessageNr());
            }
        }        
    }
View Full Code Here

           
            NormalizedMessage nm = exchange.getMessage("in");
            final InputStream in = JBIMessageHelper.convertMessageToInputStream(nm.getContent());
            // dispatch through callback
           
            ObjectMessageContext ctx = new ObjectMessageContextImpl();
            LOG.finest("dispatching message on callback: " + cb);
            ctx.put(MESSAGE_EXCHANGE_PROPERTY, exchange);
            cb.dispatch(new JBIInputStreamMessageContext(ctx, in), this);
        } catch (Exception ex) {
            LOG.log(Level.SEVERE, "error preparing message", ex);
            throw new IOException(ex.getMessage());
        }
View Full Code Here

            LOG.info("Reverse processing inbound message, exception: " + inboundException);
        }

        handlerInvoker.setOutbound();

        ObjectMessageContext replyObjectCtx = objectCtx;
        if (null == replyObjectCtx) {
            replyObjectCtx = binding.createObjectContext();
        }
        replyObjectCtx.put(ObjectMessageContext.MESSAGE_INPUT, Boolean.TRUE);       
       
        if (null != inboundException) {
            replyObjectCtx.setException(inboundException);
        }

        // If protocol handlers were invoked inbound, then also invoke them
        // outbound - except when message is oneway.
        // TODO: relax this restriction to allow outbound processing of system
        // handlers.
       
        if (!logicalChainTraversed
            && state.value() >= ServerRequestState.LOGICAL_HANDLERS_INVOKED.value()
            && !isOneway()) {
           
            // Protocol and runtime exceptions have already been caught by
            // handler invoker and stored in the object context.
           
            handlerInvoker.invokeLogicalHandlers(isRequestor(), replyObjectCtx);
        }
       
        // If on the inbound path we managed to construct a binding message
        // context use it - otherwise create a new one.

        MessageContext replyBindingCtx = bindingCtx;
        if (null == replyBindingCtx) {
            bindingCtx = binding.getBindingImpl().createBindingMessageContext(replyObjectCtx);
            replyBindingCtx = bindingCtx;
        } else if (null != replyObjectCtx) {
            replyBindingCtx.putAll(replyObjectCtx);
        }
               

        // The following will only succeed if we have a data binding callback.
       
        if (handlerInvoker.faultRaised(replyObjectCtx)) {
            LOG.fine("Marshalling fault.");
            marshalFault(replyObjectCtx, replyBindingCtx);
        } else if (null != replyObjectCtx.get(ObjectMessageContext.MESSAGE_PAYLOAD)
            || state.value() >= ServerRequestState.DISPATCHED.value()
            || null != replyObjectCtx.get(ObjectMessageContext.METHOD_RETURN)) {
            LOG.fine("Marshalling.");
            marshal(replyObjectCtx, replyBindingCtx);
        }

        // If protocol handlers were invoked inbound, then also invoke them
        // outbound - except when message is oneway.
        // TODO: relax this restriction to allow outbound processing of system
        // handlers.
        // Note we may not be able to find out if the message is oneway (in case where
        // inbound processing failed while invoking stream handlers).

        if (state.value() >= ServerRequestState.PROTOCOL_HANDLERS_INVOKED.value() && !isOneway()) {

            // Protocol and runtime exceptions have already been caught by
            // handler invoker and stored in binding context
            // As marshalling took place prior to invoking the
            // protocol handlers we need to go back and marshal this fault.
           
            handlerInvoker.invokeProtocolHandlers(isRequestor(), replyBindingCtx);
           
            if (handlerInvoker.faultRaised(replyBindingCtx)
                && !binding.getBindingImpl().hasFault(replyBindingCtx)) {
                LOG.fine("Marshalling fault raised by protocol handlers.");
                replyObjectCtx.setException((Exception)replyBindingCtx.get(
                    ObjectMessageContext.METHOD_FAULT));
                marshalFault(replyObjectCtx, replyBindingCtx);
            }
        }
View Full Code Here

        getBindingImpl().configureSystemHandlers(endpointConfiguration);
    }

    public void send(Request request, DataBindingCallback callback)
        throws IOException {
        ObjectMessageContext objectCtx = request.getObjectMessageContext();
        BindingContextUtils.storeDataBindingCallback(objectCtx, callback);
       
        try {
            OutputStreamMessageContext ostreamCtx = request.process(null);
View Full Code Here

        assertTrue(expectDOM.isEqualNode(resultDOM));
    }

    public void testInvokeOneWay() throws Exception {
        TestClientBinding clientBinding = new TestClientBinding(bus, epr);
        ObjectMessageContext objContext = clientBinding.createObjectContext();
        assertNotNull(objContext);
       
        Method method = ClassUtils.getMethod(Greeter.class, "greetMeOneWay");
       
        String arg0 = new String("TestXMLInputMessage");
        objContext.setMessageObjects(arg0);
       
        clientBinding.invokeOneWay(objContext,
                                   new JAXBDataBindingCallback(method,
                                                               DataBindingCallback.Mode.PARTS,
                                                               null));
View Full Code Here

     * @param context object message context
     * @param callback callback for data binding
     */
    public void partialResponse(OutputStreamMessageContext outputContext,
                                DataBindingCallback callback) throws IOException {
        ObjectMessageContext objectMessageContext = createObjectContext();
        objectMessageContext.putAll(outputContext);
        BindingContextUtils.storeDataBindingCallback(objectMessageContext, callback);

        if (callback != null) {
            Request request = new Request(this, transport, objectMessageContext);
            request.setOneway(true);
View Full Code Here

TOP

Related Classes of org.objectweb.celtix.context.ObjectMessageContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.