@Override public Object execute(ActionContext context) throws Exception { process(input, host, port, transactional); return null; }
public void process(OutputStream out) throws Exception { initializeJournal(config); writeOutput(out); cleanup(); }
private void printSingleMessageAsXML(ICoreMessage message, List<String> queues) throws Exception { exporter.printSingleMessageAsXML(message, queues, false); messagesPrinted++; } /**
@Override public Object execute(ActionContext context) throws Exception { super.execute(context); try { config = getParameterConfiguration(); process(context.out); } catch (Exception e) { treatError(e, "data", "exp"); } return null; }
protected void writeOutput(OutputStream out) throws Exception { XMLOutputFactory factory = XMLOutputFactory.newInstance(); XMLStreamWriter rawXmlWriter = factory.createXMLStreamWriter(out, "UTF-8"); PrettyPrintHandler handler = new PrettyPrintHandler(rawXmlWriter); xmlWriter = (XMLStreamWriter) Proxy.newProxyInstance(XMLStreamWriter.class.getClassLoader(), new Class[]{XMLStreamWriter.class}, handler); exporter = new XMLMessageExporter(xmlWriter); writeXMLData(); }
private void processMessage() throws Exception { XMLMessageImporter.MessageInfo info = messageReader.readMessage(false); if (sort) { messages.add(info); } else { sendMessage(info.queues, info.message, info.tempFile); } }
@Override public synchronized void start() throws Exception { if (writer != null) { writer.getRawXMLWriter().writeStartDocument(XmlDataConstants.XML_VERSION); writer.getRawXMLWriter().writeStartElement(XmlDataConstants.MESSAGES_PARENT); } if (reader != null) { // <messages> reader.getRawXMLReader().nextTag(); } }
public void validate(String fileName) throws Exception { try (FileInputStream file = new FileInputStream(fileName)) { validate(file); } }
@Override public void setOutput(OutputStream outputStream) throws Exception { this.out = outputStream; XMLOutputFactory factory = XMLOutputFactory.newInstance(); XMLStreamWriter rawXmlWriter = factory.createXMLStreamWriter(outputStream, "UTF-8"); XmlDataExporter.PrettyPrintHandler handler = new XmlDataExporter.PrettyPrintHandler(rawXmlWriter); XMLStreamWriter xmlWriter = (XMLStreamWriter) Proxy.newProxyInstance(XMLStreamWriter.class.getClassLoader(), new Class[]{XMLStreamWriter.class}, handler); this.writer = new XMLMessageExporter(xmlWriter); }
static String convertProperty(final Object value) { if (value instanceof byte[]) { return encode((byte[]) value); } else { return value == null ? XmlDataConstants.NULL : value.toString(); } }
/** * This is the normal constructor for programmatic access to the * <code>org.apache.activemq.artemis.core.persistence.impl.journal.XmlDataImporter</code> if the session passed * in uses auto-commit for sends. * <br> * If the session needs to be transactional then use the constructor which takes 2 sessions. * * @param inputStream the stream from which to read the XML for import * @param session used for sending messages, must use auto-commit for sends */ public void process(InputStream inputStream, ClientSession session) throws Exception { this.process(inputStream, session, null); }
@Override public Object execute(ActionContext context) throws Exception { super.execute(context); try { config = getParameterConfiguration(); process(context.out); } catch (Exception e) { treatError(e, "data", "exp"); } return null; }
public void process(OutputStream out) throws Exception { initializeJournal(config); writeOutput(out); cleanup(); }
protected void writeOutput(OutputStream out) throws Exception { XMLOutputFactory factory = XMLOutputFactory.newInstance(); XMLStreamWriter rawXmlWriter = factory.createXMLStreamWriter(out, "UTF-8"); PrettyPrintHandler handler = new PrettyPrintHandler(rawXmlWriter); xmlWriter = (XMLStreamWriter) Proxy.newProxyInstance(XMLStreamWriter.class.getClassLoader(), new Class[]{XMLStreamWriter.class}, handler); exporter = new XMLMessageExporter(xmlWriter); writeXMLData(); }
private void processMessage() throws Exception { XMLMessageImporter.MessageInfo info = messageReader.readMessage(false); if (sort) { messages.add(info); } else { sendMessage(info.queues, info.message, info.tempFile); } }
@Override public synchronized void start() throws Exception { if (writer != null) { writer.getRawXMLWriter().writeStartDocument(XmlDataConstants.XML_VERSION); writer.getRawXMLWriter().writeStartElement(XmlDataConstants.MESSAGES_PARENT); } if (reader != null) { // <messages> reader.getRawXMLReader().nextTag(); } }
private void printSingleMessageAsXML(ICoreMessage message, List<String> queues) throws Exception { exporter.printSingleMessageAsXML(message, queues, false); messagesPrinted++; } /**
@Override public Object execute(ActionContext context) throws Exception { process(input, host, port, transactional); return null; }
/** * This is the normal constructor for programmatic access to the * <code>org.apache.activemq.artemis.core.persistence.impl.journal.XmlDataImporter</code> if the session passed * in uses auto-commit for sends. * <br> * If the session needs to be transactional then use the constructor which takes 2 sessions. * * @param inputStream the stream from which to read the XML for import * @param session used for sending messages, must use auto-commit for sends */ public void process(InputStream inputStream, ClientSession session) throws Exception { this.process(inputStream, session, null); }
public void process(String inputFileName, String host, int port, boolean transactional) throws Exception { try (FileInputStream inputFile = new FileInputStream(inputFileName)) { this.process(inputFile, host, port, transactional); } }