@Override public Map<String, Object> getFields(Object o) throws OpenDataException { ActiveMQBytesMessage m = (ActiveMQBytesMessage)o; m.setReadOnlyBody(true); Map<String, Object> rc = super.getFields(o); long length = 0; try { length = m.getBodyLength(); rc.put(CompositeDataConstants.BODY_LENGTH, Long.valueOf(length)); } catch (JMSException e) { rc.put(CompositeDataConstants.BODY_LENGTH, Long.valueOf(0)); } try { byte preview[] = new byte[(int)Math.min(length, 255)]; m.readBytes(preview); m.reset(); // This is whack! Java 1.5 JMX spec does not support primitive // arrays! // In 1.6 it seems it is supported.. but until then... Byte data[] = new Byte[preview.length]; for (int i = 0; i < data.length; i++) { data[i] = new Byte(preview[i]); } rc.put(CompositeDataConstants.BODY_PREVIEW, data); } catch (JMSException e) { rc.put(CompositeDataConstants.BODY_PREVIEW, new Byte[] {}); } return rc; }
/** * Puts the message body in read-only mode and repositions the stream of * bytes to the beginning. * * @throws JMSException if an internal error occurs */ @Override public void reset() throws JMSException { storeContent(); setReadOnlyBody(true); try { if (bytesOut != null) { bytesOut.close(); bytesOut = null; } if (dataIn != null) { dataIn.close(); dataIn = null; } if (dataOut != null) { dataOut.close(); dataOut = null; } } catch (IOException ioe) { throw JMSExceptionSupport.create(ioe); } }
/** * Puts the message body in read-only mode and repositions the stream of * bytes to the beginning. * * @throws JMSException if an internal error occurs */ public void reset() throws JMSException { storeContent(); this.bytesOut = null; this.dataIn = null; this.dataOut = null; setReadOnlyBody(true); }
@Override public Map<String, Object> getFields(Object o) throws OpenDataException { ActiveMQBytesMessage m = (ActiveMQBytesMessage)o; m.setReadOnlyBody(true); Map<String, Object> rc = super.getFields(o); long length = 0; try { length = m.getBodyLength(); rc.put(CompositeDataConstants.BODY_LENGTH, Long.valueOf(length)); } catch (JMSException e) { rc.put(CompositeDataConstants.BODY_LENGTH, Long.valueOf(0)); } try { byte preview[] = new byte[(int)Math.min(length, 255)]; m.readBytes(preview); // This is whack! Java 1.5 JMX spec does not support primitive // arrays! // In 1.6 it seems it is supported.. but until then... Byte data[] = new Byte[preview.length]; for (int i = 0; i < data.length; i++) { data[i] = new Byte(preview[i]); } rc.put(CompositeDataConstants.BODY_PREVIEW, data); } catch (JMSException e) { rc.put(CompositeDataConstants.BODY_PREVIEW, new Byte[] {}); } return rc; }
@Override public Map<String, Object> getFields(Object o) throws OpenDataException { ActiveMQBytesMessage m = (ActiveMQBytesMessage)o; m.setReadOnlyBody(true); Map<String, Object> rc = super.getFields(o); long length = 0; try { length = m.getBodyLength(); rc.put(CompositeDataConstants.BODY_LENGTH, Long.valueOf(length)); } catch (JMSException e) { rc.put(CompositeDataConstants.BODY_LENGTH, Long.valueOf(0)); } try { byte preview[] = new byte[(int)Math.min(length, 255)]; m.readBytes(preview); m.reset(); // This is whack! Java 1.5 JMX spec does not support primitive // arrays! // In 1.6 it seems it is supported.. but until then... Byte data[] = new Byte[preview.length]; for (int i = 0; i < data.length; i++) { data[i] = new Byte(preview[i]); } rc.put(CompositeDataConstants.BODY_PREVIEW, data); } catch (JMSException e) { rc.put(CompositeDataConstants.BODY_PREVIEW, new Byte[] {}); } return rc; }
@Override public Map<String, Object> getFields(Object o) throws OpenDataException { ActiveMQBytesMessage m = (ActiveMQBytesMessage)o; m.setReadOnlyBody(true); Map<String, Object> rc = super.getFields(o); long length = 0; try { length = m.getBodyLength(); rc.put(CompositeDataConstants.BODY_LENGTH, Long.valueOf(length)); } catch (JMSException e) { rc.put(CompositeDataConstants.BODY_LENGTH, Long.valueOf(0)); } try { byte preview[] = new byte[(int)Math.min(length, 255)]; m.readBytes(preview); m.reset(); // This is whack! Java 1.5 JMX spec does not support primitive // arrays! // In 1.6 it seems it is supported.. but until then... Byte data[] = new Byte[preview.length]; for (int i = 0; i < data.length; i++) { data[i] = new Byte(preview[i]); } rc.put(CompositeDataConstants.BODY_PREVIEW, data); } catch (JMSException e) { rc.put(CompositeDataConstants.BODY_PREVIEW, new Byte[] {}); } return rc; }
@Override public Map<String, Object> getFields(Object o) throws OpenDataException { ActiveMQBytesMessage m = (ActiveMQBytesMessage)o; m.setReadOnlyBody(true); Map<String, Object> rc = super.getFields(o); long length = 0; try { length = m.getBodyLength(); rc.put(CompositeDataConstants.BODY_LENGTH, Long.valueOf(length)); } catch (JMSException e) { rc.put(CompositeDataConstants.BODY_LENGTH, Long.valueOf(0)); } try { byte preview[] = new byte[(int)Math.min(length, 255)]; m.readBytes(preview); m.reset(); // This is whack! Java 1.5 JMX spec does not support primitive // arrays! // In 1.6 it seems it is supported.. but until then... Byte data[] = new Byte[preview.length]; for (int i = 0; i < data.length; i++) { data[i] = new Byte(preview[i]); } rc.put(CompositeDataConstants.BODY_PREVIEW, data); } catch (JMSException e) { rc.put(CompositeDataConstants.BODY_PREVIEW, new Byte[] {}); } return rc; }
/** * Puts the message body in read-only mode and repositions the stream of * bytes to the beginning. * * @throws JMSException if an internal error occurs */ @Override public void reset() throws JMSException { storeContent(); setReadOnlyBody(true); try { if (bytesOut != null) { bytesOut.close(); bytesOut = null; } if (dataIn != null) { dataIn.close(); dataIn = null; } if (dataOut != null) { dataOut.close(); dataOut = null; } } catch (IOException ioe) { throw JMSExceptionSupport.create(ioe); } }
/** * Puts the message body in read-only mode and repositions the stream of * bytes to the beginning. * * @throws JMSException if an internal error occurs */ @Override public void reset() throws JMSException { storeContent(); setReadOnlyBody(true); try { if (bytesOut != null) { bytesOut.close(); bytesOut = null; } if (dataIn != null) { dataIn.close(); dataIn = null; } if (dataOut != null) { dataOut.close(); dataOut = null; } } catch (IOException ioe) { throw JMSExceptionSupport.create(ioe); } }
/** * Puts the message body in read-only mode and repositions the stream of * bytes to the beginning. * * @throws JMSException if an internal error occurs */ @Override public void reset() throws JMSException { storeContent(); setReadOnlyBody(true); try { if (bytesOut != null) { bytesOut.close(); bytesOut = null; } if (dataIn != null) { dataIn.close(); dataIn = null; } if (dataOut != null) { dataOut.close(); dataOut = null; } } catch (IOException ioe) { throw JMSExceptionSupport.create(ioe); } }
public StompFrame convertMessage(ProtocolConverter converter, ActiveMQMessage message) throws IOException, JMSException { StompFrame command = new StompFrame(); command.setAction(Stomp.Responses.MESSAGE); Map<String, String> headers = new HashMap<String, String>(25); command.setHeaders(headers); FrameTranslator.Helper.copyStandardHeadersFromMessageToFrame(converter, message, command, this); if (message.getDataStructureType() == ActiveMQTextMessage.DATA_STRUCTURE_TYPE) { ActiveMQTextMessage msg = (ActiveMQTextMessage)message.copy(); command.setContent(msg.getText().getBytes("UTF-8")); } else if (message.getDataStructureType() == ActiveMQBytesMessage.DATA_STRUCTURE_TYPE) { ActiveMQBytesMessage msg = (ActiveMQBytesMessage)message.copy(); msg.setReadOnlyBody(true); byte[] data = new byte[(int)msg.getBodyLength()]; msg.readBytes(data); headers.put(Stomp.Headers.CONTENT_LENGTH, "" + data.length); command.setContent(data); } else if (message.getDataStructureType() == ActiveMQMessage.DATA_STRUCTURE_TYPE && AdvisorySupport.ADIVSORY_MESSAGE_TYPE.equals(message.getType())) { FrameTranslator.Helper.copyStandardHeadersFromMessageToFrame( converter, message, command, this); String body = marshallAdvisory(message.getDataStructure()); command.setContent(body.getBytes("UTF-8")); } return command; }
msg.setReadOnlyBody(true); byte[] data = new byte[(int)msg.getBodyLength()]; msg.readBytes(data);
msg.setReadOnlyBody(true); byte[] data = new byte[(int)msg.getBodyLength()]; msg.readBytes(data);
msg.setReadOnlyBody(true); byte[] data = new byte[(int) msg.getBodyLength()]; msg.readBytes(data);
msg.setReadOnlyBody(true); byte[] data = new byte[(int) msg.getBodyLength()]; msg.readBytes(data);
msg.setReadOnlyBody(true); byte[] data = new byte[(int)msg.getBodyLength()]; msg.readBytes(data);
msg.setReadOnlyBody(true); byte[] data = new byte[(int) msg.getBodyLength()]; msg.readBytes(data);
msg.setReadOnlyBody(true); byte[] data = new byte[(int) msg.getBodyLength()]; msg.readBytes(data);
msg.setReadOnlyBody(true); byte[] data = new byte[(int) msg.getBodyLength()]; msg.readBytes(data);
msg.setReadOnlyBody(true); byte[] data = new byte[(int) msg.getBodyLength()]; msg.readBytes(data);