private void writeOut(MessageContext msgContext, Socket socket, String contentType) throws IOException { MessageFormatter messageFormatter = MessageProcessorSelector.getMessageFormatter(msgContext); OMOutputFormat format = BaseUtils.getOMOutputFormat(msgContext); format.setContentType(contentType); byte[] payload = messageFormatter.getBytes(msgContext, format); OutputStream out = socket.getOutputStream(); out.write(payload); out.flush(); }
/** * Creates and instance using the given URL * * @param targetEPR the target EPR */ public RabbitMQOutTransportInfo(String targetEPR) { this.targetEPR = targetEPR; if (!targetEPR.startsWith(RabbitMQConstants.RABBITMQ_PREFIX)) { handleException("Invalid prefix for a RabbitMQ AMQP EPR : " + targetEPR); } else { properties = BaseUtils.getEPRProperties(targetEPR); contentTypeProperty = properties.get(RabbitMQConstants.CONTENT_TYPE_PROPERTY_PARAM); } }
public boolean matches(AxisService service) { return !service.getName().startsWith("__") // these are "private" services && BaseUtils.isUsingTransport(service, pttInDescription.getName()); } },
throws AxisFault, MessagingException, IOException { OMOutputFormat format = BaseUtils.getOMOutputFormat(msgContext); MessageFormatter messageFormatter = BaseUtils.getMessageFormatter(msgContext);
private static QName getWrapperQName(MessageContext msgContext) { QName wrapperQName = BaseConstants.DEFAULT_TEXT_WRAPPER; if (msgContext.getAxisService() != null) { Parameter wrapperParam = msgContext.getAxisService().getParameter(BaseConstants.WRAPPER_PARAM); if (wrapperParam != null) { wrapperQName = BaseUtils.getQNameFromString(wrapperParam.getValue()); } } return wrapperQName; }
throws AxisFault, MessagingException, IOException { OMOutputFormat format = BaseUtils.getOMOutputFormat(msgContext); MessageFormatter messageFormatter = BaseUtils.getMessageFormatter(msgContext);
private static QName getWrapperQName(MessageContext msgContext) { QName wrapperQName = BaseConstants.DEFAULT_TEXT_WRAPPER; if (msgContext.getAxisService() != null) { Parameter wrapperParam = msgContext.getAxisService().getParameter(BaseConstants.WRAPPER_PARAM); if (wrapperParam != null) { wrapperQName = BaseUtils.getQNameFromString(wrapperParam.getValue()); } } return wrapperQName; }
private void writeOut(MessageContext msgContext, Socket socket, String contentType) throws IOException { MessageFormatter messageFormatter = MessageProcessorSelector.getMessageFormatter(msgContext); OMOutputFormat format = BaseUtils.getOMOutputFormat(msgContext); format.setContentType(contentType); OutputStream out = socket.getOutputStream(); messageFormatter.writeTo(msgContext, format, out, false); out.flush(); }
throws AxisFault, MessagingException, IOException { OMOutputFormat format = BaseUtils.getOMOutputFormat(msgContext); MessageFormatter messageFormatter = BaseUtils.getMessageFormatter(msgContext);
/** * Compares two given FIX URL strings. The second URL is considered equal to the * first URL if all the properties in the first URL also exist in the second URL * and if they have equals values. * * @param url1 a FIX URL String * @param url2 a FIX URL String * @return a boolean value */ public static boolean compareURLs(String url1, String url2) { if (!url1.substring(0, url1.indexOf("?")).equals(url2.substring(0, url2.indexOf("?")))) { return false; } else { Hashtable<String,String> properties1 = BaseUtils.getEPRProperties(url1); Hashtable<String, String> properties2 = BaseUtils.getEPRProperties(url2); for (Map.Entry<String,String> entry : properties1.entrySet()) { if (!properties2.containsKey(entry.getKey())) { return false; } else if (!properties1.get(entry.getKey()).equals(entry.getValue())) { return false; } } } return true; }
public boolean matches(AxisService service) { return !service.getName().startsWith("__") // these are "private" services && BaseUtils.isUsingTransport(service, getTransportName()); } },
public OMElement processDocument(DataSource dataSource, String contentType, MessageContext msgContext) throws AxisFault { QName wrapperQName = BaseConstants.DEFAULT_BINARY_WRAPPER; if (msgContext.getAxisService() != null) { Parameter wrapperParam = msgContext.getAxisService().getParameter(BaseConstants.WRAPPER_PARAM); if (wrapperParam != null) { wrapperQName = BaseUtils.getQNameFromString(wrapperParam.getValue()); } } OMFactory factory = OMAbstractFactory.getOMFactory(); OMElement wrapper = factory.createOMElement(wrapperQName, null); DataHandler dataHandler = new DataHandler(dataSource); wrapper.addChild(factory.createOMText(dataHandler, true)); msgContext.setDoingMTOM(true); return wrapper; }
/** * Format the messages when the messages are sent to the kafka broker */ public static String formatMessage( org.apache.axis2.context.MessageContext messageContext) throws AxisFault { OMOutputFormat format = BaseUtils.getOMOutputFormat(messageContext); MessageFormatter messageFormatter = MessageProcessorSelector.getMessageFormatter(messageContext); ; StringWriter stringWriter = new StringWriter(); OutputStream out = new WriterOutputStream(stringWriter, format.getCharSetEncoding()); try { messageFormatter.writeTo(messageContext, format, out, true); } catch (IOException e) { throw new AxisFault("The Error occurs while formatting the message", e); } finally { try { out.close(); } catch (Exception e) { throw new AxisFault("The Error occurs while closing the output stream", e); } } return stringWriter.toString(); } }
/** * Constructs a FIXOutTransportInfo out of a FIX EPR. Reads the parameters in the given * EPR and creates a SessionID out of them * * @param targetEPR a valid FIX EPR */ public FIXOutTransportInfo(String targetEPR) { if (!targetEPR.startsWith(FIXConstants.FIX_PREFIX)) { handleException("Invalid FIX EPR " + targetEPR + ". The EPR prefix must be " + FIXConstants.FIX_PREFIX); } else { Hashtable<String,String> properties = BaseUtils.getEPRProperties(targetEPR); this.sessionID = new SessionID( properties.get(FIXConstants.BEGIN_STRING), properties.get(FIXConstants.SENDER_COMP_ID), properties.get(FIXConstants.SENDER_SUB_ID), properties.get(FIXConstants.SENDER_LOCATION_ID), properties.get(FIXConstants.TARGET_COMP_ID), properties.get(FIXConstants.TARGET_SUB_ID), properties.get(FIXConstants.TARGET_LOCATION_ID), properties.get(FIXConstants.SESSION_QUALIFIER)); this.log = LogFactory.getLog(this.getClass()); } }
public boolean matches(AxisService service) { return !service.getName().startsWith("__") // these are "private" services && BaseUtils.isUsingTransport(service, getTransportName()); } },
public OMElement processDocument(DataSource dataSource, String contentType, MessageContext msgContext) throws AxisFault { QName wrapperQName = BaseConstants.DEFAULT_BINARY_WRAPPER; if (msgContext.getAxisService() != null) { Parameter wrapperParam = msgContext.getAxisService().getParameter(BaseConstants.WRAPPER_PARAM); if (wrapperParam != null) { wrapperQName = BaseUtils.getQNameFromString(wrapperParam.getValue()); } } OMFactory factory = OMAbstractFactory.getOMFactory(); OMElement wrapper = factory.createOMElement(wrapperQName, null); DataHandler dataHandler = new DataHandler(dataSource); wrapper.addChild(factory.createOMText(dataHandler, true)); msgContext.setDoingMTOM(true); return wrapper; }
OMOutputFormat format = BaseUtils.getOMOutputFormat(msgContext); format.setContentType(udpOutInfo.getContentType()); ByteArrayOutputStream out = new ByteArrayOutputStream();
Map<String,String> properties = BaseUtils.getEPRProperties(outFileURI);
public void serviceUpdate(AxisEvent event, AxisService service) { if (!ignoreService(service) && BaseUtils.isUsingTransport(service, sourceConfiguration.getInDescription().getName())) { switch (event.getEventType()) { case AxisEvent.SERVICE_DEPLOY : addToServiceURIMap(service); System.out.println("SERVICE_DEPLOY"); break; case AxisEvent.SERVICE_REMOVE : removeServiceFfromURIMap(service); System.out.println("SERVICE_REMOVE"); break; case AxisEvent.SERVICE_START : addToServiceURIMap(service); System.out.println("SERVICE_START"); break; case AxisEvent.SERVICE_STOP : removeServiceFfromURIMap(service); System.out.println("SERVICE_STOP"); break; } } }
public MessageContext createMessageContext() throws AxisFault { MessageContext msgContext = listener.createMessageContext(); if (service != null) { msgContext.setAxisService(service); // find the operation for the message, or default to one Parameter operationParam = service.getParameter(BaseConstants.OPERATION_PARAM); QName operationQName = ( operationParam != null ? BaseUtils.getQNameFromString(operationParam.getValue()) : BaseConstants.DEFAULT_OPERATION); AxisOperation operation = service.getOperation(operationQName); if (operation != null) { msgContext.setAxisOperation(operation); msgContext.setAxisMessage( operation.getMessage(WSDL2Constants.MESSAGE_LABEL_IN)); msgContext.setSoapAction("urn:" + operation.getName().getLocalPart()); } } return msgContext; } }