Examples of IterableXMLEventReader


Examples of com.collective2.signalEntry.adapter.IterableXMLEventReader

                assertTrue(((String)request.get(Parameter.Symbol)).compareTo(lastValue)>0);
                //setup for next test
                lastValue = (String)request.get(Parameter.Symbol);

                try {
                    return new IterableXMLEventReader(super.transmit(request));
                } catch (XMLStreamException e) {
                    fail(e.getMessage());
                    throw new C2ServiceException(e,false);
                }
            }
View Full Code Here

Examples of com.collective2.signalEntry.adapter.IterableXMLEventReader

    @Override
    public void visitC2Elements(C2ElementVisitor c2ElementVisitor, C2Element ... expected) {
        assert(validate(expected));
       
        IterableXMLEventReader reader = getXMLEventReader();
        try {
            Deque<C2Element> stack = new ArrayDeque<C2Element>();
            while (reader.hasNext()) {
                XMLEvent event =  reader.nextEvent();
                if (event.isEndElement()) {
                    stack.pop();
                } else if (event.isStartElement()) {
                   
                    String name = event.asStartElement().getName().getLocalPart();
                    int i =expected.length;
                    C2Element found = C2Element.None;
                    while(--i>=0) {
                        if (name.equals(expected[i].localElementName())) {
                            found = expected[i];
                            break;
                        }
                    }
                    stack.push(found);
                } else if (event.isCharacters()) {
                    if (C2Element.None != stack.peek()) {
                        c2ElementVisitor.visit(stack.peek(), event.asCharacters().getData().trim());
                    }
                }
            }
        } catch (XMLStreamException e) {
            logger.warn("visitC2Elements: \n"+request.buildURL(),e);
        } finally {
            try {
                reader.close();
            } catch (XMLStreamException e) {
                logger.warn("Unable to close xml stream", e);
            }
        }
    }
View Full Code Here

Examples of com.collective2.signalEntry.adapter.IterableXMLEventReader

                        approvalRequestable.waitForApproval(journal.pending());
                    }

                    if (!journalInstance.isApproved()) {
                       journal.markRejected(journalInstance);
                       return new IterableXMLEventReader("<rejected>not approved</rejected>");
                    };

                    //was validated upon construction but assert it was not changed in the meantime
                    assert(request.validate());
                    //all down stream requests must see the same halting exception until its reset.
                    if (haltingException != null ) {
                        throw haltingException;
                    }

                    boolean  tryAgain = false;
                    do {
                        try {
                            //exceptions thrown here are because
                            // * the network is down and we should try later
                            // * the response was not readable - must stop all

                            //transmit to the adapter
                            IterableXMLEventReader eventReader = adapter.transmit(request);
                            synchronized (ResponseManager.this) {
                                //exceptions thrown here are because
                                // * database was unable to change flag on request to sent - must stop all
                                journal.markSent(journalInstance);
                            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.