Package org.apache.qpid.amqp_1_0.type

Examples of org.apache.qpid.amqp_1_0.type.Symbol


        try
        {
            int startBarePos = -1;
            int lastPos = src.position();
            Section s = decoder.readSection(src);



            if(s instanceof Header)
            {
View Full Code Here


            size = in.getInt();
        }

        BinaryString binaryStr = new BinaryString(in.array(), in.arrayOffset()+in.position(), size);

        Symbol symbolVal = SYMBOL_MAP.get(binaryStr);
        if(symbolVal == null)
        {
            ByteBuffer dup = in.duplicate();
            try
            {
View Full Code Here

        _defaultBinaryString.setData(in.array(), in.arrayOffset()+in.position(), size);

        BinaryString binaryStr = _defaultBinaryString;

        Symbol symbolVal = SYMBOL_MAP.get(binaryStr);
        if(symbolVal == null)
        {
            ByteBuffer dup = in.duplicate();
            try
            {
View Full Code Here

            size = in.getInt();
        }

        BinaryString binaryStr = new BinaryString(in.array(), in.arrayOffset()+in.position(), size);

        Symbol symbolVal = SYMBOL_MAP.get(binaryStr);
        if(symbolVal == null)
        {
            ByteBuffer dup = in.duplicate();
            dup.limit(in.position()+size);
            CharBuffer charBuf = ASCII.decode(dup);
View Full Code Here

            size = in.getInt();
        }

        BinaryString binaryStr = new BinaryString(in.array(), in.arrayOffset()+in.position(), size);

        Symbol symbolVal = SYMBOL_MAP.get(binaryStr);
        if(symbolVal == null)
        {
            ByteBuffer dup = in.duplicate();
            dup.limit(in.position()+size);
            CharBuffer charBuf = ASCII.decode(dup);
View Full Code Here

            }
            else if(bodySection instanceof Data)
            {
                Data dataSection = (Data) bodySection;

                Symbol contentType = properties == null ? null : properties.getContentType();

                if(ObjectMessageImpl.CONTENT_TYPE.equals(contentType))
                {


                    message = new ObjectMessageImpl(header,
                                                    deliveryAnnotations,
                                                    messageAnnotations, properties, appProperties,
                                                    dataSection,
                                                    footer,
                                                    _session);
                }
                else if(contentType != null)
                {
                    ContentType contentTypeObj = parseContentType(contentType.toString());
                    // todo : content encoding - e.g. gzip
                    String contentTypeType = contentTypeObj.getType();
                    String contentTypeSubType = contentTypeObj.getSubType();
                    if ("text".equals(contentTypeType)
                        || ("application".equals(contentTypeType)
View Full Code Here

    public static void main(String[] args) throws AmqpErrorException
    {
        byte[] buffer = new byte[76];
        ByteBuffer buf = ByteBuffer.wrap(buffer);
        AMQPDescribedTypeRegistry registry = AMQPDescribedTypeRegistry.newInstance()
                .registerTransportLayer()
                .registerMessagingLayer()
                .registerTransactionLayer();

        Open open = new Open();
        // Open(container_id="venture", channel_max=10, hostname="foo", offered_capabilities=[Symbol("one"), Symbol("two"), Symbol("three")])
        open.setContainerId("venture");
        open.setChannelMax(UnsignedShort.valueOf((short) 10));
        open.setHostname("foo");
        open.setOfferedCapabilities(new Symbol[] {Symbol.valueOf("one"),Symbol.valueOf("two"),Symbol.valueOf("three")});

        ValueWriter<Open> writer = registry.getValueWriter(open);

        System.out.println("------ Encode (time in ms for 1 million opens)");
        Long myLong = Long.valueOf(32);
        ValueWriter<Long> writer2 = registry.getValueWriter(myLong);
        Double myDouble = Double.valueOf(3.14159265359);
        ValueWriter<Double> writer3 = registry.getValueWriter(myDouble);
        for(int n = 0; n < 1/*00*/; n++)
        {
            long startTime = System.currentTimeMillis();
            for(int i = 1/*000000*/; i !=0; i--)
            {
View Full Code Here

            _draining = true;
        }

        while(!_resumeAcceptedTransfers.isEmpty() && getEndpoint().hasCreditToSend())
        {
            Accepted accepted = new Accepted();
            synchronized(getLock())
            {

                Transfer xfr = new Transfer();
                Binary dt = _resumeAcceptedTransfers.remove(0);
View Full Code Here

            {
                _sender = _session.getClientSession().createSender(_session.toAddress(_destination), new Session.SourceConfigurator()
                {
                    public void configureSource(final Source source)
                    {
                        source.setDefaultOutcome(new Accepted());
                        source.setOutcomes(AcceptedConstructor.SYMBOL_CONSTRUCTOR, RejectedConstructor.SYMBOL_CONSTRUCTOR);
                    }
                });
            }
            catch (Sender.SenderCreationException e)
View Full Code Here

    private static Section convertMessageBody(String mimeType, byte[] data)
    {
        if("text/plain".equals(mimeType) || "text/xml".equals(mimeType))
        {
            String text = new String(data);
            return new AmqpValue(text);
        }
        else if("jms/map-message".equals(mimeType))
        {
            TypedBytesContentReader reader = new TypedBytesContentReader(ByteBuffer.wrap(data));

            LinkedHashMap map = new LinkedHashMap();
            final int entries = reader.readIntImpl();
            for (int i = 0; i < entries; i++)
            {
                try
                {
                    String propName = reader.readStringImpl();
                    Object value = reader.readObject();

                    map.put(propName, value);
                }
                catch (EOFException e)
                {
                    throw new IllegalArgumentException(e);
                }
                catch (TypedBytesFormatException e)
                {
                    throw new IllegalArgumentException(e);
                }

            }

            return new AmqpValue(fixMapValues(map));

        }
        else if("amqp/map".equals(mimeType))
        {
            BBDecoder decoder = new BBDecoder();
            decoder.init(ByteBuffer.wrap(data));
            final Map<String,Object> map = decoder.readMap();

            return new AmqpValue(fixMapValues(map));

        }
        else if("amqp/list".equals(mimeType))
        {
            BBDecoder decoder = new BBDecoder();
            decoder.init(ByteBuffer.wrap(data));
            return new AmqpValue(fixListValues(decoder.readList()));
        }
        else if("jms/stream-message".equals(mimeType))
        {
            TypedBytesContentReader reader = new TypedBytesContentReader(ByteBuffer.wrap(data));

            List list = new ArrayList();
            while (reader.remaining() != 0)
            {
                try
                {
                    list.add(fixValue(reader.readObject()));
                }
                catch (TypedBytesFormatException e)
                {
                    throw new RuntimeException(e)// TODO - Implement
                }
                catch (EOFException e)
                {
                    throw new RuntimeException(e)// TODO - Implement
                }
            }
            return new AmqpValue(list);
        }
        else
        {
            return new Data(new Binary(data));
View Full Code Here

TOP

Related Classes of org.apache.qpid.amqp_1_0.type.Symbol

Copyright © 2018 www.massapicom. 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.