@Override public Object execute(ActionContext context) throws Exception { process(input, host, port, transactional); return null; }
public void validate(String fileName) throws Exception { try (FileInputStream file = new FileInputStream(fileName)) { validate(file); } }
oldBinding(); // export from 1.x } else if (XmlDataConstants.QUEUE_BINDINGS_CHILD.equals(reader.getLocalName())) { bindQueue(); } else if (XmlDataConstants.ADDRESS_BINDINGS_CHILD.equals(reader.getLocalName())) { bindAddress(); } else if (XmlDataConstants.MESSAGES_CHILD.equals(reader.getLocalName())) { processMessage(); sendMessage(msgtmp.queues, msgtmp.message, msgtmp.tempFile);
XmlDataImporter xmlDataImporter = new XmlDataImporter(); xmlDataImporter.validate(xmlInputStream); xmlInputStream.reset(); xmlDataImporter.process(xmlInputStream, session); session.close();
@Override protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException { if (context.getRunningMode() != NORMAL) { throw MessagingLogger.ROOT_LOGGER.managementOperationAllowedOnlyInRunningMode(OPERATION_NAME, NORMAL); } checkAllowedOnJournal(context, OPERATION_NAME); String file = FILE.resolveModelAttribute(context, operation).asString(); boolean legacyPrefixes = LEGACY_PREFIXES.resolveModelAttribute(context, operation).asBoolean(); final XmlDataImporter importer = new XmlDataImporter(); importer.legacyPrefixes = legacyPrefixes; TransportConfiguration transportConfiguration = createInVMTransportConfiguration(context); try ( InputStream is = new FileInputStream(new File(file)); ServerLocator serverLocator = ActiveMQClient.createServerLocator(false, transportConfiguration); ClientSessionFactory sf = serverLocator.createSessionFactory() ) { ClientSession session = sf.createSession(); importer.process(is, session); } catch (Exception e) { throw new OperationFailedException(e); } }
public void validate(InputStream inputStream) throws Exception { XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(inputStream); SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = factory.newSchema(XmlDataImporter.findResource("schema/artemis-import-export.xsd")); Validator validator = schema.newValidator(); validator.validate(new StAXSource(reader)); reader.close(); }
XmlDataImporter xmlDataImporter = new XmlDataImporter(); xmlDataImporter.validate(xmlInputStream); xmlInputStream.reset(); xmlDataImporter.process(xmlInputStream, session, managementSession);
@Override protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException { if (context.getRunningMode() != NORMAL) { throw MessagingLogger.ROOT_LOGGER.managementOperationAllowedOnlyInRunningMode(OPERATION_NAME, NORMAL); } checkAllowedOnJournal(context, OPERATION_NAME); String file = FILE.resolveModelAttribute(context, operation).asString(); boolean legacyPrefixes = LEGACY_PREFIXES.resolveModelAttribute(context, operation).asBoolean(); final XmlDataImporter importer = new XmlDataImporter(); importer.legacyPrefixes = legacyPrefixes; TransportConfiguration transportConfiguration = createInVMTransportConfiguration(context); try ( InputStream is = new FileInputStream(new File(file)); ServerLocator serverLocator = ActiveMQClient.createServerLocator(false, transportConfiguration); ClientSessionFactory sf = serverLocator.createSessionFactory() ) { ClientSession session = sf.createSession(); importer.process(is, session); } catch (Exception e) { throw new OperationFailedException(e); } }
public void validate(InputStream inputStream) throws Exception { XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(inputStream); SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = factory.newSchema(XmlDataImporter.findResource("schema/artemis-import-export.xsd")); Validator validator = schema.newValidator(); validator.validate(new StAXSource(reader)); reader.close(); }
XmlDataImporter xmlDataImporter = new XmlDataImporter(); xmlDataImporter.validate(xmlInputStream); xmlInputStream.reset(); xmlDataImporter.process(xmlInputStream, session); ClientConsumer consumer = session.createConsumer(QUEUE_NAME); session.start();
/** * 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); }
oldBinding(); // export from 1.x } else if (XmlDataConstants.QUEUE_BINDINGS_CHILD.equals(reader.getLocalName())) { bindQueue(); } else if (XmlDataConstants.ADDRESS_BINDINGS_CHILD.equals(reader.getLocalName())) { bindAddress(); } else if (XmlDataConstants.MESSAGES_CHILD.equals(reader.getLocalName())) { processMessage(); sendMessage(msgtmp.queues, msgtmp.message, msgtmp.tempFile);
public void validate(String file) throws Exception { validate(new FileInputStream(file)); }
XmlDataImporter xmlDataImporter = new XmlDataImporter(); xmlDataImporter.validate(xmlInputStream); xmlInputStream.reset(); xmlDataImporter.process(xmlInputStream, session); ClientConsumer consumer = session.createConsumer(QUEUE_NAME); session.start();
@Override public Object execute(ActionContext context) throws Exception { process(input, host, port, transactional); return null; }
XmlDataImporter xmlDataImporter = new XmlDataImporter(); xmlDataImporter.validate(xmlInputStream); xmlInputStream.reset(); xmlDataImporter.process(xmlInputStream, session, managementSession); ClientConsumer consumer = session.createConsumer(QUEUE_NAME); session.start();
/** * 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); }
XmlDataImporter xmlDataImporter = new XmlDataImporter(); xmlDataImporter.validate(xmlInputStream); xmlInputStream.reset(); xmlDataImporter.process(xmlInputStream, session);
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); } }
XmlDataImporter xmlDataImporter = new XmlDataImporter(); xmlDataImporter.validate(xmlInputStream); xmlInputStream.reset(); xmlDataImporter.process(xmlInputStream, session); consumer = session.createConsumer("myQueue1"); session.start();