apache-qpid-proton-j-0.34.0-src/0040755 0000000 0000000 00000000000 14303440055 016645 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/.github/0040755 0000000 0000000 00000000000 14303440055 020205 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/.github/workflows/0040755 0000000 0000000 00000000000 14303440055 022242 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/apache-qpid-proton-j/0040755 0000000 0000000 00000000000 14303440055 022567 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/apache-qpid-proton-j/src/0040755 0000000 0000000 00000000000 14303440055 023356 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/apache-qpid-proton-j/src/main/0040755 0000000 0000000 00000000000 14303440055 024302 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/apache-qpid-proton-j/src/main/assembly/0040755 0000000 0000000 00000000000 14303440055 026121 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/0040755 0000000 0000000 00000000000 14303440055 020463 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/engine/0040755 0000000 0000000 00000000000 14303440055 021730 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/engine/src/0040755 0000000 0000000 00000000000 14303440055 022517 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/engine/src/main/0040755 0000000 0000000 00000000000 14303440055 023443 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/0040755 0000000 0000000 00000000000 14303440055 024364 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/0040755 0000000 0000000 00000000000 14303440055 025153 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/0040755 0000000 0000000 00000000000 14303440055 026374 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/0040755 0000000 0000000 00000000000 14303440055 027331 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/0040755 0000000 0000000 00000000000 14303440055 030652 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/examples/0040755 0000000 0000000 00000000000 14303440055 032470 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/0040755 0000000 0000000 00000000000 14303440055 022122 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/0040755 0000000 0000000 00000000000 14303440055 022711 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/0040755 0000000 0000000 00000000000 14303440055 023635 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/0040755 0000000 0000000 00000000000 14303440055 024556 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/0040755 0000000 0000000 00000000000 14303440055 025345 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/0040755 0000000 0000000 00000000000 14303440055 026566 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/0040755 0000000 0000000 00000000000 14303440055 027523 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/0040755 0000000 0000000 00000000000 14303440055 031044 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/0040755 0000000 0000000 00000000000 14303440055 032477 5ustar00rootroot0000000 0000000 ././@LongLink0100644 0000000 0000000 00000000147 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reactor/apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reacto0040755 0000000 0000000 00000000000 14303440055 033675 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/0040755 0000000 0000000 00000000000 14303440055 020415 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/0040755 0000000 0000000 00000000000 14303440055 021204 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/0040755 0000000 0000000 00000000000 14303440055 022130 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/0040755 0000000 0000000 00000000000 14303440055 023051 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/0040755 0000000 0000000 00000000000 14303440055 023640 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/0040755 0000000 0000000 00000000000 14303440055 025061 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/0040755 0000000 0000000 00000000000 14303440055 026016 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/0040755 0000000 0000000 00000000000 14303440055 027337 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/0040755 0000000 0000000 00000000000 14303440055 030275 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/0040755 0000000 0000000 00000000000 14303440055 032252 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/security/0040755 0000000 0000000 00000000000 14303440055 032144 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/0040755 0000000 0000000 00000000000 14303440055 032622 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/0040755 0000000 0000000 00000000000 14303440055 032331 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/0040755 0000000 0000000 00000000000 14303440055 030414 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/0040755 0000000 0000000 00000000000 14303440055 031355 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/0040755 0000000 0000000 00000000000 14303440055 032371 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/security/0040755 0000000 0000000 00000000000 14303440055 032263 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/transaction/0040755 0000000 0000000 00000000000 14303440055 032741 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/transport/0040755 0000000 0000000 00000000000 14303440055 032450 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/engine/0040755 0000000 0000000 00000000000 14303440055 030604 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/0040755 0000000 0000000 00000000000 14303440055 031545 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ssl/0040755 0000000 0000000 00000000000 14303440055 032346 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/framing/0040755 0000000 0000000 00000000000 14303440055 030762 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/logging/0040755 0000000 0000000 00000000000 14303440055 030765 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/message/0040755 0000000 0000000 00000000000 14303440055 030763 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/message/impl/0040755 0000000 0000000 00000000000 14303440055 031724 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/reactor/0040755 0000000 0000000 00000000000 14303440055 030776 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/reactor/impl/0040755 0000000 0000000 00000000000 14303440055 031737 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/0040755 0000000 0000000 00000000000 14303440055 022163 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/0040755 0000000 0000000 00000000000 14303440055 023104 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/org/0040755 0000000 0000000 00000000000 14303440055 023673 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/org/apache/0040755 0000000 0000000 00000000000 14303440055 025114 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/org/apache/qpid/0040755 0000000 0000000 00000000000 14303440055 026051 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/org/apache/qpid/proton/0040755 0000000 0000000 00000000000 14303440055 027372 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/org/apache/qpid/proton/amqp/0040755 0000000 0000000 00000000000 14303440055 030330 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/org/apache/qpid/proton/amqp/messaging/0040755 0000000 0000000 00000000000 14303440055 032305 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/org/apache/qpid/proton/amqp/transport/0040755 0000000 0000000 00000000000 14303440055 032364 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/org/apache/qpid/proton/codec/0040755 0000000 0000000 00000000000 14303440055 030447 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/org/apache/qpid/proton/codec/impl/0040755 0000000 0000000 00000000000 14303440055 031410 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/org/apache/qpid/proton/engine/0040755 0000000 0000000 00000000000 14303440055 030637 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/0040755 0000000 0000000 00000000000 14303440055 031600 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/ssl/0040755 0000000 0000000 00000000000 14303440055 032401 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/org/apache/qpid/proton/message/0040755 0000000 0000000 00000000000 14303440055 031016 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/org/apache/qpid/proton/message/impl/0040755 0000000 0000000 00000000000 14303440055 031757 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/org/apache/qpid/proton/reactor/0040755 0000000 0000000 00000000000 14303440055 031031 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/org/apache/qpid/proton/reactor/impl/0040755 0000000 0000000 00000000000 14303440055 031772 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/org/apache/qpid/proton/systemtests/0040755 0000000 0000000 00000000000 14303440055 032001 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/org/apache/qpid/proton/systemtests/engine/0040755 0000000 0000000 00000000000 14303440055 033246 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/java/org/apache/qpid/proton/test/0040755 0000000 0000000 00000000000 14303440055 030351 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/resources/0040755 0000000 0000000 00000000000 14303440055 024175 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/resources/org/0040755 0000000 0000000 00000000000 14303440055 024764 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/resources/org/apache/0040755 0000000 0000000 00000000000 14303440055 026205 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/resources/org/apache/qpid/0040755 0000000 0000000 00000000000 14303440055 027142 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/resources/org/apache/qpid/proton/0040755 0000000 0000000 00000000000 14303440055 030463 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/resources/org/apache/qpid/proton/engine/0040755 0000000 0000000 00000000000 14303440055 031730 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/resources/org/apache/qpid/proton/engine/impl/0040755 0000000 0000000 00000000000 14303440055 032671 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/test/resources/org/apache/qpid/proton/engine/impl/ssl/0040755 0000000 0000000 00000000000 14303440055 033472 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/0040755 0000000 0000000 00000000000 14303440055 020007 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/interop/0040755 0000000 0000000 00000000000 14303440055 021467 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/java/0040755 0000000 0000000 00000000000 14303440055 020730 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/java/org/0040755 0000000 0000000 00000000000 14303440055 021517 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/java/org/apache/0040755 0000000 0000000 00000000000 14303440055 022740 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/java/org/apache/qpid/0040755 0000000 0000000 00000000000 14303440055 023675 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/java/org/apache/qpid/proton/0040755 0000000 0000000 00000000000 14303440055 025216 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/java/shim/0040755 0000000 0000000 00000000000 14303440055 021670 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/java/shim/binding/0040755 0000000 0000000 00000000000 14303440055 023302 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/java/shim/binding/proton/0040755 0000000 0000000 00000000000 14303440055 024623 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/performance-jmh/0040755 0000000 0000000 00000000000 14303440055 023064 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/performance-jmh/src/0040755 0000000 0000000 00000000000 14303440055 023653 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/performance-jmh/src/main/0040755 0000000 0000000 00000000000 14303440055 024577 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/performance-jmh/src/main/java/0040755 0000000 0000000 00000000000 14303440055 025520 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/performance-jmh/src/main/java/org/0040755 0000000 0000000 00000000000 14303440055 026307 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/performance-jmh/src/main/java/org/apache/0040755 0000000 0000000 00000000000 14303440055 027530 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/performance-jmh/src/main/java/org/apache/qpid/0040755 0000000 0000000 00000000000 14303440055 030465 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/performance-jmh/src/main/java/org/apache/qpid/proton/0040755 0000000 0000000 00000000000 14303440055 032006 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/performance-jmh/src/main/java/org/apache/qpid/proton/codec/0040755 0000000 0000000 00000000000 14303440055 033063 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/performance-jmh/src/main/java/org/apache/qpid/proton/engine/0040755 0000000 0000000 00000000000 14303440055 033253 5ustar00rootroot0000000 0000000 ././@LongLink0100644 0000000 0000000 00000000150 14303440055 011625 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/performance-jmh/src/main/java/org/apache/qpid/proton/engine/impl/apache-qpid-proton-j-0.34.0-src/tests/performance-jmh/src/main/java/org/apache/qpid/proton/engine/im0040755 0000000 0000000 00000000000 14303440055 033601 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/performance-jmh/src/main/java/org/apache/qpid/proton/message/0040755 0000000 0000000 00000000000 14303440055 033432 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/python/0040755 0000000 0000000 00000000000 14303440055 021330 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/python/proton_tests/0040755 0000000 0000000 00000000000 14303440055 024073 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/python/proton_tests/ssl_db/0040755 0000000 0000000 00000000000 14303440055 025341 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/tests/resources/0040755 0000000 0000000 00000000000 14303440055 022021 5ustar00rootroot0000000 0000000 apache-qpid-proton-j-0.34.0-src/.asf.yaml0100644 0000000 0000000 00000001727 14303440055 020364 0ustar00rootroot0000000 0000000 # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # github: description: "Mirror of Apache Qpid Proton-J" homepage: https://qpid.apache.org/proton labels: - qpid - apache - amqp - library - messaging - amqp10 - java apache-qpid-proton-j-0.34.0-src/.github/workflows/build.yml0100644 0000000 0000000 00000001226 14303440055 024062 0ustar00rootroot0000000 0000000 name: "Build" on: [push, pull_request, workflow_dispatch] jobs: build: runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: java: [ 8, 11, 17 ] steps: - uses: actions/checkout@v2 - uses: actions/cache@v2 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- - name: Install JDK ${{ matrix.java }} uses: actions/setup-java@v2 with: java-version: ${{ matrix.java }} distribution: 'temurin' - name: Build run: mvn -B clean verify apache-qpid-proton-j-0.34.0-src/.gitignore0100644 0000000 0000000 00000000461 14303440055 020633 0ustar00rootroot0000000 0000000 # Emacs, vim etc *~ *.swp # Start of IntelliJ IDE files .idea .idea/* *.iml *.ipr *.iws # End of IntelliJ IDE files /build/ *.class *.pyc *.pyo target # MacOS File .DS_Store # Start of Eclipse IDE files .project .classpath .settings .cproject eclipse-classes .pydevproject # End of Eclipse IDE files apache-qpid-proton-j-0.34.0-src/.travis.yml0100644 0000000 0000000 00000000317 14303440055 020754 0ustar00rootroot0000000 0000000 language: java matrix: include: - os: linux jdk: openjdk8 - os: linux jdk: openjdk11 cache: directories: - $HOME/.m2 before_cache: - rm -rf $HOME/.m2/repository/org/apache/qpid/* apache-qpid-proton-j-0.34.0-src/LICENSE0100644 0000000 0000000 00000026137 14303440055 017660 0ustar00rootroot0000000 0000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. apache-qpid-proton-j-0.34.0-src/NOTICE0100644 0000000 0000000 00000000256 14303440055 017551 0ustar00rootroot0000000 0000000 Apache Qpid Proton-J Copyright 2012-2022 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). apache-qpid-proton-j-0.34.0-src/README.md0100644 0000000 0000000 00000001264 14303440055 020124 0ustar00rootroot0000000 0000000 # Apache Qpid Proton-J [![Linux Build Status](https://travis-ci.com/apache/qpid-proton-j.svg?branch=main)](https://travis-ci.com/github/apache/qpid-proton-j) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/wh587qrxa3c22mh2/branch/main?svg=true)](https://ci.appveyor.com/project/ApacheSoftwareFoundation/qpid-proton-j/branch/main) [Qpid Proton-J](https://qpid.apache.org/proton) is a high-performance, lightweight messaging library. It can be used in the widest range of messaging applications, including brokers, clients libraries, routers, bridges, proxies, and more. Please see [https://qpid.apache.org/proton](https://qpid.apache.org/proton) for more information. apache-qpid-proton-j-0.34.0-src/apache-qpid-proton-j/README.md0100644 0000000 0000000 00000000114 14303440055 024037 0ustar00rootroot0000000 0000000 This module is used to produce the Apache Qpid Proton-J release assemblies. apache-qpid-proton-j-0.34.0-src/apache-qpid-proton-j/pom.xml0100644 0000000 0000000 00000007611 14303440055 024106 0ustar00rootroot0000000 0000000 org.apache.qpid proton-j-parent 0.34.0 ../pom.xml 4.0.0 apache-qpid-proton-j pom Apache Qpid Proton-J org.apache.qpid proton-j org.apache.maven.plugins maven-assembly-plugin make-assembly package single src/main/assembly/bin.xml gnu apache-release maven-assembly-plugin make-src-assembly package single src/main/assembly/src.xml gnu net.nicoulaj.maven.plugins checksum-maven-plugin source-release-checksum artifacts post-integration-test SHA-512 src,bin true false true apache-qpid-proton-j-0.34.0-src/apache-qpid-proton-j/src/main/assembly/LICENSE0100644 0000000 0000000 00000026137 14303440055 027134 0ustar00rootroot0000000 0000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. apache-qpid-proton-j-0.34.0-src/apache-qpid-proton-j/src/main/assembly/NOTICE0100644 0000000 0000000 00000000256 14303440055 027025 0ustar00rootroot0000000 0000000 Apache Qpid Proton-J Copyright 2012-2022 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). apache-qpid-proton-j-0.34.0-src/apache-qpid-proton-j/src/main/assembly/bin.xml0100644 0000000 0000000 00000007672 14303440055 027424 0ustar00rootroot0000000 0000000 bin tar.gz apache-qpid-proton-j-${project.version} ${basedir}/src/main/assembly/ ${file.separator} NOTICE LICENSE 0644 0755 /lib false true true org.apache.qpid:proton-j-engine-examples false src examples/engine/src 0644 0755 examples/engine pom.xml 0644 examples/engine drain spout server 0755 true org.apache.qpid:proton-j-reactor-examples false src examples/reactor/src 0644 0755 examples/reactor pom.xml README.md 0644 examples/reactor run 0755 apache-qpid-proton-j-0.34.0-src/apache-qpid-proton-j/src/main/assembly/src.xml0100644 0000000 0000000 00000010135 14303440055 027427 0ustar00rootroot0000000 0000000 src tar.gz apache-qpid-proton-j-${project.version}-src ${project.basedir}/.. ${file.separator} true %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/).*${project.build.directory}.*] %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?maven-eclipse\.xml] %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.project] %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.classpath] %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?[^/]*\.iws] %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.idea(/.*)?] %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?out(/.*)?] %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?[^/]*\.ipr] %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?[^/]*\.iml] %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.settings(/.*)?] %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.externalToolBuilders(/.*)?] %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.deployables(/.*)?] %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.wtpmodules(/.*)?] %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?cobertura\.ser] %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?pom\.xml\.releaseBackup] %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?release\.properties] %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?.*\$py\.class] %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.mailmap] %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.repository(/.*)?] apache-qpid-proton-j-0.34.0-src/appveyor.yml0100644 0000000 0000000 00000001550 14303440055 021233 0ustar00rootroot0000000 0000000 version: '{build}' skip_tags: true clone_depth: 30 environment: JAVA_HOME: C:\Program Files\Java\jdk1.8.0 install: - cmd: SET PATH=%JAVA_HOME%\bin;%PATH% build_script: - mvn clean install -B -DskipTests test_script: - mvn clean install -B on_failure: - ps: | 7z a -r surefire-reports.zip '**\target\surefire-reports\*' Push-AppveyorArtifact surefire-reports.zip -DeploymentName 'Surefire Reports' on_finish: - ps: | $url = "https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)" $wc = New-Object 'System.Net.WebClient' $dirs = Get-ChildItem -Filter surefire-reports -Recurse ForEach ($dir in $dirs) { $files = Get-ChildItem -Path $dir.FullName -Filter TEST-*.xml ForEach ($file in $files) { $wc.UploadFile($url, (Resolve-Path $file.FullName)) } } apache-qpid-proton-j-0.34.0-src/examples/engine/drain0100644 0000000 0000000 00000001575 14303440055 022755 0ustar00rootroot0000000 0000000 #!/bin/bash # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # mvn -q -e exec:java -Dexec.mainClass=org.apache.qpid.proton.examples.Drain -Dexec.args="$*" apache-qpid-proton-j-0.34.0-src/examples/engine/pom.xml0100644 0000000 0000000 00000003352 14303440055 023245 0ustar00rootroot0000000 0000000 org.apache.qpid proton-j-parent 0.34.0 ../../pom.xml 4.0.0 proton-j-engine-examples Proton-J Engine Examples org.apache.qpid proton-j org.apache.maven.plugins maven-deploy-plugin true apache-qpid-proton-j-0.34.0-src/examples/engine/server0100644 0000000 0000000 00000001576 14303440055 023167 0ustar00rootroot0000000 0000000 #!/bin/bash # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # mvn -q -e exec:java -Dexec.mainClass=org.apache.qpid.proton.examples.Server -Dexec.args="$*" apache-qpid-proton-j-0.34.0-src/examples/engine/spout0100644 0000000 0000000 00000001575 14303440055 023032 0ustar00rootroot0000000 0000000 #!/bin/bash # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # mvn -q -e exec:java -Dexec.mainClass=org.apache.qpid.proton.examples.Spout -Dexec.args="$*" ././@LongLink0100644 0000000 0000000 00000000151 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/examples/Drain.javaapache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/examples/Drain.0100644 0000000 0000000 00000007570 14303440055 033534 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.examples; import java.util.ArrayList; import java.util.List; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Collector; import org.apache.qpid.proton.engine.Delivery; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.engine.Link; import org.apache.qpid.proton.engine.Receiver; public class Drain extends BaseHandler { private int count; private boolean block; private int received; private boolean quiet; public Drain(int count, boolean block, boolean quiet) { this.count = count; this.block = block; this.quiet = quiet; } @Override public void onLinkLocalOpen(Event evt) { Link link = evt.getLink(); if (link instanceof Receiver) { Receiver receiver = (Receiver) link; if (block) { receiver.flow(count); } else { receiver.drain(count); } } } @Override public void onLinkFlow(Event evt) { Link link = evt.getLink(); if (link instanceof Receiver) { Receiver receiver = (Receiver) link; if (!receiver.draining()) { receiver.getSession().getConnection().close(); } } } @Override public void onDelivery(Event evt) { Delivery dlv = evt.getDelivery(); if (dlv.getLink() instanceof Receiver) { Receiver receiver = (Receiver) dlv.getLink(); if (!dlv.isPartial()) { byte[] bytes = new byte[dlv.pending()]; receiver.recv(bytes, 0, bytes.length); Message msg = new Message(bytes); if (!quiet) { System.out.println(String.format("Got message: %s", msg)); } received++; dlv.settle(); } if ((received >= count) || (!block && !receiver.draining())) { receiver.getSession().getConnection().close(); } } } @Override public void onConnectionRemoteClose(Event evt) { System.out.println(String.format("Got %s messages", received)); } public static void main(String[] argv) throws Exception { List switches = new ArrayList(); List args = new ArrayList(); for (String s : argv) { if (s.startsWith("-")) { switches.add(s); } else { args.add(s); } } boolean quiet = switches.contains("-q"); String address = args.isEmpty() || !args.get(0).startsWith("/") ? "//localhost" : args.remove(0); int count = args.isEmpty() ? 1 : Integer.parseInt(args.remove(0)); boolean block = switches.contains("-b"); Collector collector = Collector.Factory.create(); Drain drain = new Drain(count, block, quiet); Driver driver = new Driver(collector, drain); Pool pool = new Pool(collector); pool.incoming(address, null); driver.run(); } } ././@LongLink0100644 0000000 0000000 00000000152 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/examples/Driver.javaapache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/examples/Driver0100644 0000000 0000000 00000021215 14303440055 033644 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.examples; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Connection; import org.apache.qpid.proton.engine.Collector; import org.apache.qpid.proton.engine.EndpointState; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.engine.Handler; import org.apache.qpid.proton.engine.Sasl; import org.apache.qpid.proton.engine.Transport; import org.apache.qpid.proton.engine.TransportException; import java.io.IOException; import java.net.InetSocketAddress; import java.net.StandardSocketOptions; import java.nio.ByteBuffer; import java.nio.channels.Selector; import java.nio.channels.SelectionKey; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; import java.util.UUID; /** * Driver * */ public class Driver extends BaseHandler { final private Collector collector; final private Handler[] handlers; final private Selector selector; public Driver(Collector collector, Handler ... handlers) throws IOException { this.collector = collector; this.handlers = handlers; this.selector = Selector.open(); } public void listen(String host, int port) throws IOException { new Acceptor(host, port); } public void run() throws IOException { while (true) { processEvents(); // I don't know if there is a better way to do this, but // the only way canceled selection keys are removed from // the key set is via a select operation, so we do this // first to figure out whether we should exit. Without // this we would block indefinitely when there are only // cancelled keys remaining. selector.selectNow(); if (selector.keys().isEmpty()) { selector.close(); return; } selector.selectedKeys().clear(); selector.select(); for (SelectionKey key : selector.selectedKeys()) { Selectable selectable = (Selectable) key.attachment(); selectable.selected(); } } } public void processEvents() { while (true) { Event ev = collector.peek(); if (ev == null) break; ev.dispatch(this); for (Handler h : handlers) { ev.dispatch(h); } collector.pop(); } } @Override public void onTransport(Event evt) { Transport transport = evt.getTransport(); ChannelHandler ch = (ChannelHandler) transport.getContext(); ch.selected(); } @Override public void onConnectionLocalOpen(Event evt) { Connection conn = evt.getConnection(); if (conn.getRemoteState() == EndpointState.UNINITIALIZED) { // Give the connection a [random] container-id conn.setContainer(UUID.randomUUID().toString()); try { new Connector(conn); } catch (IOException e) { throw new RuntimeException(e); } } } private interface Selectable { void selected() throws IOException; } private class Acceptor implements Selectable { final private ServerSocketChannel socket; final private SelectionKey key; Acceptor(String host, int port) throws IOException { socket = ServerSocketChannel.open(); socket.configureBlocking(false); socket.bind(new InetSocketAddress(host, port)); socket.setOption(StandardSocketOptions.SO_REUSEADDR, true); key = socket.register(selector, SelectionKey.OP_ACCEPT, this); } public void selected() throws IOException { SocketChannel sock = socket.accept(); System.out.println("ACCEPTED: " + sock); Connection conn = Connection.Factory.create(); conn.collect(collector); Transport transport = Transport.Factory.create(); Sasl sasl = transport.sasl(); sasl.setMechanisms("ANONYMOUS"); sasl.server(); sasl.done(Sasl.PN_SASL_OK); transport.bind(conn); new ChannelHandler(sock, SelectionKey.OP_READ, transport); } } private class ChannelHandler implements Selectable { final SocketChannel socket; final SelectionKey key; final Transport transport; ChannelHandler(SocketChannel socket, int ops, Transport transport) throws IOException { this.socket = socket; socket.configureBlocking(false); key = socket.register(selector, ops, this); this.transport = transport; transport.setContext(this); } boolean update() { if (socket.isConnected()) { int c = transport.capacity(); int p = transport.pending(); if (key.isValid()) { key.interestOps((c != 0 ? SelectionKey.OP_READ : 0) | (p > 0 ? SelectionKey.OP_WRITE : 0)); } if (c < 0 && p < 0) { return true; } else { return false; } } else { return false; } } public void selected() { if (!key.isValid()) { return; } try { if (key.isConnectable()) { System.out.println("CONNECTED: " + socket); socket.finishConnect(); } if (key.isReadable()) { int c = transport.capacity(); if (c > 0) { ByteBuffer tail = transport.tail(); int n = socket.read(tail); if (n > 0) { try { transport.process(); } catch (TransportException e) { e.printStackTrace(); } } else if (n < 0) { transport.close_tail(); } } } if (key.isWritable()) { int p = transport.pending(); if (p > 0) { ByteBuffer head = transport.head(); int n = socket.write(head); if (n > 0) { transport.pop(n); } else if (n < 0) { transport.close_head(); } } } if (update()) { transport.unbind(); System.out.println("CLOSING: " + socket); socket.close(); } } catch (IOException e) { transport.unbind(); System.out.println(String.format("CLOSING(%s): %s", e, socket)); try { socket.close(); } catch (IOException e2) { throw new RuntimeException(e2); } } } } private static Transport makeTransport(Connection conn) { Transport transport = Transport.Factory.create(); Sasl sasl = transport.sasl(); sasl.setMechanisms("ANONYMOUS"); sasl.client(); transport.bind(conn); return transport; } private class Connector extends ChannelHandler { Connector(Connection conn) throws IOException { super(SocketChannel.open(), SelectionKey.OP_CONNECT, makeTransport(conn)); System.out.println("CONNECTING: " + conn.getHostname()); socket.connect(new InetSocketAddress(conn.getHostname(), 5672)); } } } ././@LongLink0100644 0000000 0000000 00000000162 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/examples/FlowController.javaapache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/examples/FlowCo0100644 0000000 0000000 00000004127 14303440055 033605 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.examples; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Delivery; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.engine.Link; import org.apache.qpid.proton.engine.Receiver; /** * FlowController * */ public class FlowController extends BaseHandler { final private int window; public FlowController(int window) { this.window = window; } private void topUp(Receiver rcv) { int delta = window - rcv.getCredit(); rcv.flow(delta); } @Override public void onLinkLocalOpen(Event evt) { Link link = evt.getLink(); if (link instanceof Receiver) { topUp((Receiver) link); } } @Override public void onLinkRemoteOpen(Event evt) { Link link = evt.getLink(); if (link instanceof Receiver) { topUp((Receiver) link); } } @Override public void onLinkFlow(Event evt) { Link link = evt.getLink(); if (link instanceof Receiver) { topUp((Receiver) link); } } @Override public void onDelivery(Event evt) { Link link = evt.getLink(); if (link instanceof Receiver) { topUp((Receiver) link); } } } ././@LongLink0100644 0000000 0000000 00000000156 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/examples/Handshaker.javaapache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/examples/Handsh0100644 0000000 0000000 00000005021 14303440055 033613 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.examples; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Connection; import org.apache.qpid.proton.engine.EndpointState; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.engine.Link; import org.apache.qpid.proton.engine.Session; /** * Handshaker * */ public class Handshaker extends BaseHandler { @Override public void onConnectionRemoteOpen(Event evt) { Connection conn = evt.getConnection(); if (conn.getLocalState() == EndpointState.UNINITIALIZED) { conn.open(); } } @Override public void onSessionRemoteOpen(Event evt) { Session ssn = evt.getSession(); if (ssn.getLocalState() == EndpointState.UNINITIALIZED) { ssn.open(); } } @Override public void onLinkRemoteOpen(Event evt) { Link link = evt.getLink(); if (link.getLocalState() == EndpointState.UNINITIALIZED) { link.setSource(link.getRemoteSource()); link.setTarget(link.getRemoteTarget()); link.open(); } } @Override public void onConnectionRemoteClose(Event evt) { Connection conn = evt.getConnection(); if (conn.getLocalState() != EndpointState.CLOSED) { conn.close(); } } @Override public void onSessionRemoteClose(Event evt) { Session ssn = evt.getSession(); if (ssn.getLocalState() != EndpointState.CLOSED) { ssn.close(); } } @Override public void onLinkRemoteClose(Event evt) { Link link = evt.getLink(); if (link.getLocalState() != EndpointState.CLOSED) { link.close(); } } } ././@LongLink0100644 0000000 0000000 00000000153 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/examples/Message.javaapache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/examples/Messag0100644 0000000 0000000 00000004365 14303440055 033637 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.examples; import java.nio.ByteBuffer; import java.util.Arrays; /** * Message * */ public class Message { private final byte[] bytes; /** * These bytes are expected to be AMQP encoded. */ public Message(byte[] bytes) { this.bytes = bytes; } private static final byte[] PREFIX = {(byte)0x00, (byte)0x53, (byte)0x77, (byte)0xb1}; private static byte[] encodeString(String string) { byte[] utf8 = string.getBytes(); byte[] result = new byte[PREFIX.length + 4 + utf8.length]; ByteBuffer bbuf = ByteBuffer.wrap(result); bbuf.put(PREFIX); bbuf.putInt(utf8.length); bbuf.put(utf8); return result; } public Message(String string) { // XXX: special case string encoding for now this(encodeString(string)); } public byte[] getBytes() { return bytes; } public String toString() { StringBuilder bld = new StringBuilder(); bld.append("Message("); for (byte b : bytes) { if (b >= 32 && b < 127) { bld.append((char) b); } else { bld.append("\\x"); String hex = Integer.toHexString(0xFF & b); if (hex.length() < 2) { bld.append("0"); } bld.append(hex); } } bld.append(')'); return bld.toString(); } } ././@LongLink0100644 0000000 0000000 00000000150 14303440055 011625 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/examples/Pool.javaapache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/examples/Pool.j0100644 0000000 0000000 00000012101 14303440055 033544 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.examples; import org.apache.qpid.proton.engine.Collector; import org.apache.qpid.proton.engine.Connection; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.engine.Session; import org.apache.qpid.proton.engine.Link; import org.apache.qpid.proton.engine.Sender; import org.apache.qpid.proton.engine.Receiver; import org.apache.qpid.proton.amqp.messaging.Source; import org.apache.qpid.proton.amqp.messaging.Target; import java.util.HashMap; import java.util.Map; /** * Pool * */ public class Pool { final private Collector collector; final private Map connections; final private LinkConstructor outgoingConstructor = new LinkConstructor () { public Sender create(Session ssn, String remote, String local) { return newOutgoing(ssn, remote, local); } }; final private LinkConstructor incomingConstructor = new LinkConstructor () { public Receiver create(Session ssn, String remote, String local) { return newIncoming(ssn, remote, local); } }; final private LinkResolver outgoingResolver; final private LinkResolver incomingResolver; public Pool(Collector collector, final Router router) { this.collector = collector; connections = new HashMap(); if (router != null) { outgoingResolver = new LinkResolver() { public Sender resolve(String address) { return router.getOutgoing(address).choose(); } }; incomingResolver = new LinkResolver() { public Receiver resolve(String address) { return router.getIncoming(address).choose(); } }; } else { outgoingResolver = new LinkResolver() { public Sender resolve(String address) { return null; } }; incomingResolver = new LinkResolver() { public Receiver resolve(String address) { return null; } }; } } public Pool(Collector collector) { this(collector, null); } private T resolve(String remote, String local, LinkResolver resolver, LinkConstructor constructor) { String host = remote.substring(2).split("/", 2)[0]; T link = resolver.resolve(remote); if (link == null) { Connection conn = connections.get(host); if (conn == null) { conn = Connection.Factory.create(); conn.collect(collector); conn.setHostname(host); conn.open(); connections.put(host, conn); } Session ssn = conn.session(); ssn.open(); link = constructor.create(ssn, remote, local); link.open(); } return link; } public Sender outgoing(String target, String source) { return resolve(target, source, outgoingResolver, outgoingConstructor); } public Receiver incoming(String source, String target) { return resolve(source, target, incomingResolver, incomingConstructor); } public Sender newOutgoing(Session ssn, String remote, String local) { Sender snd = ssn.sender(String.format("%s-%s", local, remote)); Source src = new Source(); src.setAddress(local); snd.setSource(src); Target tgt = new Target(); tgt.setAddress(remote); snd.setTarget(tgt); return snd; } public Receiver newIncoming(Session ssn, String remote, String local) { Receiver rcv = ssn.receiver(String.format("%s-%s", remote, local)); Source src = new Source(); src.setAddress(remote); rcv.setSource(src); Target tgt = new Target(); tgt.setAddress(remote); rcv.setTarget(tgt); return rcv; } public static interface LinkConstructor { T create(Session session, String remote, String local); } public static interface LinkResolver { T resolve(String remote); } } ././@LongLink0100644 0000000 0000000 00000000152 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/examples/Router.javaapache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/examples/Router0100644 0000000 0000000 00000012144 14303440055 033672 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.examples; import org.apache.qpid.proton.amqp.transport.Source; import org.apache.qpid.proton.amqp.transport.Target; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.engine.Link; import org.apache.qpid.proton.engine.Receiver; import org.apache.qpid.proton.engine.Sender; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ThreadLocalRandom; /** * Router * */ public class Router extends BaseHandler { public static class Routes { List routes = new ArrayList(); void add(T route) { routes.add(route); } void remove(T route) { routes.remove(route); } int size() { return routes.size(); } public T choose() { if (routes.isEmpty()) { return null; } ThreadLocalRandom rand = ThreadLocalRandom.current(); int idx = rand.nextInt(0, routes.size()); return routes.get(idx); } } private static final Routes EMPTY_OUT = new Routes(); private static final Routes EMPTY_IN = new Routes(); final private Map> outgoing = new HashMap>(); final private Map> incoming = new HashMap>(); public Router() {} private String getAddress(Source source) { if (source == null) { return null; } else { return source.getAddress(); } } private String getAddress(Target target) { if (target == null) { return null; } else { return target.getAddress(); } } public String getAddress(Sender snd) { String source = getAddress(snd.getSource()); String target = getAddress(snd.getTarget()); return source != null ? source : target; } public String getAddress(Receiver rcv) { return getAddress(rcv.getTarget()); } public Routes getOutgoing(String address) { Routes routes = outgoing.get(address); if (routes == null) { return EMPTY_OUT; } return routes; } public Routes getIncoming(String address) { Routes routes = incoming.get(address); if (routes == null) { return EMPTY_IN; } return routes; } private void add(Sender snd) { String address = getAddress(snd); Routes routes = outgoing.get(address); if (routes == null) { routes = new Routes(); outgoing.put(address, routes); } routes.add(snd); } private void remove(Sender snd) { String address = getAddress(snd); Routes routes = outgoing.get(address); if (routes != null) { routes.remove(snd); if (routes.size() == 0) { outgoing.remove(address); } } } private void add(Receiver rcv) { String address = getAddress(rcv); Routes routes = incoming.get(address); if (routes == null) { routes = new Routes(); incoming.put(address, routes); } routes.add(rcv); } private void remove(Receiver rcv) { String address = getAddress(rcv); Routes routes = incoming.get(address); if (routes != null) { routes.remove(rcv); if (routes.size() == 0) { incoming.remove(address); } } } private void add(Link link) { if (link instanceof Sender) { add((Sender) link); } else { add((Receiver) link); } } private void remove(Link link) { if (link instanceof Sender) { remove((Sender) link); } else { remove((Receiver) link); } } @Override public void onLinkLocalOpen(Event evt) { add(evt.getLink()); } @Override public void onLinkLocalClose(Event evt) { remove(evt.getLink()); } @Override public void onLinkFinal(Event evt) { remove(evt.getLink()); } } ././@LongLink0100644 0000000 0000000 00000000152 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/examples/Server.javaapache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/examples/Server0100644 0000000 0000000 00000012704 14303440055 033662 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.examples; import org.apache.qpid.proton.amqp.messaging.Accepted; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Collector; import org.apache.qpid.proton.engine.Delivery; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.engine.Link; import org.apache.qpid.proton.engine.Receiver; import org.apache.qpid.proton.engine.Sender; import java.io.IOException; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Deque; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Server * */ public class Server extends BaseHandler { private class MessageStore { Map> messages = new HashMap>(); void put(String address, Message message) { Deque queue = messages.get(address); if (queue == null) { queue = new ArrayDeque(); messages.put(address, queue); } queue.add(message); } Message get(String address) { Deque queue = messages.get(address); if (queue == null) { return null; } Message msg = queue.remove(); if (queue.isEmpty()) { messages.remove(address); } return msg; } } final private MessageStore messages = new MessageStore(); final private Router router; private boolean quiet; private int tag = 0; public Server(Router router, boolean quiet) { this.router = router; this.quiet = quiet; } private byte[] nextTag() { return String.format("%s", tag++).getBytes(); } private int send(String address) { return send(address, null); } private int send(String address, Sender snd) { if (snd == null) { Router.Routes routes = router.getOutgoing(address); snd = routes.choose(); if (snd == null) { return 0; } } int count = 0; while (snd.getCredit() > 0 && snd.getQueued() < 1024) { Message msg = messages.get(address); if (msg == null) { snd.drained(); return count; } Delivery dlv = snd.delivery(nextTag()); byte[] bytes = msg.getBytes(); snd.send(bytes, 0, bytes.length); dlv.settle(); count++; if (!quiet) { System.out.println(String.format("Sent message(%s): %s", address, msg)); } } return count; } @Override public void onLinkFlow(Event evt) { Link link = evt.getLink(); if (link instanceof Sender) { Sender snd = (Sender) link; send(router.getAddress(snd), snd); } } @Override public void onDelivery(Event evt) { Delivery dlv = evt.getDelivery(); Link link = dlv.getLink(); if (link instanceof Sender) { dlv.settle(); } else { Receiver rcv = (Receiver) link; if (!dlv.isPartial()) { byte[] bytes = new byte[dlv.pending()]; rcv.recv(bytes, 0, bytes.length); String address = router.getAddress(rcv); Message message = new Message(bytes); messages.put(address, message); dlv.disposition(Accepted.getInstance()); dlv.settle(); if (!quiet) { System.out.println(String.format("Got message(%s): %s", address, message)); } send(address); } } } public static final void main(String[] argv) throws IOException { List switches = new ArrayList(); List args = new ArrayList(); for (String s : argv) { if (s.startsWith("-")) { switches.add(s); } else { args.add(s); } } boolean quiet = switches.contains("-q"); String host = !args.isEmpty() && !Character.isDigit(args.get(0).charAt(0)) ? args.remove(0) : "localhost"; int port = !args.isEmpty() ? Integer.parseInt(args.remove(0)) : 5672; Collector collector = Collector.Factory.create(); Router router = new Router(); Driver driver = new Driver(collector, new Handshaker(), new FlowController(1024), router, new Server(router, quiet)); driver.listen(host, port); driver.run(); } } ././@LongLink0100644 0000000 0000000 00000000151 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/examples/Spout.javaapache-qpid-proton-j-0.34.0-src/examples/engine/src/main/java/org/apache/qpid/proton/examples/Spout.0100644 0000000 0000000 00000007301 14303440055 033601 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.examples; import java.util.ArrayList; import java.util.List; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Collector; import org.apache.qpid.proton.engine.Connection; import org.apache.qpid.proton.engine.Delivery; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.engine.Link; import org.apache.qpid.proton.engine.Sender; public class Spout extends BaseHandler { private int count; private int sent; private int settled; private boolean quiet; public Spout(int count, boolean quiet) { this.count = count; this.quiet = quiet; } @Override public void onLinkFlow(Event evt) { Link link = evt.getLink(); if (link instanceof Sender) { Sender sender = (Sender) link; while ((sent < count) && sender.getCredit() > 0) { Delivery dlv = sender.delivery(String.format("spout-%s", sent).getBytes()); Message msg = new Message(String.format("Hello World! [%s]", sent)); byte[] bytes = msg.getBytes(); sender.send(bytes, 0, bytes.length); sender.advance(); if (!quiet) { System.out.println(String.format("Sent %s to %s: %s", new String(dlv.getTag()), sender.getTarget().getAddress(), msg)); } sent++; } } } @Override public void onDelivery(Event evt) { Delivery dlv = evt.getDelivery(); if (dlv.remotelySettled()) { if (!quiet) { System.out.println(String.format("Settled %s: %s", new String(dlv.getTag()), dlv.getRemoteState())); } dlv.settle(); settled++; } if (settled >= count) { dlv.getLink().getSession().getConnection().close(); } } @Override public void onConnectionRemoteClose(Event evt) { System.out.println("settled: " + settled); } public static void main(String[] argv) throws Exception { List switches = new ArrayList(); List args = new ArrayList(); for (String s : argv) { if (s.startsWith("-")) { switches.add(s); } else { args.add(s); } } boolean quiet = switches.contains("-q"); String address = !args.isEmpty() && args.get(0).startsWith("/") ? args.remove(0) : "//localhost"; int count = !args.isEmpty() ? Integer.parseInt(args.remove(0)) : 1; Collector collector = Collector.Factory.create(); Spout spout = new Spout(count, quiet); Driver driver = new Driver(collector, spout); Pool pool = new Pool(collector); pool.outgoing(address, null); driver.run(); } } apache-qpid-proton-j-0.34.0-src/examples/reactor/README.md0100644 0000000 0000000 00000004670 14303440055 023405 0ustar00rootroot0000000 0000000 The Reactor API provides a means to dispatch events occurring across one or more connections. It can be used purely as a dispatch tool alongside your own I/O mechanism, however by default it is configured with a handler that provides I/O for you. When programming with the reactor it is important to understand the dispatch model used to process events. Every event is associated with a context object, i.e. the *target* object upon which the event occurred. These objects are contained either directly or indirectly within the Reactor: Delivery --> Link --> Session --> Connection --+ | Task --+--> Reactor | Selectable --+ Each event is dispatched first to a target-specific handler, and second to a global handler. The target-specific handler for an event is located by searching from the event context up through the hierarchy (terminating with the Reactor) and retrieving the most specific handler found. This means that any handler set on the Reactor could receive events targeting any object. For example if no handlers are associated with a Connection or any of its child objects, then the Reactor's handler will receive all the events for that Connection. Putting a handler on any child, e.g. a Connection or Session or Link will prevent any handlers set on the ancestors of that object from seeing any events targeted for that object or its children unless that handler specifically chooses to delegate those events up to the parent, e.g. by overriding onUnhandled and delegating. The global handler (used to dispatch all events after the target-specific handler is invoked) can be accessed and modified using Reactor.set/getGlobalHandler. This can be useful for a number of reasons, e.g. you could log all events by doing this: reactor.getGlobalHandler().add(new LoggerHandler()); Where LoggerHandler does this: public void onUnhandled(Event evt) { System.out.println(evt); } The above trick is particularly useful for debugging. Handlers themselves can have child handlers which will automatically delegate the event to those children *after* dispatching the event to itself. The default global handler is what provides the default I/O behavior of the reactor. To use the reactor as a pure dispatch mechanism you can simply set the global handler to null. apache-qpid-proton-j-0.34.0-src/examples/reactor/pom.xml0100644 0000000 0000000 00000003354 14303440055 023441 0ustar00rootroot0000000 0000000 org.apache.qpid proton-j-parent 0.34.0 ../../pom.xml 4.0.0 proton-j-reactor-examples Proton-J Reactor Examples org.apache.qpid proton-j org.apache.maven.plugins maven-deploy-plugin true apache-qpid-proton-j-0.34.0-src/examples/reactor/run0100644 0000000 0000000 00000001627 14303440055 022654 0ustar00rootroot0000000 0000000 #!/bin/bash # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # CLASS=$1 shift mvn -q -e exec:java -Dexec.mainClass=org.apache.qpid.proton.example.reactor.${CLASS} -Dexec.args="$*" ././@LongLink0100644 0000000 0000000 00000000157 14303440055 011634 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reactor/Cat.javaapache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reacto0100644 0000000 0000000 00000007062 14303440055 033701 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.example.reactor; import java.io.FileInputStream; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.Pipe.SourceChannel; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.reactor.Reactor; import org.apache.qpid.proton.reactor.Selectable; public class Cat extends BaseHandler { private class EchoHandler extends BaseHandler { @Override public void onSelectableInit(Event event) { Selectable selectable = event.getSelectable(); // We can configure a selectable with any SelectableChannel we want. selectable.setChannel(channel); // Ask to be notified when the channel is readable selectable.setReading(true); event.getReactor().update(selectable); } @Override public void onSelectableReadable(Event event) { Selectable selectable = event.getSelectable(); // The onSelectableReadable event tells us that there is data // to be read, or the end of stream has been reached. SourceChannel channel = (SourceChannel)selectable.getChannel(); ByteBuffer buffer = ByteBuffer.allocate(1024); try { while(true) { int amount = channel.read(buffer); if (amount < 0) { selectable.terminate(); selectable.getReactor().update(selectable); } if (amount <= 0) break; System.out.write(buffer.array(), 0, buffer.position()); buffer.clear(); } } catch(IOException ioException) { ioException.printStackTrace(); selectable.terminate(); selectable.getReactor().update(selectable); } } } private final SourceChannel channel; private Cat(SourceChannel channel) { this.channel = channel; } @Override public void onReactorInit(Event event) { Reactor reactor = event.getReactor(); Selectable selectable = reactor.selectable(); setHandler(selectable, new EchoHandler()); reactor.update(selectable); } public static void main(String[] args) throws IOException { if (args.length != 1) { System.err.println("Specify a file name as an argument."); System.exit(1); } FileInputStream inFile = new FileInputStream(args[0]); SourceChannel inChannel = EchoInputStreamWrapper.wrap(inFile); Reactor reactor = Proton.reactor(new Cat(inChannel)); reactor.run(); } } ././@LongLink0100644 0000000 0000000 00000000171 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reactor/CountRandomly.javaapache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reacto0100644 0000000 0000000 00000007152 14303440055 033701 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.example.reactor; import java.io.IOException; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.reactor.Reactor; // Let's try to modify our counter example. In addition to counting to // 10 in quarter second intervals, let's also print out a random number // every half second. This is not a super easy thing to express in a // purely sequential program, but not so difficult using events. public class CountRandomly extends BaseHandler { private long startTime; private CounterHandler counter; class CounterHandler extends BaseHandler { private final int limit; private int count; CounterHandler(int limit) { this.limit = limit; } @Override public void onTimerTask(Event event) { count += 1; System.out.println(count); if (!done()) { event.getReactor().schedule(250, this); } } // Provide a method to check for doneness private boolean done() { return count >= limit; } } @Override public void onReactorInit(Event event) { startTime = System.currentTimeMillis(); System.out.println("Hello, World!"); // Save the counter instance in an attribute so we can refer to // it later. counter = new CounterHandler(10); event.getReactor().schedule(250, counter); // Now schedule another event with a different handler. Note // that the timer tasks go to separate handlers, and they don't // interfere with each other. event.getReactor().schedule(500, this); } @Override public void onTimerTask(Event event) { // keep on shouting until we are done counting System.out.println("Yay, " + Math.round(Math.abs((Math.random() * 110) - 10))); if (!counter.done()) { event.getReactor().schedule(500, this); } } @Override public void onReactorFinal(Event event) { long elapsedTime = System.currentTimeMillis() - startTime; System.out.println("Goodbye, World! (after " + elapsedTime + " long milliseconds)"); } public static void main(String[] args) throws IOException { // In HelloWorld.java we said the reactor exits when there are no more // events to process. While this is true, it's not actually complete. // The reactor exits when there are no more events to process and no // possibility of future events arising. For that reason the reactor // will keep running until there are no more scheduled events and then // exit. Reactor reactor = Proton.reactor(new CountRandomly()); reactor.run(); } } ././@LongLink0100644 0000000 0000000 00000000163 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reactor/Counter.javaapache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reacto0100644 0000000 0000000 00000005726 14303440055 033706 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.example.reactor; import java.io.IOException; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.reactor.Reactor; public class Counter extends BaseHandler { private long startTime; class CounterHandler extends BaseHandler { private final int limit; private int count; CounterHandler(int limit) { this.limit = limit; } @Override public void onTimerTask(Event event) { count += 1; System.out.println(count); if (count < limit) { // A recurring task can be accomplished by just scheduling // another event. event.getReactor().schedule(250, this); } } } @Override public void onReactorInit(Event event) { startTime = System.currentTimeMillis(); System.out.println("Hello, World!"); // Note that unlike the previous scheduling example, we pass in // a separate object for the handler. This means that the timer // event we just scheduled will not be seen by the Counter // implementation of BaseHandler as it is being handled by the // CounterHandler instance we create. event.getReactor().schedule(250, new CounterHandler(10)); } @Override public void onReactorFinal(Event event) { long elapsedTime = System.currentTimeMillis() - startTime; System.out.println("Goodbye, World! (after " + elapsedTime + " long milliseconds)"); } public static void main(String[] args) throws IOException { // In HelloWorld.java we said the reactor exits when there are no more // events to process. While this is true, it's not actually complete. // The reactor exits when there are no more events to process and no // possibility of future events arising. For that reason the reactor // will keep running until there are no more scheduled events and then // exit. Reactor reactor = Proton.reactor(new Counter()); reactor.run(); } } ././@LongLink0100644 0000000 0000000 00000000165 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reactor/Delegates.javaapache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reacto0100644 0000000 0000000 00000004144 14303440055 033677 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.example.reactor; import java.io.IOException; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.engine.Handler; import org.apache.qpid.proton.reactor.Reactor; // Events know how to dispatch themselves to handlers. By combining // this with on_unhandled, you can provide a kind of inheritance /// between handlers using delegation. public class Delegates extends BaseHandler { private final Handler[] handlers; static class Hello extends BaseHandler { @Override public void onReactorInit(Event e) { System.out.println("Hello, World!"); } } static class Goodbye extends BaseHandler { @Override public void onReactorFinal(Event e) { System.out.println("Goodbye, World!"); } } public Delegates(Handler... handlers) { this.handlers = handlers; } @Override public void onUnhandled(Event event) { for (Handler handler : handlers) { event.dispatch(handler); } } public static void main(String[] args) throws IOException { Reactor reactor = Proton.reactor(new Delegates(new Hello(), new Goodbye())); reactor.run(); } } ././@LongLink0100644 0000000 0000000 00000000160 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reactor/Echo.javaapache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reacto0100644 0000000 0000000 00000007214 14303440055 033700 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.example.reactor; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.Pipe.SourceChannel; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.reactor.Reactor; import org.apache.qpid.proton.reactor.Selectable; public class Echo extends BaseHandler { private class EchoHandler extends BaseHandler { @Override public void onSelectableInit(Event event) { Selectable selectable = event.getSelectable(); // We can configure a selectable with any SelectableChannel we want. selectable.setChannel(channel); // Ask to be notified when the channel is readable selectable.setReading(true); event.getReactor().update(selectable); } @Override public void onSelectableReadable(Event event) { Selectable selectable = event.getSelectable(); // The onSelectableReadable event tells us that there is data // to be read, or the end of stream has been reached. SourceChannel channel = (SourceChannel)selectable.getChannel(); ByteBuffer buffer = ByteBuffer.allocate(1024); try { while(true) { int amount = channel.read(buffer); if (amount < 0) { selectable.terminate(); selectable.getReactor().update(selectable); } if (amount <= 0) break; System.out.write(buffer.array(), 0, buffer.position()); buffer.clear(); } } catch(IOException ioException) { ioException.printStackTrace(); selectable.terminate(); selectable.getReactor().update(selectable); } } } private final SourceChannel channel; private Echo(SourceChannel channel) { this.channel = channel; } @Override public void onReactorInit(Event event) { // Every selectable is a possible source of future events. Our // selectable stays alive until it reads the end of stream // marker. This will keep the whole reactor running until we // type Control-D. System.out.println("Type whatever you want and then use Control-D to exit:"); Reactor reactor = event.getReactor(); Selectable selectable = reactor.selectable(); setHandler(selectable, new EchoHandler()); reactor.update(selectable); } public static void main(String[] args) throws IOException { SourceChannel inChannel = EchoInputStreamWrapper.wrap(System.in); Reactor reactor = Proton.reactor(new Echo(inChannel)); reactor.run(); } } ././@LongLink0100644 0000000 0000000 00000000202 14303440055 011623 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reactor/EchoInputStreamWrapper.javaapache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reacto0100644 0000000 0000000 00000004715 14303440055 033703 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.example.reactor; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.channels.Pipe; import java.nio.channels.Pipe.SinkChannel; import java.nio.channels.Pipe.SourceChannel; import java.util.concurrent.atomic.AtomicInteger; public class EchoInputStreamWrapper extends Thread { private final InputStream in; private final SinkChannel out; private final byte[] bufferBytes = new byte[1024]; private final ByteBuffer buffer = ByteBuffer.wrap(bufferBytes); private final AtomicInteger idCounter = new AtomicInteger(); private EchoInputStreamWrapper(InputStream in, SinkChannel out) { this.in = in; this.out = out; setName(getClass().getName() + "-" + idCounter.incrementAndGet()); setDaemon(true); } @Override public void run() { try { while(true) { int amount = in.read(bufferBytes); if (amount < 0) break; buffer.position(0); buffer.limit(amount); out.write(buffer); } } catch(IOException ioException) { ioException.printStackTrace(); } finally { try { out.close(); } catch(IOException ioException) { ioException.printStackTrace(); } } } public static SourceChannel wrap(InputStream in) throws IOException { Pipe pipe = Pipe.open(); new EchoInputStreamWrapper(in, pipe.sink()).start(); SourceChannel result = pipe.source(); result.configureBlocking(false); return result; } } ././@LongLink0100644 0000000 0000000 00000000170 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reactor/GlobalLogger.javaapache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reacto0100644 0000000 0000000 00000005217 14303440055 033701 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.example.reactor; import java.io.IOException; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.reactor.Reactor; // Not every event goes to the reactor's event handler. If we have a // separate handler for something like a scheduled task, then those // events aren't logged by the logger associated with the reactor's // handler. Sometimes this is useful if you don't want to see them, but // sometimes you want the global picture. public class GlobalLogger extends BaseHandler { static class Logger extends BaseHandler { @Override public void onUnhandled(Event event) { System.out.println("LOG: " + event); } } static class Task extends BaseHandler { @Override public void onTimerTask(Event e) { System.out.println("Mission accomplished!"); } } @Override public void onReactorInit(Event event) { System.out.println("Hello, World!"); event.getReactor().schedule(0, new Task()); } @Override public void onReactorFinal(Event e) { System.out.println("Goodbye, World!"); } public static void main(String[] args) throws IOException { Reactor reactor = Proton.reactor(new GlobalLogger()); // In addition to having a regular handler, the reactor also has a // global handler that sees every event. By adding the Logger to the // global handler instead of the regular handler, we can log every // single event that occurs in the system regardless of whether or not // there are specific handlers associated with the objects that are the // target of those events. reactor.getGlobalHandler().add(new Logger()); reactor.run(); } } ././@LongLink0100644 0000000 0000000 00000000170 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reactor/GoodbyeWorld.javaapache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reacto0100644 0000000 0000000 00000004405 14303440055 033677 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.example.reactor; import java.io.IOException; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.reactor.Reactor; // So far the reactive hello-world doesn't look too different from a // regular old non-reactive hello-world. The onReactorInit method can // be used roughly as a 'main' method would. A program that only uses // that one event, however, isn't going to be very reactive. By using // other events, we can write a fully reactive program. public class GoodbyeWorld extends BaseHandler { // As before we handle the reactor init event. @Override public void onReactorInit(Event event) { System.out.println("Hello, World!"); } // In addition to an initial event, the reactor also produces an // event when it is about to exit. This may not behave much // differently than just putting the goodbye print statement inside // onReactorInit, but as we grow our program, this piece of it // will always be what happens last, and will always happen // regardless of what other paths the main logic of our program // might take. @Override public void onReactorFinal(Event e) { System.out.println("Goodbye, World!"); } public static void main(String[] args) throws IOException { Reactor reactor = Proton.reactor(new GoodbyeWorld()); reactor.run(); } } ././@LongLink0100644 0000000 0000000 00000000166 14303440055 011634 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reactor/HelloWorld.javaapache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reacto0100644 0000000 0000000 00000004235 14303440055 033700 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.example.reactor; import java.io.IOException; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.reactor.Reactor; /* * The proton reactor provides a general purpose event processing * library for writing reactive programs. A reactive program is defined * by a set of event handlers. An event handler is just any class or * object that extends the Handler interface. For convenience, a class * can extend BaseHandler and only handle the events that it cares to * implement methods for. */ public class HelloWorld extends BaseHandler { // The reactor init event is produced by the reactor itself when it // starts. @Override public void onReactorInit(Event event) { System.out.println("Hello, World!"); } public static void main(String[] args) throws IOException { // When you construct a reactor, you can give it a handler that // is used, by default, to receive events generated by the reactor. Reactor reactor = Proton.reactor(new HelloWorld()); // When you call run, the reactor will process events. The reactor init // event is what kicks off everything else. When the reactor has no // more events to process, it exits. reactor.run(); } } ././@LongLink0100644 0000000 0000000 00000000160 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reactor/README.mdapache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reacto0100644 0000000 0000000 00000000736 14303440055 033702 0ustar00rootroot0000000 0000000 The examples in this directory provide a basic introduction to the proton reactor API and are best viewed in the order presented below. The examples contain comments that explain things in a tutorial-style manner. - HelloWorld.java - GoodbyeWorld.java - Scheduling.java - Counter.java - CountRandomly.java - Unhandled.java - ReactorLogger.java - GlobalLogger.java - Delegates.java - Handlers.java - Echo.java - Cat.java - Send.java - Recv.java ././@LongLink0100644 0000000 0000000 00000000171 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reactor/ReactorLogger.javaapache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reacto0100644 0000000 0000000 00000004506 14303440055 033701 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.example.reactor; import java.io.IOException; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.reactor.Reactor; public class ReactorLogger extends BaseHandler { public static class Logger extends BaseHandler { @Override public void onUnhandled(Event event) { System.out.println("LOG: " + event); } } @Override public void onReactorInit(Event e) { System.out.println("Hello, World!"); } @Override public void onReactorFinal(Event e) { System.out.println("Goodbye, World!"); } private static boolean loggingEnabled = false; public static void main(String[] args) throws IOException { // You can pass multiple handlers to a reactor when you construct it. // Each of these handlers will see every event the reactor sees. By // combining this with on_unhandled, you can log each event that goes // to the reactor. Reactor reactor = Proton.reactor(new ReactorLogger(), new Logger()); reactor.run(); // Note that if you wanted to add the logger later, you could also // write the above as below. All arguments to the reactor are just // added to the default handler for the reactor. reactor = Proton.reactor(new ReactorLogger()); if (loggingEnabled) reactor.getHandler().add(new Logger()); reactor.run(); } } ././@LongLink0100644 0000000 0000000 00000000160 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reactor/Recv.javaapache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reacto0100644 0000000 0000000 00000005334 14303440055 033701 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.example.reactor; import java.io.IOException; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.amqp.messaging.AmqpValue; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Delivery; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.engine.Receiver; import org.apache.qpid.proton.message.Message; import org.apache.qpid.proton.reactor.FlowController; import org.apache.qpid.proton.reactor.Handshaker; import org.apache.qpid.proton.reactor.Reactor; public class Recv extends BaseHandler { private Recv() { add(new Handshaker()); add(new FlowController()); } @Override public void onReactorInit(Event event) { try { // Create an amqp acceptor. event.getReactor().acceptor("0.0.0.0", 5672); // There is an optional third argument to the Reactor.acceptor // call. Using it, we could supply a handler here that would // become the handler for all accepted connections. If we omit // it, the reactor simply inherits all the connection events. } catch(IOException ioException) { ioException.printStackTrace(); } } @Override public void onDelivery(Event event) { Receiver recv = (Receiver)event.getLink(); Delivery delivery = recv.current(); if (delivery.isReadable() && !delivery.isPartial()) { int size = delivery.pending(); byte[] buffer = new byte[size]; int read = recv.recv(buffer, 0, buffer.length); recv.advance(); Message msg = Proton.message(); msg.decode(buffer, 0, read); System.out.println(((AmqpValue)msg.getBody()).getValue()); } } public static void main(String[] args) throws IOException { Reactor r = Proton.reactor(new Recv()); r.run(); } } ././@LongLink0100644 0000000 0000000 00000000166 14303440055 011634 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reactor/Scheduling.javaapache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reacto0100644 0000000 0000000 00000004761 14303440055 033704 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.example.reactor; import java.io.IOException; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.reactor.Reactor; import org.apache.qpid.proton.reactor.Task; public class Scheduling extends BaseHandler { private long startTime; @Override public void onReactorInit(Event event) { startTime = System.currentTimeMillis(); System.out.println("Hello, World!"); // We can schedule a task event for some point in the future. // This will cause the reactor to stick around until it has a // chance to process the event. // The first argument is the delay. The second argument is the // handler for the event. We are just using self for now, but // we could pass in another object if we wanted. Task task = event.getReactor().schedule(1000, this); // We can ignore the task if we want to, but we can also use it // to pass stuff to the handler. task.attachments().set("key", String.class, "Yay"); } @Override public void onTimerTask(Event event) { Task task = event.getTask(); System.out.println(task.attachments().get("key", String.class) + " my task is complete!"); } @Override public void onReactorFinal(Event e) { long elapsedTime = System.currentTimeMillis() - startTime; System.out.println("Goodbye, World! (after " + elapsedTime + " long milliseconds)"); } public static void main(String[] args) throws IOException { Reactor reactor = Proton.reactor(new Scheduling()); reactor.run(); } } ././@LongLink0100644 0000000 0000000 00000000160 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reactor/Send.javaapache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reacto0100644 0000000 0000000 00000012346 14303440055 033702 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.example.reactor; import java.io.IOException; import java.nio.BufferOverflowException; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.amqp.messaging.AmqpValue; import org.apache.qpid.proton.amqp.transport.ErrorCondition; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Connection; import org.apache.qpid.proton.engine.Delivery; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.engine.Sender; import org.apache.qpid.proton.engine.Session; import org.apache.qpid.proton.message.Message; import org.apache.qpid.proton.reactor.Handshaker; import org.apache.qpid.proton.reactor.Reactor; // This is a send in terms of low level AMQP events. public class Send extends BaseHandler { private class SendHandler extends BaseHandler { private final Message message; private int nextTag = 0; private SendHandler(Message message) { this.message = message; // Add a child handler that performs some default handshaking // behaviour. add(new Handshaker()); } @Override public void onConnectionInit(Event event) { Connection conn = event.getConnection(); // Every session or link could have their own handler(s) if we // wanted simply by adding the handler to the given session // or link Session ssn = conn.session(); // If a link doesn't have an event handler, the events go to // its parent session. If the session doesn't have a handler // the events go to its parent connection. If the connection // doesn't have a handler, the events go to the reactor. Sender snd = ssn.sender("sender"); conn.open(); ssn.open(); snd.open(); } @Override public void onLinkFlow(Event event) { Sender snd = (Sender)event.getLink(); if (snd.getCredit() > 0) { byte[] msgData = new byte[1024]; int length; while(true) { try { length = message.encode(msgData, 0, msgData.length); break; } catch(BufferOverflowException e) { msgData = new byte[msgData.length * 2]; } } byte[] tag = String.valueOf(nextTag++).getBytes(); Delivery dlv = snd.delivery(tag); snd.send(msgData, 0, length); dlv.settle(); snd.advance(); snd.close(); snd.getSession().close(); snd.getSession().getConnection().close(); } } @Override public void onTransportError(Event event) { ErrorCondition condition = event.getTransport().getCondition(); if (condition != null) { System.err.println("Error: " + condition.getDescription()); } else { System.err.println("Error (no description returned)."); } } } private final String host; private final int port; private final Message message; private Send(String host, int port, String content) { this.host = host; this.port = port; message = Proton.message(); message.setBody(new AmqpValue(content)); } @Override public void onReactorInit(Event event) { // You can use the connection method to create AMQP connections. // This connection's handler is the SendHandler object. All the events // for this connection will go to the SendHandler object instead of // going to the reactor. If you were to omit the SendHandler object, // all the events would go to the reactor. event.getReactor().connectionToHost(host, port, new SendHandler(message)); } public static void main(String[] args) throws IOException { int port = 5672; String host = "localhost"; if (args.length > 0) { String[] parts = args[0].split(":", 2); host = parts[0]; if (parts.length > 1) { port = Integer.parseInt(parts[1]); } } String content = args.length > 1 ? args[1] : "Hello World!"; Reactor r = Proton.reactor(new Send(host, port, content)); r.run(); } } ././@LongLink0100644 0000000 0000000 00000000165 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reactor/Unhandled.javaapache-qpid-proton-j-0.34.0-src/examples/reactor/src/main/java/org/apache/qpid/proton/example/reacto0100644 0000000 0000000 00000003140 14303440055 033672 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.example.reactor; import java.io.IOException; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.engine.BaseHandler; import org.apache.qpid.proton.engine.Event; import org.apache.qpid.proton.reactor.Reactor; public class Unhandled extends BaseHandler { // If an event occurs and its handler doesn't have an on_ // method, the reactor will attempt to call the on_unhandled method // if it exists. This can be useful not only for debugging, but for // logging and for delegating/inheritance. @Override public void onUnhandled(Event event) { System.out.println(event); } public static void main(String[] args) throws IOException { Reactor reactor = Proton.reactor(new Unhandled()); reactor.run(); } } apache-qpid-proton-j-0.34.0-src/pom.xml0100644 0000000 0000000 00000023333 14303440055 020163 0ustar00rootroot0000000 0000000 Proton is a library for speaking AMQP. org.apache apache 27 4.0.0 org.apache.qpid proton-j-parent 0.34.0 pom Proton-J Parent 4.13.2 4.7.0 2.7.2 1.70 5.1.8 0.8.8 1.8 1.8 -Xmx2g -enableassertions ${jacoco-config} 2022-08-30T16:51:57Z org.apache.qpid proton-j ${project.version} junit junit ${junit-version} test org.mockito mockito-core ${mockito-version} test org.python jython-standalone ${jython-version} test org.bouncycastle bcpkix-jdk15on ${bcpkix-jdk15on-version} test org.apache.maven.plugins maven-compiler-plugin true true true org.apache.felix maven-bundle-plugin ${maven-bundle-plugin-version} true ${project.groupId}.proton.* org.apache.rat apache-rat-plugin appveyor.yml .travis.yml .github/workflows/*.yml .mailmap **/*.md **/*.pkcs12 **/*.p12 **/*.pem **/*.pem.txt **/*.crt **/*.csr **/*.keystore **/*.truststore org.jacoco jacoco-maven-plugin prepare-agent jacoco-config org.eclipse.m2e lifecycle-mapping 1.0.0 org.apache.felix maven-bundle-plugin [2.4.0,) manifest org.apache.maven.plugins maven-release-plugin true @{project.version} -Papache-release -Dperform-release-checks=true ${arguments} true org.jacoco jacoco-maven-plugin ${jacoco-plugin-version} proton-j tests examples/engine examples/reactor apache-qpid-proton-j https://qpid.apache.org/proton scm:git:https://gitbox.apache.org/repos/asf/qpid-proton-j.git scm:git:https://gitbox.apache.org/repos/asf/qpid-proton-j.git https://gitbox.apache.org/repos/asf?p=qpid-proton-j.git 0.34.0 https://issues.apache.org/jira/browse/PROTON JIRA https://builds.apache.org/view/M-R/view/Qpid/job/Qpid-proton-j/ org.jacoco jacoco-maven-plugin ${jacoco-plugin-version} apache-release maven-assembly-plugin source-release-assembly true tests/performance-jmh performance-jmh tests/performance-jmh sources org.apache.maven.plugins maven-source-plugin attach-sources jar java9on [9,) 8 apache-qpid-proton-j-0.34.0-src/proton-j/LICENSE0100644 0000000 0000000 00000026137 14303440055 021430 0ustar00rootroot0000000 0000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. apache-qpid-proton-j-0.34.0-src/proton-j/pom.xml0100644 0000000 0000000 00000006122 14303440055 021730 0ustar00rootroot0000000 0000000 org.apache.qpid proton-j-parent 0.34.0 4.0.0 proton-j jar Proton-J org.bouncycastle bcpkix-jdk15on test junit junit test org.mockito mockito-core test org.apache.felix maven-bundle-plugin ${maven-bundle-plugin-version} javax.net.ssl*;resolution:=optional,!org.bouncycastle*,* bundle-manifest process-classes manifest org.apache.maven.plugins maven-jar-plugin ${project.build.outputDirectory}/META-INF/MANIFEST.MF org.apache.qpid.proton.j false false ././@LongLink0100644 0000000 0000000 00000000146 14303440055 011632 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/InterruptException.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/InterruptException.jav0100644 0000000 0000000 00000002310 14303440055 033705 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton; public class InterruptException extends ProtonException { public InterruptException() { } public InterruptException(String message) { super(message); } public InterruptException(String message, Throwable cause) { super(message, cause); } public InterruptException(Throwable cause) { super(cause); } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/Proton.java0100644 0000000 0000000 00000007531 14303440055 031466 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton; import java.io.IOException; import org.apache.qpid.proton.amqp.messaging.ApplicationProperties; import org.apache.qpid.proton.amqp.messaging.DeliveryAnnotations; import org.apache.qpid.proton.amqp.messaging.Footer; import org.apache.qpid.proton.amqp.messaging.Header; import org.apache.qpid.proton.amqp.messaging.MessageAnnotations; import org.apache.qpid.proton.amqp.messaging.Properties; import org.apache.qpid.proton.amqp.messaging.Section; import org.apache.qpid.proton.codec.Codec; import org.apache.qpid.proton.codec.Data; import org.apache.qpid.proton.engine.Collector; import org.apache.qpid.proton.engine.Connection; import org.apache.qpid.proton.engine.Engine; import org.apache.qpid.proton.engine.Handler; import org.apache.qpid.proton.engine.SslDomain; import org.apache.qpid.proton.engine.SslPeerDetails; import org.apache.qpid.proton.engine.Transport; import org.apache.qpid.proton.message.Message; import org.apache.qpid.proton.reactor.Reactor; import org.apache.qpid.proton.reactor.ReactorOptions; public final class Proton { private Proton() { } public static Collector collector() { return Engine.collector(); } public static Connection connection() { return Engine.connection(); } public static Transport transport() { return Engine.transport(); } public static SslDomain sslDomain() { return Engine.sslDomain(); } public static SslPeerDetails sslPeerDetails(String hostname, int port) { return Engine.sslPeerDetails(hostname, port); } public static Data data(long capacity) { return Codec.data(capacity); } public static Message message() { return Message.Factory.create(); } public static Message message(Header header, DeliveryAnnotations deliveryAnnotations, MessageAnnotations messageAnnotations, Properties properties, ApplicationProperties applicationProperties, Section body, Footer footer) { return Message.Factory.create(header, deliveryAnnotations, messageAnnotations, properties, applicationProperties, body, footer); } public static Reactor reactor() throws IOException { return Reactor.Factory.create(); } public static Reactor reactor(Handler... handlers) throws IOException { Reactor reactor = Reactor.Factory.create(); for (Handler handler : handlers) { reactor.getHandler().add(handler); } return reactor; } public static Reactor reactor(ReactorOptions options) throws IOException { return Reactor.Factory.create(options); } public static Reactor reactor(ReactorOptions options, Handler... handlers) throws IOException { Reactor reactor = Reactor.Factory.create(options); for (Handler handler : handlers) { reactor.getHandler().add(handler); } return reactor; } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/ProtonException.java0100644 0000000 0000000 00000002273 14303440055 033343 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton; public class ProtonException extends RuntimeException { public ProtonException() { } public ProtonException(String message) { super(message); } public ProtonException(String message, Throwable cause) { super(message, cause); } public ProtonException(Throwable cause) { super(cause); } } ././@LongLink0100644 0000000 0000000 00000000167 14303440055 011635 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/ProtonUnsupportedOperationException.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/ProtonUnsupportedOpera0100644 0000000 0000000 00000003070 14303440055 034000 0ustar00rootroot0000000 0000000 /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton; /** * Use to indicate that a feature of the Proton API is not supported by a particular implementation * (e.g. proton-j or proton-c-via-JNI). */ public class ProtonUnsupportedOperationException extends UnsupportedOperationException { /** Used by the Python test layer to detect an unsupported operation */ public static final boolean skipped = true; public ProtonUnsupportedOperationException() { } public ProtonUnsupportedOperationException(String message) { super(message); } public ProtonUnsupportedOperationException(String message, Throwable cause) { super(message, cause); } public ProtonUnsupportedOperationException(Throwable cause) { super(cause); } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/TimeoutException.java0100644 0000000 0000000 00000002570 14303440055 033510 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton; public class TimeoutException extends ProtonException { public TimeoutException() { } public TimeoutException(String message) { super(message); } public TimeoutException(String message, Throwable cause) { super(message, cause); } public TimeoutException(Throwable cause) { super(cause); } public TimeoutException(long timeoutMillis, String pendingCondition) { this("Timed out after " + timeoutMillis + " ms waiting for condition: " + pendingCondition); } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/Binary.java0100644 0000000 0000000 00000012311 14303440055 032357 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp; import java.nio.ByteBuffer; import java.util.Collection; import org.apache.qpid.proton.codec.ReadableBuffer; public final class Binary { private final byte[] _data; private final int _offset; private final int _length; private int _hashCode; public Binary(final byte[] data) { this(data, 0, data.length); } public Binary(final byte[] data, final int offset, final int length) { _data = data; _offset = offset; _length = length; } public ByteBuffer asByteBuffer() { return ByteBuffer.wrap(_data, _offset, _length); } @Override public final int hashCode() { int hc = _hashCode; if(hc == 0) { for (int i = 0; i < _length; i++) { hc = 31*hc + (0xFF & _data[_offset + i]); } _hashCode = hc; } return hc; } @Override public final boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Binary buf = (Binary) o; final int size = _length; if (size != buf._length) { return false; } final byte[] myData = _data; final byte[] theirData = buf._data; int myOffset = _offset; int theirOffset = buf._offset; final int myLimit = myOffset + size; while(myOffset < myLimit) { if (myData[myOffset++] != theirData[theirOffset++]) { return false; } } return true; } public int getArrayOffset() { return _offset; } public byte[] getArray() { return _data; } public int getLength() { return _length; } @Override public String toString() { StringBuilder str = new StringBuilder(); for (int i = 0; i < _length; i++) { byte c = _data[_offset + i]; if (c > 31 && c < 127 && c != '\\') { str.append((char)c); } else { str.append(String.format("\\x%02x", c)); } } return str.toString(); } public static Binary combine(final Collection binaries) { if(binaries.size() == 1) { return binaries.iterator().next(); } int size = 0; for(Binary binary : binaries) { size += binary.getLength(); } byte[] data = new byte[size]; int offset = 0; for(Binary binary : binaries) { System.arraycopy(binary._data, binary._offset, data, offset, binary._length); offset += binary._length; } return new Binary(data); } public Binary subBinary(final int offset, final int length) { return new Binary(_data, _offset+offset, length); } public static Binary create(ReadableBuffer buffer) { if (buffer == null) { return null; } else if (!buffer.hasArray()) { byte data[] = new byte [buffer.remaining()]; ReadableBuffer dup = buffer.duplicate(); dup.get(data); return new Binary(data); } else { return new Binary(buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining()); } } public static Binary create(ByteBuffer buffer) { if (buffer == null) { return null; } if (buffer.isDirect() || buffer.isReadOnly()) { byte data[] = new byte [buffer.remaining()]; ByteBuffer dup = buffer.duplicate(); dup.get(data); return new Binary(data); } else { return new Binary(buffer.array(), buffer.arrayOffset()+buffer.position(), buffer.remaining()); } } public static Binary copy(Binary source) { if (source == null) { return null; } else { byte[] data = new byte[source.getLength()]; System.arraycopy(source.getArray(), source.getArrayOffset(), data, 0, source.getLength()); return new Binary(data); } } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/Decimal128.java0100644 0000000 0000000 00000006556 14303440055 032742 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp; import java.math.BigDecimal; import java.nio.ByteBuffer; public final class Decimal128 extends Number { private final BigDecimal _underlying; private final long _msb; private final long _lsb; public Decimal128(BigDecimal underlying) { _underlying = underlying; _msb = calculateMostSignificantBits(underlying); _lsb = calculateLeastSignificantBits(underlying); } public Decimal128(final long msb, final long lsb) { _msb = msb; _lsb = lsb; _underlying = calculateBigDecimal(msb, lsb); } public Decimal128(byte[] data) { this(ByteBuffer.wrap(data)); } private Decimal128(final ByteBuffer buffer) { this(buffer.getLong(),buffer.getLong()); } private static long calculateMostSignificantBits(final BigDecimal underlying) { return 0; //TODO. } private static long calculateLeastSignificantBits(final BigDecimal underlying) { return 0; //TODO. } private static BigDecimal calculateBigDecimal(final long msb, final long lsb) { return BigDecimal.ZERO; //TODO. } @Override public int intValue() { return _underlying.intValue(); } @Override public long longValue() { return _underlying.longValue(); } @Override public float floatValue() { return _underlying.floatValue(); } @Override public double doubleValue() { return _underlying.doubleValue(); } public long getMostSignificantBits() { return _msb; } public long getLeastSignificantBits() { return _lsb; } public byte[] asBytes() { byte[] bytes = new byte[16]; ByteBuffer buf = ByteBuffer.wrap(bytes); buf.putLong(getMostSignificantBits()); buf.putLong(getLeastSignificantBits()); return bytes; } @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final Decimal128 that = (Decimal128) o; if (_lsb != that._lsb) { return false; } if (_msb != that._msb) { return false; } return true; } @Override public int hashCode() { int result = (int) (_msb ^ (_msb >>> 32)); result = 31 * result + (int) (_lsb ^ (_lsb >>> 32)); return result; } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/Decimal32.java0100644 0000000 0000000 00000004513 14303440055 032643 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp; import java.math.BigDecimal; public final class Decimal32 extends Number { private final BigDecimal _underlying; private final int _bits; public Decimal32(BigDecimal underlying) { _underlying = underlying; _bits = calculateBits( underlying ); } public Decimal32(final int bits) { _bits = bits; _underlying = calculateBigDecimal(bits); } static int calculateBits(final BigDecimal underlying) { return 0; //TODO. } static BigDecimal calculateBigDecimal(int bits) { return BigDecimal.ZERO; // TODO } @Override public int intValue() { return _underlying.intValue(); } @Override public long longValue() { return _underlying.longValue(); } @Override public float floatValue() { return _underlying.floatValue(); } @Override public double doubleValue() { return _underlying.doubleValue(); } public int getBits() { return _bits; } @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final Decimal32 decimal32 = (Decimal32) o; if (_bits != decimal32._bits) { return false; } return true; } @Override public int hashCode() { return _bits; } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/Decimal64.java0100644 0000000 0000000 00000004547 14303440055 032657 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp; import java.math.BigDecimal; public final class Decimal64 extends Number { private final BigDecimal _underlying; private final long _bits; public Decimal64(BigDecimal underlying) { _underlying = underlying; _bits = calculateBits(underlying); } public Decimal64(final long bits) { _bits = bits; _underlying = calculateBigDecimal(bits); } static BigDecimal calculateBigDecimal(final long bits) { return BigDecimal.ZERO; } static long calculateBits(final BigDecimal underlying) { return 0l; // TODO } @Override public int intValue() { return _underlying.intValue(); } @Override public long longValue() { return _underlying.longValue(); } @Override public float floatValue() { return _underlying.floatValue(); } @Override public double doubleValue() { return _underlying.doubleValue(); } public long getBits() { return _bits; } @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final Decimal64 decimal64 = (Decimal64) o; if (_bits != decimal64._bits) { return false; } return true; } @Override public int hashCode() { return (int) (_bits ^ (_bits >>> 32)); } } ././@LongLink0100644 0000000 0000000 00000000146 14303440055 011632 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/DescribedType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/DescribedType.jav0100644 0000000 0000000 00000001674 14303440055 033532 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp; public interface DescribedType { public Object getDescriptor(); public Object getDescribed(); } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/Symbol.java0100644 0000000 0000000 00000005526 14303440055 032412 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.concurrent.ConcurrentHashMap; import org.apache.qpid.proton.codec.WritableBuffer; public final class Symbol implements Comparable, CharSequence { private final String _underlying; private final byte[] _underlyingBytes; private static final ConcurrentHashMap _symbols = new ConcurrentHashMap(2048); private Symbol(String underlying) { _underlying = underlying; _underlyingBytes = underlying.getBytes(StandardCharsets.US_ASCII); } public int length() { return _underlying.length(); } public int compareTo(Symbol o) { return _underlying.compareTo(o._underlying); } public char charAt(int index) { return _underlying.charAt(index); } public CharSequence subSequence(int beginIndex, int endIndex) { return _underlying.subSequence(beginIndex, endIndex); } @Override public String toString() { return _underlying; } @Override public int hashCode() { return _underlying.hashCode(); } public static Symbol valueOf(String symbolVal) { return getSymbol(symbolVal); } public static Symbol getSymbol(String symbolVal) { if(symbolVal == null) { return null; } Symbol symbol = _symbols.get(symbolVal); if(symbol == null) { symbolVal = symbolVal.intern(); symbol = new Symbol(symbolVal); Symbol existing; if((existing = _symbols.putIfAbsent(symbolVal, symbol)) != null) { symbol = existing; } } return symbol; } public void writeTo(WritableBuffer buffer) { buffer.put(_underlyingBytes, 0, _underlyingBytes.length); } public void writeTo(ByteBuffer buffer) { buffer.put(_underlyingBytes, 0, _underlyingBytes.length); } } ././@LongLink0100644 0000000 0000000 00000000155 14303440055 011632 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/UnknownDescribedType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/UnknownDescribedT0100644 0000000 0000000 00000004511 14303440055 033606 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp; public class UnknownDescribedType implements DescribedType { private final Object _descriptor; private final Object _described; public UnknownDescribedType(final Object descriptor, final Object described) { _descriptor = descriptor; _described = described; } @Override public Object getDescriptor() { return _descriptor; } @Override public Object getDescribed() { return _described; } @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final UnknownDescribedType that = (UnknownDescribedType) o; if (_described != null ? !_described.equals(that._described) : that._described != null) { return false; } if (_descriptor != null ? !_descriptor.equals(that._descriptor) : that._descriptor != null) { return false; } return true; } @Override public int hashCode() { int result = _descriptor != null ? _descriptor.hashCode() : 0; result = 31 * result + (_described != null ? _described.hashCode() : 0); return result; } @Override public String toString() { return "UnknownDescribedType{" + "descriptor=" + _descriptor + ", described=" + _described + '}'; } } ././@LongLink0100644 0000000 0000000 00000000145 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/UnsignedByte.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/UnsignedByte.java0100644 0000000 0000000 00000005761 14303440055 033546 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp; public final class UnsignedByte extends Number implements Comparable { private final byte _underlying; private static final UnsignedByte[] cachedValues = new UnsignedByte[256]; static { for(int i = 0; i<256; i++) { cachedValues[i] = new UnsignedByte((byte)i); } } public UnsignedByte(byte underlying) { _underlying = underlying; } @Override public byte byteValue() { return _underlying; } @Override public short shortValue() { return (short) intValue(); } @Override public int intValue() { return ((int)_underlying) & 0xFF; } @Override public long longValue() { return ((long) _underlying) & 0xFFl; } @Override public float floatValue() { return (float) longValue(); } @Override public double doubleValue() { return (double) longValue(); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } UnsignedByte that = (UnsignedByte) o; if (_underlying != that._underlying) { return false; } return true; } public int compareTo(UnsignedByte o) { return Integer.signum(intValue() - o.intValue()); } @Override public int hashCode() { return _underlying; } @Override public String toString() { return String.valueOf(intValue()); } public static UnsignedByte valueOf(byte underlying) { final int index = ((int) underlying) & 0xFF; return cachedValues[index]; } public static UnsignedByte valueOf(final String value) throws NumberFormatException { int intVal = Integer.parseInt(value); if(intVal < 0 || intVal >= (1<<8)) { throw new NumberFormatException("Value \""+value+"\" lies outside the range [" + 0 + "-" + (1<<8) +")."); } return valueOf((byte)intVal); } } ././@LongLink0100644 0000000 0000000 00000000150 14303440055 011625 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/UnsignedInteger.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/UnsignedInteger.j0100644 0000000 0000000 00000007046 14303440055 033546 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp; public final class UnsignedInteger extends Number implements Comparable { private final int _underlying; private static final UnsignedInteger[] cachedValues = new UnsignedInteger[256]; static { for(int i = 0; i < 256; i++) { cachedValues[i] = new UnsignedInteger(i); } } public static final UnsignedInteger ZERO = cachedValues[0]; public static final UnsignedInteger ONE = cachedValues[1]; public static final UnsignedInteger MAX_VALUE = new UnsignedInteger(0xffffffff); public UnsignedInteger(int underlying) { _underlying = underlying; } @Override public int intValue() { return _underlying; } @Override public long longValue() { return ((long) _underlying) & 0xFFFFFFFFl; } @Override public float floatValue() { return (float) longValue(); } @Override public double doubleValue() { return (double) longValue(); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } UnsignedInteger that = (UnsignedInteger) o; if (_underlying != that._underlying) { return false; } return true; } public int compareTo(UnsignedInteger o) { return Long.signum(longValue() - o.longValue()); } @Override public int hashCode() { return _underlying; } @Override public String toString() { return String.valueOf(longValue()); } public static UnsignedInteger valueOf(int underlying) { if((underlying & 0xFFFFFF00) == 0) { return cachedValues[underlying]; } else { return new UnsignedInteger(underlying); } } public UnsignedInteger add(final UnsignedInteger i) { int val = _underlying + i._underlying; return UnsignedInteger.valueOf(val); } public UnsignedInteger subtract(final UnsignedInteger i) { int val = _underlying - i._underlying; return UnsignedInteger.valueOf(val); } public static UnsignedInteger valueOf(final String value) { long longVal = Long.parseLong(value); return valueOf(longVal); } public static UnsignedInteger valueOf(final long longVal) { if(longVal < 0L || longVal >= (1L<<32)) { throw new NumberFormatException("Value \""+longVal+"\" lies outside the range [" + 0L + "-" + (1L<<32) +")."); } return valueOf((int)longVal); } } ././@LongLink0100644 0000000 0000000 00000000145 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/UnsignedLong.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/UnsignedLong.java0100644 0000000 0000000 00000007544 14303440055 033543 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp; import java.math.BigInteger; public final class UnsignedLong extends Number implements Comparable { private static final BigInteger TWO_TO_THE_SIXTY_FOUR = new BigInteger( new byte[] { (byte) 1, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0 }); private static final BigInteger LONG_MAX_VALUE = BigInteger.valueOf(Long.MAX_VALUE); private static final UnsignedLong[] cachedValues = new UnsignedLong[256]; static { for(int i = 0; i<256; i++) { cachedValues[i] = new UnsignedLong(i); } } public static final UnsignedLong ZERO = cachedValues[0]; private final long _underlying; public UnsignedLong(long underlying) { _underlying = underlying; } @Override public int intValue() { return (int) _underlying; } @Override public long longValue() { return _underlying; } public BigInteger bigIntegerValue() { if(_underlying >= 0L) { return BigInteger.valueOf(_underlying); } else { return TWO_TO_THE_SIXTY_FOUR.add(BigInteger.valueOf(_underlying)); } } @Override public float floatValue() { return (float) longValue(); } @Override public double doubleValue() { return (double) longValue(); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } UnsignedLong that = (UnsignedLong) o; if (_underlying != that._underlying) { return false; } return true; } public int compareTo(UnsignedLong o) { return bigIntegerValue().compareTo(o.bigIntegerValue()); } @Override public int hashCode() { return (int)(_underlying ^ (_underlying >>> 32)); } @Override public String toString() { return String.valueOf(bigIntegerValue()); } public static UnsignedLong valueOf(long underlying) { if((underlying & 0xFFL) == underlying) { return cachedValues[(int)underlying]; } else { return new UnsignedLong(underlying); } } public static UnsignedLong valueOf(final String value) { BigInteger bigInt = new BigInteger(value); return valueOf(bigInt); } public static UnsignedLong valueOf(BigInteger bigInt) { if(bigInt.signum() == -1 || bigInt.bitLength() > 64) { throw new NumberFormatException("Value \""+bigInt+"\" lies outside the range [0 - 2^64)."); } else if(bigInt.compareTo(LONG_MAX_VALUE)>=0) { return UnsignedLong.valueOf(bigInt.longValue()); } else { return UnsignedLong.valueOf(TWO_TO_THE_SIXTY_FOUR.subtract(bigInt).negate().longValue()); } } } ././@LongLink0100644 0000000 0000000 00000000146 14303440055 011632 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/UnsignedShort.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/UnsignedShort.jav0100644 0000000 0000000 00000006037 14303440055 033576 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp; public final class UnsignedShort extends Number implements Comparable { private final short _underlying; private static final UnsignedShort[] cachedValues = new UnsignedShort[256]; public static final UnsignedShort MAX_VALUE = new UnsignedShort((short) -1); static { for(short i = 0; i < 256; i++) { cachedValues[i] = new UnsignedShort(i); } } public UnsignedShort(short underlying) { _underlying = underlying; } public short shortValue() { return _underlying; } @Override public int intValue() { return _underlying & 0xFFFF; } @Override public long longValue() { return ((long) _underlying) & 0xFFFFl; } @Override public float floatValue() { return (float) intValue(); } @Override public double doubleValue() { return (double) intValue(); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } UnsignedShort that = (UnsignedShort) o; if (_underlying != that._underlying) { return false; } return true; } public int compareTo(UnsignedShort o) { return Integer.signum(intValue() - o.intValue()); } @Override public int hashCode() { return _underlying; } @Override public String toString() { return String.valueOf(longValue()); } public static UnsignedShort valueOf(short underlying) { if((underlying & 0xFF00) == 0) { return cachedValues[underlying]; } else { return new UnsignedShort(underlying); } } public static UnsignedShort valueOf(final String value) { int intVal = Integer.parseInt(value); if(intVal < 0 || intVal >= (1<<16)) { throw new NumberFormatException("Value \""+value+"\" lies outside the range [" + 0 + "-" + (1<<16) +")."); } return valueOf((short)intVal); } } ././@LongLink0100644 0000000 0000000 00000000153 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Accepted.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Accepte0100644 0000000 0000000 00000003041 14303440055 033534 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.transport.DeliveryState; public final class Accepted implements DeliveryState, Outcome { public static final Symbol DESCRIPTOR_SYMBOL = Symbol.valueOf("amqp:accepted:list"); private static final Accepted INSTANCE = new Accepted(); /** * TODO should this (and other DeliveryStates) have a private constructor?? */ public Accepted() { } @Override public String toString() { return "Accepted{}"; } public static Accepted getInstance() { return INSTANCE; } @Override public DeliveryStateType getType() { return DeliveryStateType.Accepted; } } ././@LongLink0100644 0000000 0000000 00000000157 14303440055 011634 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/AmqpSequence.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/AmqpSeq0100644 0000000 0000000 00000002452 14303440055 033544 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; import java.util.List; public final class AmqpSequence implements Section { private final List _value; public AmqpSequence(List value) { _value = value; } public List getValue() { return _value; } @Override public String toString() { return "AmqpSequence{" + _value + '}'; } @Override public SectionType getType() { return SectionType.AmqpSequence; } } ././@LongLink0100644 0000000 0000000 00000000154 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/AmqpValue.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/AmqpVal0100644 0000000 0000000 00000002356 14303440055 033541 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; public final class AmqpValue implements Section { private final Object _value; public AmqpValue(Object value) { _value = value; } public Object getValue() { return _value; } @Override public String toString() { return "AmqpValue{" + _value + '}'; } @Override public SectionType getType() { return SectionType.AmqpValue; } } ././@LongLink0100644 0000000 0000000 00000000170 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/ApplicationProperties.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Applica0100644 0000000 0000000 00000002534 14303440055 033547 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; import java.util.Map; public final class ApplicationProperties implements Section { private final Map _value; public ApplicationProperties(Map value) { _value = value; } public Map getValue() { return _value; } @Override public String toString() { return "ApplicationProperties{" + _value + '}'; } @Override public SectionType getType() { return SectionType.ApplicationProperties; } } ././@LongLink0100644 0000000 0000000 00000000147 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Data.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Data.ja0100644 0000000 0000000 00000002406 14303440055 033436 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; import org.apache.qpid.proton.amqp.Binary; public final class Data implements Section { private final Binary _value; public Data(Binary value) { _value = value; } public Binary getValue() { return _value; } @Override public String toString() { return "Data{" + _value + '}'; } @Override public SectionType getType() { return SectionType.Data; } } ././@LongLink0100644 0000000 0000000 00000000160 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/DeleteOnClose.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/DeleteO0100644 0000000 0000000 00000002263 14303440055 033516 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; public final class DeleteOnClose implements LifetimePolicy { private static final DeleteOnClose INSTANCE = new DeleteOnClose(); private DeleteOnClose() { } @Override public String toString() { return "DeleteOnClose{}"; } public static DeleteOnClose getInstance() { return INSTANCE; } } ././@LongLink0100644 0000000 0000000 00000000162 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/DeleteOnNoLinks.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/DeleteO0100644 0000000 0000000 00000002255 14303440055 033517 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; public final class DeleteOnNoLinks implements LifetimePolicy { private static final DeleteOnNoLinks INSTANCE = new DeleteOnNoLinks(); private DeleteOnNoLinks() { } public String toString() { return "DeleteOnNoLinks{}"; } public static DeleteOnNoLinks getInstance() { return INSTANCE; } } ././@LongLink0100644 0000000 0000000 00000000174 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/DeleteOnNoLinksOrMessages.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/DeleteO0100644 0000000 0000000 00000002355 14303440055 033520 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; public final class DeleteOnNoLinksOrMessages implements LifetimePolicy { private static final DeleteOnNoLinksOrMessages INSTANCE = new DeleteOnNoLinksOrMessages(); private DeleteOnNoLinksOrMessages() { } public String toString() { return "DeleteOnNoLinksOrMessages{}"; } public static DeleteOnNoLinksOrMessages getInstance() { return INSTANCE; } } ././@LongLink0100644 0000000 0000000 00000000165 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/DeleteOnNoMessages.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/DeleteO0100644 0000000 0000000 00000002306 14303440055 033514 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; public final class DeleteOnNoMessages implements LifetimePolicy { private static final DeleteOnNoMessages INSTANCE = new DeleteOnNoMessages(); private DeleteOnNoMessages() { } public String toString() { return "DeleteOnNoMessages{}"; } public static DeleteOnNoMessages getInstance() { return INSTANCE; } } ././@LongLink0100644 0000000 0000000 00000000166 14303440055 011634 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/DeliveryAnnotations.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Deliver0100644 0000000 0000000 00000002600 14303440055 033562 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; import java.util.Map; import org.apache.qpid.proton.amqp.Symbol; public final class DeliveryAnnotations implements Section { private final Map _value; public DeliveryAnnotations(Map value) { _value = value; } public Map getValue() { return _value; } @Override public String toString() { return "DeliveryAnnotations{" + _value + '}'; } @Override public SectionType getType() { return SectionType.DeliveryAnnotations; } } ././@LongLink0100644 0000000 0000000 00000000151 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Footer.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Footer.0100644 0000000 0000000 00000002361 14303440055 033510 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; import java.util.Map; public final class Footer implements Section { private final Map _value; public Footer(Map value) { _value = value; } public Map getValue() { return _value; } @Override public String toString() { return "Footer{" + _value + '}'; } @Override public SectionType getType() { return SectionType.Footer; } } ././@LongLink0100644 0000000 0000000 00000000151 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Header.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Header.0100644 0000000 0000000 00000005310 14303440055 033437 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; import org.apache.qpid.proton.amqp.UnsignedByte; import org.apache.qpid.proton.amqp.UnsignedInteger; public final class Header implements Section { private Boolean _durable; private UnsignedByte _priority; private UnsignedInteger _ttl; private Boolean _firstAcquirer; private UnsignedInteger _deliveryCount; public Header() { } public Header(Header other) { this._durable = other._durable; this._priority = other._priority; this._ttl = other._ttl; this._firstAcquirer = other._firstAcquirer; this._deliveryCount = other._deliveryCount; } public Boolean getDurable() { return _durable; } public void setDurable(Boolean durable) { _durable = durable; } public UnsignedByte getPriority() { return _priority; } public void setPriority(UnsignedByte priority) { _priority = priority; } public UnsignedInteger getTtl() { return _ttl; } public void setTtl(UnsignedInteger ttl) { _ttl = ttl; } public Boolean getFirstAcquirer() { return _firstAcquirer; } public void setFirstAcquirer(Boolean firstAcquirer) { _firstAcquirer = firstAcquirer; } public UnsignedInteger getDeliveryCount() { return _deliveryCount; } public void setDeliveryCount(UnsignedInteger deliveryCount) { _deliveryCount = deliveryCount; } @Override public String toString() { return "Header{" + "durable=" + _durable + ", priority=" + _priority + ", ttl=" + _ttl + ", firstAcquirer=" + _firstAcquirer + ", deliveryCount=" + _deliveryCount + '}'; } @Override public SectionType getType() { return SectionType.Header; } } ././@LongLink0100644 0000000 0000000 00000000161 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/LifetimePolicy.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Lifetim0100644 0000000 0000000 00000001602 14303440055 033562 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; public interface LifetimePolicy { } ././@LongLink0100644 0000000 0000000 00000000165 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/MessageAnnotations.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Message0100644 0000000 0000000 00000002575 14303440055 033567 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; import java.util.Map; import org.apache.qpid.proton.amqp.Symbol; public final class MessageAnnotations implements Section { private final Map _value; public MessageAnnotations(Map value) { _value = value; } public Map getValue() { return _value; } @Override public String toString() { return "MessageAnnotations{" + _value + '}'; } @Override public SectionType getType() { return SectionType.MessageAnnotations; } } ././@LongLink0100644 0000000 0000000 00000000153 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Modified.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Modifie0100644 0000000 0000000 00000004335 14303440055 033553 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; import java.util.Map; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.transport.DeliveryState; public final class Modified implements DeliveryState, Outcome { public static final Symbol DESCRIPTOR_SYMBOL = Symbol.valueOf("amqp:modified:list"); private Boolean _deliveryFailed; private Boolean _undeliverableHere; private Map _messageAnnotations; public Boolean getDeliveryFailed() { return _deliveryFailed; } public void setDeliveryFailed(Boolean deliveryFailed) { _deliveryFailed = deliveryFailed; } public Boolean getUndeliverableHere() { return _undeliverableHere; } public void setUndeliverableHere(Boolean undeliverableHere) { _undeliverableHere = undeliverableHere; } public Map getMessageAnnotations() { return _messageAnnotations; } public void setMessageAnnotations(Map messageAnnotations) { _messageAnnotations = messageAnnotations; } @Override public String toString() { return "Modified{" + "deliveryFailed=" + _deliveryFailed + ", undeliverableHere=" + _undeliverableHere + ", messageAnnotations=" + _messageAnnotations + '}'; } @Override public DeliveryStateType getType() { return DeliveryStateType.Modified; } } ././@LongLink0100644 0000000 0000000 00000000152 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Outcome.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Outcome0100644 0000000 0000000 00000001573 14303440055 033613 0ustar00rootroot0000000 0000000 package org.apache.qpid.proton.amqp.messaging; /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ public interface Outcome { } ././@LongLink0100644 0000000 0000000 00000000155 14303440055 011632 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Properties.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Propert0100644 0000000 0000000 00000012263 14303440055 033631 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; import java.util.Date; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedInteger; public final class Properties implements Section { private Object _messageId; private Binary _userId; private String _to; private String _subject; private String _replyTo; private Object _correlationId; private Symbol _contentType; private Symbol _contentEncoding; private Date _absoluteExpiryTime; private Date _creationTime; private String _groupId; private UnsignedInteger _groupSequence; private String _replyToGroupId; public Properties() { } public Properties(Properties other) { this._messageId = other._messageId; this._userId = other._userId; this._to = other._to; this._subject = other._subject; this._replyTo = other._replyTo; this._correlationId = other._correlationId; this._contentType = other._contentType; this._contentEncoding = other._contentEncoding; this._absoluteExpiryTime = other._absoluteExpiryTime; this._creationTime = other._creationTime; this._groupId = other._groupId; this._groupSequence = other._groupSequence; this._replyToGroupId = other._replyToGroupId; } public Object getMessageId() { return _messageId; } public void setMessageId(Object messageId) { _messageId = messageId; } public Binary getUserId() { return _userId; } public void setUserId(Binary userId) { _userId = userId; } public String getTo() { return _to; } public void setTo(String to) { _to = to; } public String getSubject() { return _subject; } public void setSubject(String subject) { _subject = subject; } public String getReplyTo() { return _replyTo; } public void setReplyTo(String replyTo) { _replyTo = replyTo; } public Object getCorrelationId() { return _correlationId; } public void setCorrelationId(Object correlationId) { _correlationId = correlationId; } public Symbol getContentType() { return _contentType; } public void setContentType(Symbol contentType) { _contentType = contentType; } public Symbol getContentEncoding() { return _contentEncoding; } public void setContentEncoding(Symbol contentEncoding) { _contentEncoding = contentEncoding; } public Date getAbsoluteExpiryTime() { return _absoluteExpiryTime; } public void setAbsoluteExpiryTime(Date absoluteExpiryTime) { _absoluteExpiryTime = absoluteExpiryTime; } public Date getCreationTime() { return _creationTime; } public void setCreationTime(Date creationTime) { _creationTime = creationTime; } public String getGroupId() { return _groupId; } public void setGroupId(String groupId) { _groupId = groupId; } public UnsignedInteger getGroupSequence() { return _groupSequence; } public void setGroupSequence(UnsignedInteger groupSequence) { _groupSequence = groupSequence; } public String getReplyToGroupId() { return _replyToGroupId; } public void setReplyToGroupId(String replyToGroupId) { _replyToGroupId = replyToGroupId; } @Override public String toString() { return "Properties{" + "messageId=" + _messageId + ", userId=" + _userId + ", to='" + _to + '\'' + ", subject='" + _subject + '\'' + ", replyTo='" + _replyTo + '\'' + ", correlationId=" + _correlationId + ", contentType=" + _contentType + ", contentEncoding=" + _contentEncoding + ", absoluteExpiryTime=" + _absoluteExpiryTime + ", creationTime=" + _creationTime + ", groupId='" + _groupId + '\'' + ", groupSequence=" + _groupSequence + ", replyToGroupId='" + _replyToGroupId + '\'' + '}'; } @Override public SectionType getType() { return SectionType.Properties; } } ././@LongLink0100644 0000000 0000000 00000000153 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Received.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Receive0100644 0000000 0000000 00000003520 14303440055 033554 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; import org.apache.qpid.proton.amqp.UnsignedInteger; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.transport.DeliveryState; public final class Received implements DeliveryState { private UnsignedInteger _sectionNumber; private UnsignedLong _sectionOffset; public UnsignedInteger getSectionNumber() { return _sectionNumber; } public void setSectionNumber(UnsignedInteger sectionNumber) { _sectionNumber = sectionNumber; } public UnsignedLong getSectionOffset() { return _sectionOffset; } public void setSectionOffset(UnsignedLong sectionOffset) { _sectionOffset = sectionOffset; } @Override public String toString() { return "Received{" + "sectionNumber=" + _sectionNumber + ", sectionOffset=" + _sectionOffset + '}'; } @Override public DeliveryStateType getType() { return DeliveryStateType.Received; } } ././@LongLink0100644 0000000 0000000 00000000153 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Rejected.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Rejecte0100644 0000000 0000000 00000003262 14303440055 033556 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.transport.DeliveryState; import org.apache.qpid.proton.amqp.transport.ErrorCondition; public final class Rejected implements DeliveryState, Outcome { public static final Symbol DESCRIPTOR_SYMBOL = Symbol.valueOf("amqp:rejected:list"); private ErrorCondition _error; public ErrorCondition getError() { return _error; } public void setError(ErrorCondition error) { _error = error; } public int size() { return _error != null ? 1 : 0; } @Override public String toString() { return "Rejected{" + "error=" + _error + '}'; } @Override public DeliveryStateType getType() { return DeliveryStateType.Rejected; } } ././@LongLink0100644 0000000 0000000 00000000153 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Released.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Release0100644 0000000 0000000 00000002634 14303440055 033557 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.transport.DeliveryState; public final class Released implements DeliveryState, Outcome { public static final Symbol DESCRIPTOR_SYMBOL = Symbol.valueOf("amqp:released:list"); private static final Released INSTANCE = new Released(); @Override public String toString() { return "Released{}"; } public static Released getInstance() { return INSTANCE; } @Override public DeliveryStateType getType() { return DeliveryStateType.Released; } } ././@LongLink0100644 0000000 0000000 00000000152 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Section.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Section0100644 0000000 0000000 00000002315 14303440055 033577 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; public interface Section { enum SectionType { AmqpSequence, AmqpValue, ApplicationProperties, Data, DeliveryAnnotations, Footer, Header, MessageAnnotations, Properties } /** * @return the {@link SectionType} that describes this instance. */ SectionType getType(); } ././@LongLink0100644 0000000 0000000 00000000151 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Source.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Source.0100644 0000000 0000000 00000006132 14303440055 033512 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import org.apache.qpid.proton.amqp.Symbol; public final class Source extends Terminus implements org.apache.qpid.proton.amqp.transport.Source { private Symbol _distributionMode; private Map _filter; private Outcome _defaultOutcome; private Symbol[] _outcomes; private Source(Source other) { super(other); _distributionMode = other._distributionMode; if (other._filter != null) _filter = new HashMap(other._filter); _defaultOutcome = other._defaultOutcome; if (other._outcomes != null) _outcomes = other._outcomes.clone(); } public Source() {} public Symbol getDistributionMode() { return _distributionMode; } public void setDistributionMode(Symbol distributionMode) { _distributionMode = distributionMode; } public Map getFilter() { return _filter; } public void setFilter(Map filter) { _filter = filter; } public Outcome getDefaultOutcome() { return _defaultOutcome; } public void setDefaultOutcome(Outcome defaultOutcome) { _defaultOutcome = defaultOutcome; } public Symbol[] getOutcomes() { return _outcomes; } public void setOutcomes(Symbol... outcomes) { _outcomes = outcomes; } @Override public String toString() { return "Source{" + "address='" + getAddress() + '\'' + ", durable=" + getDurable() + ", expiryPolicy=" + getExpiryPolicy() + ", timeout=" + getTimeout() + ", dynamic=" + getDynamic() + ", dynamicNodeProperties=" + getDynamicNodeProperties() + ", distributionMode=" + _distributionMode + ", filter=" + _filter + ", defaultOutcome=" + _defaultOutcome + ", outcomes=" + (_outcomes == null ? null : Arrays.asList(_outcomes)) + ", capabilities=" + (getCapabilities() == null ? null : Arrays.asList(getCapabilities())) + '}'; } @Override public org.apache.qpid.proton.amqp.transport.Source copy() { return new Source(this); } } ././@LongLink0100644 0000000 0000000 00000000151 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Target.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Target.0100644 0000000 0000000 00000003266 14303440055 033505 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; import java.util.Arrays; public final class Target extends Terminus implements org.apache.qpid.proton.amqp.transport.Target { private Target(Target other) { super(other); } public Target() { } @Override public String toString() { return "Target{" + "address='" + getAddress() + '\'' + ", durable=" + getDurable() + ", expiryPolicy=" + getExpiryPolicy() + ", timeout=" + getTimeout() + ", dynamic=" + getDynamic() + ", dynamicNodeProperties=" + getDynamicNodeProperties() + ", capabilities=" + (getCapabilities() == null ? null : Arrays.asList(getCapabilities())) + '}'; } @Override public org.apache.qpid.proton.amqp.transport.Target copy() { return new Target(this); } } ././@LongLink0100644 0000000 0000000 00000000153 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Terminus.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Terminu0100644 0000000 0000000 00000006600 14303440055 033617 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; import java.util.HashMap; import java.util.Map; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedInteger; public abstract class Terminus { private String _address; private TerminusDurability _durable = TerminusDurability.NONE; private TerminusExpiryPolicy _expiryPolicy = TerminusExpiryPolicy.SESSION_END; private UnsignedInteger _timeout = UnsignedInteger.valueOf(0); private boolean _dynamic; private Map _dynamicNodeProperties; private Symbol[] _capabilities; Terminus() { } protected Terminus(Terminus other) { _address = other._address; _durable = other._durable; _expiryPolicy = other._expiryPolicy; _timeout = other._timeout; _dynamic = other._dynamic; if (other._dynamicNodeProperties != null) { // TODO: Do we need to copy or can we make a simple reference? _dynamicNodeProperties = new HashMap(other._dynamicNodeProperties); } if (other._capabilities != null) { _capabilities = other._capabilities.clone(); } } public final String getAddress() { return _address; } public final void setAddress(String address) { _address = address; } public final TerminusDurability getDurable() { return _durable; } public final void setDurable(TerminusDurability durable) { _durable = durable == null ? TerminusDurability.NONE : durable; } public final TerminusExpiryPolicy getExpiryPolicy() { return _expiryPolicy; } public final void setExpiryPolicy(TerminusExpiryPolicy expiryPolicy) { _expiryPolicy = expiryPolicy == null ? TerminusExpiryPolicy.SESSION_END : expiryPolicy; } public final UnsignedInteger getTimeout() { return _timeout; } public final void setTimeout(UnsignedInteger timeout) { _timeout = timeout; } public final boolean getDynamic() { return _dynamic; } public final void setDynamic(boolean dynamic) { _dynamic = dynamic; } public final Map getDynamicNodeProperties() { return _dynamicNodeProperties; } public final void setDynamicNodeProperties(Map dynamicNodeProperties) { _dynamicNodeProperties = dynamicNodeProperties; } public final Symbol[] getCapabilities() { return _capabilities; } public final void setCapabilities(Symbol... capabilities) { _capabilities = capabilities; } } ././@LongLink0100644 0000000 0000000 00000000165 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/TerminusDurability.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Terminu0100644 0000000 0000000 00000002665 14303440055 033626 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; import org.apache.qpid.proton.amqp.UnsignedInteger; public enum TerminusDurability { NONE, CONFIGURATION, UNSETTLED_STATE; public UnsignedInteger getValue() { return UnsignedInteger.valueOf(ordinal()); } public static TerminusDurability get(UnsignedInteger value) { switch (value.intValue()) { case 0: return NONE; case 1: return CONFIGURATION; case 2: return UNSETTLED_STATE; } throw new IllegalArgumentException("Unknown TerminusDurablity: " + value); } } ././@LongLink0100644 0000000 0000000 00000000167 14303440055 011635 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/TerminusExpiryPolicy.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/messaging/Terminu0100644 0000000 0000000 00000003647 14303440055 033627 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.messaging; import java.util.HashMap; import java.util.Map; import org.apache.qpid.proton.amqp.Symbol; public enum TerminusExpiryPolicy { LINK_DETACH("link-detach"), SESSION_END("session-end"), CONNECTION_CLOSE("connection-close"), NEVER("never"); private Symbol _policy; private static final Map _map = new HashMap(); TerminusExpiryPolicy(String policy) { _policy = Symbol.valueOf(policy); } public Symbol getPolicy() { return _policy; } static { _map.put(LINK_DETACH.getPolicy(), LINK_DETACH); _map.put(SESSION_END.getPolicy(), SESSION_END); _map.put(CONNECTION_CLOSE.getPolicy(), CONNECTION_CLOSE); _map.put(NEVER.getPolicy(), NEVER); } public static TerminusExpiryPolicy valueOf(Symbol policy) { TerminusExpiryPolicy expiryPolicy = _map.get(policy); if(expiryPolicy == null) { throw new IllegalArgumentException("Unknown TerminusExpiryPolicy: " + policy); } return expiryPolicy; } } ././@LongLink0100644 0000000 0000000 00000000157 14303440055 011634 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/security/SaslChallenge.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/security/SaslChal0100644 0000000 0000000 00000003511 14303440055 033556 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.security; import org.apache.qpid.proton.amqp.Binary; public final class SaslChallenge implements SaslFrameBody { private Binary _challenge; public Binary getChallenge() { return _challenge; } public void setChallenge(Binary challenge) { if( challenge == null ) { throw new NullPointerException("the challenge field is mandatory"); } _challenge = challenge; } public Object get(final int index) { switch(index) { case 0: return _challenge; } throw new IllegalStateException("Unknown index " + index); } public int size() { return 1; } public void invoke(SaslFrameBodyHandler handler, Binary payload, E context) { handler.handleChallenge(this, payload, context); } @Override public String toString() { return "SaslChallenge{" + "challenge=" + _challenge + '}'; } } ././@LongLink0100644 0000000 0000000 00000000152 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/security/SaslCode.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/security/SaslCode0100644 0000000 0000000 00000002227 14303440055 033564 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.security; import org.apache.qpid.proton.amqp.UnsignedByte; public enum SaslCode { OK, AUTH, SYS, SYS_PERM, SYS_TEMP; public UnsignedByte getValue() { return UnsignedByte.valueOf((byte)ordinal()); } public static SaslCode valueOf(UnsignedByte v) { return SaslCode.values()[v.byteValue()]; } } ././@LongLink0100644 0000000 0000000 00000000157 14303440055 011634 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/security/SaslFrameBody.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/security/SaslFram0100644 0000000 0000000 00000002711 14303440055 033575 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.security; import org.apache.qpid.proton.amqp.Binary; public interface SaslFrameBody { interface SaslFrameBodyHandler { void handleMechanisms(SaslMechanisms saslMechanisms, Binary payload, E context); void handleInit(SaslInit saslInit, Binary payload, E context); void handleChallenge(SaslChallenge saslChallenge, Binary payload, E context); void handleResponse(SaslResponse saslResponse, Binary payload, E context); void handleOutcome(SaslOutcome saslOutcome, Binary payload, E context); } void invoke(SaslFrameBodyHandler handler, Binary payload, E context); } ././@LongLink0100644 0000000 0000000 00000000152 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/security/SaslInit.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/security/SaslInit0100644 0000000 0000000 00000004161 14303440055 033614 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.security; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.Symbol; public final class SaslInit implements SaslFrameBody { private Symbol _mechanism; private Binary _initialResponse; private String _hostname; public Symbol getMechanism() { return _mechanism; } public void setMechanism(Symbol mechanism) { if( mechanism == null ) { throw new NullPointerException("the mechanism field is mandatory"); } _mechanism = mechanism; } public Binary getInitialResponse() { return _initialResponse; } public void setInitialResponse(Binary initialResponse) { _initialResponse = initialResponse; } public String getHostname() { return _hostname; } public void setHostname(String hostname) { _hostname = hostname; } public void invoke(SaslFrameBodyHandler handler, Binary payload, E context) { handler.handleInit(this, payload, context); } @Override public String toString() { return "SaslInit{" + "mechanism=" + _mechanism + ", initialResponse=" + _initialResponse + ", hostname='" + _hostname + '\'' + '}'; } } ././@LongLink0100644 0000000 0000000 00000000160 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/security/SaslMechanisms.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/security/SaslMech0100644 0000000 0000000 00000003520 14303440055 033563 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.security; import java.util.Arrays; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.Symbol; public final class SaslMechanisms implements SaslFrameBody { private Symbol[] _saslServerMechanisms; public Symbol[] getSaslServerMechanisms() { return _saslServerMechanisms; } public void setSaslServerMechanisms(Symbol... saslServerMechanisms) { if( saslServerMechanisms == null ) { throw new NullPointerException("the sasl-server-mechanisms field is mandatory"); } _saslServerMechanisms = saslServerMechanisms; } public void invoke(SaslFrameBodyHandler handler, Binary payload, E context) { handler.handleMechanisms(this, payload, context); } @Override public String toString() { return "SaslMechanisms{" + "saslServerMechanisms=" + (_saslServerMechanisms == null ? null : Arrays.asList(_saslServerMechanisms)) + '}'; } } ././@LongLink0100644 0000000 0000000 00000000155 14303440055 011632 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/security/SaslOutcome.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/security/SaslOutc0100644 0000000 0000000 00000003455 14303440055 033630 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.security; import org.apache.qpid.proton.amqp.Binary; public final class SaslOutcome implements SaslFrameBody { private SaslCode _code; private Binary _additionalData; public SaslCode getCode() { return _code; } public void setCode(SaslCode code) { if( code == null ) { throw new NullPointerException("the code field is mandatory"); } _code = code; } public Binary getAdditionalData() { return _additionalData; } public void setAdditionalData(Binary additionalData) { _additionalData = additionalData; } @Override public String toString() { return "SaslOutcome{" + "_code=" + _code + ", _additionalData=" + _additionalData + '}'; } public void invoke(SaslFrameBodyHandler handler, Binary payload, E context) { handler.handleOutcome(this, payload, context); } } ././@LongLink0100644 0000000 0000000 00000000156 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/security/SaslResponse.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/security/SaslResp0100644 0000000 0000000 00000003042 14303440055 033617 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.security; import org.apache.qpid.proton.amqp.Binary; public final class SaslResponse implements SaslFrameBody { private Binary _response; public Binary getResponse() { return _response; } public void setResponse(Binary response) { if( response == null ) { throw new NullPointerException("the response field is mandatory"); } _response = response; } @Override public String toString() { return "SaslResponse{response=" + _response + '}'; } public void invoke(SaslFrameBodyHandler handler, Binary payload, E context) { handler.handleResponse(this, payload, context); } } ././@LongLink0100644 0000000 0000000 00000000160 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/Coordinator.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/Coord0100644 0000000 0000000 00000003072 14303440055 033612 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transaction; import java.util.Arrays; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.transport.Target; public final class Coordinator implements Target { private Symbol[] _capabilities; public Symbol[] getCapabilities() { return _capabilities; } public void setCapabilities(Symbol... capabilities) { _capabilities = capabilities; } @Override public String toString() { return "Coordinator{" + "capabilities=" + (_capabilities == null ? null : Arrays.asList(_capabilities)) + '}'; } public String getAddress() { return null; } @Override public Target copy() { return null; } } ././@LongLink0100644 0000000 0000000 00000000154 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/Declare.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/Decla0100644 0000000 0000000 00000002314 14303440055 033552 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transaction; public final class Declare { private GlobalTxId _globalId; public GlobalTxId getGlobalId() { return _globalId; } public void setGlobalId(GlobalTxId globalId) { _globalId = globalId; } @Override public String toString() { return "Declare{" + "globalId=" + _globalId + '}'; } } ././@LongLink0100644 0000000 0000000 00000000155 14303440055 011632 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/Declared.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/Decla0100644 0000000 0000000 00000003321 14303440055 033551 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transaction; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.messaging.Outcome; import org.apache.qpid.proton.amqp.transport.DeliveryState; public final class Declared implements DeliveryState, Outcome { public static final Symbol DESCRIPTOR_SYMBOL = Symbol.valueOf("amqp:declared:list"); private Binary _txnId; public Binary getTxnId() { return _txnId; } public void setTxnId(Binary txnId) { if( txnId == null ) { throw new NullPointerException("the txn-id field is mandatory"); } _txnId = txnId; } @Override public String toString() { return "Declared{" + "txnId=" + _txnId + '}'; } @Override public DeliveryStateType getType() { return DeliveryStateType.Declared; } } ././@LongLink0100644 0000000 0000000 00000000156 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/Discharge.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/Disch0100644 0000000 0000000 00000003032 14303440055 033572 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transaction; import org.apache.qpid.proton.amqp.Binary; public final class Discharge { private Binary _txnId; private Boolean _fail; public Binary getTxnId() { return _txnId; } public void setTxnId(Binary txnId) { if( txnId == null ) { throw new NullPointerException("the txn-id field is mandatory"); } _txnId = txnId; } public Boolean getFail() { return _fail; } public void setFail(Boolean fail) { _fail = fail; } @Override public String toString() { return "Discharge{" + "txnId=" + _txnId + ", fail=" + _fail + '}'; } } ././@LongLink0100644 0000000 0000000 00000000157 14303440055 011634 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/GlobalTxId.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/Globa0100644 0000000 0000000 00000001600 14303440055 033563 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transaction; public interface GlobalTxId { } ././@LongLink0100644 0000000 0000000 00000000166 14303440055 011634 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/TransactionErrors.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/Trans0100644 0000000 0000000 00000002260 14303440055 033631 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transaction; import org.apache.qpid.proton.amqp.Symbol; public interface TransactionErrors { final static Symbol UNKNOWN_ID = Symbol.valueOf("amqp:transaction:unknown-id"); final static Symbol TRANSACTION_ROLLBACK = Symbol.valueOf("amqp:transaction:rollback"); final static Symbol TRANSACTION_TIMEOUT = Symbol.valueOf("amqp:transaction:timeout"); } ././@LongLink0100644 0000000 0000000 00000000167 14303440055 011635 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/TransactionalState.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/Trans0100644 0000000 0000000 00000003475 14303440055 033642 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transaction; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.messaging.Outcome; import org.apache.qpid.proton.amqp.transport.DeliveryState; public final class TransactionalState implements DeliveryState { private Binary _txnId; private Outcome _outcome; public Binary getTxnId() { return _txnId; } public void setTxnId(Binary txnId) { if( txnId == null ) { throw new NullPointerException("the txn-id field is mandatory"); } _txnId = txnId; } public Outcome getOutcome() { return _outcome; } public void setOutcome(Outcome outcome) { _outcome = outcome; } @Override public String toString() { return "TransactionalState{" + "txnId=" + _txnId + ", outcome=" + _outcome + '}'; } @Override public DeliveryStateType getType() { return DeliveryStateType.Transactional; } } ././@LongLink0100644 0000000 0000000 00000000162 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/TxnCapability.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transaction/TxnCa0100644 0000000 0000000 00000002527 14303440055 033565 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transaction; import org.apache.qpid.proton.amqp.Symbol; public interface TxnCapability { final static Symbol LOCAL_TXN = Symbol.valueOf("amqp:local-transactions"); final static Symbol DISTRIBUTED_TXN = Symbol.valueOf("amqp:distributed-transactions"); final static Symbol PROMOTABLE_TXN = Symbol.valueOf("amqp:promotable-transactions"); final static Symbol MULTI_TXNS_PER_SSN = Symbol.valueOf("amqp:multi-txns-per-ssn"); final static Symbol MULTI_SSNS_PER_TXN = Symbol.valueOf("amqp:multi-ssns-per-txn"); } ././@LongLink0100644 0000000 0000000 00000000154 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/AmqpError.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/AmqpErr0100644 0000000 0000000 00000003730 14303440055 033623 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; import org.apache.qpid.proton.amqp.Symbol; public interface AmqpError { final static Symbol INTERNAL_ERROR = Symbol.valueOf("amqp:internal-error"); final static Symbol NOT_FOUND = Symbol.valueOf("amqp:not-found"); final static Symbol UNAUTHORIZED_ACCESS = Symbol.valueOf("amqp:unauthorized-access"); final static Symbol DECODE_ERROR = Symbol.valueOf("amqp:decode-error"); final static Symbol RESOURCE_LIMIT_EXCEEDED = Symbol.valueOf("amqp:resource-limit-exceeded"); final static Symbol NOT_ALLOWED = Symbol.valueOf("amqp:not-allowed"); final static Symbol INVALID_FIELD = Symbol.valueOf("amqp:invalid-field"); final static Symbol NOT_IMPLEMENTED = Symbol.valueOf("amqp:not-implemented"); final static Symbol RESOURCE_LOCKED = Symbol.valueOf("amqp:resource-locked"); final static Symbol PRECONDITION_FAILED = Symbol.valueOf("amqp:precondition-failed"); final static Symbol RESOURCE_DELETED = Symbol.valueOf("amqp:resource-deleted"); final static Symbol ILLEGAL_STATE = Symbol.valueOf("amqp:illegal-state"); final static Symbol FRAME_SIZE_TOO_SMALL = Symbol.valueOf("amqp:frame-size-too-small"); } ././@LongLink0100644 0000000 0000000 00000000151 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Attach.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Attach.0100644 0000000 0000000 00000016213 14303440055 033536 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.Map; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedInteger; import org.apache.qpid.proton.amqp.UnsignedLong; @SuppressWarnings("rawtypes") public final class Attach implements FrameBody { private String _name; private UnsignedInteger _handle; private Role _role = Role.SENDER; private SenderSettleMode _sndSettleMode = SenderSettleMode.MIXED; private ReceiverSettleMode _rcvSettleMode = ReceiverSettleMode.FIRST; private Source _source; private Target _target; private Map _unsettled; private boolean _incompleteUnsettled; private UnsignedInteger _initialDeliveryCount; private UnsignedLong _maxMessageSize; private Symbol[] _offeredCapabilities; private Symbol[] _desiredCapabilities; private Map _properties; public Attach() {} @SuppressWarnings("unchecked") public Attach(Attach other) { this._name = other._name; this._handle = other._handle; this._role = other._role; this._sndSettleMode = other._sndSettleMode; this._rcvSettleMode = other._rcvSettleMode; if (other._source != null) { this._source = other._source.copy(); } if (other._target != null) { this._target = other._target.copy(); } if (other._unsettled != null) { this._unsettled = new LinkedHashMap<>(other._unsettled); } this._incompleteUnsettled = other._incompleteUnsettled; this._initialDeliveryCount = other._initialDeliveryCount; this._maxMessageSize = other._maxMessageSize; if (other._offeredCapabilities != null) { this._offeredCapabilities = Arrays.copyOf(other._offeredCapabilities, other._offeredCapabilities.length); } if (other._desiredCapabilities != null) { this._desiredCapabilities = Arrays.copyOf(other._desiredCapabilities, other._desiredCapabilities.length); } if (other._properties != null) { this._properties = new LinkedHashMap<>(other._properties); } } public String getName() { return _name; } public void setName(String name) { if( name == null ) { throw new NullPointerException("the name field is mandatory"); } _name = name; } public UnsignedInteger getHandle() { return _handle; } public void setHandle(UnsignedInteger handle) { if( handle == null ) { throw new NullPointerException("the handle field is mandatory"); } _handle = handle; } public Role getRole() { return _role; } public void setRole(Role role) { if(role == null) { throw new NullPointerException("Role cannot be null"); } _role = role; } public SenderSettleMode getSndSettleMode() { return _sndSettleMode; } public void setSndSettleMode(SenderSettleMode sndSettleMode) { _sndSettleMode = sndSettleMode == null ? SenderSettleMode.MIXED : sndSettleMode; } public ReceiverSettleMode getRcvSettleMode() { return _rcvSettleMode; } public void setRcvSettleMode(ReceiverSettleMode rcvSettleMode) { _rcvSettleMode = rcvSettleMode == null ? ReceiverSettleMode.FIRST : rcvSettleMode; } public Source getSource() { return _source; } public void setSource(Source source) { _source = source; } public Target getTarget() { return _target; } public void setTarget(Target target) { _target = target; } public Map getUnsettled() { return _unsettled; } public void setUnsettled(Map unsettled) { _unsettled = unsettled; } public boolean getIncompleteUnsettled() { return _incompleteUnsettled; } public void setIncompleteUnsettled(boolean incompleteUnsettled) { _incompleteUnsettled = incompleteUnsettled; } public UnsignedInteger getInitialDeliveryCount() { return _initialDeliveryCount; } public void setInitialDeliveryCount(UnsignedInteger initialDeliveryCount) { _initialDeliveryCount = initialDeliveryCount; } public UnsignedLong getMaxMessageSize() { return _maxMessageSize; } public void setMaxMessageSize(UnsignedLong maxMessageSize) { _maxMessageSize = maxMessageSize; } public Symbol[] getOfferedCapabilities() { return _offeredCapabilities; } public void setOfferedCapabilities(Symbol... offeredCapabilities) { _offeredCapabilities = offeredCapabilities; } public Symbol[] getDesiredCapabilities() { return _desiredCapabilities; } public void setDesiredCapabilities(Symbol... desiredCapabilities) { _desiredCapabilities = desiredCapabilities; } public Map getProperties() { return _properties; } public void setProperties(Map properties) { _properties = properties; } @Override public void invoke(FrameBodyHandler handler, Binary payload, E context) { handler.handleAttach(this, payload, context); } @Override public String toString() { return "Attach{" + "name='" + _name + '\'' + ", handle=" + _handle + ", role=" + _role + ", sndSettleMode=" + _sndSettleMode + ", rcvSettleMode=" + _rcvSettleMode + ", source=" + _source + ", target=" + _target + ", unsettled=" + _unsettled + ", incompleteUnsettled=" + _incompleteUnsettled + ", initialDeliveryCount=" + _initialDeliveryCount + ", maxMessageSize=" + _maxMessageSize + ", offeredCapabilities=" + (_offeredCapabilities == null ? null : Arrays.asList(_offeredCapabilities)) + ", desiredCapabilities=" + (_desiredCapabilities == null ? null : Arrays.asList(_desiredCapabilities)) + ", properties=" + _properties + '}'; } @Override public Attach copy() { return new Attach(this); } } ././@LongLink0100644 0000000 0000000 00000000150 14303440055 011625 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Begin.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Begin.j0100644 0000000 0000000 00000012405 14303440055 033527 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.Map; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedInteger; import org.apache.qpid.proton.amqp.UnsignedShort; @SuppressWarnings("rawtypes") public final class Begin implements FrameBody { private UnsignedShort _remoteChannel; private UnsignedInteger _nextOutgoingId; private UnsignedInteger _incomingWindow; private UnsignedInteger _outgoingWindow; private UnsignedInteger _handleMax = UnsignedInteger.valueOf(0xffffffff); private Symbol[] _offeredCapabilities; private Symbol[] _desiredCapabilities; private Map _properties; public Begin() {} @SuppressWarnings("unchecked") public Begin(Begin other) { this._remoteChannel = other._remoteChannel; this._nextOutgoingId = other._nextOutgoingId; this._incomingWindow = other._incomingWindow; this._outgoingWindow = other._outgoingWindow; this._handleMax = other._handleMax; if (other._offeredCapabilities != null) { this._offeredCapabilities = Arrays.copyOf(other._offeredCapabilities, other._offeredCapabilities.length); } if (other._desiredCapabilities != null) { this._desiredCapabilities = Arrays.copyOf(other._desiredCapabilities, other._desiredCapabilities.length); } if (other._properties != null) { this._properties = new LinkedHashMap<>(other._properties); } } public UnsignedShort getRemoteChannel() { return _remoteChannel; } public void setRemoteChannel(UnsignedShort remoteChannel) { _remoteChannel = remoteChannel; } public UnsignedInteger getNextOutgoingId() { return _nextOutgoingId; } public void setNextOutgoingId(UnsignedInteger nextOutgoingId) { if( nextOutgoingId == null ) { throw new NullPointerException("the next-outgoing-id field is mandatory"); } _nextOutgoingId = nextOutgoingId; } public UnsignedInteger getIncomingWindow() { return _incomingWindow; } public void setIncomingWindow(UnsignedInteger incomingWindow) { if( incomingWindow == null ) { throw new NullPointerException("the incoming-window field is mandatory"); } _incomingWindow = incomingWindow; } public UnsignedInteger getOutgoingWindow() { return _outgoingWindow; } public void setOutgoingWindow(UnsignedInteger outgoingWindow) { if( outgoingWindow == null ) { throw new NullPointerException("the outgoing-window field is mandatory"); } _outgoingWindow = outgoingWindow; } public UnsignedInteger getHandleMax() { return _handleMax; } public void setHandleMax(UnsignedInteger handleMax) { _handleMax = handleMax; } public Symbol[] getOfferedCapabilities() { return _offeredCapabilities; } public void setOfferedCapabilities(Symbol... offeredCapabilities) { _offeredCapabilities = offeredCapabilities; } public Symbol[] getDesiredCapabilities() { return _desiredCapabilities; } public void setDesiredCapabilities(Symbol... desiredCapabilities) { _desiredCapabilities = desiredCapabilities; } public Map getProperties() { return _properties; } public void setProperties(Map properties) { _properties = properties; } @Override public void invoke(FrameBodyHandler handler, Binary payload, E context) { handler.handleBegin(this, payload, context); } @Override public String toString() { return "Begin{" + "remoteChannel=" + _remoteChannel + ", nextOutgoingId=" + _nextOutgoingId + ", incomingWindow=" + _incomingWindow + ", outgoingWindow=" + _outgoingWindow + ", handleMax=" + _handleMax + ", offeredCapabilities=" + (_offeredCapabilities == null ? null : Arrays.asList(_offeredCapabilities)) + ", desiredCapabilities=" + (_desiredCapabilities == null ? null : Arrays.asList(_desiredCapabilities)) + ", properties=" + _properties + '}'; } @Override public Begin copy() { return new Begin(this); } } ././@LongLink0100644 0000000 0000000 00000000150 14303440055 011625 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Close.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Close.j0100644 0000000 0000000 00000003303 14303440055 033545 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; import org.apache.qpid.proton.amqp.Binary; public final class Close implements FrameBody { private ErrorCondition _error; public Close() {} public Close(Close other) { if (other._error != null) { this._error = new ErrorCondition(); this._error.copyFrom(other._error); } } public ErrorCondition getError() { return _error; } public void setError(ErrorCondition error) { _error = error; } @Override public void invoke(FrameBodyHandler handler, Binary payload, E context) { handler.handleClose(this, payload, context); } @Override public String toString() { return "Close{" + "error=" + _error + '}'; } @Override public Close copy() { return new Close(this); } } ././@LongLink0100644 0000000 0000000 00000000162 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/ConnectionError.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Connect0100644 0000000 0000000 00000002240 14303440055 033640 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; import org.apache.qpid.proton.amqp.Symbol; public interface ConnectionError { final static Symbol CONNECTION_FORCED = Symbol.valueOf("amqp:connection:forced"); final static Symbol FRAMING_ERROR = Symbol.valueOf("amqp:connection:framing-error"); final static Symbol REDIRECT = Symbol.valueOf("amqp:connection:redirect"); } ././@LongLink0100644 0000000 0000000 00000000160 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/DeliveryState.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Deliver0100644 0000000 0000000 00000002627 14303440055 033652 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; /** * Describes the state of a delivery at a link end-point. * * Note that the the sender is the owner of the state. * The receiver merely influences the state. * TODO clarify the concept of ownership? how is link recovery involved? */ public interface DeliveryState { enum DeliveryStateType { Accepted, Declared, Modified, Received, Rejected, Released, Transactional } /** * @return the {@link DeliveryStateType} that this instance represents. */ DeliveryStateType getType(); } ././@LongLink0100644 0000000 0000000 00000000151 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Detach.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Detach.0100644 0000000 0000000 00000004624 14303440055 033525 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.UnsignedInteger; public final class Detach implements FrameBody { private UnsignedInteger _handle; private boolean _closed; private ErrorCondition _error; public Detach() {} public Detach(Detach other) { this._handle = other._handle; this._closed = other._closed; if (other._error != null) { this._error = new ErrorCondition(); this._error.copyFrom(other._error); } } public UnsignedInteger getHandle() { return _handle; } public void setHandle(UnsignedInteger handle) { if( handle == null ) { throw new NullPointerException("the handle field is mandatory"); } _handle = handle; } public boolean getClosed() { return _closed; } public void setClosed(boolean closed) { _closed = closed; } public ErrorCondition getError() { return _error; } public void setError(ErrorCondition error) { _error = error; } @Override public void invoke(FrameBodyHandler handler, Binary payload, E context) { handler.handleDetach(this, payload, context); } @Override public String toString() { return "Detach{" + "handle=" + _handle + ", closed=" + _closed + ", error=" + _error + '}'; } @Override public Detach copy() { return new Detach(this); } } ././@LongLink0100644 0000000 0000000 00000000156 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Disposition.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Disposi0100644 0000000 0000000 00000006304 14303440055 033666 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.UnsignedInteger; public final class Disposition implements FrameBody { private Role _role = Role.SENDER; private UnsignedInteger _first; private UnsignedInteger _last; private boolean _settled; private DeliveryState _state; private boolean _batchable; public Disposition() {} public Disposition(Disposition other) { this._role = other._role; this._first = other._first; this._last = other._last; this._settled = other._settled; this._state = other._state; this._batchable = other._batchable; } public Role getRole() { return _role; } public void setRole(Role role) { if(role == null) { throw new NullPointerException("Role cannot be null"); } _role = role; } public UnsignedInteger getFirst() { return _first; } public void setFirst(UnsignedInteger first) { if( first == null ) { throw new NullPointerException("the first field is mandatory"); } _first = first; } public UnsignedInteger getLast() { return _last; } public void setLast(UnsignedInteger last) { _last = last; } public boolean getSettled() { return _settled; } public void setSettled(boolean settled) { _settled = settled; } public DeliveryState getState() { return _state; } public void setState(DeliveryState state) { _state = state; } public boolean getBatchable() { return _batchable; } public void setBatchable(boolean batchable) { _batchable = batchable; } @Override public void invoke(FrameBodyHandler handler, Binary payload, E context) { handler.handleDisposition(this, payload, context); } @Override public String toString() { return "Disposition{" + "role=" + _role + ", first=" + _first + ", last=" + _last + ", settled=" + _settled + ", state=" + _state + ", batchable=" + _batchable + '}'; } @Override public Disposition copy() { return new Disposition(this); } } ././@LongLink0100644 0000000 0000000 00000000155 14303440055 011632 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/EmptyFrame.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/EmptyFr0100644 0000000 0000000 00000002434 14303440055 033642 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; import org.apache.qpid.proton.amqp.Binary; public final class EmptyFrame implements FrameBody { public static final EmptyFrame INSTANCE = new EmptyFrame(); @Override public void invoke(FrameBodyHandler handler, Binary payload, E context) { // NO-OP } @Override public String toString() { return "Empty Frame"; } @Override public EmptyFrame copy() { return new EmptyFrame(); } } ././@LongLink0100644 0000000 0000000 00000000146 14303440055 011632 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/End.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/End.jav0100644 0000000 0000000 00000003263 14303440055 033542 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; import org.apache.qpid.proton.amqp.Binary; public final class End implements FrameBody { private ErrorCondition _error; public End() {} public End(End other) { if (other._error != null) { this._error = new ErrorCondition(); this._error.copyFrom(other._error); } } public ErrorCondition getError() { return _error; } public void setError(ErrorCondition error) { _error = error; } @Override public void invoke(FrameBodyHandler handler, Binary payload, E context) { handler.handleEnd(this, payload, context); } @Override public String toString() { return "End{" + "error=" + _error + '}'; } @Override public End copy() { return new End(this); } } ././@LongLink0100644 0000000 0000000 00000000161 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/ErrorCondition.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/ErrorCo0100644 0000000 0000000 00000006475 14303440055 033640 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; import java.util.Map; import org.apache.qpid.proton.amqp.Symbol; public final class ErrorCondition { private Symbol _condition; private String _description; private Map _info; public ErrorCondition() { } public ErrorCondition(Symbol condition, String description) { _condition = condition; _description = description; } public Symbol getCondition() { return _condition; } public void setCondition(Symbol condition) { if( condition == null ) { throw new NullPointerException("the condition field is mandatory"); } _condition = condition; } public String getDescription() { return _description; } public void setDescription(String description) { _description = description; } public Map getInfo() { return _info; } public void setInfo(Map info) { _info = info; } public void clear() { _condition = null; _description = null; _info = null; } public void copyFrom(ErrorCondition condition) { _condition = condition._condition; _description = condition._description; _info = condition._info; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ErrorCondition that = (ErrorCondition) o; if (_condition != null ? !_condition.equals(that._condition) : that._condition != null) { return false; } if (_description != null ? !_description.equals(that._description) : that._description != null) { return false; } if (_info != null ? !_info.equals(that._info) : that._info != null) { return false; } return true; } @Override public int hashCode() { int result = _condition != null ? _condition.hashCode() : 0; result = 31 * result + (_description != null ? _description.hashCode() : 0); result = 31 * result + (_info != null ? _info.hashCode() : 0); return result; } @Override public String toString() { return "Error{" + "condition=" + _condition + ", description='" + _description + '\'' + ", info=" + _info + '}'; } } ././@LongLink0100644 0000000 0000000 00000000147 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Flow.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Flow.ja0100644 0000000 0000000 00000012637 14303440055 033562 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; import java.util.LinkedHashMap; import java.util.Map; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.UnsignedInteger; @SuppressWarnings("rawtypes") public final class Flow implements FrameBody { private UnsignedInteger _nextIncomingId; private UnsignedInteger _incomingWindow; private UnsignedInteger _nextOutgoingId; private UnsignedInteger _outgoingWindow; private UnsignedInteger _handle; private UnsignedInteger _deliveryCount; private UnsignedInteger _linkCredit; private UnsignedInteger _available; private boolean _drain; private boolean _echo; private Map _properties; public Flow() {} @SuppressWarnings("unchecked") public Flow(Flow other) { this._nextIncomingId = other._nextIncomingId; this._incomingWindow = other._incomingWindow; this._nextOutgoingId = other._nextOutgoingId; this._outgoingWindow = other._outgoingWindow; this._handle = other._handle; this._deliveryCount = other._deliveryCount; this._linkCredit = other._linkCredit; this._available = other._available; this._drain = other._drain; this._echo = other._echo; if (other._properties != null) { this._properties = new LinkedHashMap<>(other._properties); } } public UnsignedInteger getNextIncomingId() { return _nextIncomingId; } public void setNextIncomingId(UnsignedInteger nextIncomingId) { _nextIncomingId = nextIncomingId; } public UnsignedInteger getIncomingWindow() { return _incomingWindow; } public void setIncomingWindow(UnsignedInteger incomingWindow) { if( incomingWindow == null ) { throw new NullPointerException("the incoming-window field is mandatory"); } _incomingWindow = incomingWindow; } public UnsignedInteger getNextOutgoingId() { return _nextOutgoingId; } public void setNextOutgoingId(UnsignedInteger nextOutgoingId) { if( nextOutgoingId == null ) { throw new NullPointerException("the next-outgoing-id field is mandatory"); } _nextOutgoingId = nextOutgoingId; } public UnsignedInteger getOutgoingWindow() { return _outgoingWindow; } public void setOutgoingWindow(UnsignedInteger outgoingWindow) { if( outgoingWindow == null ) { throw new NullPointerException("the outgoing-window field is mandatory"); } _outgoingWindow = outgoingWindow; } public UnsignedInteger getHandle() { return _handle; } public void setHandle(UnsignedInteger handle) { _handle = handle; } public UnsignedInteger getDeliveryCount() { return _deliveryCount; } public void setDeliveryCount(UnsignedInteger deliveryCount) { _deliveryCount = deliveryCount; } public UnsignedInteger getLinkCredit() { return _linkCredit; } public void setLinkCredit(UnsignedInteger linkCredit) { _linkCredit = linkCredit; } public UnsignedInteger getAvailable() { return _available; } public void setAvailable(UnsignedInteger available) { _available = available; } public boolean getDrain() { return _drain; } public void setDrain(boolean drain) { _drain = drain; } public boolean getEcho() { return _echo; } public void setEcho(boolean echo) { _echo = echo; } public Map getProperties() { return _properties; } public void setProperties(Map properties) { _properties = properties; } @Override public void invoke(FrameBodyHandler handler, Binary payload, E context) { handler.handleFlow(this, payload, context); } @Override public String toString() { return "Flow{" + "nextIncomingId=" + _nextIncomingId + ", incomingWindow=" + _incomingWindow + ", nextOutgoingId=" + _nextOutgoingId + ", outgoingWindow=" + _outgoingWindow + ", handle=" + _handle + ", deliveryCount=" + _deliveryCount + ", linkCredit=" + _linkCredit + ", available=" + _available + ", drain=" + _drain + ", echo=" + _echo + ", properties=" + _properties + '}'; } @Override public Flow copy() { return new Flow(this); } } ././@LongLink0100644 0000000 0000000 00000000154 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/FrameBody.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/FrameBo0100644 0000000 0000000 00000003343 14303440055 033567 0ustar00rootroot0000000 0000000 package org.apache.qpid.proton.amqp.transport; /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ import org.apache.qpid.proton.amqp.Binary; public interface FrameBody { interface FrameBodyHandler { void handleOpen(Open open, Binary payload, E context); void handleBegin(Begin begin, Binary payload, E context); void handleAttach(Attach attach, Binary payload, E context); void handleFlow(Flow flow, Binary payload, E context); void handleTransfer(Transfer transfer, Binary payload, E context); void handleDisposition(Disposition disposition, Binary payload, E context); void handleDetach(Detach detach, Binary payload, E context); void handleEnd(End end, Binary payload, E context); void handleClose(Close close, Binary payload, E context); } void invoke(FrameBodyHandler handler, Binary payload, E context); /** * @return a deep copy of this FrameBody. */ FrameBody copy(); } ././@LongLink0100644 0000000 0000000 00000000154 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/LinkError.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/LinkErr0100644 0000000 0000000 00000002511 14303440055 033616 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; import org.apache.qpid.proton.amqp.Symbol; public interface LinkError { final static Symbol DETACH_FORCED = Symbol.valueOf("amqp:link:detach-forced"); final static Symbol TRANSFER_LIMIT_EXCEEDED = Symbol.valueOf("amqp:link:transfer-limit-exceeded"); final static Symbol MESSAGE_SIZE_EXCEEDED = Symbol.valueOf("amqp:link:message-size-exceeded"); final static Symbol REDIRECT = Symbol.valueOf("amqp:link:redirect"); final static Symbol STOLEN = Symbol.valueOf("amqp:link:stolen"); } ././@LongLink0100644 0000000 0000000 00000000147 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Open.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Open.ja0100644 0000000 0000000 00000013532 14303440055 033547 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; import java.util.Arrays; import java.util.LinkedHashMap; import java.util.Map; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedInteger; import org.apache.qpid.proton.amqp.UnsignedShort; @SuppressWarnings("rawtypes") public final class Open implements FrameBody { private String _containerId; private String _hostname; private UnsignedInteger _maxFrameSize = UnsignedInteger.valueOf(0xffffffff); private UnsignedShort _channelMax = UnsignedShort.valueOf((short) 65535); private UnsignedInteger _idleTimeOut; private Symbol[] _outgoingLocales; private Symbol[] _incomingLocales; private Symbol[] _offeredCapabilities; private Symbol[] _desiredCapabilities; private Map _properties; public Open() {} @SuppressWarnings("unchecked") public Open(Open other) { this._containerId = other._containerId; this._hostname = other._hostname; this._maxFrameSize = other._maxFrameSize; this._channelMax = other._channelMax; this._idleTimeOut = other._idleTimeOut; if (other._outgoingLocales != null) { this._outgoingLocales = Arrays.copyOf(other._outgoingLocales, other._outgoingLocales.length); } if (other._incomingLocales != null) { this._incomingLocales = Arrays.copyOf(other._incomingLocales, other._incomingLocales.length); } if (other._offeredCapabilities != null) { this._offeredCapabilities = Arrays.copyOf(other._offeredCapabilities, other._offeredCapabilities.length); } if (other._desiredCapabilities != null) { this._desiredCapabilities = Arrays.copyOf(other._desiredCapabilities, other._desiredCapabilities.length); } if (other._properties != null) { this._properties = new LinkedHashMap<>(other._properties); } } public String getContainerId() { return _containerId; } public void setContainerId(String containerId) { if( containerId == null ) { throw new NullPointerException("the container-id field is mandatory"); } _containerId = containerId; } public String getHostname() { return _hostname; } public void setHostname(String hostname) { _hostname = hostname; } public UnsignedInteger getMaxFrameSize() { return _maxFrameSize; } public void setMaxFrameSize(UnsignedInteger maxFrameSize) { _maxFrameSize = maxFrameSize; } public UnsignedShort getChannelMax() { return _channelMax; } public void setChannelMax(UnsignedShort channelMax) { _channelMax = channelMax; } public UnsignedInteger getIdleTimeOut() { return _idleTimeOut; } public void setIdleTimeOut(UnsignedInteger idleTimeOut) { _idleTimeOut = idleTimeOut; } public Symbol[] getOutgoingLocales() { return _outgoingLocales; } public void setOutgoingLocales(Symbol... outgoingLocales) { _outgoingLocales = outgoingLocales; } public Symbol[] getIncomingLocales() { return _incomingLocales; } public void setIncomingLocales(Symbol... incomingLocales) { _incomingLocales = incomingLocales; } public Symbol[] getOfferedCapabilities() { return _offeredCapabilities; } public void setOfferedCapabilities(Symbol... offeredCapabilities) { _offeredCapabilities = offeredCapabilities; } public Symbol[] getDesiredCapabilities() { return _desiredCapabilities; } public void setDesiredCapabilities(Symbol... desiredCapabilities) { _desiredCapabilities = desiredCapabilities; } public Map getProperties() { return _properties; } public void setProperties(Map properties) { _properties = properties; } @Override public void invoke(FrameBodyHandler handler, Binary payload, E context) { handler.handleOpen(this, payload, context); } @Override public String toString() { return "Open{" + " containerId='" + _containerId + '\'' + ", hostname='" + _hostname + '\'' + ", maxFrameSize=" + _maxFrameSize + ", channelMax=" + _channelMax + ", idleTimeOut=" + _idleTimeOut + ", outgoingLocales=" + (_outgoingLocales == null ? null : Arrays.asList(_outgoingLocales)) + ", incomingLocales=" + (_incomingLocales == null ? null : Arrays.asList(_incomingLocales)) + ", offeredCapabilities=" + (_offeredCapabilities == null ? null : Arrays.asList(_offeredCapabilities)) + ", desiredCapabilities=" + (_desiredCapabilities == null ? null : Arrays.asList(_desiredCapabilities)) + ", properties=" + _properties + '}'; } @Override public Open copy() { return new Open(this); } } ././@LongLink0100644 0000000 0000000 00000000165 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/ReceiverSettleMode.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Receive0100644 0000000 0000000 00000003032 14303440055 033631 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; import org.apache.qpid.proton.amqp.UnsignedByte; public enum ReceiverSettleMode { FIRST(0), SECOND(1); private UnsignedByte value; private ReceiverSettleMode(int value) { this.value = UnsignedByte.valueOf((byte)value); } public static ReceiverSettleMode valueOf(UnsignedByte value) { switch (value.intValue()) { case 0: return ReceiverSettleMode.FIRST; case 1: return ReceiverSettleMode.SECOND; default: throw new IllegalArgumentException("The value can be only 0 (for FIRST) and 1 (for SECOND)"); } } public UnsignedByte getValue() { return this.value; } } ././@LongLink0100644 0000000 0000000 00000000147 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Role.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Role.ja0100644 0000000 0000000 00000001705 14303440055 033546 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; public enum Role { SENDER, RECEIVER; public boolean getValue() { return this == RECEIVER; } } ././@LongLink0100644 0000000 0000000 00000000163 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/SenderSettleMode.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/SenderS0100644 0000000 0000000 00000003200 14303440055 033607 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; import org.apache.qpid.proton.amqp.UnsignedByte; public enum SenderSettleMode { UNSETTLED(0), SETTLED(1), MIXED(2); private UnsignedByte value; private SenderSettleMode(int value) { this.value = UnsignedByte.valueOf((byte)value); } public static SenderSettleMode valueOf(UnsignedByte value) { switch (value.intValue()) { case 0: return SenderSettleMode.UNSETTLED; case 1: return SenderSettleMode.SETTLED; case 2: return SenderSettleMode.MIXED; default: throw new IllegalArgumentException("The value can be only 0 (for UNSETTLED), 1 (for SETTLED) and 2 (for MIXED)"); } } public UnsignedByte getValue() { return this.value; } } ././@LongLink0100644 0000000 0000000 00000000157 14303440055 011634 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/SessionError.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Session0100644 0000000 0000000 00000002402 14303440055 033672 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; import org.apache.qpid.proton.amqp.Symbol; public interface SessionError { final static Symbol WINDOW_VIOLATION = Symbol.valueOf("amqp:session:window-violation"); final static Symbol ERRANT_LINK = Symbol.valueOf("amqp:session:errant-link"); final static Symbol HANDLE_IN_USE = Symbol.valueOf("amqp:session:handle-in-use"); final static Symbol UNATTACHED_HANDLE = Symbol.valueOf("amqp:session:unattached-handle"); } ././@LongLink0100644 0000000 0000000 00000000151 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Source.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Source.0100644 0000000 0000000 00000001664 14303440055 033576 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; public interface Source { public String getAddress(); public Source copy(); } ././@LongLink0100644 0000000 0000000 00000000151 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Target.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Target.0100644 0000000 0000000 00000001665 14303440055 033565 0ustar00rootroot0000000 0000000 package org.apache.qpid.proton.amqp.transport; /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ public interface Target { public String getAddress(); public Target copy(); } ././@LongLink0100644 0000000 0000000 00000000153 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Transfer.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/amqp/transport/Transfe0100644 0000000 0000000 00000011240 14303440055 033651 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.amqp.transport; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.UnsignedInteger; public final class Transfer implements FrameBody { private UnsignedInteger _handle; private UnsignedInteger _deliveryId; private Binary _deliveryTag; private UnsignedInteger _messageFormat; private Boolean _settled; private boolean _more; private ReceiverSettleMode _rcvSettleMode; private DeliveryState _state; private boolean _resume; private boolean _aborted; private boolean _batchable; public Transfer() {} public Transfer(Transfer other) { this._handle = other._handle; this._deliveryId = other._deliveryId; this._deliveryTag = Binary.copy(other._deliveryTag); this._messageFormat = other._messageFormat; this._settled = other._settled; this._more = other._more; this._rcvSettleMode = other._rcvSettleMode; this._state = other._state; this._resume = other._resume; this._aborted = other._aborted; this._batchable = other._batchable; } public UnsignedInteger getHandle() { return _handle; } public void setHandle(UnsignedInteger handle) { if( handle == null ) { throw new NullPointerException("the handle field is mandatory"); } _handle = handle; } public UnsignedInteger getDeliveryId() { return _deliveryId; } public void setDeliveryId(UnsignedInteger deliveryId) { _deliveryId = deliveryId; } public Binary getDeliveryTag() { return _deliveryTag; } public void setDeliveryTag(Binary deliveryTag) { _deliveryTag = deliveryTag; } public UnsignedInteger getMessageFormat() { return _messageFormat; } public void setMessageFormat(UnsignedInteger messageFormat) { _messageFormat = messageFormat; } public Boolean getSettled() { return _settled; } public void setSettled(Boolean settled) { _settled = settled; } public boolean getMore() { return _more; } public void setMore(boolean more) { _more = more; } public ReceiverSettleMode getRcvSettleMode() { return _rcvSettleMode; } public void setRcvSettleMode(ReceiverSettleMode rcvSettleMode) { _rcvSettleMode = rcvSettleMode; } public DeliveryState getState() { return _state; } public void setState(DeliveryState state) { _state = state; } public boolean getResume() { return _resume; } public void setResume(boolean resume) { _resume = resume; } public boolean getAborted() { return _aborted; } public void setAborted(boolean aborted) { _aborted = aborted; } public boolean getBatchable() { return _batchable; } public void setBatchable(boolean batchable) { _batchable = batchable; } @Override public void invoke(FrameBodyHandler handler, Binary payload, E context) { handler.handleTransfer(this, payload, context); } @Override public String toString() { return "Transfer{" + "handle=" + _handle + ", deliveryId=" + _deliveryId + ", deliveryTag=" + _deliveryTag + ", messageFormat=" + _messageFormat + ", settled=" + _settled + ", more=" + _more + ", rcvSettleMode=" + _rcvSettleMode + ", state=" + _state + ", resume=" + _resume + ", aborted=" + _aborted + ", batchable=" + _batchable + '}'; } @Override public Transfer copy() { return new Transfer(this); } } ././@LongLink0100644 0000000 0000000 00000000152 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/AMQPDefinedTypes.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/AMQPDefinedTypes0100644 0000000 0000000 00000010737 14303440055 033406 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import org.apache.qpid.proton.codec.messaging.*; import org.apache.qpid.proton.codec.security.*; import org.apache.qpid.proton.codec.transaction.*; import org.apache.qpid.proton.codec.transport.*; public class AMQPDefinedTypes { public static void registerAllTypes(Decoder decoder, EncoderImpl encoder) { registerTransportTypes(decoder, encoder); registerMessagingTypes(decoder, encoder); registerTransactionTypes(decoder, encoder); registerSecurityTypes(decoder, encoder); } public static void registerTransportTypes(Decoder decoder, EncoderImpl encoder) { OpenType.register(decoder, encoder); BeginType.register(decoder, encoder); AttachType.register(decoder, encoder); FlowType.register(decoder, encoder); TransferType.register(decoder, encoder); DispositionType.register(decoder, encoder); DetachType.register(decoder, encoder); EndType.register(decoder, encoder); CloseType.register(decoder, encoder); ErrorConditionType.register(decoder, encoder); FastPathFlowType.register(decoder, encoder); FastPathTransferType.register(decoder, encoder); FastPathDispositionType.register(decoder, encoder); } public static void registerMessagingTypes(Decoder decoder, EncoderImpl encoder) { HeaderType.register(decoder, encoder); AcceptedType.register(decoder , encoder); PropertiesType.register( decoder, encoder ); DeliveryAnnotationsType.register(decoder, encoder); MessageAnnotationsType.register(decoder, encoder); ApplicationPropertiesType.register(decoder, encoder); DataType.register(decoder, encoder); AmqpSequenceType.register(decoder, encoder); AmqpValueType.register(decoder, encoder); FooterType.register(decoder, encoder); ReceivedType.register(decoder, encoder); RejectedType.register(decoder, encoder); ReleasedType.register(decoder, encoder); ModifiedType.register(decoder, encoder); SourceType.register(decoder, encoder); TargetType.register(decoder, encoder); DeleteOnCloseType.register(decoder, encoder); DeleteOnNoLinksType.register(decoder, encoder); DeleteOnNoMessagesType.register(decoder, encoder); DeleteOnNoLinksOrMessagesType.register(decoder, encoder); FastPathHeaderType.register(decoder, encoder); FastPathAcceptedType.register(decoder , encoder); FastPathPropertiesType.register( decoder, encoder ); FastPathDeliveryAnnotationsType.register(decoder, encoder); FastPathMessageAnnotationsType.register(decoder, encoder); FastPathApplicationPropertiesType.register(decoder, encoder); FastPathDataType.register(decoder, encoder); FastPathAmqpSequenceType.register(decoder, encoder); FastPathAmqpValueType.register(decoder, encoder); FastPathFooterType.register(decoder, encoder); } public static void registerTransactionTypes(Decoder decoder, EncoderImpl encoder) { CoordinatorType.register(decoder, encoder); DeclareType.register(decoder, encoder); DischargeType.register(decoder, encoder); DeclaredType.register(decoder, encoder); TransactionalStateType.register(decoder, encoder); } public static void registerSecurityTypes(Decoder decoder, EncoderImpl encoder) { SaslMechanismsType.register(decoder, encoder); SaslInitType.register(decoder, encoder); SaslChallengeType.register(decoder, encoder); SaslResponseType.register(decoder, encoder); SaslOutcomeType.register(decoder, encoder); } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/AMQPType.java0100644 0000000 0000000 00000002135 14303440055 032655 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.util.Collection; public interface AMQPType { Class getTypeClass(); TypeEncoding getEncoding(V val); TypeEncoding getCanonicalEncoding(); Collection> getAllEncodings(); void write(V val); } ././@LongLink0100644 0000000 0000000 00000000157 14303440055 011634 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/AbstractDescribedType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/AbstractDescribe0100644 0000000 0000000 00000011137 14303440055 033543 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.apache.qpid.proton.amqp.UnsignedLong; abstract public class AbstractDescribedType implements AMQPType { private final DecoderImpl _decoder; private final EncoderImpl _encoder; private final Map, TypeEncoding> _encodings = new HashMap, TypeEncoding>(); public AbstractDescribedType(EncoderImpl encoder) { _encoder = encoder; _decoder = encoder.getDecoder(); } abstract protected UnsignedLong getDescriptor(); public EncoderImpl getEncoder() { return _encoder; } public DecoderImpl getDecoder() { return _decoder; } public TypeEncoding getEncoding(final T val) { M asUnderlying = wrap(val); TypeEncoding underlyingEncoding = _encoder.getType(asUnderlying).getEncoding(asUnderlying); TypeEncoding encoding = _encodings.get(underlyingEncoding); if(encoding == null) { encoding = new DynamicDescribedTypeEncoding(underlyingEncoding); _encodings.put(underlyingEncoding, encoding); } return encoding; } abstract protected M wrap(T val); public TypeEncoding getCanonicalEncoding() { return null; } public Collection> getAllEncodings() { Collection values = _encodings.values(); Collection unmodifiable = Collections.unmodifiableCollection(values); return (Collection>) unmodifiable; } public void write(final T val) { TypeEncoding encoding = getEncoding(val); encoding.writeConstructor(); encoding.writeValue(val); } private class DynamicDescribedTypeEncoding implements TypeEncoding { private final TypeEncoding _underlyingEncoding; private final TypeEncoding _descriptorType; private final int _constructorSize; public DynamicDescribedTypeEncoding(final TypeEncoding underlyingEncoding) { _underlyingEncoding = underlyingEncoding; _descriptorType = _encoder.getType(getDescriptor()).getEncoding(getDescriptor()); _constructorSize = 1 + _descriptorType.getConstructorSize() + _descriptorType.getValueSize(getDescriptor()) + _underlyingEncoding.getConstructorSize(); } public AMQPType getType() { return AbstractDescribedType.this; } public void writeConstructor() { _encoder.writeRaw(EncodingCodes.DESCRIBED_TYPE_INDICATOR); _descriptorType.writeConstructor(); _descriptorType.writeValue(getDescriptor()); _underlyingEncoding.writeConstructor(); } public int getConstructorSize() { return _constructorSize; } public void writeValue(final T val) { _underlyingEncoding.writeValue(wrap(val)); } public int getValueSize(final T val) { return _underlyingEncoding.getValueSize(wrap(val)); } public boolean isFixedSizeVal() { return _underlyingEncoding.isFixedSizeVal(); } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()) && (_underlyingEncoding.encodesSuperset(((DynamicDescribedTypeEncoding)encoding) ._underlyingEncoding)); } @Override public boolean encodesJavaPrimitive() { return false; } } } ././@LongLink0100644 0000000 0000000 00000000157 14303440055 011634 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/AbstractPrimitiveType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/AbstractPrimitiv0100644 0000000 0000000 00000002117 14303440055 033624 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; abstract class AbstractPrimitiveType implements PrimitiveType { public final void write(T val) { final TypeEncoding encoding = getEncoding(val); encoding.writeConstructor(); encoding.writeValue(val); } } ././@LongLink0100644 0000000 0000000 00000000167 14303440055 011635 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/AbstractPrimitiveTypeEncoding.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/AbstractPrimitiv0100644 0000000 0000000 00000003260 14303440055 033624 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; abstract class AbstractPrimitiveTypeEncoding implements PrimitiveTypeEncoding { private final EncoderImpl _encoder; private final DecoderImpl _decoder; AbstractPrimitiveTypeEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { _encoder = encoder; _decoder = decoder; } public final void writeConstructor() { _encoder.writeRaw(getEncodingCode()); } public int getConstructorSize() { return 1; } public abstract byte getEncodingCode(); protected EncoderImpl getEncoder() { return _encoder; } public Class getTypeClass() { return getType().getTypeClass(); } protected DecoderImpl getDecoder() { return _decoder; } public boolean encodesJavaPrimitive() { return false; } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/ArrayType.java0100644 0000000 0000000 00000122345 14303440055 033203 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.lang.reflect.Array; import java.util.Arrays; import java.util.Collection; public class ArrayType implements PrimitiveType { private final EncoderImpl _encoder; private final BooleanType _booleanType; private final ByteType _byteType; private final ShortType _shortType; private final IntegerType _integerType; private final LongType _longType; private final FloatType _floatType; private final DoubleType _doubleType; private final CharacterType _characterType; public static interface ArrayEncoding extends PrimitiveTypeEncoding { void writeValue(boolean[] a); void writeValue(byte[] a); void writeValue(short[] a); void writeValue(int[] a); void writeValue(long[] a); void writeValue(float[] a); void writeValue(double[] a); void writeValue(char[] a); void setValue(Object[] val, TypeEncoding encoder, int size); int getSizeBytes(); Object readValueArray(); } private final ArrayEncoding _shortArrayEncoding; private final ArrayEncoding _arrayEncoding; public ArrayType(EncoderImpl encoder, final DecoderImpl decoder, BooleanType boolType, ByteType byteType, ShortType shortType, IntegerType intType, LongType longType, FloatType floatType, DoubleType doubleType, CharacterType characterType) { _encoder = encoder; _booleanType = boolType; _byteType = byteType; _shortType = shortType; _integerType = intType; _longType = longType; _floatType = floatType; _doubleType = doubleType; _characterType = characterType; _arrayEncoding = new AllArrayEncoding(encoder, decoder); _shortArrayEncoding = new ShortArrayEncoding(encoder, decoder); encoder.register(Object[].class, this); decoder.register(this); } @Override public Class getTypeClass() { return Object[].class; } @Override public ArrayEncoding getEncoding(final Object[] val) { TypeEncoding encoder = calculateEncoder(val,_encoder); int size = calculateSize(val, encoder); ArrayEncoding arrayEncoding = (val.length > 255 || size > 254) ? _arrayEncoding : _shortArrayEncoding; arrayEncoding.setValue(val, encoder, size); return arrayEncoding; } private static TypeEncoding calculateEncoder(final Object[] val, final EncoderImpl encoder) { if(val.length == 0) { AMQPType underlyingType = encoder.getTypeFromClass(val.getClass().getComponentType()); return underlyingType.getCanonicalEncoding(); } else { AMQPType underlyingType = encoder.getTypeFromClass(val.getClass().getComponentType()); boolean checkTypes = false; if(val[0].getClass().isArray() && val[0].getClass().getComponentType().isPrimitive()) { Class componentType = val[0].getClass().getComponentType(); if(componentType == Boolean.TYPE) { return ((ArrayType)underlyingType).getEncoding((boolean[])val[0]); } else if(componentType == Byte.TYPE) { return ((ArrayType)underlyingType).getEncoding((byte[])val[0]); } else if(componentType == Short.TYPE) { return ((ArrayType)underlyingType).getEncoding((short[])val[0]); } else if(componentType == Integer.TYPE) { return ((ArrayType)underlyingType).getEncoding((int[])val[0]); } else if(componentType == Long.TYPE) { return ((ArrayType)underlyingType).getEncoding((long[])val[0]); } else if(componentType == Float.TYPE) { return ((ArrayType)underlyingType).getEncoding((float[])val[0]); } else if(componentType == Double.TYPE) { return ((ArrayType)underlyingType).getEncoding((double[])val[0]); } else if(componentType == Character.TYPE) { return ((ArrayType)underlyingType).getEncoding((char[])val[0]); } else { throw new IllegalArgumentException("Cannot encode arrays of type " + componentType.getName()); } } else { if(underlyingType == null) { checkTypes = true; underlyingType = encoder.getType(val[0]); } TypeEncoding underlyingEncoding = underlyingType.getEncoding(val[0]); TypeEncoding canonicalEncoding = underlyingType.getCanonicalEncoding(); for(int i = 0; i < val.length && (checkTypes || underlyingEncoding != canonicalEncoding); i++) { if(checkTypes && encoder.getType(val[i]) != underlyingType) { throw new IllegalArgumentException("Non matching types " + underlyingType + " and " + encoder .getType(val[i]) + " in array"); } TypeEncoding elementEncoding = underlyingType.getEncoding(val[i]); if(elementEncoding != underlyingEncoding && !underlyingEncoding.encodesSuperset(elementEncoding)) { if(elementEncoding.encodesSuperset(underlyingEncoding)) { underlyingEncoding = elementEncoding; } else { underlyingEncoding = canonicalEncoding; } } } return underlyingEncoding; } } } private static int calculateSize(final Object[] val, final TypeEncoding encoder) { int size = encoder.getConstructorSize(); if(encoder.isFixedSizeVal()) { size += val.length * encoder.getValueSize(null); } else { for(Object o : val) { if(o.getClass().isArray() && o.getClass().getComponentType().isPrimitive()) { ArrayEncoding arrayEncoding = (ArrayEncoding) encoder; ArrayType arrayType = (ArrayType) arrayEncoding.getType(); Class componentType = o.getClass().getComponentType(); size += 2 * arrayEncoding.getSizeBytes(); TypeEncoding componentEncoding; int componentCount; if(componentType == Boolean.TYPE) { boolean[] componentArray = (boolean[]) o; componentEncoding = arrayType.getUnderlyingEncoding(componentArray); componentCount = componentArray.length; } else if(componentType == Byte.TYPE) { byte[] componentArray = (byte[]) o; componentEncoding = arrayType.getUnderlyingEncoding(componentArray); componentCount = componentArray.length; } else if(componentType == Short.TYPE) { short[] componentArray = (short[]) o; componentEncoding = arrayType.getUnderlyingEncoding(componentArray); componentCount = componentArray.length; } else if(componentType == Integer.TYPE) { int[] componentArray = (int[]) o; componentEncoding = arrayType.getUnderlyingEncoding(componentArray); componentCount = componentArray.length; } else if(componentType == Long.TYPE) { long[] componentArray = (long[]) o; componentEncoding = arrayType.getUnderlyingEncoding(componentArray); componentCount = componentArray.length; } else if(componentType == Float.TYPE) { float[] componentArray = (float[]) o; componentEncoding = arrayType.getUnderlyingEncoding(componentArray); componentCount = componentArray.length; } else if(componentType == Double.TYPE) { double[] componentArray = (double[]) o; componentEncoding = arrayType.getUnderlyingEncoding(componentArray); componentCount = componentArray.length; } else if(componentType == Character.TYPE) { char[] componentArray = (char[]) o; componentEncoding = arrayType.getUnderlyingEncoding(componentArray); componentCount = componentArray.length; } else { throw new IllegalArgumentException("Cannot encode arrays of type " + componentType.getName()); } size += componentEncoding.getConstructorSize() + componentEncoding.getValueSize(null) * componentCount; } else { size += encoder.getValueSize(o); } } } return size; } @Override public ArrayEncoding getCanonicalEncoding() { return _arrayEncoding; } @Override public Collection getAllEncodings() { return Arrays.asList(_shortArrayEncoding, _arrayEncoding); } @Override public void write(final Object[] val) { ArrayEncoding encoding = getEncoding(val); encoding.writeConstructor(); encoding.writeValue(val); } public void write(boolean[] a) { ArrayEncoding encoding = getEncoding(a); encoding.writeConstructor(); encoding.writeValue(a); } private ArrayEncoding getEncoding(final boolean[] a) { return a.length < 254 || a.length <= 255 && allSameValue(a) ? _shortArrayEncoding : _arrayEncoding; } private boolean allSameValue(final boolean[] a) { boolean val = a[0]; for(int i = 1; i < a.length; i++) { if(val != a[i]) { return false; } } return true; } public void write(byte[] a) { ArrayEncoding encoding = getEncoding(a); encoding.writeConstructor(); encoding.writeValue(a); } private ArrayEncoding getEncoding(final byte[] a) { return a.length < 254 ? _shortArrayEncoding : _arrayEncoding; } public void write(short[] a) { ArrayEncoding encoding = getEncoding(a); encoding.writeConstructor(); encoding.writeValue(a); } private ArrayEncoding getEncoding(final short[] a) { return a.length < 127 ? _shortArrayEncoding : _arrayEncoding; } public void write(int[] a) { ArrayEncoding encoding = getEncoding(a); encoding.writeConstructor(); encoding.writeValue(a); } private ArrayEncoding getEncoding(final int[] a) { return a.length < 63 || (a.length < 254 && allSmallInts(a)) ? _shortArrayEncoding : _arrayEncoding; } private boolean allSmallInts(final int[] a) { for(int i = 0; i < a.length; i++) { if(a[i] < -128 || a[i] > 127) { return false; } } return true; } public void write(long[] a) { ArrayEncoding encoding = getEncoding(a); encoding.writeConstructor(); encoding.writeValue(a); } private ArrayEncoding getEncoding(final long[] a) { return a.length < 31 || (a.length < 254 && allSmallLongs(a)) ? _shortArrayEncoding : _arrayEncoding; } private boolean allSmallLongs(final long[] a) { for(int i = 0; i < a.length; i++) { if(a[i] < -128L || a[i] > 127L) { return false; } } return true; } public void write(float[] a) { ArrayEncoding encoding = getEncoding(a); encoding.writeConstructor(); encoding.writeValue(a); } private ArrayEncoding getEncoding(final float[] a) { return a.length < 63 ? _shortArrayEncoding : _arrayEncoding; } public void write(double[] a) { ArrayEncoding encoding = getEncoding(a); encoding.writeConstructor(); encoding.writeValue(a); } private ArrayEncoding getEncoding(final double[] a) { return a.length < 31 ? _shortArrayEncoding : _arrayEncoding; } public void write(char[] a) { ArrayEncoding encoding = getEncoding(a); encoding.writeConstructor(); encoding.writeValue(a); } private ArrayEncoding getEncoding(final char[] a) { return a.length < 63 ? _shortArrayEncoding : _arrayEncoding; } private class AllArrayEncoding extends LargeFloatingSizePrimitiveTypeEncoding implements ArrayEncoding { private Object[] _val; private TypeEncoding _underlyingEncoder; private int _size; AllArrayEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected void writeSize(final Object[] val) { int encodedValueSize = getEncodedValueSize(val); getEncoder().getBuffer().ensureRemaining(encodedValueSize); getEncoder().writeRaw(encodedValueSize); } @Override public void writeValue(final boolean[] a) { BooleanType.BooleanEncoding underlyingEncoder = getUnderlyingEncoding(a); int encodedValueSize = 4 + underlyingEncoder.getConstructorSize() + a.length * underlyingEncoder.getValueSize(null); getEncoder().getBuffer().ensureRemaining(encodedValueSize); getEncoder().writeRaw(encodedValueSize); getEncoder().writeRaw(a.length); underlyingEncoder.writeConstructor(); for(boolean b : a) { underlyingEncoder.writeValue(b); } } @Override public void writeValue(final byte[] a) { ByteType.ByteEncoding underlyingEncoder = getUnderlyingEncoding(a); int encodedValueSize = 4 + underlyingEncoder.getConstructorSize() + a.length * underlyingEncoder.getValueSize(null); getEncoder().getBuffer().ensureRemaining(encodedValueSize); getEncoder().writeRaw(encodedValueSize); getEncoder().writeRaw(a.length); underlyingEncoder.writeConstructor(); for(byte b : a) { underlyingEncoder.writeValue(b); } } @Override public void writeValue(final short[] a) { ShortType.ShortEncoding underlyingEncoder = getUnderlyingEncoding(a); int encodedValueSize = 4 + underlyingEncoder.getConstructorSize() + a.length * underlyingEncoder.getValueSize(null); getEncoder().getBuffer().ensureRemaining(encodedValueSize); getEncoder().writeRaw(encodedValueSize); getEncoder().writeRaw(a.length); underlyingEncoder.writeConstructor(); for(short b : a) { underlyingEncoder.writeValue(b); } } @Override public void writeValue(final int[] a) { IntegerType.IntegerEncoding underlyingEncoder = getUnderlyingEncoding(a); int encodedValueSize = 4 + underlyingEncoder.getConstructorSize() + a.length * underlyingEncoder.getValueSize(null); getEncoder().getBuffer().ensureRemaining(encodedValueSize); getEncoder().writeRaw(encodedValueSize); getEncoder().writeRaw(a.length); underlyingEncoder.writeConstructor(); for(int b : a) { underlyingEncoder.writeValue(b); } } @Override public void writeValue(final long[] a) { LongType.LongEncoding underlyingEncoder = getUnderlyingEncoding(a); int encodedValueSize = 4 + underlyingEncoder.getConstructorSize() + a.length * underlyingEncoder.getValueSize(null); getEncoder().getBuffer().ensureRemaining(encodedValueSize); getEncoder().writeRaw(encodedValueSize); getEncoder().writeRaw(a.length); underlyingEncoder.writeConstructor(); for(long b : a) { underlyingEncoder.writeValue(b); } } @Override public void writeValue(final float[] a) { FloatType.FloatEncoding underlyingEncoder = getUnderlyingEncoding(a); int encodedValueSize = 4 + underlyingEncoder.getConstructorSize() + a.length * underlyingEncoder.getValueSize(null); getEncoder().getBuffer().ensureRemaining(encodedValueSize); getEncoder().writeRaw(encodedValueSize); getEncoder().writeRaw(a.length); underlyingEncoder.writeConstructor(); for(float b : a) { underlyingEncoder.writeValue(b); } } @Override public void writeValue(final double[] a) { DoubleType.DoubleEncoding underlyingEncoder = getUnderlyingEncoding(a); int encodedValueSize = 4 + underlyingEncoder.getConstructorSize() + a.length * underlyingEncoder.getValueSize(null); getEncoder().getBuffer().ensureRemaining(encodedValueSize); getEncoder().writeRaw(encodedValueSize); getEncoder().writeRaw(a.length); underlyingEncoder.writeConstructor(); for(double b : a) { underlyingEncoder.writeValue(b); } } @Override public void writeValue(final char[] a) { CharacterType.CharacterEncoding underlyingEncoder = getUnderlyingEncoding(a); int encodedValueSize = 4 + underlyingEncoder.getConstructorSize() + a.length * underlyingEncoder.getValueSize(null); getEncoder().getBuffer().ensureRemaining(encodedValueSize); getEncoder().writeRaw(encodedValueSize); getEncoder().writeRaw(a.length); underlyingEncoder.writeConstructor(); for(char b : a) { underlyingEncoder.writeValue(b); } } @Override public void setValue(final Object[] val, final TypeEncoding encoder, final int size) { _val = val; _underlyingEncoder = encoder; _size = size; } @Override protected void writeEncodedValue(final Object[] val) { TypeEncoding underlyingEncoder; if(_val != val) { _val = val; _underlyingEncoder = underlyingEncoder = calculateEncoder(val, getEncoder()); _size = calculateSize(val, underlyingEncoder); } else { underlyingEncoder = _underlyingEncoder; } getEncoder().writeRaw(val.length); underlyingEncoder.writeConstructor(); for(Object o : val) { underlyingEncoder.writeValue(o); } } @Override protected int getEncodedValueSize(final Object[] val) { if(_val != val) { _val = val; _underlyingEncoder = calculateEncoder(val, getEncoder()); _size = calculateSize(val, _underlyingEncoder); } return 4 + _size; } @Override public byte getEncodingCode() { return EncodingCodes.ARRAY32; } @Override public ArrayType getType() { return ArrayType.this; } @Override public boolean encodesSuperset(final TypeEncoding encoding) { return getType() == encoding.getType(); } @Override public Object[] readValue() { DecoderImpl decoder = getDecoder(); int size = decoder.readRawInt(); int count = decoder.readRawInt(); return decodeArray(decoder, count); } @Override public Object readValueArray() { DecoderImpl decoder = getDecoder(); int size = decoder.readRawInt(); int count = decoder.readRawInt(); return decodeArrayAsObject(decoder, count); } @Override public void skipValue() { DecoderImpl decoder = getDecoder(); ReadableBuffer buffer = decoder.getBuffer(); int size = decoder.readRawInt(); buffer.position(buffer.position() + size); } } private class ShortArrayEncoding extends SmallFloatingSizePrimitiveTypeEncoding implements ArrayEncoding { private Object[] _val; private TypeEncoding _underlyingEncoder; private int _size; ShortArrayEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected void writeSize(final Object[] val) { int encodedValueSize = getEncodedValueSize(val); getEncoder().getBuffer().ensureRemaining(encodedValueSize); getEncoder().writeRaw((byte) encodedValueSize); } @Override public void writeValue(final boolean[] a) { BooleanType.BooleanEncoding underlyingEncoder = getUnderlyingEncoding(a); int encodedValueSize = 1 + underlyingEncoder.getConstructorSize() + a.length * underlyingEncoder.getValueSize(null); getEncoder().getBuffer().ensureRemaining(encodedValueSize); getEncoder().writeRaw((byte)encodedValueSize); getEncoder().writeRaw((byte)a.length); underlyingEncoder.writeConstructor(); for(boolean b : a) { underlyingEncoder.writeValue(b); } } @Override public void writeValue(final byte[] a) { ByteType.ByteEncoding underlyingEncoder = getUnderlyingEncoding(a); int encodedValueSize = 1 + underlyingEncoder.getConstructorSize() + a.length * underlyingEncoder.getValueSize(null); getEncoder().getBuffer().ensureRemaining(encodedValueSize); getEncoder().writeRaw((byte)encodedValueSize); getEncoder().writeRaw((byte)a.length); underlyingEncoder.writeConstructor(); for(byte b : a) { underlyingEncoder.writeValue(b); } } @Override public void writeValue(final short[] a) { ShortType.ShortEncoding underlyingEncoder = getUnderlyingEncoding(a); int encodedValueSize = 1 + underlyingEncoder.getConstructorSize() + a.length * underlyingEncoder.getValueSize(null); getEncoder().getBuffer().ensureRemaining(encodedValueSize); getEncoder().writeRaw((byte)encodedValueSize); getEncoder().writeRaw((byte)a.length); underlyingEncoder.writeConstructor(); for(short b : a) { underlyingEncoder.writeValue(b); } } @Override public void writeValue(final int[] a) { IntegerType.IntegerEncoding underlyingEncoder = getUnderlyingEncoding(a); int encodedValueSize = 1 + underlyingEncoder.getConstructorSize() + a.length * underlyingEncoder.getValueSize(null); getEncoder().getBuffer().ensureRemaining(encodedValueSize); getEncoder().writeRaw((byte)encodedValueSize); getEncoder().writeRaw((byte)a.length); underlyingEncoder.writeConstructor(); for(int b : a) { underlyingEncoder.writeValue(b); } } @Override public void writeValue(final long[] a) { LongType.LongEncoding underlyingEncoder = getUnderlyingEncoding(a); int encodedValueSize = 1 + underlyingEncoder.getConstructorSize() + a.length * underlyingEncoder.getValueSize(null); getEncoder().getBuffer().ensureRemaining(encodedValueSize); getEncoder().writeRaw((byte)encodedValueSize); getEncoder().writeRaw((byte)a.length); underlyingEncoder.writeConstructor(); for(long b : a) { underlyingEncoder.writeValue(b); } } @Override public void writeValue(final float[] a) { FloatType.FloatEncoding underlyingEncoder = getUnderlyingEncoding(a); int encodedValueSize = 1 + underlyingEncoder.getConstructorSize() + a.length * underlyingEncoder.getValueSize(null); getEncoder().getBuffer().ensureRemaining(encodedValueSize); getEncoder().writeRaw((byte)encodedValueSize); getEncoder().writeRaw((byte)a.length); underlyingEncoder.writeConstructor(); for(float b : a) { underlyingEncoder.writeValue(b); } } @Override public void writeValue(final double[] a) { DoubleType.DoubleEncoding underlyingEncoder = getUnderlyingEncoding(a); int encodedValueSize = 1 + underlyingEncoder.getConstructorSize() + a.length * underlyingEncoder.getValueSize(null); getEncoder().getBuffer().ensureRemaining(encodedValueSize); getEncoder().writeRaw((byte)encodedValueSize); getEncoder().writeRaw((byte)a.length); underlyingEncoder.writeConstructor(); for(double b : a) { underlyingEncoder.writeValue(b); } } @Override public void writeValue(final char[] a) { CharacterType.CharacterEncoding underlyingEncoder = getUnderlyingEncoding(a); int encodedValueSize = 1 + underlyingEncoder.getConstructorSize() + a.length * underlyingEncoder.getValueSize(null); getEncoder().getBuffer().ensureRemaining(encodedValueSize); getEncoder().writeRaw((byte)encodedValueSize); getEncoder().writeRaw((byte)a.length); underlyingEncoder.writeConstructor(); for(char b : a) { underlyingEncoder.writeValue(b); } } @Override public void setValue(final Object[] val, final TypeEncoding encoder, final int size) { _val = val; _underlyingEncoder = encoder; _size = size; } @Override protected void writeEncodedValue(final Object[] val) { TypeEncoding underlyingEncoder; if(_val != val) { _val = val; _underlyingEncoder = underlyingEncoder = calculateEncoder(val, getEncoder()); _size = calculateSize(val, underlyingEncoder); } else { underlyingEncoder = _underlyingEncoder; } getEncoder().writeRaw((byte)val.length); underlyingEncoder.writeConstructor(); for(Object o : val) { if(o.getClass().isArray() && o.getClass().getComponentType().isPrimitive()) { ArrayEncoding arrayEncoding = (ArrayEncoding) underlyingEncoder; ArrayType arrayType = (ArrayType) arrayEncoding.getType(); Class componentType = o.getClass().getComponentType(); if(componentType == Boolean.TYPE) { boolean[] componentArray = (boolean[]) o; arrayEncoding.writeValue(componentArray); } else if(componentType == Byte.TYPE) { byte[] componentArray = (byte[]) o; arrayEncoding.writeValue(componentArray); } else if(componentType == Short.TYPE) { short[] componentArray = (short[]) o; arrayEncoding.writeValue(componentArray); } else if(componentType == Integer.TYPE) { int[] componentArray = (int[]) o; arrayEncoding.writeValue(componentArray); } else if(componentType == Long.TYPE) { long[] componentArray = (long[]) o; arrayEncoding.writeValue(componentArray); } else if(componentType == Float.TYPE) { float[] componentArray = (float[]) o; arrayEncoding.writeValue(componentArray); } else if(componentType == Double.TYPE) { double[] componentArray = (double[]) o; arrayEncoding.writeValue(componentArray); } else if(componentType == Character.TYPE) { char[] componentArray = (char[]) o; arrayEncoding.writeValue(componentArray); } else { throw new IllegalArgumentException("Cannot encode arrays of type " + componentType.getName()); } } else { underlyingEncoder.writeValue(o); } } } @Override protected int getEncodedValueSize(final Object[] val) { if(_val != val) { _val = val; _underlyingEncoder = calculateEncoder(val, getEncoder()); _size = calculateSize(val, _underlyingEncoder); } return 1 + _size; } @Override public byte getEncodingCode() { return EncodingCodes.ARRAY8; } @Override public ArrayType getType() { return ArrayType.this; } @Override public boolean encodesSuperset(final TypeEncoding encoding) { return getType() == encoding.getType(); } @Override public Object[] readValue() { DecoderImpl decoder = getDecoder(); int size = ((int)decoder.readRawByte()) & 0xFF; int count = ((int)decoder.readRawByte()) & 0xFF; return decodeArray(decoder, count); } @Override public Object readValueArray() { DecoderImpl decoder = getDecoder(); int size = ((int)decoder.readRawByte()) & 0xFF; int count = ((int)decoder.readRawByte()) & 0xFF; return decodeArrayAsObject(decoder, count); } @Override public void skipValue() { DecoderImpl decoder = getDecoder(); ReadableBuffer buffer = decoder.getBuffer(); int size = ((int)decoder.readRawByte()) & 0xFF; buffer.position(buffer.position() + size); } } private BooleanType.BooleanEncoding getUnderlyingEncoding(final boolean[] a) { if(a.length == 0) { return _booleanType.getCanonicalEncoding(); } else { boolean val = a[0]; for(int i = 1; i < a.length; i++) { if(val != a[i]) { return _booleanType.getCanonicalEncoding(); } } return _booleanType.getEncoding(val); } } private ByteType.ByteEncoding getUnderlyingEncoding(final byte[] a) { return _byteType.getCanonicalEncoding(); } private ShortType.ShortEncoding getUnderlyingEncoding(final short[] a) { return _shortType.getCanonicalEncoding(); } private IntegerType.IntegerEncoding getUnderlyingEncoding(final int[] a) { if(a.length == 0 || !allSmallInts(a)) { return _integerType.getCanonicalEncoding(); } else { return _integerType.getEncoding(a[0]); } } private LongType.LongEncoding getUnderlyingEncoding(final long[] a) { if(a.length == 0 || !allSmallLongs(a)) { return _longType.getCanonicalEncoding(); } else { return _longType.getEncoding(a[0]); } } private FloatType.FloatEncoding getUnderlyingEncoding(final float[] a) { return _floatType.getCanonicalEncoding(); } private DoubleType.DoubleEncoding getUnderlyingEncoding(final double[] a) { return _doubleType.getCanonicalEncoding(); } private CharacterType.CharacterEncoding getUnderlyingEncoding(final char[] a) { return _characterType.getCanonicalEncoding(); } private static Object[] decodeArray(final DecoderImpl decoder, final int count) { TypeConstructor constructor = decoder.readConstructor(true); return decodeNonPrimitive(decoder, constructor, count); } private static Object[] decodeNonPrimitive(final DecoderImpl decoder, final TypeConstructor constructor, final int count) { if (count > decoder.getByteBufferRemaining()) { throw new IllegalArgumentException("Array element count "+count+" is specified to be greater than the amount of data available ("+ decoder.getByteBufferRemaining()+")"); } if(constructor instanceof ArrayEncoding) { ArrayEncoding arrayEncoding = (ArrayEncoding) constructor; Object[] array = new Object[count]; for(int i = 0; i < count; i++) { array[i] = arrayEncoding.readValueArray(); } return array; } else { Object[] array = (Object[]) Array.newInstance(constructor.getTypeClass(), count); for(int i = 0; i < count; i++) { array[i] = constructor.readValue(); } return array; } } private static Object decodeArrayAsObject(final DecoderImpl decoder, final int count) { TypeConstructor constructor = decoder.readConstructor(true); if(constructor.encodesJavaPrimitive()) { if (count > decoder.getByteBufferRemaining()) { throw new IllegalArgumentException("Array element count "+count+" is specified to be greater than the amount of data available ("+ decoder.getByteBufferRemaining()+")"); } if(constructor instanceof BooleanType.BooleanEncoding) { return decodeBooleanArray((BooleanType.BooleanEncoding) constructor, count); } else if(constructor instanceof ByteType.ByteEncoding) { return decodeByteArray((ByteType.ByteEncoding)constructor, count); } else if(constructor instanceof ShortType.ShortEncoding) { return decodeShortArray((ShortType.ShortEncoding)constructor, count); } else if(constructor instanceof IntegerType.IntegerEncoding) { return decodeIntArray((IntegerType.IntegerEncoding)constructor, count); } else if(constructor instanceof LongType.LongEncoding) { return decodeLongArray((LongType.LongEncoding) constructor, count); } else if(constructor instanceof FloatType.FloatEncoding) { return decodeFloatArray((FloatType.FloatEncoding) constructor, count); } else if(constructor instanceof DoubleType.DoubleEncoding) { return decodeDoubleArray((DoubleType.DoubleEncoding)constructor, count); } else if(constructor instanceof CharacterType.CharacterEncoding) { return decodeCharArray((CharacterType.CharacterEncoding)constructor, count); } else { throw new ClassCastException("Unexpected class " + constructor.getClass().getName()); } } else { return decodeNonPrimitive(decoder, constructor, count); } } private static boolean[] decodeBooleanArray(BooleanType.BooleanEncoding constructor, final int count) { boolean[] array = new boolean[count]; for(int i = 0; i < count; i++) { array[i] = constructor.readPrimitiveValue(); } return array; } private static byte[] decodeByteArray(ByteType.ByteEncoding constructor , final int count) { byte[] array = new byte[count]; for(int i = 0; i < count; i++) { array[i] = constructor.readPrimitiveValue(); } return array; } private static short[] decodeShortArray(ShortType.ShortEncoding constructor, final int count) { short[] array = new short[count]; for(int i = 0; i < count; i++) { array[i] = constructor.readPrimitiveValue(); } return array; } private static int[] decodeIntArray(IntegerType.IntegerEncoding constructor, final int count) { int[] array = new int[count]; for(int i = 0; i < count; i++) { array[i] = constructor.readPrimitiveValue(); } return array; } private static long[] decodeLongArray(LongType.LongEncoding constructor, final int count) { long[] array = new long[count]; for(int i = 0; i < count; i++) { array[i] = constructor.readPrimitiveValue(); } return array; } private static float[] decodeFloatArray(FloatType.FloatEncoding constructor, final int count) { float[] array = new float[count]; for(int i = 0; i < count; i++) { array[i] = constructor.readPrimitiveValue(); } return array; } private static double[] decodeDoubleArray(DoubleType.DoubleEncoding constructor, final int count) { double[] array = new double[count]; for(int i = 0; i < count; i++) { array[i] = constructor.readPrimitiveValue(); } return array; } private static char[] decodeCharArray(CharacterType.CharacterEncoding constructor, final int count) { char[] array = new char[count]; for(int i = 0; i < count; i++) { array[i] = constructor.readPrimitiveValue(); } return array; } } ././@LongLink0100644 0000000 0000000 00000000150 14303440055 011625 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/BigIntegerType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/BigIntegerType.j0100644 0000000 0000000 00000012720 14303440055 033447 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.math.BigInteger; import java.util.Arrays; import java.util.Collection; public class BigIntegerType extends AbstractPrimitiveType { public static interface BigIntegerEncoding extends PrimitiveTypeEncoding { void write(BigInteger l); void writeValue(BigInteger l); public BigInteger readPrimitiveValue(); } private static final BigInteger BIG_BYTE_MIN = BigInteger.valueOf(Byte.MIN_VALUE); private static final BigInteger BIG_BYTE_MAX = BigInteger.valueOf(Byte.MAX_VALUE); private static final BigInteger BIG_LONG_MIN = BigInteger.valueOf(Long.MIN_VALUE); private static final BigInteger BIG_LONG_MAX = BigInteger.valueOf(Long.MAX_VALUE); private BigIntegerEncoding _BigIntegerEncoding; private BigIntegerEncoding _smallBigIntegerEncoding; BigIntegerType(final EncoderImpl encoder, final DecoderImpl decoder) { _BigIntegerEncoding = new AllBigIntegerEncoding(encoder, decoder); _smallBigIntegerEncoding = new SmallBigIntegerEncoding(encoder, decoder); encoder.register(BigInteger.class, this); } public Class getTypeClass() { return BigInteger.class; } public BigIntegerEncoding getEncoding(final BigInteger l) { return (l.compareTo(BIG_BYTE_MIN) >= 0 && l.compareTo(BIG_BYTE_MAX) <= 0) ? _smallBigIntegerEncoding : _BigIntegerEncoding; } public BigIntegerEncoding getCanonicalEncoding() { return _BigIntegerEncoding; } public Collection getAllEncodings() { return Arrays.asList(_smallBigIntegerEncoding, _BigIntegerEncoding); } private long longValueExact(final BigInteger val) { if (val.compareTo(BIG_LONG_MIN) < 0 || val.compareTo(BIG_LONG_MAX) > 0) { throw new ArithmeticException("cannot encode BigInteger not representable as long"); } return val.longValue(); } private class AllBigIntegerEncoding extends FixedSizePrimitiveTypeEncoding implements BigIntegerEncoding { public AllBigIntegerEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 8; } @Override public byte getEncodingCode() { return EncodingCodes.LONG; } public BigIntegerType getType() { return BigIntegerType.this; } public void writeValue(final BigInteger val) { getEncoder().writeRaw(longValueExact(val)); } public void write(final BigInteger l) { writeConstructor(); getEncoder().writeRaw(longValueExact(l)); } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } public BigInteger readValue() { return readPrimitiveValue(); } public BigInteger readPrimitiveValue() { return BigInteger.valueOf(getDecoder().readLong()); } @Override public boolean encodesJavaPrimitive() { return true; } } private class SmallBigIntegerEncoding extends FixedSizePrimitiveTypeEncoding implements BigIntegerEncoding { public SmallBigIntegerEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override public byte getEncodingCode() { return EncodingCodes.SMALLLONG; } @Override protected int getFixedSize() { return 1; } public void write(final BigInteger l) { writeConstructor(); getEncoder().writeRaw(l.byteValue()); } public BigInteger readPrimitiveValue() { return BigInteger.valueOf(getDecoder().readRawByte()); } public BigIntegerType getType() { return BigIntegerType.this; } public void writeValue(final BigInteger val) { getEncoder().writeRaw(val.byteValue()); } public boolean encodesSuperset(final TypeEncoding encoder) { return encoder == this; } public BigInteger readValue() { return readPrimitiveValue(); } @Override public boolean encodesJavaPrimitive() { return true; } } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/BinaryType.java0100644 0000000 0000000 00000014546 14303440055 033354 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.util.Arrays; import java.util.Collection; import org.apache.qpid.proton.amqp.Binary; public class BinaryType extends AbstractPrimitiveType { private final BinaryEncoding _binaryEncoding; private final BinaryEncoding _shortBinaryEncoding; private static interface BinaryEncoding extends PrimitiveTypeEncoding { } BinaryType(final EncoderImpl encoder, final DecoderImpl decoder) { _binaryEncoding = new LongBinaryEncoding(encoder, decoder); _shortBinaryEncoding = new ShortBinaryEncoding(encoder, decoder); encoder.register(Binary.class, this); decoder.register(this); } @Override public Class getTypeClass() { return Binary.class; } @Override public BinaryEncoding getEncoding(final Binary val) { return val.getLength() <= 255 ? _shortBinaryEncoding : _binaryEncoding; } @Override public BinaryEncoding getCanonicalEncoding() { return _binaryEncoding; } @Override public Collection getAllEncodings() { return Arrays.asList(_shortBinaryEncoding, _binaryEncoding); } public void fastWrite(EncoderImpl encoder, Binary binary) { if (binary.getLength() <= 255) { // Reserve size of body + type encoding and single byte size encoder.getBuffer().ensureRemaining(2 + binary.getLength()); encoder.writeRaw(EncodingCodes.VBIN8); encoder.writeRaw((byte) binary.getLength()); encoder.writeRaw(binary.getArray(), binary.getArrayOffset(), binary.getLength()); } else { // Reserve size of body + type encoding and four byte size encoder.getBuffer().ensureRemaining(5 + binary.getLength()); encoder.writeRaw(EncodingCodes.VBIN32); encoder.writeRaw(binary.getLength()); encoder.writeRaw(binary.getArray(), binary.getArrayOffset(), binary.getLength()); } } private class LongBinaryEncoding extends LargeFloatingSizePrimitiveTypeEncoding implements BinaryEncoding { public LongBinaryEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected void writeEncodedValue(final Binary val) { getEncoder().getBuffer().ensureRemaining(val.getLength()); getEncoder().writeRaw(val.getArray(), val.getArrayOffset(), val.getLength()); } @Override protected int getEncodedValueSize(final Binary val) { return val.getLength(); } @Override public byte getEncodingCode() { return EncodingCodes.VBIN32; } @Override public BinaryType getType() { return BinaryType.this; } @Override public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } @Override public Binary readValue() { final DecoderImpl decoder = getDecoder(); int size = decoder.readRawInt(); if (size > decoder.getByteBufferRemaining()) { throw new IllegalArgumentException("Binary data size "+size+" is specified to be greater than the amount of data available ("+ decoder.getByteBufferRemaining()+")"); } byte[] data = new byte[size]; decoder.readRaw(data, 0, size); return new Binary(data); } @Override public void skipValue() { DecoderImpl decoder = getDecoder(); ReadableBuffer buffer = decoder.getBuffer(); int size = decoder.readRawInt(); buffer.position(buffer.position() + size); } } private class ShortBinaryEncoding extends SmallFloatingSizePrimitiveTypeEncoding implements BinaryEncoding { public ShortBinaryEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected void writeEncodedValue(final Binary val) { getEncoder().getBuffer().ensureRemaining(val.getLength()); getEncoder().writeRaw(val.getArray(), val.getArrayOffset(), val.getLength()); } @Override protected int getEncodedValueSize(final Binary val) { return val.getLength(); } @Override public byte getEncodingCode() { return EncodingCodes.VBIN8; } @Override public BinaryType getType() { return BinaryType.this; } @Override public boolean encodesSuperset(final TypeEncoding encoder) { return encoder == this; } @Override public Binary readValue() { int size = ((int)getDecoder().readRawByte()) & 0xff; byte[] data = new byte[size]; getDecoder().readRaw(data, 0, size); return new Binary(data); } @Override public void skipValue() { DecoderImpl decoder = getDecoder(); ReadableBuffer buffer = decoder.getBuffer(); int size = ((int)getDecoder().readRawByte()) & 0xff; buffer.position(buffer.position() + size); } } } ././@LongLink0100644 0000000 0000000 00000000145 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/BooleanType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/BooleanType.java0100644 0000000 0000000 00000014674 14303440055 033511 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.util.Arrays; import java.util.Collection; public final class BooleanType extends AbstractPrimitiveType { private static final byte BYTE_0 = (byte) 0; private static final byte BYTE_1 = (byte) 1; private org.apache.qpid.proton.codec.BooleanType.BooleanEncoding _trueEncoder; private org.apache.qpid.proton.codec.BooleanType.BooleanEncoding _falseEncoder; private org.apache.qpid.proton.codec.BooleanType.BooleanEncoding _booleanEncoder; public static interface BooleanEncoding extends PrimitiveTypeEncoding { void write(boolean b); void writeValue(boolean b); boolean readPrimitiveValue(); } BooleanType(final EncoderImpl encoder, final DecoderImpl decoder) { _trueEncoder = new TrueEncoding(encoder, decoder); _falseEncoder = new FalseEncoding(encoder, decoder); _booleanEncoder = new AllBooleanEncoding(encoder, decoder); encoder.register(Boolean.class, this); decoder.register(this); } public Class getTypeClass() { return Boolean.class; } public BooleanEncoding getEncoding(final Boolean val) { return val ? _trueEncoder : _falseEncoder; } public BooleanEncoding getEncoding(final boolean val) { return val ? _trueEncoder : _falseEncoder; } public void writeValue(final boolean val) { getEncoding(val).write(val); } public BooleanEncoding getCanonicalEncoding() { return _booleanEncoder; } public Collection getAllEncodings() { return Arrays.asList(_trueEncoder, _falseEncoder, _booleanEncoder); } private class TrueEncoding extends FixedSizePrimitiveTypeEncoding implements BooleanEncoding { public TrueEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 0; } @Override public byte getEncodingCode() { return EncodingCodes.BOOLEAN_TRUE; } public BooleanType getType() { return BooleanType.this; } public void writeValue(final Boolean val) { } public void write(final boolean b) { writeConstructor(); } public void writeValue(final boolean b) { } public boolean encodesSuperset(final TypeEncoding encoding) { return encoding == this; } public Boolean readValue() { return Boolean.TRUE; } public boolean readPrimitiveValue() { return true; } @Override public boolean encodesJavaPrimitive() { return true; } } private class FalseEncoding extends FixedSizePrimitiveTypeEncoding implements org.apache.qpid.proton.codec.BooleanType.BooleanEncoding { public FalseEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 0; } @Override public byte getEncodingCode() { return EncodingCodes.BOOLEAN_FALSE; } public BooleanType getType() { return BooleanType.this; } public void writeValue(final Boolean val) { } public void write(final boolean b) { writeConstructor(); } public void writeValue(final boolean b) { } public boolean readPrimitiveValue() { return false; } public boolean encodesSuperset(final TypeEncoding encoding) { return encoding == this; } public Boolean readValue() { return Boolean.FALSE; } @Override public boolean encodesJavaPrimitive() { return true; } } private class AllBooleanEncoding extends FixedSizePrimitiveTypeEncoding implements BooleanEncoding { public AllBooleanEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } public BooleanType getType() { return BooleanType.this; } @Override protected int getFixedSize() { return 1; } @Override public byte getEncodingCode() { return EncodingCodes.BOOLEAN; } public void writeValue(final Boolean val) { getEncoder().writeRaw(val ? BYTE_1 : BYTE_0); } public void write(final boolean val) { writeConstructor(); getEncoder().writeRaw(val ? BYTE_1 : BYTE_0); } public void writeValue(final boolean b) { getEncoder().writeRaw(b ? BYTE_1 : BYTE_0); } public boolean readPrimitiveValue() { return getDecoder().readRawByte() != BYTE_0; } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } public Boolean readValue() { return readPrimitiveValue() ? Boolean.TRUE : Boolean.FALSE; } @Override public boolean encodesJavaPrimitive() { return true; } } } ././@LongLink0100644 0000000 0000000 00000000153 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/ByteBufferDecoder.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/ByteBufferDecode0100644 0000000 0000000 00000002005 14303440055 033472 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.nio.ByteBuffer; public interface ByteBufferDecoder extends Decoder { public void setByteBuffer(ByteBuffer buffer); public int getByteBufferRemaining(); } ././@LongLink0100644 0000000 0000000 00000000153 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/ByteBufferEncoder.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/ByteBufferEncode0100644 0000000 0000000 00000001730 14303440055 033510 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.nio.ByteBuffer; public interface ByteBufferEncoder extends Encoder { public void setByteBuffer(ByteBuffer buf); } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/ByteType.java0100644 0000000 0000000 00000005742 14303440055 033031 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.util.Collection; import java.util.Collections; public class ByteType extends AbstractPrimitiveType { private ByteEncoding _byteEncoding; ByteType(final EncoderImpl encoder, final DecoderImpl decoder) { _byteEncoding = new ByteEncoding(encoder, decoder); encoder.register(Byte.class, this); decoder.register(this); } public Class getTypeClass() { return Byte.class; } public ByteEncoding getEncoding(final Byte val) { return _byteEncoding; } public ByteEncoding getCanonicalEncoding() { return _byteEncoding; } public Collection getAllEncodings() { return Collections.singleton(_byteEncoding); } public void writeType(byte b) { _byteEncoding.write(b); } public class ByteEncoding extends FixedSizePrimitiveTypeEncoding { public ByteEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 1; } @Override public byte getEncodingCode() { return EncodingCodes.BYTE; } public ByteType getType() { return ByteType.this; } public void writeValue(final Byte val) { getEncoder().writeRaw(val); } public void write(final byte val) { writeConstructor(); getEncoder().writeRaw(val); } public void writeValue(final byte val) { getEncoder().writeRaw(val); } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } public Byte readValue() { return readPrimitiveValue(); } public byte readPrimitiveValue() { return getDecoder().readRawByte(); } @Override public boolean encodesJavaPrimitive() { return true; } } } ././@LongLink0100644 0000000 0000000 00000000147 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/CharacterType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/CharacterType.ja0100644 0000000 0000000 00000006241 14303440055 033466 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.util.Collection; import java.util.Collections; public class CharacterType extends AbstractPrimitiveType { private CharacterEncoding _characterEncoding; CharacterType(final EncoderImpl encoder, final DecoderImpl decoder) { _characterEncoding = new CharacterEncoding(encoder, decoder); encoder.register(Character.class, this); decoder.register(this); } public Class getTypeClass() { return Character.class; } public CharacterEncoding getEncoding(final Character val) { return _characterEncoding; } public CharacterEncoding getCanonicalEncoding() { return _characterEncoding; } public Collection getAllEncodings() { return Collections.singleton(_characterEncoding); } public void write(char c) { _characterEncoding.write(c); } public class CharacterEncoding extends FixedSizePrimitiveTypeEncoding { public CharacterEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 4; } @Override public byte getEncodingCode() { return EncodingCodes.CHAR; } public CharacterType getType() { return CharacterType.this; } public void writeValue(final Character val) { getEncoder().writeRaw((int)val.charValue() & 0xffff); } public void writeValue(final char val) { getEncoder().writeRaw((int)val & 0xffff); } public void write(final char c) { writeConstructor(); getEncoder().writeRaw((int)c & 0xffff); } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } public Character readValue() { return readPrimitiveValue(); } public char readPrimitiveValue() { return (char) (getDecoder().readRawInt() & 0xffff); } @Override public boolean encodesJavaPrimitive() { return true; } } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/Codec.java0100644 0000000 0000000 00000002007 14303440055 032270 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; /** * Codec * */ public final class Codec { private Codec() { } public static Data data(long capacity) { return Data.Factory.create(); } } ././@LongLink0100644 0000000 0000000 00000000161 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeReadableBuffer.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeReadabl0100644 0000000 0000000 00000073526 14303440055 033566 0ustar00rootroot0000000 0000000 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.qpid.proton.codec; import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.InvalidMarkException; import java.nio.charset.CharacterCodingException; import java.nio.charset.CharsetDecoder; import java.nio.charset.CoderResult; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * ReadableBuffer implementation whose content is made up of one or more * byte arrays. */ public class CompositeReadableBuffer implements ReadableBuffer { private static final List EMPTY_LIST = Collections.unmodifiableList(new ArrayList()); private static final ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(new byte[0]); private static final CompositeReadableBuffer EMPTY_SLICE = new CompositeReadableBuffer(false); private static int UNSET_MARK = -1; private static final int SHORT_BYTES = 2; private static final int INT_BYTES = 4; private static final int LONG_BYTES = 8; private ArrayList contents; // Track active array and our offset into it. private int currentArrayIndex = -1; private byte[] currentArray; private int currentOffset; // State global to the buffer. private int position; private int limit; private int capacity; private int mark = -1; private boolean compactable = true; /** * Creates a default empty composite buffer */ public CompositeReadableBuffer() { } private CompositeReadableBuffer(byte[] array, int offset) { this.currentArray = array; this.currentOffset = offset; if(array != null) { this.capacity = array.length; } this.limit = capacity; } private CompositeReadableBuffer(boolean compactable) { this.compactable = compactable; } public List getArrays() { return contents == null ? EMPTY_LIST : Collections.unmodifiableList(contents); } public int getCurrentIndex() { return currentArrayIndex; } /** * Gets the current position index in the current backing array, which represents the current buffer position. * * This value includes any buffer position movement, and resets when moving across array segments, so it only * gives the starting offset for the first array if the buffer position is 0. * * Value may be out of array bounds if the the buffer currently has no content remaining. * * @return the position index in the current array representing the current buffer position. */ public int getCurrentArrayPosition() { return currentOffset; } @Override public boolean hasArray() { return currentArray != null && (contents == null || contents.size() == 1); } @Override public int capacity() { return capacity; } @Override public byte[] array() { if (hasArray()) { return currentArray; } throw new UnsupportedOperationException("Buffer not backed by a single array"); } @Override public int arrayOffset() { if (hasArray()) { return currentOffset - position; } throw new UnsupportedOperationException("Buffer not backed by a single array"); } @Override public byte get() { if (position == limit) { throw new BufferUnderflowException(); } final byte result = currentArray[currentOffset++]; position++; maybeMoveToNextArray(); return result; } @Override public byte get(int index) { if (index < 0 || index >= limit) { throw new IndexOutOfBoundsException("The given index is not valid: " + index); } byte result = 0; if (index == position) { result = currentArray[currentOffset]; } else if (index < position) { result = getBackwards(index); } else { result = getForward(index); } return result; } private byte getForward(int index) { byte result = 0; int currentArrayIndex = this.currentArrayIndex; int currentOffset = this.currentOffset; byte[] currentArray = this.currentArray; for (int amount = index - position; amount >= 0;) { if (amount < currentArray.length - currentOffset) { result = currentArray[currentOffset + amount]; break; } else { amount -= currentArray.length - currentOffset; currentArray = contents.get(++currentArrayIndex); currentOffset = 0; } } return result; } private byte getBackwards(int index) { byte result = 0; int currentArrayIndex = this.currentArrayIndex; int currentOffset = this.currentOffset; byte[] currentArray = this.currentArray; for (int amount = position - index; amount >= 0;) { if ((currentOffset - amount) >= 0) { result = currentArray[currentOffset - amount]; break; } else { amount -= currentOffset; currentArray = contents.get(--currentArrayIndex); currentOffset = currentArray.length; } } return result; } @Override public int getInt() { if (remaining() < INT_BYTES) { throw new BufferUnderflowException(); } int result = 0; if (currentArray.length - currentOffset >= 4) { result = (int)(currentArray[currentOffset++] & 0xFF) << 24 | (int)(currentArray[currentOffset++] & 0xFF) << 16 | (int)(currentArray[currentOffset++] & 0xFF) << 8 | (int)(currentArray[currentOffset++] & 0xFF) << 0; maybeMoveToNextArray(); } else { for (int i = INT_BYTES - 1; i >= 0; --i) { result |= (int)(currentArray[currentOffset++] & 0xFF) << (i * Byte.SIZE); maybeMoveToNextArray(); } } position += 4; return result; } @Override public long getLong() { if (remaining() < LONG_BYTES) { throw new BufferUnderflowException(); } long result = 0; if (currentArray.length - currentOffset >= 8) { result = (long)(currentArray[currentOffset++] & 0xFF) << 56 | (long)(currentArray[currentOffset++] & 0xFF) << 48 | (long)(currentArray[currentOffset++] & 0xFF) << 40 | (long)(currentArray[currentOffset++] & 0xFF) << 32 | (long)(currentArray[currentOffset++] & 0xFF) << 24 | (long)(currentArray[currentOffset++] & 0xFF) << 16 | (long)(currentArray[currentOffset++] & 0xFF) << 8 | (long)(currentArray[currentOffset++] & 0xFF) << 0; maybeMoveToNextArray(); } else { for (int i = LONG_BYTES - 1; i >= 0; --i) { result |= (long)(currentArray[currentOffset++] & 0xFF) << (i * Byte.SIZE); maybeMoveToNextArray(); } } position += 8; return result; } @Override public short getShort() { if (remaining() < SHORT_BYTES) { throw new BufferUnderflowException(); } short result = 0; for (int i = SHORT_BYTES - 1; i >= 0; --i) { result |= (currentArray[currentOffset++] & 0xFF) << (i * Byte.SIZE); maybeMoveToNextArray(); } position += 2; return result; } @Override public float getFloat() { return Float.intBitsToFloat(getInt()); } @Override public double getDouble() { return Double.longBitsToDouble(getLong()); } @Override public CompositeReadableBuffer get(byte[] data) { return get(data, 0, data.length); } @Override public CompositeReadableBuffer get(byte[] data, int offset, int length) { validateReadTarget(data.length, offset, length); if (length > remaining()) { throw new BufferUnderflowException(); } int copied = 0; while (length > 0) { final int chunk = Math.min((currentArray.length - currentOffset), length); System.arraycopy(currentArray, currentOffset, data, offset + copied, chunk); currentOffset += chunk; length -= chunk; copied += chunk; maybeMoveToNextArray(); } position += copied; return this; } @Override public CompositeReadableBuffer get(WritableBuffer target) { int length = Math.min(target.remaining(), remaining()); do { final int chunk = Math.min((currentArray.length - currentOffset), length); if (chunk == 0) { break; // This buffer is out of data } target.put(currentArray, currentOffset, chunk); currentOffset += chunk; position += chunk; length -= chunk; maybeMoveToNextArray(); } while (length > 0); return this; } @Override public CompositeReadableBuffer position(int position) { if (position < 0 || position > limit) { throw new IllegalArgumentException("position must be non-negative and no greater than the limit"); } int moveBy = position - this.position; if (moveBy >= 0) { moveForward(moveBy); } else { moveBackwards(Math.abs(moveBy)); } this.position = position; if (mark > position) { mark = UNSET_MARK; } return this; } private void moveForward(int moveBy) { while (moveBy > 0) { if (moveBy < currentArray.length - currentOffset) { currentOffset += moveBy; break; } else { moveBy -= currentArray.length - currentOffset; if (currentArrayIndex != -1 && currentArrayIndex < contents.size() - 1) { currentArray = contents.get(++currentArrayIndex); currentOffset = 0; } else { currentOffset = currentArray.length; } } } } private void moveBackwards(int moveBy) { while (moveBy > 0) { if ((currentOffset - moveBy) >= 0) { currentOffset -= moveBy; break; } else { moveBy -= currentOffset; currentArray = contents.get(--currentArrayIndex); currentOffset = currentArray.length; } } } @Override public int position() { return position; } @Override public CompositeReadableBuffer slice() { int newCapacity = limit() - position(); final CompositeReadableBuffer result; if (newCapacity == 0) { result = EMPTY_SLICE; } else { result = new CompositeReadableBuffer(currentArray, currentOffset); result.contents = contents; result.currentArrayIndex = currentArrayIndex; result.capacity = newCapacity; result.limit = newCapacity; result.position = 0; result.compactable = false; } return result; } @Override public CompositeReadableBuffer flip() { limit = position; position(0); // Move by index to avoid corrupting a slice. mark = UNSET_MARK; return this; } @Override public CompositeReadableBuffer limit(int limit) { if (limit < 0 || limit > capacity) { throw new IllegalArgumentException("limit must be non-negative and no greater than the capacity"); } if (mark > limit) { mark = UNSET_MARK; } if (position > limit) { position(limit); } this.limit = limit; return this; } @Override public int limit() { return limit; } @Override public CompositeReadableBuffer mark() { this.mark = position; return this; } @Override public CompositeReadableBuffer reset() { if (mark < 0) { throw new InvalidMarkException(); } position(mark); return this; } @Override public CompositeReadableBuffer rewind() { return position(0); } @Override public CompositeReadableBuffer clear() { mark = UNSET_MARK; limit = capacity; return position(0); } @Override public int remaining() { return limit - position; } @Override public boolean hasRemaining() { return remaining() > 0; } @Override public CompositeReadableBuffer duplicate() { CompositeReadableBuffer duplicated = new CompositeReadableBuffer(currentArray, currentOffset); if (contents != null) { duplicated.contents = new ArrayList<>(contents); } duplicated.capacity = capacity; duplicated.currentArrayIndex = currentArrayIndex; duplicated.limit = limit; duplicated.position = position; duplicated.mark = mark; duplicated.compactable = compactable; // A slice duplicated should not allow compaction. return duplicated; } @Override public ByteBuffer byteBuffer() { int viewSpan = limit() - position(); final ByteBuffer result; if (viewSpan == 0) { result = EMPTY_BUFFER; } else if (viewSpan <= currentArray.length - currentOffset) { result = ByteBuffer.wrap(currentArray, currentOffset, viewSpan); } else { result = buildByteBuffer(viewSpan); } return result.asReadOnlyBuffer(); } private ByteBuffer buildByteBuffer(int span) { byte[] compactedView = new byte[span]; int arrayIndex = currentArrayIndex; // Take whatever is left from the current array; System.arraycopy(currentArray, currentOffset, compactedView, 0, currentArray.length - currentOffset); int copied = currentArray.length - currentOffset; while (copied < span) { byte[] next = contents.get(++arrayIndex); final int length = Math.min(span - copied, next.length); System.arraycopy(next, 0, compactedView, copied, length); copied += length; } return ByteBuffer.wrap(compactedView); } @Override public String readUTF8() throws CharacterCodingException { return readString(StandardCharsets.UTF_8.newDecoder()); } @Override public String readString(CharsetDecoder decoder) throws CharacterCodingException { if (!hasRemaining()) { return ""; } CharBuffer decoded = null; if (hasArray()) { decoded = decoder.decode(ByteBuffer.wrap(currentArray, currentOffset, remaining())); } else { decoded = readStringFromComponents(decoder); } // Ensure that all currently readable bytes are consumed. position(limit); return decoded.toString(); } private CharBuffer readStringFromComponents(CharsetDecoder decoder) throws CharacterCodingException { int size = (int)(remaining() * decoder.averageCharsPerByte()); CharBuffer decoded = CharBuffer.allocate(size); int arrayIndex = currentArrayIndex; final int viewSpan = limit() - position(); int processed = Math.min(currentArray.length - currentOffset, viewSpan); ByteBuffer wrapper = ByteBuffer.wrap(currentArray, currentOffset, processed); CoderResult step = CoderResult.OVERFLOW; do { boolean endOfInput = processed == viewSpan; step = decoder.decode(wrapper, decoded, endOfInput); if (step.isUnderflow()) { if (endOfInput) { step = decoder.flush(decoded); break; } if (wrapper.hasRemaining()) { final int unprocessed = wrapper.remaining(); final byte[] next = contents.get(++arrayIndex); final ByteBuffer previous = wrapper; final int nextAmount = Math.min(next.length, viewSpan - processed); wrapper = ByteBuffer.allocate(unprocessed + nextAmount); wrapper.put(previous); wrapper.put(next, 0, nextAmount); processed += nextAmount; wrapper.flip(); } else { final byte[] next = contents.get(++arrayIndex); final int wrapSize = Math.min(next.length, viewSpan - processed); wrapper = ByteBuffer.wrap(next, 0, wrapSize); processed += wrapSize; } } else if (step.isOverflow()) { size = 2 * size + 1; CharBuffer upsized = CharBuffer.allocate(size); decoded.flip(); upsized.put(decoded); decoded = upsized; continue; } } while (!step.isError()); if (step.isError()) { step.throwException(); } return (CharBuffer) decoded.flip(); } /** * Compact the buffer dropping arrays that have been consumed by previous * reads from this Composite buffer. The limit is reset to the new capacity */ @Override public CompositeReadableBuffer reclaimRead() { if (!compactable || (currentArray == null && contents == null)) { return this; } int totalCompaction = 0; int totalRemovals = 0; for (; totalRemovals < currentArrayIndex; ++totalRemovals) { byte[] element = contents.remove(0); totalCompaction += element.length; } currentArrayIndex -= totalRemovals; if (currentArray.length == currentOffset) { totalCompaction += currentArray.length; // If we are sitting on the end of the data (length == offest) then // we are also at the last element in the ArrayList if one is currently // in use, so remove the data and release the list. if (currentArrayIndex == 0) { contents.clear(); contents = null; } currentArray = null; currentArrayIndex = -1; currentOffset = 0; } position -= totalCompaction; limit = capacity -= totalCompaction; if (mark != UNSET_MARK) { mark -= totalCompaction; } return this; } /** * Adds the given array into the composite buffer at the end. *

* The appended array is not copied so changes to the source array are visible in this * buffer and vice versa. If this composite was empty than it would return true for the * {@link #hasArray()} method until another array is appended. *

* Calling this method resets the limit to the new capacity. * * @param array * The array to add to this composite buffer. * * @throws IllegalArgumentException if the array is null or zero size. * @throws IllegalStateException if the buffer does not allow appends. * * @return a reference to this {@link CompositeReadableBuffer}. */ public CompositeReadableBuffer append(byte[] array) { validateAppendable(); if (array == null || array.length == 0) { throw new IllegalArgumentException("Array must not be empty or null"); } if (currentArray == null) { currentArray = array; currentOffset = 0; } else if (contents == null) { contents = new ArrayList<>(); contents.add(currentArray); contents.add(array); currentArrayIndex = 0; // If we exhausted the array previously then it should move to the new one now. maybeMoveToNextArray(); } else { contents.add(array); // If we exhausted the list previously then it didn't move onward at the time, so it should now. maybeMoveToNextArray(); } capacity += array.length; limit = capacity; return this; } private void validateAppendable() { if (!compactable) { throw new IllegalStateException(); } } private void validateBuffer(ReadableBuffer buffer) { if (buffer == null) { throw new IllegalArgumentException("A non-null buffer must be provided"); } if (!buffer.hasRemaining()) { throw new IllegalArgumentException("Buffer has no remaining content to append"); } } /** * Adds the given composite buffer contents (from current position, up to the limit) into this * composite buffer at the end. The source buffer position will be set to its limit. *

* The appended buffer contents are not copied wherever possible, so changes to the source * arrays are typically visible in this buffer and vice versa. Exceptions include where the * source buffer position is not located at the start of its current backing array, or where the * given buffer has a limit that doesn't encompass all of the last array used, and * so the remainder of that arrays contents must be copied first to append here. *

* Calling this method resets the limit to the new capacity. * * @param buffer * the buffer with contents to append into this composite buffer. * * @throws IllegalArgumentException if the given buffer is null or has zero remainder. * @throws IllegalStateException if the buffer does not allow appends. * * @return a reference to this {@link CompositeReadableBuffer}. */ public CompositeReadableBuffer append(CompositeReadableBuffer buffer) { validateAppendable(); validateBuffer(buffer); byte[] chunk; do { int bufferRemaining = buffer.remaining(); int arrayRemaining = buffer.currentArray.length - buffer.currentOffset; if (buffer.currentOffset > 0 || bufferRemaining < arrayRemaining) { int length = Math.min(arrayRemaining, bufferRemaining); chunk = new byte[length]; System.arraycopy(buffer.currentArray, buffer.currentOffset, chunk, 0, length); } else { chunk = buffer.currentArray; } append(chunk); buffer.position(buffer.position() + chunk.length); } while (buffer.hasRemaining()); return this; } /** * Adds the given readable buffer contents (from current position, up to the limit) into this * composite buffer at the end. The source buffer position will be set to its limit. *

* The appended buffer contents are not copied wherever possible, so changes to the source * arrays are typically visible in this buffer and vice versa. Exceptions are where the * source buffer is not backed by an array, or where the source buffer position is not * located at the start of its backing array, and so the remainder of the contents must * be copied first to append here. *

* Calling this method resets the limit to the new capacity. * * @param buffer * the buffer with contents to append into this composite buffer. * * @throws IllegalArgumentException if the given buffer is null or has zero remainder. * @throws IllegalStateException if the buffer does not allow appends. * * @return a reference to this {@link CompositeReadableBuffer}. */ public CompositeReadableBuffer append(ReadableBuffer buffer) { if(buffer instanceof CompositeReadableBuffer) { append((CompositeReadableBuffer) buffer); } else { validateAppendable(); validateBuffer(buffer); if (buffer.hasArray()) { byte[] chunk = buffer.array(); int bufferRemaining = buffer.remaining(); if (buffer.arrayOffset() > 0 || bufferRemaining < chunk.length) { chunk = new byte[bufferRemaining]; System.arraycopy(buffer.array(), buffer.arrayOffset(), chunk, 0, bufferRemaining); } append(chunk); buffer.position(buffer.position() + chunk.length); } else { byte[] chunk = new byte[buffer.remaining()]; buffer.get(chunk); append(chunk); } } return this; } @Override public int hashCode() { int hash = 1; int remaining = remaining(); if (currentArrayIndex < 0 || remaining <= currentArray.length - currentOffset) { while (remaining > 0) { hash = 31 * hash + currentArray[currentOffset + --remaining]; } } else { hash = hashCodeFromComponents(); } return hash; } private int hashCodeFromComponents() { int hash = 1; byte[] array = currentArray; int arrayOffset = currentOffset; int arraysIndex = currentArrayIndex; // Run to the the array and offset where we want to start the hash from final int remaining = remaining(); for (int moveBy = remaining; moveBy > 0; ) { if (moveBy <= array.length - arrayOffset) { arrayOffset += moveBy; break; } else { moveBy -= array.length - arrayOffset; array = contents.get(++arraysIndex); arrayOffset = 0; } } // Now run backwards through the arrays to match what ByteBuffer would produce for (int moveBy = remaining; moveBy > 0; moveBy--) { hash = 31 * hash + array[--arrayOffset]; if (arrayOffset == 0 && arraysIndex > 0) { array = contents.get(--arraysIndex); arrayOffset = array.length; } } return hash; } @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof ReadableBuffer)) { return false; } ReadableBuffer buffer = (ReadableBuffer) other; final int remaining = remaining(); if (remaining != buffer.remaining()) { return false; } if (remaining == 0) { // No content to compare, and we already checked 'remaining' is equal. Protects from NPE below. return true; } if (hasArray() || remaining <= currentArray.length - currentOffset) { // Either there is only one array, or the span to compare is within a single chunk of this buffer, // allowing the compare to directly access the underlying array instead of using slower get methods. return equals(currentArray, currentOffset, remaining, buffer); } else { return equals(this, buffer); } } private static boolean equals(byte[] buffer, int start, int length, ReadableBuffer other) { final int position = other.position(); for (int i = 0; i < length; i++) { if (buffer[start + i] != other.get(position + i)) { return false; } } return true; } private static boolean equals(ReadableBuffer buffer, ReadableBuffer other) { final int origPos = buffer.position(); try { for (int i = other.position(); buffer.hasRemaining(); i++) { if (!equals(buffer.get(), other.get(i))) { return false; } } return true; } finally { buffer.position(origPos); } } @Override public String toString() { StringBuffer builder = new StringBuffer(); builder.append("CompositeReadableBuffer"); builder.append("{ pos="); builder.append(position()); builder.append(" limit="); builder.append(limit()); builder.append(" capacity="); builder.append(capacity()); builder.append(" }"); return builder.toString(); } private static boolean equals(byte x, byte y) { return x == y; } private void maybeMoveToNextArray() { if (currentArray.length == currentOffset) { if (currentArrayIndex >= 0 && currentArrayIndex < (contents.size() - 1)) { currentArray = contents.get(++currentArrayIndex); currentOffset = 0; } } } private static void validateReadTarget(int destSize, int offset, int length) { if ((offset | length) < 0) { throw new IndexOutOfBoundsException("offset and legnth must be non-negative"); } if (((long) offset + (long) length) > destSize) { throw new IndexOutOfBoundsException("target is to small for specified read size"); } } } ././@LongLink0100644 0000000 0000000 00000000161 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeWritableBuffer.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/CompositeWritabl0100644 0000000 0000000 00000013131 14303440055 033622 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; public class CompositeWritableBuffer implements WritableBuffer { private final WritableBuffer _first; private final WritableBuffer _second; public CompositeWritableBuffer(WritableBuffer first, WritableBuffer second) { _first = first; _second = second; } @Override public void put(byte b) { (_first.hasRemaining() ? _first : _second).put(b); } @Override public void putFloat(float f) { putInt(Float.floatToRawIntBits(f)); } @Override public void putDouble(double d) { putLong(Double.doubleToRawLongBits(d)); } @Override public void putShort(short s) { int remaining = _first.remaining(); if(remaining >= 2) { _first.putShort(s); } else if(remaining ==0 ) { _second.putShort(s); } else { ByteBuffer wrap = ByteBuffer.wrap(new byte[2]); wrap.putShort(s); wrap.flip(); put(wrap); } } @Override public void putInt(int i) { int remaining = _first.remaining(); if(remaining >= 4) { _first.putInt(i); } else if(remaining ==0 ) { _second.putInt(i); } else { ByteBuffer wrap = ByteBuffer.wrap(new byte[4]); wrap.putInt(i); wrap.flip(); put(wrap); } } @Override public void putLong(long l) { int remaining = _first.remaining(); if(remaining >= 8) { _first.putLong(l); } else if(remaining ==0 ) { _second.putLong(l); } else { ByteBuffer wrap = ByteBuffer.wrap(new byte[8]); wrap.putLong(l); wrap.flip(); put(wrap); } } @Override public boolean hasRemaining() { return _first.hasRemaining() || _second.hasRemaining(); } @Override public int remaining() { return _first.remaining()+_second.remaining(); } @Override public int position() { return _first.position()+_second.position(); } @Override public int limit() { return _first.limit() + _second.limit(); } @Override public void position(int position) { int first_limit = _first.limit(); if( position <= first_limit ) { _first.position(position); _second.position(0); } else { _first.position(first_limit); _second.position(position - first_limit); } } @Override public void put(byte[] src, int offset, int length) { final int firstRemaining = _first.remaining(); if(firstRemaining > 0) { if(firstRemaining >= length) { _first.put(src, offset, length); return; } else { _first.put(src,offset, firstRemaining); } } _second.put(src, offset+firstRemaining, length-firstRemaining); } @Override public void put(ByteBuffer payload) { int firstRemaining = _first.remaining(); if(firstRemaining > 0) { if(firstRemaining >= payload.remaining()) { _first.put(payload); return; } else { int limit = payload.limit(); payload.limit(payload.position()+firstRemaining); _first.put(payload); payload.limit(limit); } } _second.put(payload); } @Override public String toString() { return _first.toString() + " + "+_second.toString(); } @Override public void put(ReadableBuffer payload) { int firstRemaining = _first.remaining(); if(firstRemaining > 0) { if(firstRemaining >= payload.remaining()) { _first.put(payload); return; } else { int limit = payload.limit(); payload.limit(payload.position()+firstRemaining); _first.put(payload); payload.limit(limit); } } _second.put(payload); } @Override public void put(String value) { if (_first.hasRemaining()) { byte[] utf8Bytes = value.getBytes(StandardCharsets.UTF_8); put(utf8Bytes, 0, utf8Bytes.length); } else { _second.put(value); } } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/Data.java0100644 0000000 0000000 00000010242 14303440055 032124 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.nio.ByteBuffer; import java.util.Date; import java.util.List; import java.util.Map; import java.util.UUID; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.Decimal128; import org.apache.qpid.proton.amqp.Decimal32; import org.apache.qpid.proton.amqp.Decimal64; import org.apache.qpid.proton.amqp.DescribedType; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedByte; import org.apache.qpid.proton.amqp.UnsignedInteger; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.UnsignedShort; import org.apache.qpid.proton.codec.impl.DataImpl; public interface Data { public static final class Factory { public static Data create() { return new DataImpl(); } } enum DataType { NULL, BOOL, UBYTE, BYTE, USHORT, SHORT, UINT, INT, CHAR, ULONG, LONG, TIMESTAMP, FLOAT, DOUBLE, DECIMAL32, DECIMAL64, DECIMAL128, UUID, BINARY, STRING, SYMBOL, DESCRIBED, ARRAY, LIST, MAP } void free(); void clear(); long size(); void rewind(); DataType next(); DataType prev(); boolean enter(); boolean exit(); DataType type(); Binary encode(); long encodedSize(); long encode(ByteBuffer buf); long decode(ByteBuffer buf); void putList(); void putMap(); void putArray(boolean described, DataType type); void putDescribed(); void putNull(); void putBoolean(boolean b); void putUnsignedByte(UnsignedByte ub); void putByte(byte b); void putUnsignedShort(UnsignedShort us); void putShort(short s); void putUnsignedInteger(UnsignedInteger ui); void putInt(int i); void putChar(int c); void putUnsignedLong(UnsignedLong ul); void putLong(long l); void putTimestamp(Date t); void putFloat(float f); void putDouble(double d); void putDecimal32(Decimal32 d); void putDecimal64(Decimal64 d); void putDecimal128(Decimal128 d); void putUUID(UUID u); void putBinary(Binary bytes); void putBinary(byte[] bytes); void putString(String string); void putSymbol(Symbol symbol); void putObject(Object o); void putJavaMap(Map map); void putJavaList(List list); void putDescribedType(DescribedType dt); long getList(); long getMap(); long getArray(); boolean isArrayDescribed(); DataType getArrayType(); boolean isDescribed(); boolean isNull(); boolean getBoolean(); UnsignedByte getUnsignedByte(); byte getByte(); UnsignedShort getUnsignedShort(); short getShort(); UnsignedInteger getUnsignedInteger(); int getInt(); int getChar(); UnsignedLong getUnsignedLong(); long getLong(); Date getTimestamp(); float getFloat(); double getDouble(); Decimal32 getDecimal32(); Decimal64 getDecimal64(); Decimal128 getDecimal128(); UUID getUUID(); Binary getBinary(); String getString(); Symbol getSymbol(); Object getObject(); Map getJavaMap(); List getJavaList(); Object[] getJavaArray(); DescribedType getDescribedType(); String format(); } ././@LongLink0100644 0000000 0000000 00000000150 14303440055 011625 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/Decimal128Type.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/Decimal128Type.j0100644 0000000 0000000 00000005517 14303440055 033227 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import org.apache.qpid.proton.amqp.Decimal128; import java.util.Collection; import java.util.Collections; public class Decimal128Type extends AbstractPrimitiveType { private Decimal128Encoding _decimal128Encoder; Decimal128Type(final EncoderImpl encoder, final DecoderImpl decoder) { _decimal128Encoder = new Decimal128Encoding(encoder, decoder); encoder.register(Decimal128.class, this); decoder.register(this); } public Class getTypeClass() { return Decimal128.class; } public Decimal128Encoding getEncoding(final Decimal128 val) { return _decimal128Encoder; } public Decimal128Encoding getCanonicalEncoding() { return _decimal128Encoder; } public Collection getAllEncodings() { return Collections.singleton(_decimal128Encoder); } private class Decimal128Encoding extends FixedSizePrimitiveTypeEncoding { public Decimal128Encoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 16; } @Override public byte getEncodingCode() { return EncodingCodes.DECIMAL128; } public Decimal128Type getType() { return Decimal128Type.this; } public void writeValue(final Decimal128 val) { getEncoder().writeRaw(val.getMostSignificantBits()); getEncoder().writeRaw(val.getLeastSignificantBits()); } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } public Decimal128 readValue() { long msb = getDecoder().readRawLong(); long lsb = getDecoder().readRawLong(); return new Decimal128(msb, lsb); } } } ././@LongLink0100644 0000000 0000000 00000000147 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/Decimal32Type.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/Decimal32Type.ja0100644 0000000 0000000 00000005214 14303440055 033274 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import org.apache.qpid.proton.amqp.Decimal32; import java.util.Collection; import java.util.Collections; public class Decimal32Type extends AbstractPrimitiveType { private Decimal32Encoding _decimal32Encoder; Decimal32Type(final EncoderImpl encoder, final DecoderImpl decoder) { _decimal32Encoder = new Decimal32Encoding(encoder, decoder); encoder.register(Decimal32.class, this); decoder.register(this); } public Class getTypeClass() { return Decimal32.class; } public Decimal32Encoding getEncoding(final Decimal32 val) { return _decimal32Encoder; } public Decimal32Encoding getCanonicalEncoding() { return _decimal32Encoder; } public Collection getAllEncodings() { return Collections.singleton(_decimal32Encoder); } private class Decimal32Encoding extends FixedSizePrimitiveTypeEncoding { public Decimal32Encoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 4; } @Override public byte getEncodingCode() { return EncodingCodes.DECIMAL32; } public Decimal32Type getType() { return Decimal32Type.this; } public void writeValue(final Decimal32 val) { getEncoder().writeRaw(val.getBits()); } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } public Decimal32 readValue() { return new Decimal32(getDecoder().readRawInt()); } } } ././@LongLink0100644 0000000 0000000 00000000147 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/Decimal64Type.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/Decimal64Type.ja0100644 0000000 0000000 00000005215 14303440055 033302 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import org.apache.qpid.proton.amqp.Decimal64; import java.util.Collection; import java.util.Collections; public class Decimal64Type extends AbstractPrimitiveType { private Decimal64Encoding _decimal64Encoder; Decimal64Type(final EncoderImpl encoder, final DecoderImpl decoder) { _decimal64Encoder = new Decimal64Encoding(encoder, decoder); encoder.register(Decimal64.class, this); decoder.register(this); } public Class getTypeClass() { return Decimal64.class; } public Decimal64Encoding getEncoding(final Decimal64 val) { return _decimal64Encoder; } public Decimal64Encoding getCanonicalEncoding() { return _decimal64Encoder; } public Collection getAllEncodings() { return Collections.singleton(_decimal64Encoder); } private class Decimal64Encoding extends FixedSizePrimitiveTypeEncoding { public Decimal64Encoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 8; } @Override public byte getEncodingCode() { return EncodingCodes.DECIMAL64; } public Decimal64Type getType() { return Decimal64Type.this; } public void writeValue(final Decimal64 val) { getEncoder().writeRaw(val.getBits()); } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } public Decimal64 readValue() { return new Decimal64(getDecoder().readRawLong()); } } } ././@LongLink0100644 0000000 0000000 00000000151 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/DecodeException.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/DecodeException.0100644 0000000 0000000 00000002300 14303440055 033447 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; public class DecodeException extends RuntimeException { public DecodeException() { } public DecodeException(String message) { super(message); } public DecodeException(String message, Throwable cause) { super(message, cause); } public DecodeException(Throwable cause) { super(cause); } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/Decoder.java0100644 0000000 0000000 00000010346 14303440055 032625 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.Decimal128; import org.apache.qpid.proton.amqp.Decimal32; import org.apache.qpid.proton.amqp.Decimal64; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedByte; import org.apache.qpid.proton.amqp.UnsignedInteger; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.UnsignedShort; import java.util.Date; import java.util.List; import java.util.Map; import java.util.UUID; public interface Decoder { public static interface ListProcessor { T process(int count, Encoder encoder); } Boolean readBoolean(); Boolean readBoolean(Boolean defaultVal); boolean readBoolean(boolean defaultVal); Byte readByte(); Byte readByte(Byte defaultVal); byte readByte(byte defaultVal); Short readShort(); Short readShort(Short defaultVal); short readShort(short defaultVal); Integer readInteger(); Integer readInteger(Integer defaultVal); int readInteger(int defaultVal); Long readLong(); Long readLong(Long defaultVal); long readLong(long defaultVal); UnsignedByte readUnsignedByte(); UnsignedByte readUnsignedByte(UnsignedByte defaultVal); UnsignedShort readUnsignedShort(); UnsignedShort readUnsignedShort(UnsignedShort defaultVal); UnsignedInteger readUnsignedInteger(); UnsignedInteger readUnsignedInteger(UnsignedInteger defaultVal); UnsignedLong readUnsignedLong(); UnsignedLong readUnsignedLong(UnsignedLong defaultVal); Character readCharacter(); Character readCharacter(Character defaultVal); char readCharacter(char defaultVal); Float readFloat(); Float readFloat(Float defaultVal); float readFloat(float defaultVal); Double readDouble(); Double readDouble(Double defaultVal); double readDouble(double defaultVal); UUID readUUID(); UUID readUUID(UUID defaultValue); Decimal32 readDecimal32(); Decimal32 readDecimal32(Decimal32 defaultValue); Decimal64 readDecimal64(); Decimal64 readDecimal64(Decimal64 defaultValue); Decimal128 readDecimal128(); Decimal128 readDecimal128(Decimal128 defaultValue); Date readTimestamp(); Date readTimestamp(Date defaultValue); Binary readBinary(); Binary readBinary(Binary defaultValue); Symbol readSymbol(); Symbol readSymbol(Symbol defaultValue); String readString(); String readString(String defaultValue); List readList(); void readList(ListProcessor processor); Map readMap(); T[] readArray(Class clazz); Object[] readArray(); boolean[] readBooleanArray(); byte[] readByteArray(); short[] readShortArray(); int[] readIntegerArray(); long[] readLongArray(); float[] readFloatArray(); double[] readDoubleArray(); char[] readCharacterArray(); T[] readMultiple(Class clazz); Object[] readMultiple(); byte[] readByteMultiple(); short[] readShortMultiple(); int[] readIntegerMultiple(); long[] readLongMultiple(); float[] readFloatMultiple(); double[] readDoubleMultiple(); char[] readCharacterMultiple(); Object readObject(); Object readObject(Object defaultValue); void register(final Object descriptor, final DescribedTypeConstructor dtc); void register(final Object descriptor, final FastPathDescribedTypeConstructor dtc); } ././@LongLink0100644 0000000 0000000 00000000145 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/DecoderImpl.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/DecoderImpl.java0100644 0000000 0000000 00000076220 14303440055 033452 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.lang.reflect.Array; import java.nio.ByteBuffer; import java.nio.charset.CharsetDecoder; import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.Decimal128; import org.apache.qpid.proton.amqp.Decimal32; import org.apache.qpid.proton.amqp.Decimal64; import org.apache.qpid.proton.amqp.DescribedType; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedByte; import org.apache.qpid.proton.amqp.UnsignedInteger; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.UnsignedShort; public class DecoderImpl implements ByteBufferDecoder { private ReadableBuffer _buffer; private final CharsetDecoder _charsetDecoder = StandardCharsets.UTF_8.newDecoder(); private final PrimitiveTypeEncoding[] _constructors = new PrimitiveTypeEncoding[256]; private final Map _dynamicTypeConstructors = new HashMap(); private final Map> _fastPathTypeConstructors = new HashMap>(); public DecoderImpl() { } DecoderImpl(final ByteBuffer buffer) { _buffer = new ReadableBuffer.ByteBufferReader(buffer); } public TypeConstructor peekConstructor() { _buffer.mark(); try { return readConstructor(); } finally { _buffer.reset(); } } @SuppressWarnings("rawtypes") public TypeConstructor readConstructor() { return readConstructor(false); } @SuppressWarnings("rawtypes") public TypeConstructor readConstructor(boolean excludeFastPathConstructors) { int code = ((int)readRawByte()) & 0xff; if(code == EncodingCodes.DESCRIBED_TYPE_INDICATOR) { final byte encoding = _buffer.get(_buffer.position()); final Object descriptor; if (EncodingCodes.SMALLULONG == encoding || EncodingCodes.ULONG == encoding) { descriptor = readUnsignedLong(null); } else if (EncodingCodes.SYM8 == encoding || EncodingCodes.SYM32 == encoding) { descriptor = readSymbol(null); } else { descriptor = readObject(); } if (!excludeFastPathConstructors) { TypeConstructor fastPathTypeConstructor = _fastPathTypeConstructors.get(descriptor); if (fastPathTypeConstructor != null) { return fastPathTypeConstructor; } } TypeConstructor nestedEncoding = readConstructor(false); DescribedTypeConstructor dtc = _dynamicTypeConstructors.get(descriptor); if(dtc == null) { dtc = new DescribedTypeConstructor() { @Override public DescribedType newInstance(final Object described) { return new UnknownDescribedType(descriptor, described); } @Override public Class getTypeClass() { return UnknownDescribedType.class; } }; register(descriptor, dtc); } return new DynamicTypeConstructor(dtc, nestedEncoding); } else { return _constructors[code]; } } @Override public void register(final Object descriptor, final FastPathDescribedTypeConstructor btc) { _fastPathTypeConstructors.put(descriptor, btc); } @Override public void register(final Object descriptor, final DescribedTypeConstructor dtc) { // Allow external type constructors to replace the built-in instances. _fastPathTypeConstructors.remove(descriptor); _dynamicTypeConstructors.put(descriptor, dtc); } private ClassCastException unexpectedType(final Object val, Class clazz) { return new ClassCastException("Unexpected type " + val.getClass().getName() + ". Expected " + clazz.getName() +"."); } @Override public Boolean readBoolean() { return readBoolean(null); } @Override public Boolean readBoolean(final Boolean defaultVal) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.BOOLEAN_TRUE: return Boolean.TRUE; case EncodingCodes.BOOLEAN_FALSE: return Boolean.FALSE; case EncodingCodes.BOOLEAN: return readRawByte() == 0 ? Boolean.FALSE : Boolean.TRUE; case EncodingCodes.NULL: return defaultVal; default: throw new DecodeException("Expected Boolean type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public boolean readBoolean(final boolean defaultVal) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.BOOLEAN_TRUE: return true; case EncodingCodes.BOOLEAN_FALSE: return false; case EncodingCodes.BOOLEAN: return readRawByte() != 0; case EncodingCodes.NULL: return defaultVal; default: throw new DecodeException("Expected Boolean type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public Byte readByte() { return readByte(null); } @Override public Byte readByte(final Byte defaultVal) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.BYTE: return (Byte) readRawByte(); case EncodingCodes.NULL: return defaultVal; default: throw new DecodeException("Expected Byte type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public byte readByte(final byte defaultVal) { TypeConstructor constructor = readConstructor(); if(constructor instanceof ByteType.ByteEncoding) { return ((ByteType.ByteEncoding)constructor).readPrimitiveValue(); } else { Object val = constructor.readValue(); if(val == null) { return defaultVal; } else { throw unexpectedType(val, Byte.class); } } } @Override public Short readShort() { return readShort(null); } @Override public Short readShort(final Short defaultVal) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.SHORT: return Short.valueOf(readRawShort()); case EncodingCodes.NULL: return defaultVal; default: throw new DecodeException("Expected Short type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public short readShort(final short defaultVal) { TypeConstructor constructor = readConstructor(); if(constructor instanceof ShortType.ShortEncoding) { return ((ShortType.ShortEncoding)constructor).readPrimitiveValue(); } else { Object val = constructor.readValue(); if(val == null) { return defaultVal; } else { throw unexpectedType(val, Short.class); } } } @Override public Integer readInteger() { return readInteger(null); } @Override public Integer readInteger(final Integer defaultVal) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.SMALLINT: return Integer.valueOf(readRawByte()); case EncodingCodes.INT: return Integer.valueOf(readRawInt()); case EncodingCodes.NULL: return defaultVal; default: throw new DecodeException("Expected Integer type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public int readInteger(final int defaultVal) { TypeConstructor constructor = readConstructor(); if(constructor instanceof IntegerType.IntegerEncoding) { return ((IntegerType.IntegerEncoding)constructor).readPrimitiveValue(); } else { Object val = constructor.readValue(); if(val == null) { return defaultVal; } else { throw unexpectedType(val, Integer.class); } } } @Override public Long readLong() { return readLong(null); } @Override public Long readLong(final Long defaultVal) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.SMALLLONG: return Long.valueOf(readRawByte()); case EncodingCodes.LONG: return Long.valueOf(readRawLong()); case EncodingCodes.NULL: return defaultVal; default: throw new DecodeException("Expected Long type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public long readLong(final long defaultVal) { TypeConstructor constructor = readConstructor(); if(constructor instanceof LongType.LongEncoding) { return ((LongType.LongEncoding)constructor).readPrimitiveValue(); } else { Object val = constructor.readValue(); if(val == null) { return defaultVal; } else { throw unexpectedType(val, Long.class); } } } @Override public UnsignedByte readUnsignedByte() { return readUnsignedByte(null); } @Override public UnsignedByte readUnsignedByte(final UnsignedByte defaultVal) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.UBYTE: return UnsignedByte.valueOf(readRawByte()); case EncodingCodes.NULL: return defaultVal; default: throw new DecodeException("Expected UnsignedByte type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public UnsignedShort readUnsignedShort() { return readUnsignedShort(null); } @Override public UnsignedShort readUnsignedShort(final UnsignedShort defaultVal) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.USHORT: return UnsignedShort.valueOf(readRawShort()); case EncodingCodes.NULL: return defaultVal; default: throw new DecodeException("Expected UnsignedShort type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public UnsignedInteger readUnsignedInteger() { return readUnsignedInteger(null); } @Override public UnsignedInteger readUnsignedInteger(final UnsignedInteger defaultVal) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.UINT0: return UnsignedInteger.ZERO; case EncodingCodes.SMALLUINT: return UnsignedInteger.valueOf(((int) readRawByte()) & 0xff); case EncodingCodes.UINT: return UnsignedInteger.valueOf(readRawInt()); case EncodingCodes.NULL: return defaultVal; default: throw new DecodeException("Expected UnsignedInteger type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public UnsignedLong readUnsignedLong() { return readUnsignedLong(null); } @Override public UnsignedLong readUnsignedLong(final UnsignedLong defaultVal) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.ULONG0: return UnsignedLong.ZERO; case EncodingCodes.SMALLULONG: return UnsignedLong.valueOf(((long) readRawByte())&0xffl); case EncodingCodes.ULONG: return UnsignedLong.valueOf(readRawLong()); case EncodingCodes.NULL: return defaultVal; default: throw new DecodeException("Expected UnsignedLong type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public Character readCharacter() { return readCharacter(null); } @Override public Character readCharacter(final Character defaultVal) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.CHAR: return Character.valueOf((char) (readRawInt() & 0xffff)); case EncodingCodes.NULL: return defaultVal; default: throw new DecodeException("Expected Character type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public char readCharacter(final char defaultVal) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.CHAR: return (char) (readRawInt() & 0xffff); case EncodingCodes.NULL: return defaultVal; default: throw new DecodeException("Expected Character type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public Float readFloat() { return readFloat(null); } @Override public Float readFloat(final Float defaultVal) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.FLOAT: return Float.valueOf(readRawFloat()); case EncodingCodes.NULL: return defaultVal; default: throw new DecodeException("Expected Float type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public float readFloat(final float defaultVal) { TypeConstructor constructor = readConstructor(); if(constructor instanceof FloatType.FloatEncoding) { return ((FloatType.FloatEncoding)constructor).readPrimitiveValue(); } else { Object val = constructor.readValue(); if(val == null) { return defaultVal; } else { throw unexpectedType(val, Float.class); } } } @Override public Double readDouble() { return readDouble(null); } @Override public Double readDouble(final Double defaultVal) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.DOUBLE: return Double.valueOf(readRawDouble()); case EncodingCodes.NULL: return defaultVal; default: throw new DecodeException("Expected Double type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public double readDouble(final double defaultVal) { TypeConstructor constructor = readConstructor(); if(constructor instanceof DoubleType.DoubleEncoding) { return ((DoubleType.DoubleEncoding)constructor).readPrimitiveValue(); } else { Object val = constructor.readValue(); if(val == null) { return defaultVal; } else { throw unexpectedType(val, Double.class); } } } @Override public UUID readUUID() { return readUUID(null); } @Override public UUID readUUID(final UUID defaultVal) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.UUID: return new UUID(readRawLong(), readRawLong()); case EncodingCodes.NULL: return defaultVal; default: throw new DecodeException("Expected UUID type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public Decimal32 readDecimal32() { return readDecimal32(null); } @Override public Decimal32 readDecimal32(final Decimal32 defaultValue) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.DECIMAL32: return (Decimal32) _constructors[EncodingCodes.DECIMAL32 & 0xff].readValue(); case EncodingCodes.NULL: return defaultValue; default: throw new DecodeException("Expected Decimal32 type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public Decimal64 readDecimal64() { return readDecimal64(null); } @Override public Decimal64 readDecimal64(final Decimal64 defaultValue) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.DECIMAL64: return (Decimal64) _constructors[EncodingCodes.DECIMAL64 & 0xff].readValue(); case EncodingCodes.NULL: return defaultValue; default: throw new DecodeException("Expected Decimal64 type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public Decimal128 readDecimal128() { return readDecimal128(null); } @Override public Decimal128 readDecimal128(final Decimal128 defaultValue) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.DECIMAL128: return (Decimal128) _constructors[EncodingCodes.DECIMAL128 & 0xff].readValue(); case EncodingCodes.NULL: return defaultValue; default: throw new DecodeException("Expected Decimal128 type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public Date readTimestamp() { return readTimestamp(null); } @Override public Date readTimestamp(final Date defaultValue) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.TIMESTAMP: return new Date(readRawLong()); case EncodingCodes.NULL: return defaultValue; default: throw new DecodeException("Expected Timestamp type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public Binary readBinary() { return readBinary(null); } @Override public Binary readBinary(final Binary defaultValue) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.VBIN8: return (Binary) _constructors[EncodingCodes.VBIN8 & 0xff].readValue(); case EncodingCodes.VBIN32: return (Binary) _constructors[EncodingCodes.VBIN32 & 0xff].readValue(); case EncodingCodes.NULL: return defaultValue; default: throw new DecodeException("Expected Binary type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public Symbol readSymbol() { return readSymbol(null); } @Override public Symbol readSymbol(final Symbol defaultValue) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.SYM8: return (Symbol) _constructors[EncodingCodes.SYM8 & 0xff].readValue(); case EncodingCodes.SYM32: return (Symbol) _constructors[EncodingCodes.SYM32 & 0xff].readValue(); case EncodingCodes.NULL: return defaultValue; default: throw new DecodeException("Expected Symbol type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public String readString() { return readString(null); } @Override public String readString(final String defaultValue) { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.STR8: return (String) _constructors[EncodingCodes.STR8 & 0xff].readValue(); case EncodingCodes.STR32: return (String) _constructors[EncodingCodes.STR32 & 0xff].readValue(); case EncodingCodes.NULL: return defaultValue; default: throw new DecodeException("Expected String type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override @SuppressWarnings("rawtypes") public List readList() { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.LIST0: return Collections.EMPTY_LIST; case EncodingCodes.LIST8: return (List) _constructors[EncodingCodes.LIST8 & 0xff].readValue(); case EncodingCodes.LIST32: return (List) _constructors[EncodingCodes.LIST32 & 0xff].readValue(); case EncodingCodes.NULL: return null; default: throw new DecodeException("Expected List type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public void readList(final ListProcessor processor) { //TODO. } @Override @SuppressWarnings("rawtypes") public Map readMap() { byte encodingCode = _buffer.get(); switch (encodingCode) { case EncodingCodes.MAP8: return (Map) _constructors[EncodingCodes.MAP8 & 0xff].readValue(); case EncodingCodes.MAP32: return (Map) _constructors[EncodingCodes.MAP32 & 0xff].readValue(); case EncodingCodes.NULL: return null; default: throw new DecodeException("Expected Map type but found encoding: " + EncodingCodes.toString(encodingCode)); } } @Override public T[] readArray(final Class clazz) { return null; //TODO. } @Override public Object[] readArray() { return (Object[]) readConstructor().readValue(); } @Override public boolean[] readBooleanArray() { return (boolean[]) ((ArrayType.ArrayEncoding)readConstructor()).readValueArray(); } @Override public byte[] readByteArray() { return (byte[]) ((ArrayType.ArrayEncoding)readConstructor()).readValueArray(); } @Override public short[] readShortArray() { return (short[]) ((ArrayType.ArrayEncoding)readConstructor()).readValueArray(); } @Override public int[] readIntegerArray() { return (int[]) ((ArrayType.ArrayEncoding)readConstructor()).readValueArray(); } @Override public long[] readLongArray() { return (long[]) ((ArrayType.ArrayEncoding)readConstructor()).readValueArray(); } @Override public float[] readFloatArray() { return (float[]) ((ArrayType.ArrayEncoding)readConstructor()).readValueArray(); } @Override public double[] readDoubleArray() { return (double[]) ((ArrayType.ArrayEncoding)readConstructor()).readValueArray(); } @Override public char[] readCharacterArray() { return (char[]) ((ArrayType.ArrayEncoding)readConstructor()).readValueArray(); } @Override public T[] readMultiple(final Class clazz) { Object val = readObject(); if(val == null) { return null; } else if(val.getClass().isArray()) { if(clazz.isAssignableFrom(val.getClass().getComponentType())) { return (T[]) val; } else { throw unexpectedType(val, Array.newInstance(clazz, 0).getClass()); } } else if(clazz.isAssignableFrom(val.getClass())) { T[] array = (T[]) Array.newInstance(clazz, 1); array[0] = (T) val; return array; } else { throw unexpectedType(val, Array.newInstance(clazz, 0).getClass()); } } @Override public Object[] readMultiple() { Object val = readObject(); if(val == null) { return null; } else if(val.getClass().isArray()) { return (Object[]) val; } else { Object[] array = (Object[]) Array.newInstance(val.getClass(), 1); array[0] = val; return array; } } @Override public byte[] readByteMultiple() { return new byte[0]; //TODO. } @Override public short[] readShortMultiple() { return new short[0]; //TODO. } @Override public int[] readIntegerMultiple() { return new int[0]; //TODO. } @Override public long[] readLongMultiple() { return new long[0]; //TODO. } @Override public float[] readFloatMultiple() { return new float[0]; //TODO. } @Override public double[] readDoubleMultiple() { return new double[0]; //TODO. } @Override public char[] readCharacterMultiple() { return new char[0]; //TODO. } @Override public Object readObject() { boolean arrayType = false; byte code = _buffer.get(_buffer.position()); switch (code) { case EncodingCodes.ARRAY8: case EncodingCodes.ARRAY32: arrayType = true; } TypeConstructor constructor = readConstructor(); if(constructor== null) { throw new DecodeException("Unknown constructor"); } if (arrayType) { return ((ArrayType.ArrayEncoding)constructor).readValueArray(); } else { return constructor.readValue(); } } @Override public Object readObject(final Object defaultValue) { Object val = readObject(); return val == null ? defaultValue : val; } void register(PrimitiveType type) { Collection> encodings = type.getAllEncodings(); for(PrimitiveTypeEncoding encoding : encodings) { _constructors[((int) encoding.getEncodingCode()) & 0xFF ] = encoding; } } byte readRawByte() { return _buffer.get(); } int readRawInt() { return _buffer.getInt(); } long readRawLong() { return _buffer.getLong(); } short readRawShort() { return _buffer.getShort(); } float readRawFloat() { return _buffer.getFloat(); } double readRawDouble() { return _buffer.getDouble(); } void readRaw(final byte[] data, final int offset, final int length) { _buffer.get(data, offset, length); } V readRaw(TypeDecoder decoder, int size) { V decode = decoder.decode(this, _buffer.slice().limit(size)); _buffer.position(_buffer.position()+size); return decode; } @Override public void setByteBuffer(final ByteBuffer buffer) { _buffer = new ReadableBuffer.ByteBufferReader(buffer); } public ByteBuffer getByteBuffer() { return _buffer.byteBuffer(); } public void setBuffer(final ReadableBuffer buffer) { _buffer = buffer; } public ReadableBuffer getBuffer() { return _buffer; } CharsetDecoder getCharsetDecoder() { return _charsetDecoder; } interface TypeDecoder { V decode(DecoderImpl decoder, ReadableBuffer buf); } private static class UnknownDescribedType implements DescribedType { private final Object _descriptor; private final Object _described; public UnknownDescribedType(final Object descriptor, final Object described) { _descriptor = descriptor; _described = described; } @Override public Object getDescriptor() { return _descriptor; } @Override public Object getDescribed() { return _described; } @Override public boolean equals(Object obj) { return obj instanceof DescribedType && _descriptor == null ? ((DescribedType) obj).getDescriptor() == null : _descriptor.equals(((DescribedType) obj).getDescriptor()) && _described == null ? ((DescribedType) obj).getDescribed() == null : _described.equals(((DescribedType) obj).getDescribed()); } } @Override public int getByteBufferRemaining() { return _buffer.remaining(); } } ././@LongLink0100644 0000000 0000000 00000000162 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/DescribedTypeConstructor.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/DescribedTypeCon0100644 0000000 0000000 00000001706 14303440055 033526 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; public interface DescribedTypeConstructor { V newInstance(Object described); Class getTypeClass(); } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/DoubleType.java0100644 0000000 0000000 00000006066 14303440055 033340 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.util.Collection; import java.util.Collections; public class DoubleType extends AbstractPrimitiveType { private DoubleEncoding _doubleEncoding; DoubleType(final EncoderImpl encoder, final DecoderImpl decoder) { _doubleEncoding = new DoubleEncoding(encoder, decoder); encoder.register(Double.class, this); decoder.register(this); } public Class getTypeClass() { return Double.class; } public DoubleEncoding getEncoding(final Double val) { return _doubleEncoding; } public DoubleEncoding getCanonicalEncoding() { return _doubleEncoding; } public Collection getAllEncodings() { return Collections.singleton(_doubleEncoding); } public void write(double d) { _doubleEncoding.write(d); } public class DoubleEncoding extends FixedSizePrimitiveTypeEncoding { public DoubleEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 8; } @Override public byte getEncodingCode() { return EncodingCodes.DOUBLE; } public DoubleType getType() { return DoubleType.this; } public void writeValue(final Double val) { getEncoder().writeRaw(val.doubleValue()); } public void writeValue(final double val) { getEncoder().writeRaw(val); } public void write(final double d) { writeConstructor(); getEncoder().writeRaw(d); } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } public Double readValue() { return readPrimitiveValue(); } public double readPrimitiveValue() { return getDecoder().readRawDouble(); } @Override public boolean encodesJavaPrimitive() { return true; } } } ././@LongLink0100644 0000000 0000000 00000000160 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/DroppingWritableBuffer.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/DroppingWritable0100644 0000000 0000000 00000004611 14303440055 033612 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; public class DroppingWritableBuffer implements WritableBuffer { private int _pos = 0; @Override public boolean hasRemaining() { return true; } @Override public void put(byte b) { _pos += 1; } @Override public void putFloat(float f) { _pos += 4; } @Override public void putDouble(double d) { _pos += 8; } @Override public void put(byte[] src, int offset, int length) { _pos += length; } @Override public void putShort(short s) { _pos += 2; } @Override public void putInt(int i) { _pos += 4; } @Override public void putLong(long l) { _pos += 8; } @Override public int remaining() { return Integer.MAX_VALUE - _pos; } @Override public int position() { return _pos; } @Override public void position(int position) { _pos = position; } @Override public void put(ByteBuffer payload) { _pos += payload.remaining(); payload.position(payload.limit()); } @Override public int limit() { return Integer.MAX_VALUE; } @Override public void put(ReadableBuffer payload) { _pos += payload.remaining(); payload.position(payload.limit()); } @Override public void put(String value) { _pos += value.getBytes(StandardCharsets.UTF_8).length; } } ././@LongLink0100644 0000000 0000000 00000000156 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/DynamicDescribedType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/DynamicDescribed0100644 0000000 0000000 00000011031 14303440055 033521 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import org.apache.qpid.proton.amqp.DescribedType; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; public class DynamicDescribedType implements AMQPType { private final EncoderImpl _encoder; private final Map _encodings = new HashMap(); private final Object _descriptor; public DynamicDescribedType(EncoderImpl encoder, final Object descriptor) { _encoder = encoder; _descriptor = descriptor; } public Class getTypeClass() { return DescribedType.class; } public TypeEncoding getEncoding(final DescribedType val) { TypeEncoding underlyingEncoding = _encoder.getType(val.getDescribed()).getEncoding(val.getDescribed()); TypeEncoding encoding = _encodings.get(underlyingEncoding); if(encoding == null) { encoding = new DynamicDescribedTypeEncoding(underlyingEncoding); _encodings.put(underlyingEncoding, encoding); } return encoding; } public TypeEncoding getCanonicalEncoding() { return null; } public Collection> getAllEncodings() { Collection values = _encodings.values(); Collection unmodifiable = Collections.unmodifiableCollection(values); return (Collection>) unmodifiable; } public void write(final DescribedType val) { TypeEncoding encoding = getEncoding(val); encoding.writeConstructor(); encoding.writeValue(val); } private class DynamicDescribedTypeEncoding implements TypeEncoding { private final TypeEncoding _underlyingEncoding; private final TypeEncoding _descriptorType; private final int _constructorSize; public DynamicDescribedTypeEncoding(final TypeEncoding underlyingEncoding) { _underlyingEncoding = underlyingEncoding; _descriptorType = _encoder.getType(_descriptor).getEncoding(_descriptor); _constructorSize = 1 + _descriptorType.getConstructorSize() + _descriptorType.getValueSize(_descriptor) + _underlyingEncoding.getConstructorSize(); } public AMQPType getType() { return DynamicDescribedType.this; } public void writeConstructor() { _encoder.writeRaw(EncodingCodes.DESCRIBED_TYPE_INDICATOR); _descriptorType.writeConstructor(); _descriptorType.writeValue(_descriptor); _underlyingEncoding.writeConstructor(); } public int getConstructorSize() { return _constructorSize; } public void writeValue(final Object val) { _underlyingEncoding.writeValue(((DescribedType)val).getDescribed()); } public int getValueSize(final Object val) { return _underlyingEncoding.getValueSize(((DescribedType) val).getDescribed()); } public boolean isFixedSizeVal() { return _underlyingEncoding.isFixedSizeVal(); } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()) && (_underlyingEncoding.encodesSuperset(((DynamicDescribedTypeEncoding)encoding) ._underlyingEncoding)); } @Override public boolean encodesJavaPrimitive() { return false; } } } ././@LongLink0100644 0000000 0000000 00000000160 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/DynamicTypeConstructor.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/DynamicTypeConst0100644 0000000 0000000 00000003754 14303440055 033602 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; public class DynamicTypeConstructor implements TypeConstructor { private final DescribedTypeConstructor _describedTypeConstructor; private final TypeConstructor _underlyingEncoding; public DynamicTypeConstructor(final DescribedTypeConstructor dtc, final TypeConstructor underlyingEncoding) { _describedTypeConstructor = dtc; _underlyingEncoding = underlyingEncoding; } public Object readValue() { try { return _describedTypeConstructor.newInstance(_underlyingEncoding.readValue()); } catch (NullPointerException npe) { throw new DecodeException("Unexpected null value - mandatory field not set? ("+npe.getMessage()+")", npe); } catch (ClassCastException cce) { throw new DecodeException("Incorrect type used", cce); } } public boolean encodesJavaPrimitive() { return false; } public void skipValue() { _underlyingEncoding.skipValue(); } public Class getTypeClass() { return _describedTypeConstructor.getTypeClass(); } } ././@LongLink0100644 0000000 0000000 00000000151 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/EncodeException.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/EncodeException.0100644 0000000 0000000 00000002300 14303440055 033461 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; public class EncodeException extends RuntimeException { public EncodeException() { } public EncodeException(String message) { super(message); } public EncodeException(String message, Throwable cause) { super(message, cause); } public EncodeException(Throwable cause) { super(cause); } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/Encoder.java0100644 0000000 0000000 00000005715 14303440055 032643 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.Decimal128; import org.apache.qpid.proton.amqp.Decimal32; import org.apache.qpid.proton.amqp.Decimal64; import org.apache.qpid.proton.amqp.DescribedType; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedByte; import org.apache.qpid.proton.amqp.UnsignedInteger; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.UnsignedShort; import java.util.Date; import java.util.List; import java.util.Map; import java.util.UUID; public interface Encoder { void writeNull(); void writeBoolean(boolean bool); void writeBoolean(Boolean bool); void writeUnsignedByte(UnsignedByte ubyte); void writeUnsignedShort(UnsignedShort ushort); void writeUnsignedInteger(UnsignedInteger ushort); void writeUnsignedLong(UnsignedLong ulong); void writeByte(byte b); void writeByte(Byte b); void writeShort(short s); void writeShort(Short s); void writeInteger(int i); void writeInteger(Integer i); void writeLong(long l); void writeLong(Long l); void writeFloat(float f); void writeFloat(Float f); void writeDouble(double d); void writeDouble(Double d); void writeDecimal32(Decimal32 d); void writeDecimal64(Decimal64 d); void writeDecimal128(Decimal128 d); void writeCharacter(char c); void writeCharacter(Character c); void writeTimestamp(long d); void writeTimestamp(Date d); void writeUUID(UUID uuid); void writeBinary(Binary b); void writeString(String s); void writeSymbol(Symbol s); void writeList(List l); void writeMap(Map m); void writeDescribedType(DescribedType d); void writeArray(boolean[] a); void writeArray(byte[] a); void writeArray(short[] a); void writeArray(int[] a); void writeArray(long[] a); void writeArray(float[] a); void writeArray(double[] a); void writeArray(char[] a); void writeArray(Object[] a); void writeObject(Object o); void register(AMQPType type); AMQPType getType(Object element); } ././@LongLink0100644 0000000 0000000 00000000145 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/EncoderImpl.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/EncoderImpl.java0100644 0000000 0000000 00000047032 14303440055 033463 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.nio.ByteBuffer; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.Decimal128; import org.apache.qpid.proton.amqp.Decimal32; import org.apache.qpid.proton.amqp.Decimal64; import org.apache.qpid.proton.amqp.DescribedType; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedByte; import org.apache.qpid.proton.amqp.UnsignedInteger; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.UnsignedShort; public final class EncoderImpl implements ByteBufferEncoder { private static final byte DESCRIBED_TYPE_OP = (byte)0; private WritableBuffer _buffer; private final DecoderImpl _decoder; private final Map _typeRegistry = new HashMap(); private Map _describedDescriptorRegistry = new HashMap(); private Map _describedTypesClassRegistry = new HashMap(); private final NullType _nullType; private final BooleanType _booleanType; private final ByteType _byteType; private final UnsignedByteType _unsignedByteType; private final ShortType _shortType; private final UnsignedShortType _unsignedShortType; private final IntegerType _integerType; private final UnsignedIntegerType _unsignedIntegerType; private final LongType _longType; private final UnsignedLongType _unsignedLongType; private final BigIntegerType _bigIntegerType; private final CharacterType _characterType; private final FloatType _floatType; private final DoubleType _doubleType; private final TimestampType _timestampType; private final UUIDType _uuidType; private final Decimal32Type _decimal32Type; private final Decimal64Type _decimal64Type; private final Decimal128Type _decimal128Type; private final BinaryType _binaryType; private final SymbolType _symbolType; private final StringType _stringType; private final ListType _listType; private final MapType _mapType; private final ArrayType _arrayType; public EncoderImpl(DecoderImpl decoder) { _decoder = decoder; _nullType = new NullType(this, decoder); _booleanType = new BooleanType(this, decoder); _byteType = new ByteType(this, decoder); _unsignedByteType = new UnsignedByteType(this, decoder); _shortType = new ShortType(this, decoder); _unsignedShortType = new UnsignedShortType(this, decoder); _integerType = new IntegerType(this, decoder); _unsignedIntegerType = new UnsignedIntegerType(this, decoder); _longType = new LongType(this, decoder); _unsignedLongType = new UnsignedLongType(this, decoder); _bigIntegerType = new BigIntegerType(this, decoder); _characterType = new CharacterType(this, decoder); _floatType = new FloatType(this, decoder); _doubleType = new DoubleType(this, decoder); _timestampType = new TimestampType(this, decoder); _uuidType = new UUIDType(this, decoder); _decimal32Type = new Decimal32Type(this, decoder); _decimal64Type = new Decimal64Type(this, decoder); _decimal128Type = new Decimal128Type(this, decoder); _binaryType = new BinaryType(this, decoder); _symbolType = new SymbolType(this, decoder); _stringType = new StringType(this, decoder); _listType = new ListType(this, decoder); _mapType = new MapType(this, decoder); _arrayType = new ArrayType(this, decoder, _booleanType, _byteType, _shortType, _integerType, _longType, _floatType, _doubleType, _characterType); } @Override public void setByteBuffer(final ByteBuffer buf) { _buffer = new WritableBuffer.ByteBufferWrapper(buf); } public void setByteBuffer(final WritableBuffer buf) { _buffer = buf; } public WritableBuffer getBuffer() { return _buffer; } public DecoderImpl getDecoder() { return _decoder; } @Override public AMQPType getType(final Object element) { return getTypeFromClass(element == null ? Void.class : element.getClass(), element); } public AMQPType getTypeFromClass(final Class clazz) { return getTypeFromClass(clazz, null); } private AMQPType getTypeFromClass(final Class clazz, final Object instance) { AMQPType amqpType = _typeRegistry.get(clazz); if(amqpType == null) { amqpType = deduceTypeFromClass(clazz, instance); } return amqpType; } private AMQPType deduceTypeFromClass(final Class clazz, final Object instance) { AMQPType amqpType = null; if(clazz.isArray()) { amqpType = _arrayType; } else { if(List.class.isAssignableFrom(clazz)) { amqpType = _listType; } else if(Map.class.isAssignableFrom(clazz)) { amqpType = _mapType; } else if(DescribedType.class.isAssignableFrom(clazz)) { amqpType = _describedTypesClassRegistry.get(clazz); if(amqpType == null && instance != null) { Object descriptor = ((DescribedType) instance).getDescriptor(); amqpType = _describedDescriptorRegistry.get(descriptor); if(amqpType == null) { amqpType = new DynamicDescribedType(this, descriptor); _describedDescriptorRegistry.put(descriptor, amqpType); } } return amqpType; } } _typeRegistry.put(clazz, amqpType); return amqpType; } @Override public void register(AMQPType type) { register(type.getTypeClass(), type); } void register(Class clazz, AMQPType type) { _typeRegistry.put(clazz, type); } public void registerDescribedType(Class clazz, Object descriptor) { AMQPType type = _describedDescriptorRegistry.get(descriptor); if(type == null) { type = new DynamicDescribedType(this, descriptor); _describedDescriptorRegistry.put(descriptor, type); } _describedTypesClassRegistry.put(clazz, type); } @Override public void writeNull() { _buffer.put(EncodingCodes.NULL); } @Override public void writeBoolean(final boolean bool) { if (bool) { _buffer.put(EncodingCodes.BOOLEAN_TRUE); } else { _buffer.put(EncodingCodes.BOOLEAN_FALSE); } } @Override public void writeBoolean(final Boolean bool) { if(bool == null) { writeNull(); } else if (Boolean.TRUE.equals(bool)) { _buffer.put(EncodingCodes.BOOLEAN_TRUE); } else { _buffer.put(EncodingCodes.BOOLEAN_FALSE); } } @Override public void writeUnsignedByte(final UnsignedByte ubyte) { if(ubyte == null) { writeNull(); } else { _unsignedByteType.fastWrite(this, ubyte); } } @Override public void writeUnsignedShort(final UnsignedShort ushort) { if(ushort == null) { writeNull(); } else { _unsignedShortType.fastWrite(this, ushort); } } @Override public void writeUnsignedInteger(final UnsignedInteger uint) { if(uint == null) { writeNull(); } else { _unsignedIntegerType.fastWrite(this, uint); } } @Override public void writeUnsignedLong(final UnsignedLong ulong) { if(ulong == null) { writeNull(); } else { _unsignedLongType.fastWrite(this, ulong); } } @Override public void writeByte(final byte b) { _byteType.write(b); } @Override public void writeByte(final Byte b) { if(b == null) { writeNull(); } else { writeByte(b.byteValue()); } } @Override public void writeShort(final short s) { _shortType.write(s); } @Override public void writeShort(final Short s) { if(s == null) { writeNull(); } else { writeShort(s.shortValue()); } } @Override public void writeInteger(final int i) { _integerType.write(i); } @Override public void writeInteger(final Integer i) { if(i == null) { writeNull(); } else { writeInteger(i.intValue()); } } @Override public void writeLong(final long l) { _longType.write(l); } @Override public void writeLong(final Long l) { if(l == null) { writeNull(); } else { writeLong(l.longValue()); } } @Override public void writeFloat(final float f) { _floatType.write(f); } @Override public void writeFloat(final Float f) { if(f == null) { writeNull(); } else { writeFloat(f.floatValue()); } } @Override public void writeDouble(final double d) { _doubleType.write(d); } @Override public void writeDouble(final Double d) { if(d == null) { writeNull(); } else { writeDouble(d.doubleValue()); } } @Override public void writeDecimal32(final Decimal32 d) { if(d == null) { writeNull(); } else { _decimal32Type.write(d); } } @Override public void writeDecimal64(final Decimal64 d) { if(d == null) { writeNull(); } else { _decimal64Type.write(d); } } @Override public void writeDecimal128(final Decimal128 d) { if(d == null) { writeNull(); } else { _decimal128Type.write(d); } } @Override public void writeCharacter(final char c) { // TODO - java character may be half of a pair, should probably throw exception then _characterType.write(c); } @Override public void writeCharacter(final Character c) { if(c == null) { writeNull(); } else { writeCharacter(c.charValue()); } } @Override public void writeTimestamp(final long timestamp) { _timestampType.fastWrite(this, timestamp); } @Override public void writeTimestamp(final Date d) { if(d == null) { writeNull(); } else { _timestampType.fastWrite(this, d.getTime()); } } @Override public void writeUUID(final UUID uuid) { if(uuid == null) { writeNull(); } else { _uuidType.fastWrite(this, uuid); } } @Override public void writeBinary(final Binary b) { if(b == null) { writeNull(); } else { _binaryType.fastWrite(this, b); } } @Override public void writeString(final String s) { if(s == null) { writeNull(); } else { _stringType.write(s); } } @Override public void writeSymbol(final Symbol s) { if(s == null) { writeNull(); } else { _symbolType.fastWrite(this, s); } } @Override public void writeList(final List l) { if(l == null) { writeNull(); } else { _listType.write(l); } } @Override public void writeMap(final Map m) { if(m == null) { writeNull(); } else { _mapType.write(m); } } @Override public void writeDescribedType(final DescribedType d) { if(d == null) { writeNull(); } else { _buffer.put(DESCRIBED_TYPE_OP); writeObject(d.getDescriptor()); writeObject(d.getDescribed()); } } @Override public void writeArray(final boolean[] a) { if(a == null) { writeNull(); } else { _arrayType.write(a); } } @Override public void writeArray(final byte[] a) { if(a == null) { writeNull(); } else { _arrayType.write(a); } } @Override public void writeArray(final short[] a) { if(a == null) { writeNull(); } else { _arrayType.write(a); } } @Override public void writeArray(final int[] a) { if(a == null) { writeNull(); } else { _arrayType.write(a); } } @Override public void writeArray(final long[] a) { if(a == null) { writeNull(); } else { _arrayType.write(a); } } @Override public void writeArray(final float[] a) { if(a == null) { writeNull(); } else { _arrayType.write(a); } } @Override public void writeArray(final double[] a) { if(a == null) { writeNull(); } else { _arrayType.write(a); } } @Override public void writeArray(final char[] a) { if(a == null) { writeNull(); } else { _arrayType.write(a); } } @Override public void writeArray(final Object[] a) { if(a == null) { writeNull(); } else { _arrayType.write(a); } } @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void writeObject(final Object o) { if (o != null) { AMQPType type = _typeRegistry.get(o.getClass()); if(type != null) { type.write(o); } else { writeUnregisteredType(o); } } else { _buffer.put(EncodingCodes.NULL); } } private void writeUnregisteredType(final Object o) { if(o.getClass().isArray()) { writeArrayType(o); } else if(o instanceof List) { writeList((List)o); } else if(o instanceof Map) { writeMap((Map)o); } else if(o instanceof DescribedType) { writeDescribedType((DescribedType)o); } else { throw new IllegalArgumentException( "Do not know how to write Objects of class " + o.getClass().getName()); } } private void writeArrayType(Object array) { Class componentType = array.getClass().getComponentType(); if(componentType.isPrimitive()) { if(componentType == Boolean.TYPE) { writeArray((boolean[])array); } else if(componentType == Byte.TYPE) { writeArray((byte[])array); } else if(componentType == Short.TYPE) { writeArray((short[])array); } else if(componentType == Integer.TYPE) { writeArray((int[])array); } else if(componentType == Long.TYPE) { writeArray((long[])array); } else if(componentType == Float.TYPE) { writeArray((float[])array); } else if(componentType == Double.TYPE) { writeArray((double[])array); } else if(componentType == Character.TYPE) { writeArray((char[])array); } else { throw new IllegalArgumentException("Cannot write arrays of type " + componentType.getName()); } } else { writeArray((Object[]) array); } } public void writeRaw(final byte b) { _buffer.put(b); } void writeRaw(final short s) { _buffer.putShort(s); } void writeRaw(final int i) { _buffer.putInt(i); } void writeRaw(final long l) { _buffer.putLong(l); } void writeRaw(final float f) { _buffer.putFloat(f); } void writeRaw(final double d) { _buffer.putDouble(d); } void writeRaw(byte[] src, int offset, int length) { _buffer.put(src, offset, length); } void writeRaw(final String string) { _buffer.put(string); } AMQPType getNullTypeEncoder() { return _nullType; } } ././@LongLink0100644 0000000 0000000 00000000147 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/EncodingCodes.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/EncodingCodes.ja0100644 0000000 0000000 00000014436 14303440055 033441 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; public interface EncodingCodes { public static final byte DESCRIBED_TYPE_INDICATOR = (byte) 0x00; public static final byte NULL = (byte) 0x40; public static final byte BOOLEAN = (byte) 0x56; public static final byte BOOLEAN_TRUE = (byte) 0x41; public static final byte BOOLEAN_FALSE = (byte) 0x42; public static final byte UBYTE = (byte) 0x50; public static final byte USHORT = (byte) 0x60; public static final byte UINT = (byte) 0x70; public static final byte SMALLUINT = (byte) 0x52; public static final byte UINT0 = (byte) 0x43; public static final byte ULONG = (byte) 0x80; public static final byte SMALLULONG = (byte) 0x53; public static final byte ULONG0 = (byte) 0x44; public static final byte BYTE = (byte) 0x51; public static final byte SHORT = (byte) 0x61; public static final byte INT = (byte) 0x71; public static final byte SMALLINT = (byte) 0x54; public static final byte LONG = (byte) 0x81; public static final byte SMALLLONG = (byte) 0x55; public static final byte FLOAT = (byte) 0x72; public static final byte DOUBLE = (byte) 0x82; public static final byte DECIMAL32 = (byte) 0x74; public static final byte DECIMAL64 = (byte) 0x84; public static final byte DECIMAL128 = (byte) 0x94; public static final byte CHAR = (byte) 0x73; public static final byte TIMESTAMP = (byte) 0x83; public static final byte UUID = (byte) 0x98; public static final byte VBIN8 = (byte) 0xa0; public static final byte VBIN32 = (byte) 0xb0; public static final byte STR8 = (byte) 0xa1; public static final byte STR32 = (byte) 0xb1; public static final byte SYM8 = (byte) 0xa3; public static final byte SYM32 = (byte) 0xb3; public static final byte LIST0 = (byte) 0x45; public static final byte LIST8 = (byte) 0xc0; public static final byte LIST32 = (byte) 0xd0; public static final byte MAP8 = (byte) 0xc1; public static final byte MAP32 = (byte) 0xd1; public static final byte ARRAY8 = (byte) 0xe0; public static final byte ARRAY32 = (byte) 0xf0; static String toString(byte encoding) { switch (encoding) { case DESCRIBED_TYPE_INDICATOR: return "DESCRIBED_TYPE_INDICATOR:0x00"; case NULL: return "NULL:0x40"; case BOOLEAN: return "BOOLEAN:0x56"; case BOOLEAN_TRUE: return "BOOLEAN_TRUE:0x41"; case BOOLEAN_FALSE: return "BOOLEAN_FALSE:0x42"; case UBYTE: return "UBYTE:0x50"; case USHORT: return "USHORT:0x60"; case UINT: return "UINT:0x70"; case SMALLUINT: return "SMALLUINT:0x52"; case UINT0: return "UINT0:0x43"; case ULONG: return "ULONG:0x80"; case SMALLULONG: return "SMALLULONG:0x53"; case ULONG0: return "ULONG0:0x44"; case BYTE: return "BYTE:0x51"; case SHORT: return "SHORT:0x61"; case INT: return "INT:0x71"; case SMALLINT: return "SMALLINT:0x54"; case LONG: return "LONG:0x81"; case SMALLLONG: return "SMALLLONG:0x55"; case FLOAT: return "FLOAT:0x72"; case DOUBLE: return "DOUBLE:0x82"; case DECIMAL32: return "DECIMAL32:0x74"; case DECIMAL64: return "DECIMAL64:0x84"; case DECIMAL128: return "DECIMAL128:0x94"; case CHAR: return "CHAR:0x73"; case TIMESTAMP: return "TIMESTAMP:0x83"; case UUID: return "UUID:0x98"; case VBIN8: return "VBIN8:0xa0"; case VBIN32: return "VBIN32:0xb0"; case STR8: return "STR8:0xa1"; case STR32: return "STR32:0xb1"; case SYM8: return "SYM8:0xa3"; case SYM32: return "SYM32:0xb3"; case LIST0: return "LIST0:0x45"; case LIST8: return "LIST8:0xc0"; case LIST32: return "LIST32:0xd0"; case MAP8: return "MAP8:0xc1"; case MAP32: return "MAP32:0xd1"; case ARRAY8: return "ARRAY8:0xe0"; case ARRAY32: return "ARRAY32:0xf0"; default: return "Unknown-Type:" + String.format("0x%02X", encoding); } } } ././@LongLink0100644 0000000 0000000 00000000172 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/FastPathDescribedTypeConstructor.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/FastPathDescribe0100644 0000000 0000000 00000002330 14303440055 033505 0ustar00rootroot0000000 0000000 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.qpid.proton.codec; /** * Marker interface that indicates the TypeConstructor can decode known Proton-J types * using a fast path read / write operation. These types may result in an encode that * does not always write the smallest form of the given type to save time. * * @param The type that this constructor handles */ public interface FastPathDescribedTypeConstructor extends TypeConstructor { } ././@LongLink0100644 0000000 0000000 00000000170 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/FixedSizePrimitiveTypeEncoding.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/FixedSizePrimiti0100644 0000000 0000000 00000002635 14303440055 033572 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; abstract class FixedSizePrimitiveTypeEncoding extends AbstractPrimitiveTypeEncoding { FixedSizePrimitiveTypeEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } public final boolean isFixedSizeVal() { return true; } public final int getValueSize(final T val) { return getFixedSize(); } public final void skipValue() { getDecoder().getBuffer().position(getDecoder().getBuffer().position() + getFixedSize()); } protected abstract int getFixedSize(); } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/FloatType.java0100644 0000000 0000000 00000006026 14303440055 033167 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.util.Collection; import java.util.Collections; public class FloatType extends AbstractPrimitiveType { private FloatEncoding _floatEncoding; FloatType(final EncoderImpl encoder, final DecoderImpl decoder) { _floatEncoding = new FloatEncoding(encoder, decoder); encoder.register(Float.class, this); decoder.register(this); } public Class getTypeClass() { return Float.class; } public FloatEncoding getEncoding(final Float val) { return _floatEncoding; } public FloatEncoding getCanonicalEncoding() { return _floatEncoding; } public Collection getAllEncodings() { return Collections.singleton(_floatEncoding); } public void write(float f) { _floatEncoding.write(f); } public class FloatEncoding extends FixedSizePrimitiveTypeEncoding { public FloatEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 4; } @Override public byte getEncodingCode() { return EncodingCodes.FLOAT; } public FloatType getType() { return FloatType.this; } public void writeValue(final Float val) { getEncoder().writeRaw(val.floatValue()); } public void writeValue(final float val) { getEncoder().writeRaw(val); } public void write(final float f) { writeConstructor(); getEncoder().writeRaw(f); } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } public Float readValue() { return readPrimitiveValue(); } public float readPrimitiveValue() { return getDecoder().readRawFloat(); } @Override public boolean encodesJavaPrimitive() { return true; } } } ././@LongLink0100644 0000000 0000000 00000000173 14303440055 011632 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/FloatingSizePrimitiveTypeEncoding.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/FloatingSizePrim0100644 0000000 0000000 00000003074 14303440055 033566 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; abstract class FloatingSizePrimitiveTypeEncoding extends AbstractPrimitiveTypeEncoding { FloatingSizePrimitiveTypeEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } public final boolean isFixedSizeVal() { return false; } abstract int getSizeBytes(); public void writeValue(final T val) { writeSize(val); writeEncodedValue(val); } protected abstract void writeEncodedValue(final T val); protected abstract void writeSize(final T val); public int getValueSize(final T val) { return getSizeBytes() + getEncodedValueSize(val); } protected abstract int getEncodedValueSize(final T val); } ././@LongLink0100644 0000000 0000000 00000000145 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/IntegerType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/IntegerType.java0100644 0000000 0000000 00000012124 14303440055 033513 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.util.Arrays; import java.util.Collection; public class IntegerType extends AbstractPrimitiveType { public static interface IntegerEncoding extends PrimitiveTypeEncoding { void write(int i); void writeValue(int i); int readPrimitiveValue(); } private IntegerEncoding _integerEncoding; private IntegerEncoding _smallIntegerEncoding; IntegerType(final EncoderImpl encoder, final DecoderImpl decoder) { _integerEncoding = new AllIntegerEncoding(encoder, decoder); _smallIntegerEncoding = new SmallIntegerEncoding(encoder, decoder); encoder.register(Integer.class, this); decoder.register(this); } public Class getTypeClass() { return Integer.class; } public IntegerEncoding getEncoding(final Integer val) { return getEncoding(val.intValue()); } public IntegerEncoding getEncoding(final int i) { return (i >= -128 && i <= 127) ? _smallIntegerEncoding : _integerEncoding; } public IntegerEncoding getCanonicalEncoding() { return _integerEncoding; } public Collection getAllEncodings() { return Arrays.asList(_integerEncoding, _smallIntegerEncoding); } public void write(int i) { if(i >= -128 && i <= 127) { _smallIntegerEncoding.write(i); } else { _integerEncoding.write(i); } } private class AllIntegerEncoding extends FixedSizePrimitiveTypeEncoding implements IntegerEncoding { public AllIntegerEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 4; } @Override public byte getEncodingCode() { return EncodingCodes.INT; } public IntegerType getType() { return IntegerType.this; } public void writeValue(final Integer val) { getEncoder().writeRaw(val.intValue()); } public void write(final int i) { writeConstructor(); getEncoder().writeRaw(i); } public void writeValue(final int i) { getEncoder().writeRaw(i); } public int readPrimitiveValue() { return getDecoder().readRawInt(); } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } public Integer readValue() { return readPrimitiveValue(); } @Override public boolean encodesJavaPrimitive() { return true; } } private class SmallIntegerEncoding extends FixedSizePrimitiveTypeEncoding implements IntegerEncoding { public SmallIntegerEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override public byte getEncodingCode() { return EncodingCodes.SMALLINT; } @Override protected int getFixedSize() { return 1; } public void write(final int i) { writeConstructor(); getEncoder().writeRaw((byte)i); } public void writeValue(final int i) { getEncoder().writeRaw((byte)i); } public int readPrimitiveValue() { return getDecoder().readRawByte(); } public IntegerType getType() { return IntegerType.this; } public void writeValue(final Integer val) { getEncoder().writeRaw((byte)val.intValue()); } public boolean encodesSuperset(final TypeEncoding encoder) { return encoder == this; } public Integer readValue() { return readPrimitiveValue(); } @Override public boolean encodesJavaPrimitive() { return true; } } } ././@LongLink0100644 0000000 0000000 00000000200 14303440055 011621 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/LargeFloatingSizePrimitiveTypeEncoding.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/LargeFloatingSiz0100644 0000000 0000000 00000002421 14303440055 033537 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; abstract class LargeFloatingSizePrimitiveTypeEncoding extends FloatingSizePrimitiveTypeEncoding { LargeFloatingSizePrimitiveTypeEncoding(final EncoderImpl encoder, DecoderImpl decoder) { super(encoder, decoder); } @Override public int getSizeBytes() { return 4; } @Override protected void writeSize(final T val) { getEncoder().writeRaw(getEncodedValueSize(val)); } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/ListType.java0100644 0000000 0000000 00000033074 14303440055 033040 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; public class ListType extends AbstractPrimitiveType { private final ListEncoding _listEncoding; private final ListEncoding _shortListEncoding; private final ListEncoding _zeroListEncoding; private EncoderImpl _encoder; private static interface ListEncoding extends PrimitiveTypeEncoding { void setValue(List value, int length); } ListType(final EncoderImpl encoder, final DecoderImpl decoder) { _encoder = encoder; _listEncoding = new AllListEncoding(encoder, decoder); _shortListEncoding = new ShortListEncoding(encoder, decoder); _zeroListEncoding = new ZeroListEncoding(encoder, decoder); encoder.register(List.class, this); decoder.register(this); } @Override public Class getTypeClass() { return List.class; } @Override public ListEncoding getEncoding(final List val) { int calculatedSize = calculateSize(val, _encoder); ListEncoding encoding = val.isEmpty() ? _zeroListEncoding : (val.size() > 255 || calculatedSize >= 254) ? _listEncoding : _shortListEncoding; encoding.setValue(val, calculatedSize); return encoding; } private static int calculateSize(final List val, EncoderImpl encoder) { int len = 0; final int count = val.size(); for(int i = 0; i < count; i++) { Object element = val.get(i); AMQPType type = encoder.getType(element); if(type == null) { throw new IllegalArgumentException("No encoding defined for type: " + element.getClass()); } TypeEncoding elementEncoding = type.getEncoding(element); len += elementEncoding.getConstructorSize()+elementEncoding.getValueSize(element); } return len; } @Override public ListEncoding getCanonicalEncoding() { return _listEncoding; } @Override public Collection getAllEncodings() { return Arrays.asList(_zeroListEncoding, _shortListEncoding, _listEncoding); } private class AllListEncoding extends LargeFloatingSizePrimitiveTypeEncoding implements ListEncoding { private List _value; private int _length; public AllListEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected void writeEncodedValue(final List val) { getEncoder().getBuffer().ensureRemaining(getSizeBytes() + getEncodedValueSize(val)); getEncoder().writeRaw(val.size()); final int count = val.size(); for(int i = 0; i < count; i++) { Object element = val.get(i); TypeEncoding elementEncoding = getEncoder().getType(element).getEncoding(element); elementEncoding.writeConstructor(); elementEncoding.writeValue(element); } } @Override protected int getEncodedValueSize(final List val) { return 4 + ((val == _value) ? _length : calculateSize(val, getEncoder())); } @Override public byte getEncodingCode() { return EncodingCodes.LIST32; } @Override public ListType getType() { return ListType.this; } @Override public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } @Override public List readValue() { DecoderImpl decoder = getDecoder(); ReadableBuffer buffer = decoder.getBuffer(); int size = decoder.readRawInt(); // todo - limit the decoder with size int count = decoder.readRawInt(); // Ensure we do not allocate an array of size greater then the available data, otherwise there is a risk for an OOM error if (count > decoder.getByteBufferRemaining()) { throw new IllegalArgumentException("List element count "+count+" is specified to be greater than the amount of data available ("+ decoder.getByteBufferRemaining()+")"); } TypeConstructor typeConstructor = null; List list = new ArrayList<>(count); for (int i = 0; i < count; i++) { boolean arrayType = false; byte encodingCode = buffer.get(buffer.position()); switch (encodingCode) { case EncodingCodes.ARRAY8: case EncodingCodes.ARRAY32: arrayType = true; } // Whenever we can just reuse the previously used TypeDecoder instead // of spending time looking up the same one again. if (typeConstructor == null) { typeConstructor = getDecoder().readConstructor(); } else { if (encodingCode == EncodingCodes.DESCRIBED_TYPE_INDICATOR || !(typeConstructor instanceof PrimitiveTypeEncoding)) { typeConstructor = getDecoder().readConstructor(); } else { PrimitiveTypeEncoding primitiveConstructor = (PrimitiveTypeEncoding) typeConstructor; if (encodingCode != primitiveConstructor.getEncodingCode()) { typeConstructor = getDecoder().readConstructor(); } else { // consume the encoding code byte for real encodingCode = buffer.get(); } } } if(typeConstructor == null) { throw new DecodeException("Unknown constructor"); } final Object value; if (arrayType) { value = ((ArrayType.ArrayEncoding) typeConstructor).readValueArray(); } else { value = typeConstructor.readValue(); } list.add(value); } return list; } @Override public void skipValue() { DecoderImpl decoder = getDecoder(); ReadableBuffer buffer = decoder.getBuffer(); int size = decoder.readRawInt(); buffer.position(buffer.position() + size); } @Override public void setValue(final List value, final int length) { _value = value; _length = length; } } private class ShortListEncoding extends SmallFloatingSizePrimitiveTypeEncoding implements ListEncoding { private List _value; private int _length; public ShortListEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected void writeEncodedValue(final List val) { getEncoder().getBuffer().ensureRemaining(getSizeBytes() + getEncodedValueSize(val)); getEncoder().writeRaw((byte)val.size()); final int count = val.size(); for(int i = 0; i < count; i++) { Object element = val.get(i); TypeEncoding elementEncoding = getEncoder().getType(element).getEncoding(element); elementEncoding.writeConstructor(); elementEncoding.writeValue(element); } } @Override protected int getEncodedValueSize(final List val) { return 1 + ((val == _value) ? _length : calculateSize(val, getEncoder())); } @Override public byte getEncodingCode() { return EncodingCodes.LIST8; } @Override public ListType getType() { return ListType.this; } @Override public boolean encodesSuperset(final TypeEncoding encoder) { return encoder == this; } @Override public List readValue() { DecoderImpl decoder = getDecoder(); ReadableBuffer buffer = decoder.getBuffer(); int size = ((int)decoder.readRawByte()) & 0xff; // todo - limit the decoder with size int count = ((int)decoder.readRawByte()) & 0xff; TypeConstructor typeConstructor = null; List list = new ArrayList<>(count); for (int i = 0; i < count; i++) { boolean arrayType = false; byte encodingCode = buffer.get(buffer.position()); switch (encodingCode) { case EncodingCodes.ARRAY8: case EncodingCodes.ARRAY32: arrayType = true; } // Whenever we can just reuse the previously used TypeDecoder instead // of spending time looking up the same one again. if (typeConstructor == null) { typeConstructor = getDecoder().readConstructor(); } else { if (encodingCode == EncodingCodes.DESCRIBED_TYPE_INDICATOR || !(typeConstructor instanceof PrimitiveTypeEncoding)) { typeConstructor = getDecoder().readConstructor(); } else { PrimitiveTypeEncoding primitiveConstructor = (PrimitiveTypeEncoding) typeConstructor; if (encodingCode != primitiveConstructor.getEncodingCode()) { typeConstructor = getDecoder().readConstructor(); } else { // consume the encoding code byte for real encodingCode = buffer.get(); } } } if (typeConstructor == null) { throw new DecodeException("Unknown constructor"); } final Object value; if (arrayType) { value = ((ArrayType.ArrayEncoding) typeConstructor).readValueArray(); } else { value = typeConstructor.readValue(); } list.add(value); } return list; } @Override public void skipValue() { DecoderImpl decoder = getDecoder(); ReadableBuffer buffer = decoder.getBuffer(); int size = ((int)decoder.readRawByte()) & 0xff; buffer.position(buffer.position() + size); } @Override public void setValue(final List value, final int length) { _value = value; _length = length; } } private class ZeroListEncoding extends FixedSizePrimitiveTypeEncoding implements ListEncoding { public ZeroListEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override public byte getEncodingCode() { return EncodingCodes.LIST0; } @Override protected int getFixedSize() { return 0; } @Override public ListType getType() { return ListType.this; } @Override public void setValue(List value, int length) { } @Override public void writeValue(final List val) { } @Override public boolean encodesSuperset(final TypeEncoding encoder) { return encoder == this; } @Override public List readValue() { return Collections.EMPTY_LIST; } } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/LongType.java0100644 0000000 0000000 00000011760 14303440055 033022 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.util.Arrays; import java.util.Collection; public class LongType extends AbstractPrimitiveType { public static interface LongEncoding extends PrimitiveTypeEncoding { void write(long l); void writeValue(long l); public long readPrimitiveValue(); } private LongEncoding _longEncoding; private LongEncoding _smallLongEncoding; LongType(final EncoderImpl encoder, final DecoderImpl decoder) { _longEncoding = new AllLongEncoding(encoder, decoder); _smallLongEncoding = new SmallLongEncoding(encoder, decoder); encoder.register(Long.class, this); decoder.register(this); } public Class getTypeClass() { return Long.class; } public LongEncoding getEncoding(final Long val) { return getEncoding(val.longValue()); } public LongEncoding getEncoding(final long l) { return (l >= -128l && l <= 127l) ? _smallLongEncoding : _longEncoding; } public LongEncoding getCanonicalEncoding() { return _longEncoding; } public Collection getAllEncodings() { return Arrays.asList(_smallLongEncoding, _longEncoding); } public void write(long l) { if(l >= -128l && l <= 127l) { _smallLongEncoding.write(l); } else { _longEncoding.write(l); } } private class AllLongEncoding extends FixedSizePrimitiveTypeEncoding implements LongEncoding { public AllLongEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 8; } @Override public byte getEncodingCode() { return EncodingCodes.LONG; } public LongType getType() { return LongType.this; } public void writeValue(final Long val) { getEncoder().writeRaw(val.longValue()); } public void write(final long l) { writeConstructor(); getEncoder().writeRaw(l); } public void writeValue(final long l) { getEncoder().writeRaw(l); } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } public Long readValue() { return readPrimitiveValue(); } public long readPrimitiveValue() { return getDecoder().readRawLong(); } @Override public boolean encodesJavaPrimitive() { return true; } } private class SmallLongEncoding extends FixedSizePrimitiveTypeEncoding implements LongEncoding { public SmallLongEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override public byte getEncodingCode() { return EncodingCodes.SMALLLONG; } @Override protected int getFixedSize() { return 1; } public void write(final long l) { writeConstructor(); getEncoder().writeRaw((byte)l); } public void writeValue(final long l) { getEncoder().writeRaw((byte)l); } public long readPrimitiveValue() { return (long) getDecoder().readRawByte(); } public LongType getType() { return LongType.this; } public void writeValue(final Long val) { getEncoder().writeRaw((byte)val.longValue()); } public boolean encodesSuperset(final TypeEncoding encoder) { return encoder == this; } public Long readValue() { return readPrimitiveValue(); } @Override public boolean encodesJavaPrimitive() { return true; } } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/MapType.java0100644 0000000 0000000 00000036242 14303440055 032642 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; @SuppressWarnings({ "rawtypes", "unchecked" }) public class MapType extends AbstractPrimitiveType { private final MapEncoding _mapEncoding; private final MapEncoding _shortMapEncoding; private EncoderImpl _encoder; private AMQPType fixedKeyType; private static interface MapEncoding extends PrimitiveTypeEncoding { void setValue(Map value, int length); } MapType(final EncoderImpl encoder, final DecoderImpl decoder) { _encoder = encoder; _mapEncoding = new AllMapEncoding(encoder, decoder); _shortMapEncoding = new ShortMapEncoding(encoder, decoder); encoder.register(Map.class, this); decoder.register(this); } @Override public Class getTypeClass() { return Map.class; } public void setKeyEncoding(AMQPType keyType) { this.fixedKeyType = keyType; } @Override public MapEncoding getEncoding(final Map val) { final int calculatedSize = calculateSize(val); final MapEncoding encoding = (val.size() > 127 || calculatedSize >= 254) ? _mapEncoding : _shortMapEncoding; encoding.setValue(val, calculatedSize); return encoding; } private int calculateSize(final Map map) { int len = 0; final Iterator> iter = map.entrySet().iterator(); final AMQPType fixedKeyType = this.fixedKeyType; // Clear existing fixed key type encoding to prevent application to nested Maps setKeyEncoding(null); try { while (iter.hasNext()) { final Map.Entry element = iter.next(); TypeEncoding elementEncoding; if (fixedKeyType == null) { AMQPType keyType = _encoder.getType(element.getKey()); if(keyType == null) { throw new IllegalArgumentException( "No encoding is known for map entry key of type: " + element.getKey().getClass().getName()); } elementEncoding = keyType.getEncoding(element.getKey()); } else { elementEncoding = fixedKeyType.getEncoding(element.getKey()); } len += elementEncoding.getConstructorSize() + elementEncoding.getValueSize(element.getKey()); AMQPType valueType = _encoder.getType(element.getValue()); if(valueType == null) { throw new IllegalArgumentException( "No encoding is known for map entry value of type: " + element.getValue().getClass().getName()); } elementEncoding = valueType.getEncoding(element.getValue()); len += elementEncoding.getConstructorSize() + elementEncoding.getValueSize(element.getValue()); } } finally { // Reset Existing key type encoding for later encode step or reuse until cleared by caller setKeyEncoding(fixedKeyType); } return len; } private static TypeConstructor findNextDecoder(DecoderImpl decoder, ReadableBuffer buffer, TypeConstructor previousConstructor) { if (previousConstructor == null) { return decoder.readConstructor(); } else { byte encodingCode = buffer.get(buffer.position()); if (encodingCode == EncodingCodes.DESCRIBED_TYPE_INDICATOR || !(previousConstructor instanceof PrimitiveTypeEncoding)) { return decoder.readConstructor(); } else { final PrimitiveTypeEncoding primitiveConstructor = (PrimitiveTypeEncoding) previousConstructor; if (encodingCode != primitiveConstructor.getEncodingCode()) { return decoder.readConstructor(); } else { // consume the encoding code byte for real encodingCode = buffer.get(); } } } return previousConstructor; } @Override public MapEncoding getCanonicalEncoding() { return _mapEncoding; } @Override public Collection getAllEncodings() { return Arrays.asList(_shortMapEncoding, _mapEncoding); } private class AllMapEncoding extends LargeFloatingSizePrimitiveTypeEncoding implements MapEncoding { private Map _value; private int _length; public AllMapEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected void writeEncodedValue(final Map map) { getEncoder().getBuffer().ensureRemaining(getSizeBytes() + getEncodedValueSize(map)); getEncoder().writeRaw(2 * map.size()); final Iterator iter = map.entrySet().iterator(); final AMQPType fixedKeyType = MapType.this.fixedKeyType; // Clear existing fixed key type encoding to prevent application to nested Maps setKeyEncoding(null); try { while (iter.hasNext()) { final Map.Entry element = iter.next(); TypeEncoding elementEncoding; if (fixedKeyType == null) { elementEncoding = _encoder.getType(element.getKey()).getEncoding(element.getKey()); } else { elementEncoding = fixedKeyType.getEncoding(element.getKey()); } elementEncoding.writeConstructor(); elementEncoding.writeValue(element.getKey()); elementEncoding = getEncoder().getType(element.getValue()).getEncoding(element.getValue()); elementEncoding.writeConstructor(); elementEncoding.writeValue(element.getValue()); } } finally { // Reset Existing key type encoding for later encode step or reuse until cleared by caller setKeyEncoding(fixedKeyType); } } @Override protected int getEncodedValueSize(final Map val) { return 4 + ((val == _value) ? _length : calculateSize(val)); } @Override public byte getEncodingCode() { return EncodingCodes.MAP32; } @Override public MapType getType() { return MapType.this; } @Override public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } @Override public Map readValue() { final DecoderImpl decoder = getDecoder(); final ReadableBuffer buffer = decoder.getBuffer(); final int size = decoder.readRawInt(); // todo - limit the decoder with size final int count = decoder.readRawInt(); if (count > decoder.getByteBufferRemaining()) { throw new IllegalArgumentException("Map element count "+count+" is specified to be greater than the amount of data available ("+ decoder.getByteBufferRemaining()+")"); } TypeConstructor keyConstructor = null; TypeConstructor valueConstructor = null; Map map = new LinkedHashMap<>(count); for(int i = 0; i < count / 2; i++) { keyConstructor = findNextDecoder(decoder, buffer, keyConstructor); if(keyConstructor == null) { throw new DecodeException("Unknown constructor"); } final Object key = keyConstructor.readValue(); boolean arrayType = false; final byte code = buffer.get(buffer.position()); switch (code) { case EncodingCodes.ARRAY8: case EncodingCodes.ARRAY32: arrayType = true; } valueConstructor = findNextDecoder(decoder, buffer, valueConstructor); if (valueConstructor == null) { throw new DecodeException("Unknown constructor"); } final Object value; if (arrayType) { value = ((ArrayType.ArrayEncoding) valueConstructor).readValueArray(); } else { value = valueConstructor.readValue(); } map.put(key, value); } return map; } @Override public void skipValue() { final DecoderImpl decoder = getDecoder(); final ReadableBuffer buffer = decoder.getBuffer(); final int size = decoder.readRawInt(); buffer.position(buffer.position() + size); } @Override public void setValue(final Map value, final int length) { _value = value; _length = length; } } private class ShortMapEncoding extends SmallFloatingSizePrimitiveTypeEncoding implements MapEncoding { private Map _value; private int _length; public ShortMapEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected void writeEncodedValue(final Map map) { getEncoder().getBuffer().ensureRemaining(getSizeBytes() + getEncodedValueSize(map)); getEncoder().writeRaw((byte)(2 * map.size())); final Iterator iter = map.entrySet().iterator(); final AMQPType fixedKeyType = MapType.this.fixedKeyType; // Clear existing fixed key type encoding to prevent application to nested Maps setKeyEncoding(null); try { while (iter.hasNext()) { final Map.Entry element = iter.next(); TypeEncoding elementEncoding; if (fixedKeyType == null) { elementEncoding = _encoder.getType(element.getKey()).getEncoding(element.getKey()); } else { elementEncoding = fixedKeyType.getEncoding(element.getKey()); } elementEncoding.writeConstructor(); elementEncoding.writeValue(element.getKey()); elementEncoding = getEncoder().getType(element.getValue()).getEncoding(element.getValue()); elementEncoding.writeConstructor(); elementEncoding.writeValue(element.getValue()); } } finally { // Reset Existing key type encoding for later encode step or reuse until cleared by caller setKeyEncoding(fixedKeyType); } } @Override protected int getEncodedValueSize(final Map val) { return 1 + ((val == _value) ? _length : calculateSize(val)); } @Override public byte getEncodingCode() { return EncodingCodes.MAP8; } @Override public MapType getType() { return MapType.this; } @Override public boolean encodesSuperset(final TypeEncoding encoder) { return encoder == this; } @Override public Map readValue() { final DecoderImpl decoder = getDecoder(); final ReadableBuffer buffer = decoder.getBuffer(); final int size = (decoder.readRawByte()) & 0xff; // todo - limit the decoder with size final int count = (decoder.readRawByte()) & 0xff; TypeConstructor keyConstructor = null; TypeConstructor valueConstructor = null; final Map map = new LinkedHashMap<>(count); for(int i = 0; i < count / 2; i++) { keyConstructor = findNextDecoder(decoder, buffer, keyConstructor); if(keyConstructor == null) { throw new DecodeException("Unknown constructor"); } final Object key = keyConstructor.readValue(); boolean arrayType = false; final byte code = buffer.get(buffer.position()); switch (code) { case EncodingCodes.ARRAY8: case EncodingCodes.ARRAY32: arrayType = true; } valueConstructor = findNextDecoder(decoder, buffer, valueConstructor); if(valueConstructor== null) { throw new DecodeException("Unknown constructor"); } final Object value; if (arrayType) { value = ((ArrayType.ArrayEncoding) valueConstructor).readValueArray(); } else { value = valueConstructor.readValue(); } map.put(key, value); } return map; } @Override public void skipValue() { final DecoderImpl decoder = getDecoder(); final ReadableBuffer buffer = decoder.getBuffer(); final int size = ((int)decoder.readRawByte()) & 0xff; buffer.position(buffer.position() + size); } @Override public void setValue(final Map value, final int length) { _value = value; _length = length; } } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/NullType.java0100644 0000000 0000000 00000005112 14303440055 033027 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.util.Collection; import java.util.Collections; public final class NullType extends AbstractPrimitiveType { private NullEncoding _nullEncoding; NullType(final EncoderImpl encoder, final DecoderImpl decoder) { _nullEncoding = new NullEncoding(encoder, decoder); encoder.register(Void.class, this); decoder.register(this); } public Class getTypeClass() { return Void.class; } public NullEncoding getEncoding(final Void val) { return _nullEncoding; } public NullEncoding getCanonicalEncoding() { return _nullEncoding; } public Collection getAllEncodings() { return Collections.singleton(_nullEncoding); } public void write() { _nullEncoding.write(); } private class NullEncoding extends FixedSizePrimitiveTypeEncoding { public NullEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 0; } @Override public byte getEncodingCode() { return EncodingCodes.NULL; } public NullType getType() { return NullType.this; } public void writeValue(final Void val) { } public void writeValue() { } public boolean encodesSuperset(final TypeEncoding encoding) { return encoding == this; } public Void readValue() { return null; } public void write() { writeConstructor(); } } } ././@LongLink0100644 0000000 0000000 00000000147 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/PrimitiveType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/PrimitiveType.ja0100644 0000000 0000000 00000002136 14303440055 033541 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.util.Collection; public interface PrimitiveType extends AMQPType { PrimitiveTypeEncoding getEncoding(V val); PrimitiveTypeEncoding getCanonicalEncoding(); Collection> getAllEncodings(); } ././@LongLink0100644 0000000 0000000 00000000157 14303440055 011634 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/PrimitiveTypeEncoding.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/PrimitiveTypeEnc0100644 0000000 0000000 00000002051 14303440055 033572 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; public interface PrimitiveTypeEncoding extends TypeEncoding, TypeConstructor { PrimitiveType getType(); byte getEncodingCode(); void writeConstructor(); int getConstructorSize(); } ././@LongLink0100644 0000000 0000000 00000000150 14303440055 011625 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/ReadableBuffer.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/ReadableBuffer.j0100644 0000000 0000000 00000040744 14303440055 033426 0ustar00rootroot0000000 0000000 /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.qpid.proton.codec; import java.nio.BufferUnderflowException; import java.nio.ByteBuffer; import java.nio.InvalidMarkException; import java.nio.ReadOnlyBufferException; import java.nio.charset.CharacterCodingException; import java.nio.charset.CharsetDecoder; import java.nio.charset.StandardCharsets; /** * Interface to abstract a buffer, similar to {@link WritableBuffer} */ public interface ReadableBuffer { /** * Returns the capacity of the backing buffer of this ReadableBuffer * @return the capacity of the backing buffer of this ReadableBuffer */ int capacity(); /** * Returns true if this ReadableBuffer is backed by an array which can be * accessed by the {@link #array()} and {@link #arrayOffset()} methods. * * @return true if the buffer is backed by a primitive array. */ boolean hasArray(); /** * Returns the primitive array that backs this buffer if one exists and the * buffer is not read-only. The caller should have checked the {@link #hasArray()} * method before calling this method. * * @return the array that backs this buffer is available. * * @throws UnsupportedOperationException if this {@link ReadableBuffer} doesn't support array access. * @throws ReadOnlyBufferException if the ReadableBuffer is read-only. */ byte[] array(); /** * Returns the offset into the backing array of the first element in the buffer. The caller * should have checked the {@link #hasArray()} method before calling this method. * * @return the offset into the backing array of the first element in the buffer. * * @throws UnsupportedOperationException if this {@link ReadableBuffer} doesn't support array access. * @throws ReadOnlyBufferException if the ReadableBuffer is read-only. */ int arrayOffset(); /** * Compact the backing storage of this ReadableBuffer, possibly freeing previously-read * portions of pooled data or reducing the number of backing arrays if present. *

* This is an optional operation and care should be taken in its implementation. * * @return a reference to this buffer */ ReadableBuffer reclaimRead(); /** * Reads the byte at the current position and advances the position by 1. * * @return the byte at the current position. * * @throws BufferUnderflowException if the buffer position has reached the limit. */ byte get(); /** * Reads the byte at the given index, the buffer position is not affected. * * @param index * The index in the buffer from which to read the byte. * * @return the byte value stored at the target index. * * @throws IndexOutOfBoundsException if the index is not in range for this buffer. */ byte get(int index); /** * Reads four bytes from the buffer and returns them as an integer value. The * buffer position is advanced by four byes. * * @return and integer value composed of bytes read from the buffer. * * @throws BufferUnderflowException if the buffer position has reached the limit. */ int getInt(); /** * Reads eight bytes from the buffer and returns them as an long value. The * buffer position is advanced by eight byes. * * @return and long value composed of bytes read from the buffer. * * @throws BufferUnderflowException if the buffer position has reached the limit. */ long getLong(); /** * Reads two bytes from the buffer and returns them as an short value. The * buffer position is advanced by two byes. * * @return and short value composed of bytes read from the buffer. * * @throws BufferUnderflowException if the buffer position has reached the limit. */ short getShort(); /** * Reads four bytes from the buffer and returns them as an float value. The * buffer position is advanced by four byes. * * @return and float value composed of bytes read from the buffer. * * @throws BufferUnderflowException if the buffer position has reached the limit. */ float getFloat(); /** * Reads eight bytes from the buffer and returns them as an double value. The * buffer position is advanced by eight byes. * * @return and double value composed of bytes read from the buffer. * * @throws BufferUnderflowException if the buffer position has reached the limit. */ double getDouble(); /** * A bulk read method that copies bytes from this buffer into the target byte array. * * @param target * The byte array to copy bytes read from this buffer. * @param offset * The offset into the given array where the copy starts. * @param length * The number of bytes to copy into the target array. * * @return a reference to this ReadableBuffer instance. * * @throws BufferUnderflowException if the are less readable bytes than the array length. * @throws IndexOutOfBoundsException if the offset or length values are invalid. */ ReadableBuffer get(final byte[] target, final int offset, final int length); /** * A bulk read method that copies bytes from this buffer into the target byte array. * * @param target * The byte array to copy bytes read from this buffer. * * @return a reference to this ReadableBuffer instance. * * @throws BufferUnderflowException if the are less readable bytes than the array length. */ ReadableBuffer get(final byte[] target); /** * Copy data from this buffer to the target buffer starting from the current * position and continuing until either this buffer's remaining bytes are * consumed or the target is full. * * @param target * The WritableBuffer to transfer this buffer's data to. * * @return a reference to this ReadableBuffer instance. */ ReadableBuffer get(WritableBuffer target); /** * Creates a new ReadableBuffer instance that is a view of the readable portion of * this buffer. The position will be set to zero and the limit and the reported capacity * will match the value returned by this buffer's {@link #remaining()} method, the mark * will be undefined. * * @return a new ReadableBuffer that is a view of the readable portion of this buffer. */ ReadableBuffer slice(); /** * Sets the buffer limit to the current position and the position is set to zero, the * mark value reset to undefined. * * @return a reference to this {@link ReadableBuffer}. */ ReadableBuffer flip(); /** * Sets the current read limit of this buffer to the given value. If the buffer mark * value is defined and is larger than the limit the mark will be discarded. If the * position is larger than the new limit it will be reset to the new limit. * * @param limit * The new read limit to set for this buffer. * * @return a reference to this {@link ReadableBuffer}. * * @throws IllegalArgumentException if the limit value is negative or greater than the capacity. */ ReadableBuffer limit(int limit); /** * @return the current value of this buffer's limit. */ int limit(); /** * Sets the current position of this buffer to the given value. If the buffer mark * value is defined and is larger than the newly set position is must be discarded. * * @param position * The new position to set for this buffer. * * @return a reference to this {@link ReadableBuffer}. * * @throws IllegalArgumentException if the position value is negative or greater than the limit. */ ReadableBuffer position(int position); /** * @return the current position from which the next read operation will start. */ int position(); /** * Mark the current position of this buffer which can be returned to after a * read operation by calling {@link #reset()}. * * @return a reference to this {@link ReadableBuffer}. */ ReadableBuffer mark(); /** * Reset the buffer's position to a previously marked value, the mark should remain * set after calling this method. * * @return a reference to this {@link ReadableBuffer}. * * @throws InvalidMarkException if the mark value is undefined. */ ReadableBuffer reset(); /** * Resets the buffer position to zero and clears and previously set mark. * * @return a reference to this {@link ReadableBuffer}. */ ReadableBuffer rewind(); /** * Resets the buffer position to zero and sets the limit to the buffer capacity, * the mark value is discarded if set. * * @return a reference to this {@link ReadableBuffer}. */ ReadableBuffer clear(); /** * @return the remaining number of readable bytes in this buffer. */ int remaining(); /** * @return true if there are readable bytes still remaining in this buffer. */ boolean hasRemaining(); /** * Creates a duplicate {@link ReadableBuffer} to this instance. *

* The duplicated buffer will have the same position, limit and mark as this * buffer. The two buffers share the same backing data. * * @return a duplicate of this {@link ReadableBuffer}. */ ReadableBuffer duplicate(); /** * @return a ByteBuffer view of the current readable portion of this buffer. */ ByteBuffer byteBuffer(); /** * Reads a UTF-8 encoded String from the buffer starting the decode at the * current position and reading until the limit is reached. The position * is advanced to the limit once this method returns. If there is no bytes * remaining in the buffer when this method is called a null is returned. * * @return a string decoded from the remaining bytes in this buffer. * * @throws CharacterCodingException if the encoding is invalid for any reason. */ String readUTF8() throws CharacterCodingException; /** * Decodes a String from the buffer using the provided {@link CharsetDecoder} * starting the decode at the current position and reading until the limit is * reached. The position is advanced to the limit once this method returns. * If there is no bytes remaining in the buffer when this method is called a * null is returned. * * @return a string decoded from the remaining bytes in this buffer. * * @throws CharacterCodingException if the encoding is invalid for any reason. */ String readString(CharsetDecoder decoder) throws CharacterCodingException; final class ByteBufferReader implements ReadableBuffer { private ByteBuffer buffer; public static ByteBufferReader allocate(int size) { ByteBuffer allocated = ByteBuffer.allocate(size); return new ByteBufferReader(allocated); } public static ByteBufferReader wrap(ByteBuffer buffer) { return new ByteBufferReader(buffer); } public static ByteBufferReader wrap(byte[] array) { return new ByteBufferReader(ByteBuffer.wrap(array)); } public ByteBufferReader(ByteBuffer buffer) { this.buffer = buffer; } @Override public int capacity() { return buffer.capacity(); } @Override public byte get() { return buffer.get(); } @Override public byte get(int index) { return buffer.get(index); } @Override public int getInt() { return buffer.getInt(); } @Override public long getLong() { return buffer.getLong(); } @Override public short getShort() { return buffer.getShort(); } @Override public float getFloat() { return buffer.getFloat(); } @Override public double getDouble() { return buffer.getDouble(); } @Override public int limit() { return buffer.limit(); } @Override public ReadableBuffer get(byte[] data, int offset, int length) { buffer.get(data, offset, length); return this; } @Override public ReadableBuffer get(byte[] data) { buffer.get(data); return this; } @Override public ReadableBuffer flip() { buffer.flip(); return this; } @Override public ReadableBuffer position(int position) { buffer.position(position); return this; } @Override public ReadableBuffer slice() { return new ByteBufferReader(buffer.slice()); } @Override public ReadableBuffer limit(int limit) { buffer.limit(limit); return this; } @Override public int remaining() { return buffer.remaining(); } @Override public int position() { return buffer.position(); } @Override public boolean hasRemaining() { return buffer.hasRemaining(); } @Override public ReadableBuffer duplicate() { return new ByteBufferReader(buffer.duplicate()); } @Override public ByteBuffer byteBuffer() { return buffer; } @Override public String readUTF8() { return StandardCharsets.UTF_8.decode(buffer).toString(); } @Override public String readString(CharsetDecoder decoder) throws CharacterCodingException { return decoder.decode(buffer).toString(); } @Override public boolean hasArray() { return buffer.hasArray(); } @Override public byte[] array() { return buffer.array(); } @Override public int arrayOffset() { return buffer.arrayOffset(); } @Override public ReadableBuffer reclaimRead() { // Don't compact ByteBuffer due to the expense of the copy return this; } @Override public ReadableBuffer mark() { buffer.mark(); return this; } @Override public ReadableBuffer reset() { buffer.reset(); return this; } @Override public ReadableBuffer rewind() { buffer.rewind(); return this; } @Override public ReadableBuffer clear() { buffer.clear(); return this; } @Override public ReadableBuffer get(WritableBuffer target) { target.put(buffer); return this; } @Override public String toString() { return buffer.toString(); } @Override public int hashCode() { return buffer.hashCode(); } @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof ReadableBuffer)) { return false; } ReadableBuffer readable = (ReadableBuffer) other; if (this.remaining() != readable.remaining()) { return false; } if (other instanceof CompositeReadableBuffer) { return other.equals(this); } return buffer.equals(readable.byteBuffer()); } } }apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/ShortType.java0100644 0000000 0000000 00000005770 14303440055 033226 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.util.Collection; import java.util.Collections; public class ShortType extends AbstractPrimitiveType { private ShortEncoding _shortEncoding; ShortType(final EncoderImpl encoder, final DecoderImpl decoder) { _shortEncoding = new ShortEncoding(encoder, decoder); encoder.register(Short.class, this); decoder.register(this); } public Class getTypeClass() { return Short.class; } public ShortEncoding getEncoding(final Short val) { return _shortEncoding; } public void write(short s) { _shortEncoding.write(s); } public ShortEncoding getCanonicalEncoding() { return _shortEncoding; } public Collection getAllEncodings() { return Collections.singleton(_shortEncoding); } public class ShortEncoding extends FixedSizePrimitiveTypeEncoding { public ShortEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 2; } @Override public byte getEncodingCode() { return EncodingCodes.SHORT; } public ShortType getType() { return ShortType.this; } public void writeValue(final Short val) { getEncoder().writeRaw(val); } public void writeValue(final short val) { getEncoder().writeRaw(val); } public void write(final short s) { writeConstructor(); getEncoder().writeRaw(s); } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } public Short readValue() { return readPrimitiveValue(); } public short readPrimitiveValue() { return getDecoder().readRawShort(); } @Override public boolean encodesJavaPrimitive() { return true; } } } ././@LongLink0100644 0000000 0000000 00000000200 14303440055 011621 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/SmallFloatingSizePrimitiveTypeEncoding.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/SmallFloatingSiz0100644 0000000 0000000 00000002435 14303440055 033562 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; abstract class SmallFloatingSizePrimitiveTypeEncoding extends FloatingSizePrimitiveTypeEncoding { SmallFloatingSizePrimitiveTypeEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override public int getSizeBytes() { return 1; } @Override protected void writeSize(final T val) { getEncoder().writeRaw((byte)getEncodedValueSize(val)); } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/StringType.java0100644 0000000 0000000 00000017371 14303440055 033375 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.nio.charset.CharacterCodingException; import java.nio.charset.CharsetDecoder; import java.util.Arrays; import java.util.Collection; public class StringType extends AbstractPrimitiveType { private static final DecoderImpl.TypeDecoder _stringCreator = new DecoderImpl.TypeDecoder() { @Override public String decode(DecoderImpl decoder, final ReadableBuffer buffer) { CharsetDecoder charsetDecoder = decoder.getCharsetDecoder(); try { return buffer.readString(charsetDecoder); } catch (CharacterCodingException e) { throw new IllegalArgumentException("Cannot parse String", e); } finally { charsetDecoder.reset(); } } }; public static interface StringEncoding extends PrimitiveTypeEncoding { void setValue(String val, int length); } private final StringEncoding _stringEncoding; private final StringEncoding _shortStringEncoding; StringType(final EncoderImpl encoder, final DecoderImpl decoder) { _stringEncoding = new AllStringEncoding(encoder, decoder); _shortStringEncoding = new ShortStringEncoding(encoder, decoder); encoder.register(String.class, this); decoder.register(this); } @Override public Class getTypeClass() { return String.class; } @Override public StringEncoding getEncoding(final String val) { final int length = calculateUTF8Length(val); StringEncoding encoding = length <= 255 ? _shortStringEncoding : _stringEncoding; encoding.setValue(val, length); return encoding; } static int calculateUTF8Length(final String s) { final int stringLength = s.length(); // ASCII Optimized length case int utf8len = stringLength; int processed = 0; for (; processed < stringLength && s.charAt(processed) < 0x80; processed++) {} if (processed < stringLength) { // Non-ASCII length remainder utf8len = extendedCalculateUTF8Length(s, processed, stringLength, utf8len); } return utf8len; } static int extendedCalculateUTF8Length(final String s, int index, int length, int utf8len) { for (; index < length; index++) { int c = s.charAt(index); if ((c & 0xFF80) != 0) /* U+0080.. */ { utf8len++; if(((c & 0xF800) != 0)) /* U+0800.. */ { utf8len++; // surrogate pairs should always combine to create a code point with a 4 octet representation if ((c & 0xD800) == 0xD800 && c < 0xDC00) { index++; } } } } return utf8len; } @Override public StringEncoding getCanonicalEncoding() { return _stringEncoding; } @Override public Collection getAllEncodings() { return Arrays.asList(_shortStringEncoding, _stringEncoding); } private class AllStringEncoding extends LargeFloatingSizePrimitiveTypeEncoding implements StringEncoding { private String _value; private int _length; public AllStringEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected void writeEncodedValue(final String val) { getEncoder().getBuffer().ensureRemaining(getEncodedValueSize(val)); getEncoder().writeRaw(val); } @Override protected int getEncodedValueSize(final String val) { return (val == _value) ? _length : calculateUTF8Length(val); } @Override public byte getEncodingCode() { return EncodingCodes.STR32; } @Override public StringType getType() { return StringType.this; } @Override public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } @Override public String readValue() { DecoderImpl decoder = getDecoder(); int size = decoder.readRawInt(); return size == 0 ? "" : decoder.readRaw(_stringCreator, size); } @Override public void setValue(final String val, final int length) { _value = val; _length = length; } @Override public void skipValue() { DecoderImpl decoder = getDecoder(); ReadableBuffer buffer = decoder.getBuffer(); int size = decoder.readRawInt(); buffer.position(buffer.position() + size); } } private class ShortStringEncoding extends SmallFloatingSizePrimitiveTypeEncoding implements StringEncoding { private String _value; private int _length; public ShortStringEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected void writeEncodedValue(final String val) { getEncoder().getBuffer().ensureRemaining(getEncodedValueSize(val)); getEncoder().writeRaw(val); } @Override protected int getEncodedValueSize(final String val) { return (val == _value) ? _length : calculateUTF8Length(val); } @Override public byte getEncodingCode() { return EncodingCodes.STR8; } @Override public StringType getType() { return StringType.this; } @Override public boolean encodesSuperset(final TypeEncoding encoder) { return encoder == this; } @Override public String readValue() { DecoderImpl decoder = getDecoder(); int size = ((int)decoder.readRawByte()) & 0xff; return size == 0 ? "" : decoder.readRaw(_stringCreator, size); } @Override public void setValue(final String val, final int length) { _value = val; _length = length; } @Override public void skipValue() { DecoderImpl decoder = getDecoder(); ReadableBuffer buffer = decoder.getBuffer(); int size = ((int)decoder.readRawByte()) & 0xff; buffer.position(buffer.position() + size); } } } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/SymbolType.java0100644 0000000 0000000 00000015367 14303440055 033377 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.nio.charset.Charset; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.Map; import org.apache.qpid.proton.amqp.Symbol; public class SymbolType extends AbstractPrimitiveType { private static final Charset ASCII_CHARSET = Charset.forName("US-ASCII"); private final SymbolEncoding _symbolEncoding; private final SymbolEncoding _shortSymbolEncoding; private final Map _symbolCache = new HashMap(); private DecoderImpl.TypeDecoder _symbolCreator = new DecoderImpl.TypeDecoder() { @Override public Symbol decode(DecoderImpl decoder, ReadableBuffer buffer) { Symbol symbol = _symbolCache.get(buffer); if (symbol == null) { byte[] bytes = new byte[buffer.limit()]; buffer.get(bytes); String str = new String(bytes, ASCII_CHARSET); symbol = Symbol.getSymbol(str); _symbolCache.put(ReadableBuffer.ByteBufferReader.wrap(bytes), symbol); } return symbol; } }; public static interface SymbolEncoding extends PrimitiveTypeEncoding { } SymbolType(final EncoderImpl encoder, final DecoderImpl decoder) { _symbolEncoding = new LongSymbolEncoding(encoder, decoder); _shortSymbolEncoding = new ShortSymbolEncoding(encoder, decoder); encoder.register(Symbol.class, this); decoder.register(this); } @Override public Class getTypeClass() { return Symbol.class; } public void fastWrite(EncoderImpl encoder, Symbol symbol) { if (symbol.length() <= 255) { // Reserve size of body + type encoding and single byte size encoder.getBuffer().ensureRemaining(2 + symbol.length()); encoder.writeRaw(EncodingCodes.SYM8); encoder.writeRaw((byte) symbol.length()); symbol.writeTo(encoder.getBuffer()); } else { // Reserve size of body + type encoding and four byte size encoder.getBuffer().ensureRemaining(5 + symbol.length()); encoder.writeRaw(EncodingCodes.SYM32); encoder.writeRaw(symbol.length()); symbol.writeTo(encoder.getBuffer()); } } @Override public SymbolEncoding getEncoding(final Symbol val) { return val.length() <= 255 ? _shortSymbolEncoding : _symbolEncoding; } @Override public SymbolEncoding getCanonicalEncoding() { return _symbolEncoding; } @Override public Collection getAllEncodings() { return Arrays.asList(_shortSymbolEncoding, _symbolEncoding); } private class LongSymbolEncoding extends LargeFloatingSizePrimitiveTypeEncoding implements SymbolEncoding { public LongSymbolEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected void writeEncodedValue(final Symbol val) { getEncoder().getBuffer().ensureRemaining(getEncodedValueSize(val)); val.writeTo(getEncoder().getBuffer()); } @Override protected int getEncodedValueSize(final Symbol val) { return val.length(); } @Override public byte getEncodingCode() { return EncodingCodes.SYM32; } @Override public SymbolType getType() { return SymbolType.this; } @Override public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } @Override public Symbol readValue() { DecoderImpl decoder = getDecoder(); int size = decoder.readRawInt(); return decoder.readRaw(_symbolCreator, size); } @Override public void skipValue() { DecoderImpl decoder = getDecoder(); ReadableBuffer buffer = decoder.getBuffer(); int size = decoder.readRawInt(); buffer.position(buffer.position() + size); } } private class ShortSymbolEncoding extends SmallFloatingSizePrimitiveTypeEncoding implements SymbolEncoding { public ShortSymbolEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected void writeEncodedValue(final Symbol val) { getEncoder().getBuffer().ensureRemaining(getEncodedValueSize(val)); val.writeTo(getEncoder().getBuffer()); } @Override protected int getEncodedValueSize(final Symbol val) { return val.length(); } @Override public byte getEncodingCode() { return EncodingCodes.SYM8; } @Override public SymbolType getType() { return SymbolType.this; } @Override public boolean encodesSuperset(final TypeEncoding encoder) { return encoder == this; } @Override public Symbol readValue() { DecoderImpl decoder = getDecoder(); int size = ((int)decoder.readRawByte()) & 0xff; return decoder.readRaw(_symbolCreator, size); } @Override public void skipValue() { DecoderImpl decoder = getDecoder(); ReadableBuffer buffer = decoder.getBuffer(); int size = ((int)decoder.readRawByte()) & 0xff; buffer.position(buffer.position() + size); } } } ././@LongLink0100644 0000000 0000000 00000000147 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/TimestampType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/TimestampType.ja0100644 0000000 0000000 00000005677 14303440055 033551 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.util.Collection; import java.util.Collections; import java.util.Date; public class TimestampType extends AbstractPrimitiveType { private TimestampEncoding _timestampEncoding; TimestampType(final EncoderImpl encoder, final DecoderImpl decoder) { _timestampEncoding = new TimestampEncoding(encoder, decoder); encoder.register(Date.class, this); decoder.register(this); } public Class getTypeClass() { return Date.class; } public TimestampEncoding getEncoding(final Date val) { return _timestampEncoding; } public void fastWrite(EncoderImpl encoder, long timestamp) { encoder.writeRaw(EncodingCodes.TIMESTAMP); encoder.writeRaw(timestamp); } public TimestampEncoding getCanonicalEncoding() { return _timestampEncoding; } public Collection getAllEncodings() { return Collections.singleton(_timestampEncoding); } public void write(long l) { _timestampEncoding.write(l); } private class TimestampEncoding extends FixedSizePrimitiveTypeEncoding { public TimestampEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 8; } @Override public byte getEncodingCode() { return EncodingCodes.TIMESTAMP; } public TimestampType getType() { return TimestampType.this; } public void writeValue(final Date val) { getEncoder().writeRaw(val.getTime()); } public void write(final long l) { writeConstructor(); getEncoder().writeRaw(l); } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } public Date readValue() { return new Date(getDecoder().readRawLong()); } } } ././@LongLink0100644 0000000 0000000 00000000151 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/TypeConstructor.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/TypeConstructor.0100644 0000000 0000000 00000001752 14303440055 033606 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; public interface TypeConstructor { V readValue(); void skipValue(); boolean encodesJavaPrimitive(); Class getTypeClass(); } ././@LongLink0100644 0000000 0000000 00000000146 14303440055 011632 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/TypeEncoding.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/TypeEncoding.jav0100644 0000000 0000000 00000002210 14303440055 033476 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; public interface TypeEncoding { AMQPType getType(); void writeConstructor(); int getConstructorSize(); void writeValue(V val); int getValueSize(V val); boolean isFixedSizeVal(); boolean encodesSuperset(TypeEncoding encoder); boolean encodesJavaPrimitive(); } apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/UUIDType.java0100644 0000000 0000000 00000005604 14303440055 032671 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.util.Collection; import java.util.Collections; import java.util.UUID; public class UUIDType extends AbstractPrimitiveType { private UUIDEncoding _uuidEncoding; UUIDType(final EncoderImpl encoder, final DecoderImpl decoder) { _uuidEncoding = new UUIDEncoding(encoder, decoder); encoder.register(UUID.class, this); decoder.register(this); } public Class getTypeClass() { return UUID.class; } public UUIDEncoding getEncoding(final UUID val) { return _uuidEncoding; } public void fastWrite(EncoderImpl encoder, UUID value) { encoder.writeRaw(EncodingCodes.UUID); encoder.writeRaw(value.getMostSignificantBits()); encoder.writeRaw(value.getLeastSignificantBits()); } public UUIDEncoding getCanonicalEncoding() { return _uuidEncoding; } public Collection getAllEncodings() { return Collections.singleton(_uuidEncoding); } private class UUIDEncoding extends FixedSizePrimitiveTypeEncoding { public UUIDEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 16; } @Override public byte getEncodingCode() { return EncodingCodes.UUID; } public UUIDType getType() { return UUIDType.this; } public void writeValue(final UUID val) { getEncoder().writeRaw(val.getMostSignificantBits()); getEncoder().writeRaw(val.getLeastSignificantBits()); } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } public UUID readValue() { long msb = getDecoder().readRawLong(); long lsb = getDecoder().readRawLong(); return new UUID(msb, lsb); } } } ././@LongLink0100644 0000000 0000000 00000000152 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/UnsignedByteType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/UnsignedByteType0100644 0000000 0000000 00000005617 14303440055 033607 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import org.apache.qpid.proton.amqp.UnsignedByte; import java.util.Collection; import java.util.Collections; public class UnsignedByteType extends AbstractPrimitiveType { private UnsignedByteEncoding _unsignedByteEncoding; UnsignedByteType(final EncoderImpl encoder, final DecoderImpl decoder) { _unsignedByteEncoding = new UnsignedByteEncoding(encoder, decoder); encoder.register(UnsignedByte.class, this); decoder.register(this); } public Class getTypeClass() { return UnsignedByte.class; } public UnsignedByteEncoding getEncoding(final UnsignedByte val) { return _unsignedByteEncoding; } public void fastWrite(EncoderImpl encoder, UnsignedByte value) { encoder.writeRaw(EncodingCodes.UBYTE); encoder.writeRaw(value.byteValue()); } public UnsignedByteEncoding getCanonicalEncoding() { return _unsignedByteEncoding; } public Collection getAllEncodings() { return Collections.singleton(_unsignedByteEncoding); } public class UnsignedByteEncoding extends FixedSizePrimitiveTypeEncoding { public UnsignedByteEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 1; } @Override public byte getEncodingCode() { return EncodingCodes.UBYTE; } public UnsignedByteType getType() { return UnsignedByteType.this; } public void writeValue(final UnsignedByte val) { getEncoder().writeRaw(val.byteValue()); } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } public UnsignedByte readValue() { return UnsignedByte.valueOf(getDecoder().readRawByte()); } } } ././@LongLink0100644 0000000 0000000 00000000155 14303440055 011632 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/UnsignedIntegerType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/UnsignedIntegerT0100644 0000000 0000000 00000014272 14303440055 033560 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import org.apache.qpid.proton.amqp.UnsignedInteger; import java.util.Arrays; import java.util.Collection; public class UnsignedIntegerType extends AbstractPrimitiveType { public static interface UnsignedIntegerEncoding extends PrimitiveTypeEncoding { } private UnsignedIntegerEncoding _unsignedIntegerEncoding; private UnsignedIntegerEncoding _smallUnsignedIntegerEncoding; private UnsignedIntegerEncoding _zeroUnsignedIntegerEncoding; UnsignedIntegerType(final EncoderImpl encoder, final DecoderImpl decoder) { _unsignedIntegerEncoding = new AllUnsignedIntegerEncoding(encoder, decoder); _smallUnsignedIntegerEncoding = new SmallUnsignedIntegerEncoding(encoder, decoder); _zeroUnsignedIntegerEncoding = new ZeroUnsignedIntegerEncoding(encoder, decoder); encoder.register(UnsignedInteger.class, this); decoder.register(this); } public Class getTypeClass() { return UnsignedInteger.class; } public UnsignedIntegerEncoding getEncoding(final UnsignedInteger val) { int i = val.intValue(); return i == 0 ? _zeroUnsignedIntegerEncoding : (i >= 0 && i <= 255) ? _smallUnsignedIntegerEncoding : _unsignedIntegerEncoding; } public void fastWrite(EncoderImpl encoder, UnsignedInteger value) { int intValue = value.intValue(); if (intValue == 0) { encoder.writeRaw(EncodingCodes.UINT0); } else if (intValue > 0 && intValue <= 255) { encoder.writeRaw(EncodingCodes.SMALLUINT); encoder.writeRaw((byte)intValue); } else { encoder.writeRaw(EncodingCodes.UINT); encoder.writeRaw(intValue); } } public UnsignedIntegerEncoding getCanonicalEncoding() { return _unsignedIntegerEncoding; } public Collection getAllEncodings() { return Arrays.asList(_unsignedIntegerEncoding, _smallUnsignedIntegerEncoding, _zeroUnsignedIntegerEncoding); } private class AllUnsignedIntegerEncoding extends FixedSizePrimitiveTypeEncoding implements UnsignedIntegerEncoding { public AllUnsignedIntegerEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 4; } @Override public byte getEncodingCode() { return EncodingCodes.UINT; } public UnsignedIntegerType getType() { return UnsignedIntegerType.this; } public void writeValue(final UnsignedInteger val) { getEncoder().writeRaw(val.intValue()); } public void write(final int i) { writeConstructor(); getEncoder().writeRaw(i); } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } public UnsignedInteger readValue() { return UnsignedInteger.valueOf(getDecoder().readRawInt()); } } private class SmallUnsignedIntegerEncoding extends FixedSizePrimitiveTypeEncoding implements UnsignedIntegerEncoding { public SmallUnsignedIntegerEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override public byte getEncodingCode() { return EncodingCodes.SMALLUINT; } @Override protected int getFixedSize() { return 1; } public UnsignedIntegerType getType() { return UnsignedIntegerType.this; } public void writeValue(final UnsignedInteger val) { getEncoder().writeRaw((byte)val.intValue()); } public boolean encodesSuperset(final TypeEncoding encoder) { return encoder == this || encoder instanceof ZeroUnsignedIntegerEncoding; } public UnsignedInteger readValue() { return UnsignedInteger.valueOf(((int)getDecoder().readRawByte()) & 0xff); } } private class ZeroUnsignedIntegerEncoding extends FixedSizePrimitiveTypeEncoding implements UnsignedIntegerEncoding { public ZeroUnsignedIntegerEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override public byte getEncodingCode() { return EncodingCodes.UINT0; } @Override protected int getFixedSize() { return 0; } public UnsignedIntegerType getType() { return UnsignedIntegerType.this; } public void writeValue(final UnsignedInteger val) { } public boolean encodesSuperset(final TypeEncoding encoder) { return encoder == this; } public UnsignedInteger readValue() { return UnsignedInteger.ZERO; } } } ././@LongLink0100644 0000000 0000000 00000000152 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/UnsignedLongType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/UnsignedLongType0100644 0000000 0000000 00000013615 14303440055 033600 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import org.apache.qpid.proton.amqp.UnsignedLong; import java.util.Arrays; import java.util.Collection; public class UnsignedLongType extends AbstractPrimitiveType { public static interface UnsignedLongEncoding extends PrimitiveTypeEncoding { } private UnsignedLongEncoding _unsignedLongEncoding; private UnsignedLongEncoding _smallUnsignedLongEncoding; private UnsignedLongEncoding _zeroUnsignedLongEncoding; UnsignedLongType(final EncoderImpl encoder, final DecoderImpl decoder) { _unsignedLongEncoding = new AllUnsignedLongEncoding(encoder, decoder); _smallUnsignedLongEncoding = new SmallUnsignedLongEncoding(encoder, decoder); _zeroUnsignedLongEncoding = new ZeroUnsignedLongEncoding(encoder, decoder); encoder.register(UnsignedLong.class, this); decoder.register(this); } public Class getTypeClass() { return UnsignedLong.class; } public UnsignedLongEncoding getEncoding(final UnsignedLong val) { long l = val.longValue(); return l == 0L ? _zeroUnsignedLongEncoding : (l >= 0 && l <= 255L) ? _smallUnsignedLongEncoding : _unsignedLongEncoding; } public void fastWrite(EncoderImpl encoder, UnsignedLong value) { long longValue = value.longValue(); if (longValue == 0) { encoder.writeRaw(EncodingCodes.ULONG0); } else if (longValue > 0 && longValue <= 255) { encoder.writeRaw(EncodingCodes.SMALLULONG); encoder.writeRaw((byte)longValue); } else { encoder.writeRaw(EncodingCodes.ULONG); encoder.writeRaw(longValue); } } public UnsignedLongEncoding getCanonicalEncoding() { return _unsignedLongEncoding; } public Collection getAllEncodings() { return Arrays.asList(_zeroUnsignedLongEncoding, _smallUnsignedLongEncoding, _unsignedLongEncoding); } private class AllUnsignedLongEncoding extends FixedSizePrimitiveTypeEncoding implements UnsignedLongEncoding { public AllUnsignedLongEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 8; } @Override public byte getEncodingCode() { return EncodingCodes.ULONG; } public UnsignedLongType getType() { return UnsignedLongType.this; } public void writeValue(final UnsignedLong val) { getEncoder().writeRaw(val.longValue()); } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } public UnsignedLong readValue() { return UnsignedLong.valueOf(getDecoder().readRawLong()); } } private class SmallUnsignedLongEncoding extends FixedSizePrimitiveTypeEncoding implements UnsignedLongEncoding { public SmallUnsignedLongEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override public byte getEncodingCode() { return EncodingCodes.SMALLULONG; } @Override protected int getFixedSize() { return 1; } public UnsignedLongType getType() { return UnsignedLongType.this; } public void writeValue(final UnsignedLong val) { getEncoder().writeRaw((byte)val.longValue()); } public boolean encodesSuperset(final TypeEncoding encoder) { return encoder == this || encoder instanceof ZeroUnsignedLongEncoding; } public UnsignedLong readValue() { return UnsignedLong.valueOf(((long)getDecoder().readRawByte())&0xffl); } } private class ZeroUnsignedLongEncoding extends FixedSizePrimitiveTypeEncoding implements UnsignedLongEncoding { public ZeroUnsignedLongEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override public byte getEncodingCode() { return EncodingCodes.ULONG0; } @Override protected int getFixedSize() { return 0; } public UnsignedLongType getType() { return UnsignedLongType.this; } public void writeValue(final UnsignedLong val) { } public boolean encodesSuperset(final TypeEncoding encoder) { return encoder == this; } public UnsignedLong readValue() { return UnsignedLong.ZERO; } } } ././@LongLink0100644 0000000 0000000 00000000153 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/UnsignedShortType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/UnsignedShortTyp0100644 0000000 0000000 00000005654 14303440055 033637 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import org.apache.qpid.proton.amqp.UnsignedShort; import java.util.Collection; import java.util.Collections; public class UnsignedShortType extends AbstractPrimitiveType { private UnsignedShortEncoding _unsignedShortEncoder; UnsignedShortType(final EncoderImpl encoder, final DecoderImpl decoder) { _unsignedShortEncoder = new UnsignedShortEncoding(encoder, decoder); encoder.register(UnsignedShort.class, this); decoder.register(this); } public Class getTypeClass() { return UnsignedShort.class; } public UnsignedShortEncoding getEncoding(final UnsignedShort val) { return _unsignedShortEncoder; } public void fastWrite(EncoderImpl encoder, UnsignedShort value) { encoder.writeRaw(EncodingCodes.USHORT); encoder.writeRaw(value.shortValue()); } public UnsignedShortEncoding getCanonicalEncoding() { return _unsignedShortEncoder; } public Collection getAllEncodings() { return Collections.singleton(_unsignedShortEncoder); } private class UnsignedShortEncoding extends FixedSizePrimitiveTypeEncoding { public UnsignedShortEncoding(final EncoderImpl encoder, final DecoderImpl decoder) { super(encoder, decoder); } @Override protected int getFixedSize() { return 2; } @Override public byte getEncodingCode() { return EncodingCodes.USHORT; } public UnsignedShortType getType() { return UnsignedShortType.this; } public void writeValue(final UnsignedShort val) { getEncoder().writeRaw(val.shortValue()); } public boolean encodesSuperset(final TypeEncoding encoding) { return (getType() == encoding.getType()); } public UnsignedShort readValue() { return UnsignedShort.valueOf(getDecoder().readRawShort()); } } } ././@LongLink0100644 0000000 0000000 00000000150 14303440055 011625 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/WritableBuffer.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/WritableBuffer.j0100644 0000000 0000000 00000017642 14303440055 033501 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec; import java.nio.BufferOverflowException; import java.nio.ByteBuffer; public interface WritableBuffer { void put(byte b); void putFloat(float f); void putDouble(double d); void put(byte[] src, int offset, int length); void putShort(short s); void putInt(int i); void putLong(long l); boolean hasRemaining(); default void ensureRemaining(int requiredRemaining) { // No-op to allow for drop in updates } int remaining(); int position(); void position(int position); void put(ByteBuffer payload); void put(ReadableBuffer payload); default void put(final String value) { final int length = value.length(); for (int i = 0; i < length; i++) { int c = value.charAt(i); if ((c & 0xFF80) == 0) { // U+0000..U+007F put((byte) c); } else if ((c & 0xF800) == 0) { // U+0080..U+07FF put((byte) (0xC0 | ((c >> 6) & 0x1F))); put((byte) (0x80 | (c & 0x3F))); } else if ((c & 0xD800) != 0xD800 || (c > 0xDBFF)) { // U+0800..U+FFFF - excluding surrogate pairs put((byte) (0xE0 | ((c >> 12) & 0x0F))); put((byte) (0x80 | ((c >> 6) & 0x3F))); put((byte) (0x80 | (c & 0x3F))); } else { int low; if ((++i == length) || ((low = value.charAt(i)) & 0xDC00) != 0xDC00) { throw new IllegalArgumentException("String contains invalid Unicode code points"); } c = 0x010000 + ((c & 0x03FF) << 10) + (low & 0x03FF); put((byte) (0xF0 | ((c >> 18) & 0x07))); put((byte) (0x80 | ((c >> 12) & 0x3F))); put((byte) (0x80 | ((c >> 6) & 0x3F))); put((byte) (0x80 | (c & 0x3F))); } } } int limit(); class ByteBufferWrapper implements WritableBuffer { private final ByteBuffer _buf; public ByteBufferWrapper(ByteBuffer buf) { _buf = buf; } @Override public void put(byte b) { _buf.put(b); } @Override public void putFloat(float f) { _buf.putFloat(f); } @Override public void putDouble(double d) { _buf.putDouble(d); } @Override public void put(byte[] src, int offset, int length) { _buf.put(src, offset, length); } @Override public void putShort(short s) { _buf.putShort(s); } @Override public void putInt(int i) { _buf.putInt(i); } @Override public void putLong(long l) { _buf.putLong(l); } @Override public boolean hasRemaining() { return _buf.hasRemaining(); } @Override public void ensureRemaining(int remaining) { if (remaining < 0) { throw new IllegalArgumentException("Required remaining bytes cannot be negative"); } if (_buf.remaining() < remaining) { IndexOutOfBoundsException cause = new IndexOutOfBoundsException(String.format( "Requested min remaining bytes(%d) exceeds remaining(%d) in underlying ByteBuffer: %s", remaining, _buf.remaining(), _buf)); throw (BufferOverflowException) new BufferOverflowException().initCause(cause); } } @Override public int remaining() { return _buf.remaining(); } @Override public int position() { return _buf.position(); } @Override public void position(int position) { _buf.position(position); } @Override public void put(ByteBuffer src) { _buf.put(src); } @Override public void put(ReadableBuffer src) { src.get(this); } @Override public void put(final String value) { final int length = value.length(); int pos = _buf.position(); for (int i = 0; i < length; i++) { int c = value.charAt(i); try { if ((c & 0xFF80) == 0) { // U+0000..U+007F put(pos++, (byte) c); } else if ((c & 0xF800) == 0) { // U+0080..U+07FF put(pos++, (byte) (0xC0 | ((c >> 6) & 0x1F))); put(pos++, (byte) (0x80 | (c & 0x3F))); } else if ((c & 0xD800) != 0xD800 || (c > 0xDBFF)) { // U+0800..U+FFFF - excluding surrogate pairs put(pos++, (byte) (0xE0 | ((c >> 12) & 0x0F))); put(pos++, (byte) (0x80 | ((c >> 6) & 0x3F))); put(pos++, (byte) (0x80 | (c & 0x3F))); } else { int low; if ((++i == length) || ((low = value.charAt(i)) & 0xDC00) != 0xDC00) { throw new IllegalArgumentException("String contains invalid Unicode code points"); } c = 0x010000 + ((c & 0x03FF) << 10) + (low & 0x03FF); put(pos++, (byte) (0xF0 | ((c >> 18) & 0x07))); put(pos++, (byte) (0x80 | ((c >> 12) & 0x3F))); put(pos++, (byte) (0x80 | ((c >> 6) & 0x3F))); put(pos++, (byte) (0x80 | (c & 0x3F))); } } catch(IndexOutOfBoundsException ioobe) { throw new BufferOverflowException(); } } // Now move the buffer position to reflect the work done here _buf.position(pos); } @Override public int limit() { return _buf.limit(); } public ByteBuffer byteBuffer() { return _buf; } public ReadableBuffer toReadableBuffer() { return ReadableBuffer.ByteBufferReader.wrap((ByteBuffer) _buf.duplicate().flip()); } @Override public String toString() { return String.format("[pos: %d, limit: %d, remaining:%d]", _buf.position(), _buf.limit(), _buf.remaining()); } public static ByteBufferWrapper allocate(int size) { ByteBuffer allocated = ByteBuffer.allocate(size); return new ByteBufferWrapper(allocated); } public static ByteBufferWrapper wrap(ByteBuffer buffer) { return new ByteBufferWrapper(buffer); } public static ByteBufferWrapper wrap(byte[] bytes) { return new ByteBufferWrapper(ByteBuffer.wrap(bytes)); } private void put(int index, byte value) { if (_buf.hasArray()) { _buf.array()[_buf.arrayOffset() + index] = value; } else { _buf.put(index, value); } } } } ././@LongLink0100644 0000000 0000000 00000000156 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/AbstractElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/AbstractEle0100644 0000000 0000000 00000006542 14303440055 033475 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; abstract class AbstractElement implements Element { private Element _parent; private Element _next; private Element _prev; AbstractElement(Element parent, Element prev) { _parent = parent; _prev = prev; } protected boolean isElementOfArray() { return _parent instanceof ArrayElement && !(((ArrayElement)parent()).isDescribed() && this == _parent.child()); } @Override public Element next() { // TODO return _next; } @Override public Element prev() { // TODO return _prev; } @Override public Element parent() { // TODO return _parent; } @Override public void setNext(Element elt) { _next = elt; } @Override public void setPrev(Element elt) { _prev = elt; } @Override public void setParent(Element elt) { _parent = elt; } @Override public Element replaceWith(Element elt) { if (_parent != null) { elt = _parent.checkChild(elt); } elt.setPrev(_prev); elt.setNext(_next); elt.setParent(_parent); if (_prev != null) { _prev.setNext(elt); } if (_next != null) { _next.setPrev(elt); } if (_parent != null && _parent.child() == this) { _parent.setChild(elt); } return elt; } @Override public String toString() { return String.format("%s[%h]{parent=%h, prev=%h, next=%h}", this.getClass().getSimpleName(), System.identityHashCode(this), System.identityHashCode(_parent), System.identityHashCode(_prev), System.identityHashCode(_next)); } abstract String startSymbol(); abstract String stopSymbol(); @Override public void render(StringBuilder sb) { if (canEnter()) { sb.append(startSymbol()); Element el = child(); boolean first = true; while (el != null) { if (first) { first = false; } else { sb.append(", "); } el.render(sb); el = el.next(); } sb.append(stopSymbol()); } else { sb.append(getDataType()).append(" ").append(getValue()); } } } ././@LongLink0100644 0000000 0000000 00000000153 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ArrayElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ArrayElemen0100644 0000000 0000000 00000032342 14303440055 033505 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import org.apache.qpid.proton.amqp.DescribedType; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.codec.Data; class ArrayElement extends AbstractElement { private final boolean _described; private final Data.DataType _arrayType; private ConstructorType _constructorType; private Element _first; static enum ConstructorType { TINY, SMALL, LARGE } static ConstructorType TINY = ConstructorType.TINY; static ConstructorType SMALL = ConstructorType.SMALL; static ConstructorType LARGE = ConstructorType.LARGE; ArrayElement(Element parent, Element prev, boolean described, Data.DataType type) { super(parent, prev); _described = described; _arrayType = type; if(_arrayType == null) { throw new NullPointerException("Array type cannot be null"); } else if(_arrayType == Data.DataType.DESCRIBED) { throw new IllegalArgumentException("Array type cannot be DESCRIBED"); } switch(_arrayType) { case UINT: case ULONG: case LIST: setConstructorType(TINY); break; default: setConstructorType(SMALL); } } ConstructorType constructorType() { return _constructorType; } void setConstructorType(ConstructorType type) { _constructorType = type; } @Override public int size() { ConstructorType oldConstructorType; int bodySize; int count = 0; do { bodySize = 1; // data type constructor oldConstructorType = _constructorType; Element element = _first; while(element != null) { count++; bodySize += element.size(); element = element.next(); } } while (oldConstructorType != constructorType()); if(isDescribed()) { bodySize++; // 00 instruction if(count != 0) { count--; } } if(isElementOfArray()) { ArrayElement parent = (ArrayElement)parent(); if(parent.constructorType()==SMALL) { if(count<=255 && bodySize<=254) { bodySize+=2; } else { parent.setConstructorType(LARGE); bodySize+=8; } } else { bodySize+=8; } } else { if(count<=255 && bodySize<=254) { bodySize+=3; } else { bodySize+=9; } } return bodySize; } @Override public Object[] getValue() { if(isDescribed()) { DescribedType[] rVal = new DescribedType[(int) count()]; Object descriptor = _first == null ? null : _first.getValue(); Element element = _first == null ? null : _first.next(); int i = 0; while(element != null) { rVal[i++] = new DescribedTypeImpl(descriptor, element.getValue()); element = element.next(); } return rVal; } else if(_arrayType == Data.DataType.SYMBOL) { Symbol[] rVal = new Symbol[(int) count()]; SymbolElement element = (SymbolElement) _first; int i = 0; while (element!=null) { rVal[i++] = element.getValue(); element = (SymbolElement) element.next(); } return rVal; } else { Object[] rVal = new Object[(int) count()]; Element element = _first; int i = 0; while (element!=null) { rVal[i++] = element.getValue(); element = element.next(); } return rVal; } } @Override public Data.DataType getDataType() { return Data.DataType.ARRAY; } @Override public int encode(ByteBuffer b) { int size = size(); final int count = (int) count(); if(b.remaining()>=size) { if(!isElementOfArray()) { if(size>257 || count >255) { b.put((byte)0xf0); b.putInt(size-5); b.putInt(count); } else { b.put((byte)0xe0); b.put((byte)(size-2)); b.put((byte)count); } } else { ArrayElement parent = (ArrayElement)parent(); if(parent.constructorType()==SMALL) { b.put((byte)(size-1)); b.put((byte)count); } else { b.putInt(size-4); b.putInt(count); } } Element element = _first; if(isDescribed()) { b.put((byte)0); if(element == null) { b.put((byte)0x40); } else { element.encode(b); element = element.next(); } } switch(_arrayType) { case NULL: b.put((byte)0x40); break; case BOOL: b.put((byte)0x56); break; case UBYTE: b.put((byte)0x50); break; case BYTE: b.put((byte)0x51); break; case USHORT: b.put((byte)0x60); break; case SHORT: b.put((byte)0x61); break; case UINT: switch (constructorType()) { case TINY: b.put((byte)0x43); break; case SMALL: b.put((byte)0x52); break; case LARGE: b.put((byte)0x70); break; } break; case INT: b.put(_constructorType == SMALL ? (byte)0x54 : (byte)0x71); break; case CHAR: b.put((byte)0x73); break; case ULONG: switch (constructorType()) { case TINY: b.put((byte)0x44); break; case SMALL: b.put((byte)0x53); break; case LARGE: b.put((byte)0x80); break; } break; case LONG: b.put(_constructorType == SMALL ? (byte)0x55 : (byte)0x81); break; case TIMESTAMP: b.put((byte)0x83); break; case FLOAT: b.put((byte)0x72); break; case DOUBLE: b.put((byte)0x82); break; case DECIMAL32: b.put((byte)0x74); break; case DECIMAL64: b.put((byte)0x84); break; case DECIMAL128: b.put((byte)0x94); break; case UUID: b.put((byte)0x98); break; case BINARY: b.put(_constructorType == SMALL ? (byte)0xa0 : (byte)0xb0); break; case STRING: b.put(_constructorType == SMALL ? (byte)0xa1 : (byte)0xb1); break; case SYMBOL: b.put(_constructorType == SMALL ? (byte)0xa3 : (byte)0xb3); break; case ARRAY: b.put(_constructorType == SMALL ? (byte)0xe0 : (byte)0xf0); break; case LIST: b.put(_constructorType == TINY ? (byte)0x45 :_constructorType == SMALL ? (byte)0xc0 : (byte)0xd0); break; case MAP: b.put(_constructorType == SMALL ? (byte)0xc1 : (byte)0xd1); break; } while(element!=null) { element.encode(b); element = element.next(); } return size; } else { return 0; } } @Override public boolean canEnter() { return true; } @Override public Element child() { return _first; } @Override public void setChild(Element elt) { _first = elt; } @Override public Element addChild(Element element) { if(isDescribed() || element.getDataType() == _arrayType) { _first = element; return element; } else { Element replacement = coerce(element); if(replacement != null) { _first = replacement; return replacement; } throw new IllegalArgumentException("Attempting to add instance of " + element.getDataType() + " to array of " + _arrayType); } } private Element coerce(Element element) { switch (_arrayType) { case INT: int i; switch (element.getDataType()) { case BYTE: i = ((ByteElement)element).getValue().intValue(); break; case SHORT: i = ((ShortElement)element).getValue().intValue(); break; case LONG: i = ((LongElement)element).getValue().intValue(); break; default: return null; } return new IntegerElement(element.parent(),element.prev(),i); case LONG: long l; switch (element.getDataType()) { case BYTE: l = ((ByteElement)element).getValue().longValue(); break; case SHORT: l = ((ShortElement)element).getValue().longValue(); break; case INT: l = ((IntegerElement)element).getValue().longValue(); break; default: return null; } return new LongElement(element.parent(),element.prev(),l); } return null; } @Override public Element checkChild(Element element) { if(element.getDataType() != _arrayType) { Element replacement = coerce(element); if(replacement != null) { return replacement; } throw new IllegalArgumentException("Attempting to add instance of " + element.getDataType() + " to array of " + _arrayType); } return element; } public long count() { int count = 0; Element elt = _first; while(elt != null) { count++; elt = elt.next(); } if(isDescribed() && count != 0) { count--; } return count; } public boolean isDescribed() { return _described; } public Data.DataType getArrayDataType() { return _arrayType; } @Override String startSymbol() { return String.format("%s%s[", isDescribed() ? "D" : "", getArrayDataType()); } @Override String stopSymbol() { return "]"; } } ././@LongLink0100644 0000000 0000000 00000000154 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/AtomicElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/AtomicEleme0100644 0000000 0000000 00000003337 14303440055 033467 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; abstract class AtomicElement extends AbstractElement { AtomicElement(Element parent, Element prev) { super(parent, prev); } @Override public Element child() { throw new UnsupportedOperationException(); } @Override public void setChild(Element elt) { throw new UnsupportedOperationException(); } @Override public boolean canEnter() { return false; } @Override public Element checkChild(Element element) { throw new UnsupportedOperationException(); } @Override public Element addChild(Element element) { throw new UnsupportedOperationException(); } @Override String startSymbol() { throw new UnsupportedOperationException(); } @Override String stopSymbol() { throw new UnsupportedOperationException(); } } ././@LongLink0100644 0000000 0000000 00000000154 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/BinaryElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/BinaryEleme0100644 0000000 0000000 00000006215 14303440055 033475 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.codec.Data; class BinaryElement extends AtomicElement { private final Binary _value; BinaryElement(Element parent, Element prev, Binary b) { super(parent, prev); byte[] data = new byte[b.getLength()]; System.arraycopy(b.getArray(),b.getArrayOffset(),data,0,b.getLength()); _value = new Binary(data); } @Override public int size() { final int length = _value.getLength(); if(isElementOfArray()) { final ArrayElement parent = (ArrayElement) parent(); if(parent.constructorType() == ArrayElement.SMALL) { if(length > 255) { parent.setConstructorType(ArrayElement.LARGE); return 4+length; } else { return 1+length; } } else { return 4+length; } } else { if(length >255) { return 5 + length; } else { return 2 + length; } } } @Override public Binary getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.BINARY; } @Override public int encode(ByteBuffer b) { int size = size(); if(b.remaining() { private final boolean _value; public BooleanElement(Element parent, Element current, boolean b) { super(parent, current); _value = b; } @Override public int size() { // in non-array parent then there is a single byte encoding, in an array there is a 1-byte encoding but no // constructor return 1; } @Override public Boolean getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.BOOL; } @Override public int encode(ByteBuffer b) { if(b.hasRemaining()) { if(isElementOfArray()) { b.put(_value ? (byte) 1 : (byte) 0); } else { b.put(_value ? (byte) 0x41 : (byte) 0x42); } return 1; } return 0; } } ././@LongLink0100644 0000000 0000000 00000000152 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ByteElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ByteElement0100644 0000000 0000000 00000003453 14303440055 033517 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import org.apache.qpid.proton.codec.Data; class ByteElement extends AtomicElement { private final byte _value; ByteElement(Element parent, Element prev, byte b) { super(parent, prev); _value = b; } @Override public int size() { return isElementOfArray() ? 1 : 2; } @Override public Byte getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.BYTE; } @Override public int encode(ByteBuffer b) { if(isElementOfArray()) { if(b.hasRemaining()) { b.put(_value); return 1; } } else { if(b.remaining()>=2) { b.put((byte)0x51); b.put(_value); return 2; } } return 0; } } ././@LongLink0100644 0000000 0000000 00000000152 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/CharElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/CharElement0100644 0000000 0000000 00000003232 14303440055 033464 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import org.apache.qpid.proton.codec.Data; class CharElement extends AtomicElement { private final int _value; CharElement(Element parent, Element prev, int i) { super(parent, prev); _value = i; } @Override public int size() { return isElementOfArray() ? 4 : 5; } @Override public Integer getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.CHAR; } @Override public int encode(ByteBuffer b) { final int size = size(); if(size <= b.remaining()) { if(size == 5) { b.put((byte)0x73); } b.putInt(_value); } return 0; } } ././@LongLink0100644 0000000 0000000 00000000152 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/DataDecoder.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/DataDecoder0100644 0000000 0000000 00000061724 14303440055 033446 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.util.Date; import java.util.UUID; import org.apache.qpid.proton.amqp.*; import org.apache.qpid.proton.codec.Data; class DataDecoder { private static final Charset ASCII = Charset.forName("US-ASCII"); private static final Charset UTF_8 = Charset.forName("UTF-8"); private static final TypeConstructor[] _constructors = new TypeConstructor[256]; static { _constructors[0x00] = new DescribedTypeConstructor(); _constructors[0x40] = new NullConstructor(); _constructors[0x41] = new TrueConstructor(); _constructors[0x42] = new FalseConstructor(); _constructors[0x43] = new UInt0Constructor(); _constructors[0x44] = new ULong0Constructor(); _constructors[0x45] = new EmptyListConstructor(); _constructors[0x50] = new UByteConstructor(); _constructors[0x51] = new ByteConstructor(); _constructors[0x52] = new SmallUIntConstructor(); _constructors[0x53] = new SmallULongConstructor(); _constructors[0x54] = new SmallIntConstructor(); _constructors[0x55] = new SmallLongConstructor(); _constructors[0x56] = new BooleanConstructor(); _constructors[0x60] = new UShortConstructor(); _constructors[0x61] = new ShortConstructor(); _constructors[0x70] = new UIntConstructor(); _constructors[0x71] = new IntConstructor(); _constructors[0x72] = new FloatConstructor(); _constructors[0x73] = new CharConstructor(); _constructors[0x74] = new Decimal32Constructor(); _constructors[0x80] = new ULongConstructor(); _constructors[0x81] = new LongConstructor(); _constructors[0x82] = new DoubleConstructor(); _constructors[0x83] = new TimestampConstructor(); _constructors[0x84] = new Decimal64Constructor(); _constructors[0x94] = new Decimal128Constructor(); _constructors[0x98] = new UUIDConstructor(); _constructors[0xa0] = new SmallBinaryConstructor(); _constructors[0xa1] = new SmallStringConstructor(); _constructors[0xa3] = new SmallSymbolConstructor(); _constructors[0xb0] = new BinaryConstructor(); _constructors[0xb1] = new StringConstructor(); _constructors[0xb3] = new SymbolConstructor(); _constructors[0xc0] = new SmallListConstructor(); _constructors[0xc1] = new SmallMapConstructor(); _constructors[0xd0] = new ListConstructor(); _constructors[0xd1] = new MapConstructor(); _constructors[0xe0] = new SmallArrayConstructor(); _constructors[0xf0] = new ArrayConstructor(); } private interface TypeConstructor { Data.DataType getType(); int size(ByteBuffer b); void parse(ByteBuffer b, Data data); } static int decode(ByteBuffer b, Data data) { if(b.hasRemaining()) { int position = b.position(); TypeConstructor c = readConstructor(b); final int size = c.size(b); if(b.remaining() >= size) { c.parse(b, data); return 1+size; } else { b.position(position); return -4; } } return 0; } private static TypeConstructor readConstructor(ByteBuffer b) { int index = b.get() & 0xff; TypeConstructor tc = _constructors[index]; if(tc == null) { throw new IllegalArgumentException("No constructor for type " + index); } return tc; } private static class NullConstructor implements TypeConstructor { @Override public Data.DataType getType() { return Data.DataType.NULL; } @Override public int size(ByteBuffer b) { return 0; } @Override public void parse(ByteBuffer b, Data data) { data.putNull(); } } private static class TrueConstructor implements TypeConstructor { @Override public Data.DataType getType() { return Data.DataType.BOOL; } @Override public int size(ByteBuffer b) { return 0; } @Override public void parse(ByteBuffer b, Data data) { data.putBoolean(true); } } private static class FalseConstructor implements TypeConstructor { @Override public Data.DataType getType() { return Data.DataType.BOOL; } @Override public int size(ByteBuffer b) { return 0; } @Override public void parse(ByteBuffer b, Data data) { data.putBoolean(false); } } private static class UInt0Constructor implements TypeConstructor { @Override public Data.DataType getType() { return Data.DataType.UINT; } @Override public int size(ByteBuffer b) { return 0; } @Override public void parse(ByteBuffer b, Data data) { data.putUnsignedInteger(UnsignedInteger.ZERO); } } private static class ULong0Constructor implements TypeConstructor { @Override public Data.DataType getType() { return Data.DataType.ULONG; } @Override public int size(ByteBuffer b) { return 0; } @Override public void parse(ByteBuffer b, Data data) { data.putUnsignedLong(UnsignedLong.ZERO); } } private static class EmptyListConstructor implements TypeConstructor { @Override public Data.DataType getType() { return Data.DataType.LIST; } @Override public int size(ByteBuffer b) { return 0; } @Override public void parse(ByteBuffer b, Data data) { data.putList(); } } private static abstract class Fixed0SizeConstructor implements TypeConstructor { @Override public final int size(ByteBuffer b) { return 0; } } private static abstract class Fixed1SizeConstructor implements TypeConstructor { @Override public int size(ByteBuffer b) { return 1; } } private static abstract class Fixed2SizeConstructor implements TypeConstructor { @Override public int size(ByteBuffer b) { return 2; } } private static abstract class Fixed4SizeConstructor implements TypeConstructor { @Override public int size(ByteBuffer b) { return 4; } } private static abstract class Fixed8SizeConstructor implements TypeConstructor { @Override public int size(ByteBuffer b) { return 8; } } private static abstract class Fixed16SizeConstructor implements TypeConstructor { @Override public int size(ByteBuffer b) { return 16; } } private static class UByteConstructor extends Fixed1SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.UBYTE; } @Override public void parse(ByteBuffer b, Data data) { data.putUnsignedByte(UnsignedByte.valueOf(b.get())); } } private static class ByteConstructor extends Fixed1SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.BYTE; } @Override public void parse(ByteBuffer b, Data data) { data.putByte(b.get()); } } private static class SmallUIntConstructor extends Fixed1SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.UINT; } @Override public void parse(ByteBuffer b, Data data) { data.putUnsignedInteger(UnsignedInteger.valueOf(((int) b.get()) & 0xff)); } } private static class SmallIntConstructor extends Fixed1SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.INT; } @Override public void parse(ByteBuffer b, Data data) { data.putInt(b.get()); } } private static class SmallULongConstructor extends Fixed1SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.ULONG; } @Override public void parse(ByteBuffer b, Data data) { data.putUnsignedLong(UnsignedLong.valueOf(((int) b.get()) & 0xff)); } } private static class SmallLongConstructor extends Fixed1SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.LONG; } @Override public void parse(ByteBuffer b, Data data) { data.putLong(b.get()); } } private static class BooleanConstructor extends Fixed1SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.BOOL; } @Override public void parse(ByteBuffer b, Data data) { int i = b.get(); if(i != 0 && i != 1) { throw new IllegalArgumentException("Illegal value " + i + " for boolean"); } data.putBoolean(i == 1); } } private static class UShortConstructor extends Fixed2SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.USHORT; } @Override public void parse(ByteBuffer b, Data data) { data.putUnsignedShort(UnsignedShort.valueOf(b.getShort())); } } private static class ShortConstructor extends Fixed2SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.SHORT; } @Override public void parse(ByteBuffer b, Data data) { data.putShort(b.getShort()); } } private static class UIntConstructor extends Fixed4SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.UINT; } @Override public void parse(ByteBuffer b, Data data) { data.putUnsignedInteger(UnsignedInteger.valueOf(b.getInt())); } } private static class IntConstructor extends Fixed4SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.INT; } @Override public void parse(ByteBuffer b, Data data) { data.putInt(b.getInt()); } } private static class FloatConstructor extends Fixed4SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.FLOAT; } @Override public void parse(ByteBuffer b, Data data) { data.putFloat(b.getFloat()); } } private static class CharConstructor extends Fixed4SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.CHAR; } @Override public void parse(ByteBuffer b, Data data) { data.putChar(b.getInt()); } } private static class Decimal32Constructor extends Fixed4SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.DECIMAL32; } @Override public void parse(ByteBuffer b, Data data) { data.putDecimal32(new Decimal32(b.getInt())); } } private static class ULongConstructor extends Fixed8SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.ULONG; } @Override public void parse(ByteBuffer b, Data data) { data.putUnsignedLong(UnsignedLong.valueOf(b.getLong())); } } private static class LongConstructor extends Fixed8SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.LONG; } @Override public void parse(ByteBuffer b, Data data) { data.putLong(b.getLong()); } } private static class DoubleConstructor extends Fixed8SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.DOUBLE; } @Override public void parse(ByteBuffer b, Data data) { data.putDouble(b.getDouble()); } } private static class TimestampConstructor extends Fixed8SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.TIMESTAMP; } @Override public void parse(ByteBuffer b, Data data) { data.putTimestamp(new Date(b.getLong())); } } private static class Decimal64Constructor extends Fixed8SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.DECIMAL64; } @Override public void parse(ByteBuffer b, Data data) { data.putDecimal64(new Decimal64(b.getLong())); } } private static class Decimal128Constructor extends Fixed16SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.DECIMAL128; } @Override public void parse(ByteBuffer b, Data data) { data.putDecimal128(new Decimal128(b.getLong(), b.getLong())); } } private static class UUIDConstructor extends Fixed16SizeConstructor { @Override public Data.DataType getType() { return Data.DataType.UUID; } @Override public void parse(ByteBuffer b, Data data) { data.putUUID(new UUID(b.getLong(), b.getLong())); } } private static abstract class SmallVariableConstructor implements TypeConstructor { @Override public int size(ByteBuffer b) { int position = b.position(); if(b.hasRemaining()) { int size = b.get() & 0xff; b.position(position); return size+1; } else { return 1; } } } private static abstract class VariableConstructor implements TypeConstructor { @Override public int size(ByteBuffer b) { int position = b.position(); if(b.remaining()>=4) { int size = b.getInt(); b.position(position); return size+4; } else { return 4; } } } private static class SmallBinaryConstructor extends SmallVariableConstructor { @Override public Data.DataType getType() { return Data.DataType.BINARY; } @Override public void parse(ByteBuffer b, Data data) { int size = b.get() & 0xff; byte[] bytes = new byte[size]; b.get(bytes); data.putBinary(bytes); } } private static class SmallSymbolConstructor extends SmallVariableConstructor { @Override public Data.DataType getType() { return Data.DataType.SYMBOL; } @Override public void parse(ByteBuffer b, Data data) { int size = b.get() & 0xff; byte[] bytes = new byte[size]; b.get(bytes); data.putSymbol(Symbol.valueOf(new String(bytes, ASCII))); } } private static class SmallStringConstructor extends SmallVariableConstructor { @Override public Data.DataType getType() { return Data.DataType.STRING; } @Override public void parse(ByteBuffer b, Data data) { int size = b.get() & 0xff; byte[] bytes = new byte[size]; b.get(bytes); data.putString(new String(bytes, UTF_8)); } } private static class BinaryConstructor extends VariableConstructor { @Override public Data.DataType getType() { return Data.DataType.BINARY; } @Override public void parse(ByteBuffer b, Data data) { int size = b.getInt(); byte[] bytes = new byte[size]; b.get(bytes); data.putBinary(bytes); } } private static class SymbolConstructor extends VariableConstructor { @Override public Data.DataType getType() { return Data.DataType.SYMBOL; } @Override public void parse(ByteBuffer b, Data data) { int size = b.getInt(); byte[] bytes = new byte[size]; b.get(bytes); data.putSymbol(Symbol.valueOf(new String(bytes, ASCII))); } } private static class StringConstructor extends VariableConstructor { @Override public Data.DataType getType() { return Data.DataType.STRING; } @Override public void parse(ByteBuffer b, Data data) { int size = b.getInt(); byte[] bytes = new byte[size]; b.get(bytes); data.putString(new String(bytes, UTF_8)); } } private static class SmallListConstructor extends SmallVariableConstructor { @Override public Data.DataType getType() { return Data.DataType.LIST; } @Override public void parse(ByteBuffer b, Data data) { int size = b.get() & 0xff; ByteBuffer buf = b.slice(); buf.limit(size); b.position(b.position()+size); int count = buf.get() & 0xff; data.putList(); parseChildren(data, buf, count); } } private static class SmallMapConstructor extends SmallVariableConstructor { @Override public Data.DataType getType() { return Data.DataType.MAP; } @Override public void parse(ByteBuffer b, Data data) { int size = b.get() & 0xff; ByteBuffer buf = b.slice(); buf.limit(size); b.position(b.position()+size); int count = buf.get() & 0xff; data.putMap(); parseChildren(data, buf, count); } } private static class ListConstructor extends VariableConstructor { @Override public Data.DataType getType() { return Data.DataType.LIST; } @Override public void parse(ByteBuffer b, Data data) { int size = b.getInt(); ByteBuffer buf = b.slice(); buf.limit(size); b.position(b.position()+size); int count = buf.getInt(); data.putList(); parseChildren(data, buf, count); } } private static class MapConstructor extends VariableConstructor { @Override public Data.DataType getType() { return Data.DataType.MAP; } @Override public void parse(ByteBuffer b, Data data) { int size = b.getInt(); ByteBuffer buf = b.slice(); buf.limit(size); b.position(b.position()+size); int count = buf.getInt(); data.putMap(); parseChildren(data, buf, count); } } private static void parseChildren(Data data, ByteBuffer buf, int count) { data.enter(); for(int i = 0; i < count; i++) { TypeConstructor c = readConstructor(buf); final int size = c.size(buf); final int remaining = buf.remaining(); if(size <= remaining) { c.parse(buf, data); } else { throw new IllegalArgumentException("Malformed data"); } } data.exit(); } private static class DescribedTypeConstructor implements TypeConstructor { @Override public Data.DataType getType() { return Data.DataType.DESCRIBED; } @Override public int size(ByteBuffer b) { ByteBuffer buf = b.slice(); if(buf.hasRemaining()) { TypeConstructor c = readConstructor(buf); int size = c.size(buf); if(buf.remaining()>size) { buf.position(size + 1); c = readConstructor(buf); return size + 2 + c.size(buf); } else { return size + 2; } } else { return 1; } } @Override public void parse(ByteBuffer b, Data data) { data.putDescribed(); data.enter(); TypeConstructor c = readConstructor(b); c.parse(b, data); c = readConstructor(b); c.parse(b, data); data.exit(); } } private static class SmallArrayConstructor extends SmallVariableConstructor { @Override public Data.DataType getType() { return Data.DataType.ARRAY; } @Override public void parse(ByteBuffer b, Data data) { int size = b.get() & 0xff; ByteBuffer buf = b.slice(); buf.limit(size); b.position(b.position()+size); int count = buf.get() & 0xff; parseArray(data, buf, count); } } private static class ArrayConstructor extends VariableConstructor { @Override public Data.DataType getType() { return Data.DataType.ARRAY; } @Override public void parse(ByteBuffer b, Data data) { int size = b.getInt(); ByteBuffer buf = b.slice(); buf.limit(size); b.position(b.position()+size); int count = buf.getInt(); parseArray(data, buf, count); } } private static void parseArray(Data data, ByteBuffer buf, int count) { byte type = buf.get(); boolean isDescribed = type == (byte)0x00; int descriptorPosition = buf.position(); if(isDescribed) { TypeConstructor descriptorTc = readConstructor(buf); buf.position(buf.position()+descriptorTc.size(buf)); type = buf.get(); if(type == (byte)0x00) { throw new IllegalArgumentException("Malformed array data"); } } TypeConstructor tc = _constructors[type&0xff]; data.putArray(isDescribed, tc.getType()); data.enter(); if(isDescribed) { int position = buf.position(); buf.position(descriptorPosition); TypeConstructor descriptorTc = readConstructor(buf); descriptorTc.parse(buf,data); buf.position(position); } for(int i = 0; i map) { putMap(); enter(); for(Map.Entry entry : map.entrySet()) { putObject(entry.getKey()); putObject(entry.getValue()); } exit(); } @Override public void putJavaList(List list) { putList(); enter(); for(Object o : list) { putObject(o); } exit(); } @Override public void putDescribedType(DescribedType dt) { putElement(new DescribedTypeElement(_parent,_current)); enter(); putObject(dt.getDescriptor()); putObject(dt.getDescribed()); exit(); } @Override public long getList() { if(_current instanceof ListElement) { return ((ListElement)_current).count(); } throw new IllegalStateException("Current value not list"); } @Override public long getMap() { if(_current instanceof MapElement) { return ((MapElement)_current).count(); } throw new IllegalStateException("Current value not map"); } @Override public long getArray() { if(_current instanceof ArrayElement) { return ((ArrayElement)_current).count(); } throw new IllegalStateException("Current value not array"); } @Override public boolean isArrayDescribed() { if(_current instanceof ArrayElement) { return ((ArrayElement)_current).isDescribed(); } throw new IllegalStateException("Current value not array"); } @Override public DataType getArrayType() { if(_current instanceof ArrayElement) { return ((ArrayElement)_current).getArrayDataType(); } throw new IllegalStateException("Current value not array"); } @Override public boolean isDescribed() { return _current != null && _current.getDataType() == DataType.DESCRIBED; } @Override public boolean isNull() { return _current != null && _current.getDataType() == DataType.NULL; } @Override public boolean getBoolean() { if(_current instanceof BooleanElement) { return ((BooleanElement)_current).getValue(); } throw new IllegalStateException("Current value not boolean"); } @Override public UnsignedByte getUnsignedByte() { if(_current instanceof UnsignedByteElement) { return ((UnsignedByteElement)_current).getValue(); } throw new IllegalStateException("Current value not unsigned byte"); } @Override public byte getByte() { if(_current instanceof ByteElement) { return ((ByteElement)_current).getValue(); } throw new IllegalStateException("Current value not byte"); } @Override public UnsignedShort getUnsignedShort() { if(_current instanceof UnsignedShortElement) { return ((UnsignedShortElement)_current).getValue(); } throw new IllegalStateException("Current value not unsigned short"); } @Override public short getShort() { if(_current instanceof ShortElement) { return ((ShortElement)_current).getValue(); } throw new IllegalStateException("Current value not short"); } @Override public UnsignedInteger getUnsignedInteger() { if(_current instanceof UnsignedIntegerElement) { return ((UnsignedIntegerElement)_current).getValue(); } throw new IllegalStateException("Current value not unsigned integer"); } @Override public int getInt() { if(_current instanceof IntegerElement) { return ((IntegerElement)_current).getValue(); } throw new IllegalStateException("Current value not integer"); } @Override public int getChar() { if(_current instanceof CharElement) { return ((CharElement)_current).getValue(); } throw new IllegalStateException("Current value not char"); } @Override public UnsignedLong getUnsignedLong() { if(_current instanceof UnsignedLongElement) { return ((UnsignedLongElement)_current).getValue(); } throw new IllegalStateException("Current value not unsigned long"); } @Override public long getLong() { if(_current instanceof LongElement) { return ((LongElement)_current).getValue(); } throw new IllegalStateException("Current value not long"); } @Override public Date getTimestamp() { if(_current instanceof TimestampElement) { return ((TimestampElement)_current).getValue(); } throw new IllegalStateException("Current value not timestamp"); } @Override public float getFloat() { if(_current instanceof FloatElement) { return ((FloatElement)_current).getValue(); } throw new IllegalStateException("Current value not float"); } @Override public double getDouble() { if(_current instanceof DoubleElement) { return ((DoubleElement)_current).getValue(); } throw new IllegalStateException("Current value not double"); } @Override public Decimal32 getDecimal32() { if(_current instanceof Decimal32Element) { return ((Decimal32Element)_current).getValue(); } throw new IllegalStateException("Current value not decimal32"); } @Override public Decimal64 getDecimal64() { if(_current instanceof Decimal64Element) { return ((Decimal64Element)_current).getValue(); } throw new IllegalStateException("Current value not decimal32"); } @Override public Decimal128 getDecimal128() { if(_current instanceof Decimal128Element) { return ((Decimal128Element)_current).getValue(); } throw new IllegalStateException("Current value not decimal32"); } @Override public UUID getUUID() { if(_current instanceof UUIDElement) { return ((UUIDElement)_current).getValue(); } throw new IllegalStateException("Current value not uuid"); } @Override public Binary getBinary() { if(_current instanceof BinaryElement) { return ((BinaryElement)_current).getValue(); } throw new IllegalStateException("Current value not binary"); } @Override public String getString() { if (_current instanceof StringElement) { return ((StringElement) _current).getValue(); } throw new IllegalStateException("Current value not string"); } @Override public Symbol getSymbol() { if(_current instanceof SymbolElement) { return ((SymbolElement)_current).getValue(); } throw new IllegalStateException("Current value not symbol"); } @Override public Object getObject() { return _current == null ? null : _current.getValue(); } @Override public Map getJavaMap() { if(_current instanceof MapElement) { return ((MapElement)_current).getValue(); } throw new IllegalStateException("Current value not map"); } @Override public List getJavaList() { if(_current instanceof ListElement) { return ((ListElement)_current).getValue(); } throw new IllegalStateException("Current value not list"); } @Override public Object[] getJavaArray() { if(_current instanceof ArrayElement) { return ((ArrayElement)_current).getValue(); } throw new IllegalStateException("Current value not array"); } @Override public DescribedType getDescribedType() { if(_current instanceof DescribedTypeElement) { return ((DescribedTypeElement)_current).getValue(); } throw new IllegalStateException("Current value not described type"); } @Override public String format() { StringBuilder sb = new StringBuilder(); Element el = _first; boolean first = true; while (el != null) { if (first) { first = false; } else { sb.append(", "); } el.render(sb); el = el.next(); } return sb.toString(); } private void render(StringBuilder sb, Element el) { if (el == null) return; sb.append(" ").append(el).append("\n"); if (el.canEnter()) { render(sb, el.child()); } render(sb, el.next()); } @Override public String toString() { StringBuilder sb = new StringBuilder(); render(sb, _first); return String.format("Data[current=%h, parent=%h]{%n%s}", System.identityHashCode(_current), System.identityHashCode(_parent), sb); } } ././@LongLink0100644 0000000 0000000 00000000160 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/Decimal128Element.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/Decimal128E0100644 0000000 0000000 00000003573 14303440055 033203 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import org.apache.qpid.proton.amqp.Decimal128; import org.apache.qpid.proton.codec.Data; class Decimal128Element extends AtomicElement { private final Decimal128 _value; Decimal128Element(Element parent, Element prev, Decimal128 d) { super(parent, prev); _value = d; } @Override public int size() { return isElementOfArray() ? 16 : 17; } @Override public Decimal128 getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.DECIMAL128; } @Override public int encode(ByteBuffer b) { int size = size(); if(b.remaining()>=size) { if(size == 17) { b.put((byte)0x94); } b.putLong(_value.getMostSignificantBits()); b.putLong(_value.getLeastSignificantBits()); return size; } else { return 0; } } } ././@LongLink0100644 0000000 0000000 00000000157 14303440055 011634 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/Decimal32Element.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/Decimal32El0100644 0000000 0000000 00000003447 14303440055 033271 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import org.apache.qpid.proton.amqp.Decimal32; import org.apache.qpid.proton.codec.Data; class Decimal32Element extends AtomicElement { private final Decimal32 _value; Decimal32Element(Element parent, Element prev, Decimal32 d) { super(parent, prev); _value = d; } @Override public int size() { return isElementOfArray() ? 4 : 5; } @Override public Decimal32 getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.DECIMAL32; } @Override public int encode(ByteBuffer b) { int size = size(); if(b.remaining()>=size) { if(size == 5) { b.put((byte)0x74); } b.putInt(_value.getBits()); return size; } else { return 0; } } } ././@LongLink0100644 0000000 0000000 00000000157 14303440055 011634 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/Decimal64Element.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/Decimal64El0100644 0000000 0000000 00000003450 14303440055 033270 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import org.apache.qpid.proton.amqp.Decimal64; import org.apache.qpid.proton.codec.Data; class Decimal64Element extends AtomicElement { private final Decimal64 _value; Decimal64Element(Element parent, Element prev, Decimal64 d) { super(parent, prev); _value = d; } @Override public int size() { return isElementOfArray() ? 8 : 9; } @Override public Decimal64 getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.DECIMAL64; } @Override public int encode(ByteBuffer b) { int size = size(); if(b.remaining()>=size) { if(size == 9) { b.put((byte)0x84); } b.putLong(_value.getBits()); return size; } else { return 0; } } } ././@LongLink0100644 0000000 0000000 00000000163 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/DescribedTypeElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/DescribedTy0100644 0000000 0000000 00000007554 14303440055 033511 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import java.util.AbstractSequentialList; import java.util.ArrayList; import java.util.List; import java.util.ListIterator; import org.apache.qpid.proton.amqp.DescribedType; import org.apache.qpid.proton.codec.Data; class DescribedTypeElement extends AbstractElement { private Element _first; DescribedTypeElement(Element parent, Element prev) { super(parent, prev); } @Override public int size() { int count = 0; int size = 0; Element elt = _first; while(elt != null) { count++; size += elt.size(); elt = elt.next(); } if(isElementOfArray()) { throw new IllegalArgumentException("Cannot add described type members to an array"); } else if(count > 2) { throw new IllegalArgumentException("Too many elements in described type"); } else if(count == 0) { size = 3; } else if(count == 1) { size += 2; } else { size+=1; } return size; } @Override public DescribedType getValue() { final Object descriptor = _first == null ? null : _first.getValue(); Element second = _first == null ? null : _first.next(); final Object described = second == null ? null : second.getValue(); return new DescribedTypeImpl(descriptor,described); } @Override public Data.DataType getDataType() { return Data.DataType.DESCRIBED; } @Override public int encode(ByteBuffer b) { int encodedSize = size(); if(encodedSize > b.remaining()) { return 0; } else { b.put((byte) 0); if(_first == null) { b.put((byte)0x40); b.put((byte)0x40); } else { _first.encode(b); if(_first.next() == null) { b.put((byte)0x40); } else { _first.next().encode(b); } } } return encodedSize; } @Override public boolean canEnter() { return true; } @Override public Element child() { return _first; } @Override public void setChild(Element elt) { _first = elt; } @Override public Element checkChild(Element element) { if(element.prev() != _first) { throw new IllegalArgumentException("Described Type may only have two elements"); } return element; } @Override public Element addChild(Element element) { _first = element; return element; } @Override String startSymbol() { return "("; } @Override String stopSymbol() { return ")"; } } ././@LongLink0100644 0000000 0000000 00000000160 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/DescribedTypeImpl.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/DescribedTy0100644 0000000 0000000 00000004463 14303440055 033505 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import org.apache.qpid.proton.amqp.DescribedType; class DescribedTypeImpl implements DescribedType { private final Object _descriptor; private final Object _described; public DescribedTypeImpl(final Object descriptor, final Object described) { _descriptor = descriptor; _described = described; } @Override public Object getDescriptor() { return _descriptor; } @Override public Object getDescribed() { return _described; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || ! (o instanceof DescribedType)) { return false; } DescribedType that = (DescribedType) o; if (_described != null ? !_described.equals(that.getDescribed()) : that.getDescribed() != null) { return false; } if (_descriptor != null ? !_descriptor.equals(that.getDescriptor()) : that.getDescriptor() != null) { return false; } return true; } @Override public int hashCode() { int result = _descriptor != null ? _descriptor.hashCode() : 0; result = 31 * result + (_described != null ? _described.hashCode() : 0); return result; } @Override public String toString() { return "{" + _descriptor + ": " + _described + '}'; } }././@LongLink0100644 0000000 0000000 00000000154 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/DoubleElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/DoubleEleme0100644 0000000 0000000 00000003335 14303440055 033463 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import org.apache.qpid.proton.codec.Data; class DoubleElement extends AtomicElement { private final double _value; DoubleElement(Element parent, Element prev, double d) { super(parent, prev); _value = d; } @Override public int size() { return isElementOfArray() ? 8 : 9; } @Override public Double getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.DOUBLE; } @Override public int encode(ByteBuffer b) { int size = size(); if(b.remaining()>=size) { if(size == 9) { b.put((byte)0x82); } b.putDouble(_value); return size; } else { return 0; } } } ././@LongLink0100644 0000000 0000000 00000000146 14303440055 011632 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/Element.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/Element.jav0100644 0000000 0000000 00000002646 14303440055 033455 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import org.apache.qpid.proton.codec.Data; interface Element { int size(); T getValue(); Data.DataType getDataType(); int encode(ByteBuffer b); Element next(); Element prev(); Element child(); Element parent(); void setNext(Element elt); void setPrev(Element elt); void setParent(Element elt); void setChild(Element elt); Element replaceWith(Element elt); Element addChild(Element element); Element checkChild(Element element); boolean canEnter(); void render(StringBuilder sb); } ././@LongLink0100644 0000000 0000000 00000000153 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/FloatElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/FloatElemen0100644 0000000 0000000 00000003325 14303440055 033473 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import org.apache.qpid.proton.codec.Data; class FloatElement extends AtomicElement { private final float _value; FloatElement(Element parent, Element prev, float f) { super(parent, prev); _value = f; } @Override public int size() { return isElementOfArray() ? 4 : 5; } @Override public Float getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.FLOAT; } @Override public int encode(ByteBuffer b) { int size = size(); if(b.remaining()>=size) { if(size == 5) { b.put((byte)0x72); } b.putFloat(_value); return size; } else { return 0; } } } ././@LongLink0100644 0000000 0000000 00000000155 14303440055 011632 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/IntegerElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/IntegerElem0100644 0000000 0000000 00000004746 14303440055 033510 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import org.apache.qpid.proton.codec.Data; class IntegerElement extends AtomicElement { private final int _value; IntegerElement(Element parent, Element prev, int i) { super(parent, prev); _value = i; } @Override public int size() { if(isElementOfArray()) { final ArrayElement parent = (ArrayElement) parent(); if(parent.constructorType() == ArrayElement.SMALL) { if(-128 <= _value && _value <= 127) { return 1; } else { parent.setConstructorType(ArrayElement.LARGE); return 4; } } else { return 4; } } else { return (-128 <= _value && _value <= 127) ? 2 : 5; } } @Override public Integer getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.INT; } @Override public int encode(ByteBuffer b) { int size = size(); if(size <= b.remaining()) { switch(size) { case 2: b.put((byte)0x54); case 1: b.put((byte)_value); break; case 5: b.put((byte)0x71); case 4: b.putInt(_value); } return size; } return 0; } } ././@LongLink0100644 0000000 0000000 00000000152 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ListElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ListElement0100644 0000000 0000000 00000012407 14303440055 033526 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import java.util.*; import org.apache.qpid.proton.codec.Data; class ListElement extends AbstractElement> { private Element _first; ListElement(Element parent, Element prev) { super(parent, prev); } public int count() { int count = 0; Element elt = _first; while(elt != null) { count++; elt = elt.next(); } return count; } @Override public int size() { int count = 0; int size = 0; Element elt = _first; while(elt != null) { count++; size += elt.size(); elt = elt.next(); } if(isElementOfArray()) { ArrayElement parent = (ArrayElement) parent(); if(parent.constructorType() == ArrayElement.TINY) { if(count != 0) { parent.setConstructorType(ArrayElement.ConstructorType.SMALL); size += 2; } } else if(parent.constructorType() == ArrayElement.SMALL) { if(count > 255 || size > 254) { parent.setConstructorType(ArrayElement.ConstructorType.LARGE); size += 8; } else { size += 2; } } else { size += 8; } } else { if(count == 0) { size = 1; } else if(count <= 255 && size <= 254) { size += 3; } else { size+=9; } } return size; } @Override public List getValue() { List list = new ArrayList(); Element elt = _first; while(elt != null) { list.add(elt.getValue()); elt = elt.next(); } return Collections.unmodifiableList(list); } @Override public Data.DataType getDataType() { return Data.DataType.LIST; } @Override public int encode(ByteBuffer b) { int encodedSize = size(); int count = 0; int size = 0; Element elt = _first; while(elt != null) { count++; size += elt.size(); elt = elt.next(); } if(encodedSize > b.remaining()) { return 0; } else { if(isElementOfArray()) { switch(((ArrayElement)parent()).constructorType()) { case TINY: break; case SMALL: b.put((byte)(size+1)); b.put((byte)count); break; case LARGE: b.putInt((size+4)); b.putInt(count); } } else { if(count == 0) { b.put((byte)0x45); } else if(size <= 254 && count <=255) { b.put((byte)0xc0); b.put((byte)(size+1)); b.put((byte)count); } else { b.put((byte)0xd0); b.putInt((size+4)); b.putInt(count); } } elt = _first; while(elt != null) { elt.encode(b); elt = elt.next(); } return encodedSize; } } @Override public boolean canEnter() { return true; } @Override public Element child() { return _first; } @Override public void setChild(Element elt) { _first = elt; } @Override public Element checkChild(Element element) { return element; } @Override public Element addChild(Element element) { _first = element; return element; } @Override String startSymbol() { return "["; } @Override String stopSymbol() { return "]"; } } ././@LongLink0100644 0000000 0000000 00000000152 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/LongElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/LongElement0100644 0000000 0000000 00000004543 14303440055 033514 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import org.apache.qpid.proton.codec.Data; class LongElement extends AtomicElement { private final long _value; LongElement(Element parent, Element prev, long l) { super(parent, prev); _value = l; } @Override public int size() { if(isElementOfArray()) { final ArrayElement parent = (ArrayElement) parent(); if(parent.constructorType() == ArrayElement.SMALL) { if(-128l <= _value && _value <= 127l) { return 1; } else { parent.setConstructorType(ArrayElement.LARGE); } } return 8; } else { return (-128l <= _value && _value <= 127l) ? 2 : 9; } } @Override public Long getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.LONG; } @Override public int encode(ByteBuffer b) { int size = size(); if(size > b.remaining()) { return 0; } switch(size) { case 2: b.put((byte)0x55); case 1: b.put((byte)_value); break; case 9: b.put((byte)0x81); case 8: b.putLong(_value); } return size; } } ././@LongLink0100644 0000000 0000000 00000000151 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/MapElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/MapElement.0100644 0000000 0000000 00000012033 14303440055 033401 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import java.util.*; import org.apache.qpid.proton.codec.Data; class MapElement extends AbstractElement> { private Element _first; MapElement(Element parent, Element prev) { super(parent, prev); } public int count() { int count = 0; Element elt = _first; while(elt != null) { count++; elt = elt.next(); } return count; } @Override public int size() { int count = 0; int size = 0; Element elt = _first; while(elt != null) { count++; size += elt.size(); elt = elt.next(); } if(isElementOfArray()) { ArrayElement parent = (ArrayElement) parent(); if(parent.constructorType() == ArrayElement.SMALL) { if(count > 255 || size > 254) { parent.setConstructorType(ArrayElement.ConstructorType.LARGE); size += 8; } else { size += 2; } } else { size += 8; } } else { if(count <= 255 && size <= 254) { size += 3; } else { size+=9; } } return size; } @Override public Map getValue() { LinkedHashMap map = new LinkedHashMap(); Element elt = _first; while(elt != null) { Object key = elt.getValue(); Object value; elt = elt.next(); if(elt != null) { value = elt.getValue(); elt = elt.next(); } else { value = null; } map.put(key,value); } return Collections.unmodifiableMap(map); } @Override public Data.DataType getDataType() { return Data.DataType.MAP; } @Override public int encode(ByteBuffer b) { int encodedSize = size(); int count = 0; int size = 0; Element elt = _first; while(elt != null) { count++; size += elt.size(); elt = elt.next(); } if(encodedSize > b.remaining()) { return 0; } else { if(isElementOfArray()) { switch(((ArrayElement)parent()).constructorType()) { case SMALL: b.put((byte)(size+1)); b.put((byte)count); break; case LARGE: b.putInt((size+4)); b.putInt(count); } } else { if(size <= 254 && count <=255) { b.put((byte)0xc1); b.put((byte)(size+1)); b.put((byte)count); } else { b.put((byte)0xd1); b.putInt((size+4)); b.putInt(count); } } elt = _first; while(elt != null) { elt.encode(b); elt = elt.next(); } return encodedSize; } } @Override public boolean canEnter() { return true; } @Override public Element child() { return _first; } @Override public void setChild(Element elt) { _first = elt; } @Override public Element checkChild(Element element) { return element; } @Override public Element addChild(Element element) { _first = element; return element; } @Override String startSymbol() { return "{"; } @Override String stopSymbol() { return "}"; } } ././@LongLink0100644 0000000 0000000 00000000152 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/NullElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/NullElement0100644 0000000 0000000 00000003006 14303440055 033520 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import org.apache.qpid.proton.codec.Data; class NullElement extends AtomicElement { NullElement(Element parent, Element prev) { super(parent, prev); } @Override public int size() { return isElementOfArray() ? 0 : 1; } @Override public Void getValue() { return null; } @Override public Data.DataType getDataType() { return Data.DataType.NULL; } @Override public int encode(ByteBuffer b) { if(b.hasRemaining() && !isElementOfArray()) { b.put((byte)0x40); return 1; } return 0; } } ././@LongLink0100644 0000000 0000000 00000000153 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ShortElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/ShortElemen0100644 0000000 0000000 00000003476 14303440055 033534 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import org.apache.qpid.proton.codec.Data; class ShortElement extends AtomicElement { private final short _value; ShortElement(Element parent, Element prev, short s) { super(parent, prev); _value = s; } @Override public int size() { return isElementOfArray() ? 2 : 3; } @Override public Short getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.SHORT; } @Override public int encode(ByteBuffer b) { if(isElementOfArray()) { if(b.remaining() >= 2) { b.putShort(_value); return 2; } } else { if(b.remaining()>=3) { b.put((byte)0x61); b.putShort(_value); return 3; } } return 0; } } ././@LongLink0100644 0000000 0000000 00000000154 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/StringElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/StringEleme0100644 0000000 0000000 00000006253 14303440055 033521 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import java.nio.charset.Charset; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.codec.Data; class StringElement extends AtomicElement { private static final Charset UTF_8 = Charset.forName("UTF-8"); private final String _value; StringElement(Element parent, Element prev, String s) { super(parent, prev); _value = s; } @Override public int size() { final int length = _value.getBytes(UTF_8).length; return size(length); } private int size(int length) { if(isElementOfArray()) { final ArrayElement parent = (ArrayElement) parent(); if(parent.constructorType() == ArrayElement.SMALL) { if(length > 255) { parent.setConstructorType(ArrayElement.LARGE); return 4+length; } else { return 1+length; } } else { return 4+length; } } else { if(length >255) { return 5 + length; } else { return 2 + length; } } } @Override public String getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.STRING; } @Override public int encode(ByteBuffer b) { final byte[] bytes = _value.getBytes(UTF_8); final int length = bytes.length; int size = size(length); if(b.remaining() { private static final Charset ASCII = Charset.forName("US-ASCII"); private final Symbol _value; SymbolElement(Element parent, Element prev, Symbol s) { super(parent, prev); _value = s; } @Override public int size() { final int length = _value.length(); if(isElementOfArray()) { final ArrayElement parent = (ArrayElement) parent(); if(parent.constructorType() == ArrayElement.SMALL) { if(length > 255) { parent.setConstructorType(ArrayElement.LARGE); return 4+length; } else { return 1+length; } } else { return 4+length; } } else { if(length >255) { return 5 + length; } else { return 2 + length; } } } @Override public Symbol getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.SYMBOL; } @Override public int encode(ByteBuffer b) { int size = size(); if(b.remaining() { private final Date _value; TimestampElement(Element parent, Element prev, Date d) { super(parent, prev); _value = d; } @Override public int size() { return isElementOfArray() ? 8 : 9; } @Override public Date getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.TIMESTAMP; } @Override public int encode(ByteBuffer b) { int size = size(); if(size > b.remaining()) { return 0; } if(size == 9) { b.put((byte)0x83); } b.putLong(_value.getTime()); return size; } } ././@LongLink0100644 0000000 0000000 00000000152 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UUIDElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UUIDElement0100644 0000000 0000000 00000003471 14303440055 033362 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import java.util.UUID; import org.apache.qpid.proton.codec.Data; class UUIDElement extends AtomicElement { private final UUID _value; UUIDElement(Element parent, Element prev, UUID u) { super(parent, prev); _value = u; } @Override public int size() { return isElementOfArray() ? 16 : 17; } @Override public UUID getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.UUID; } @Override public int encode(ByteBuffer b) { int size = size(); if(b.remaining()>=size) { if(size == 17) { b.put((byte)0x98); } b.putLong(_value.getMostSignificantBits()); b.putLong(_value.getLeastSignificantBits()); return size; } else { return 0; } } } ././@LongLink0100644 0000000 0000000 00000000162 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedByteElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedByt0100644 0000000 0000000 00000003647 14303440055 033542 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import org.apache.qpid.proton.amqp.UnsignedByte; import org.apache.qpid.proton.codec.Data; class UnsignedByteElement extends AtomicElement { private final UnsignedByte _value; UnsignedByteElement(Element parent, Element prev, UnsignedByte ub) { super(parent, prev); _value = ub; } @Override public int size() { return isElementOfArray() ? 1 : 2; } @Override public UnsignedByte getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.UBYTE; } @Override public int encode(ByteBuffer b) { if(isElementOfArray()) { if(b.hasRemaining()) { b.put(_value.byteValue()); return 1; } } else { if(b.remaining()>=2) { b.put((byte)0x50); b.put(_value.byteValue()); return 2; } } return 0; } } ././@LongLink0100644 0000000 0000000 00000000165 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedIntegerElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedInt0100644 0000000 0000000 00000006147 14303440055 033534 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import org.apache.qpid.proton.amqp.UnsignedInteger; import org.apache.qpid.proton.codec.Data; class UnsignedIntegerElement extends AtomicElement { private final UnsignedInteger _value; UnsignedIntegerElement(Element parent, Element prev, UnsignedInteger i) { super(parent, prev); _value = i; } @Override public int size() { if(isElementOfArray()) { final ArrayElement parent = (ArrayElement) parent(); if(parent.constructorType() == ArrayElement.TINY) { if(_value.intValue() == 0) { return 0; } else { parent.setConstructorType(ArrayElement.SMALL); } } if(parent.constructorType() == ArrayElement.SMALL) { if(0 <= _value.intValue() && _value.intValue() <= 255) { return 1; } else { parent.setConstructorType(ArrayElement.LARGE); } } return 4; } else { return 0 == _value.intValue() ? 1 : (1 <= _value.intValue() && _value.intValue() <= 255) ? 2 : 5; } } @Override public UnsignedInteger getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.UINT; } @Override public int encode(ByteBuffer b) { int size = size(); if(size > b.remaining()) { return 0; } switch(size) { case 1: if(isElementOfArray()) { b.put((byte)_value.intValue()); } else { b.put((byte)0x43); } break; case 2: b.put((byte)0x52); b.put((byte)_value.intValue()); break; case 5: b.put((byte)0x70); case 4: b.putInt(_value.intValue()); } return size; } } ././@LongLink0100644 0000000 0000000 00000000162 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedLongElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedLon0100644 0000000 0000000 00000006145 14303440055 033530 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.codec.Data; class UnsignedLongElement extends AtomicElement { private final UnsignedLong _value; UnsignedLongElement(Element parent, Element prev, UnsignedLong ul) { super(parent, prev); _value = ul; } @Override public int size() { if(isElementOfArray()) { final ArrayElement parent = (ArrayElement) parent(); if(parent.constructorType() == ArrayElement.TINY) { if(_value.longValue() == 0l) { return 0; } else { parent.setConstructorType(ArrayElement.SMALL); } } if(parent.constructorType() == ArrayElement.SMALL) { if(0l <= _value.longValue() && _value.longValue() <= 255l) { return 1; } else { parent.setConstructorType(ArrayElement.LARGE); } } return 8; } else { return 0l == _value.longValue() ? 1 : (1l <= _value.longValue() && _value.longValue() <= 255l) ? 2 : 9; } } @Override public UnsignedLong getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.ULONG; } @Override public int encode(ByteBuffer b) { int size = size(); if(size > b.remaining()) { return 0; } switch(size) { case 1: if(isElementOfArray()) { b.put((byte)_value.longValue()); } else { b.put((byte)0x44); } break; case 2: b.put((byte)0x53); b.put((byte)_value.longValue()); break; case 9: b.put((byte)0x80); case 8: b.putLong(_value.longValue()); } return size; } } ././@LongLink0100644 0000000 0000000 00000000163 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedShortElement.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/impl/UnsignedSho0100644 0000000 0000000 00000003673 14303440055 033534 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.impl; import java.nio.ByteBuffer; import org.apache.qpid.proton.amqp.UnsignedShort; import org.apache.qpid.proton.codec.Data; class UnsignedShortElement extends AtomicElement { private final UnsignedShort _value; UnsignedShortElement(Element parent, Element prev, UnsignedShort ub) { super(parent, prev); _value = ub; } @Override public int size() { return isElementOfArray() ? 2 : 3; } @Override public UnsignedShort getValue() { return _value; } @Override public Data.DataType getDataType() { return Data.DataType.USHORT; } @Override public int encode(ByteBuffer b) { if(isElementOfArray()) { if(b.remaining()>=2) { b.putShort(_value.shortValue()); return 2; } } else { if(b.remaining()>=3) { b.put((byte)0x60); b.putShort(_value.shortValue()); return 3; } } return 0; } } ././@LongLink0100644 0000000 0000000 00000000160 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/AcceptedType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/Accept0100644 0000000 0000000 00000004556 14303440055 033522 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.messaging; import java.util.Collections; import java.util.List; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.messaging.Accepted; import org.apache.qpid.proton.codec.AbstractDescribedType; import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DescribedTypeConstructor; import org.apache.qpid.proton.codec.EncoderImpl; public final class AcceptedType extends AbstractDescribedType implements DescribedTypeConstructor { private static final Object[] DESCRIPTORS = { UnsignedLong.valueOf(0x0000000000000024L), Symbol.valueOf("amqp:accepted:list"), }; private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000024L); AcceptedType(EncoderImpl encoder) { super(encoder); } @Override protected UnsignedLong getDescriptor() { return DESCRIPTOR; } @Override protected List wrap(Accepted val) { return Collections.EMPTY_LIST; } @Override public Class getTypeClass() { return Accepted.class; } public Accepted newInstance(Object described) { return Accepted.getInstance(); } public static void register(Decoder decoder, EncoderImpl encoder) { AcceptedType type = new AcceptedType(encoder); for(Object descriptor : DESCRIPTORS) { decoder.register(descriptor, type); } encoder.register(type); } } ././@LongLink0100644 0000000 0000000 00000000164 14303440055 011632 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpSequenceType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpSe0100644 0000000 0000000 00000004523 14303440055 033503 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.messaging; import java.util.List; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.messaging.AmqpSequence; import org.apache.qpid.proton.codec.AbstractDescribedType; import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DescribedTypeConstructor; import org.apache.qpid.proton.codec.EncoderImpl; public class AmqpSequenceType extends AbstractDescribedType implements DescribedTypeConstructor { private static final Object[] DESCRIPTORS = { UnsignedLong.valueOf(0x0000000000000076L), Symbol.valueOf("amqp:amqp-sequence:list"), }; private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000076L); AmqpSequenceType(EncoderImpl encoder) { super(encoder); } public UnsignedLong getDescriptor() { return DESCRIPTOR; } @Override protected List wrap(AmqpSequence val) { return val.getValue(); } public AmqpSequence newInstance(Object described) { return new AmqpSequence( (List) described ); } public Class getTypeClass() { return AmqpSequence.class; } public static void register(Decoder decoder, EncoderImpl encoder) { AmqpSequenceType type = new AmqpSequenceType(encoder); for(Object descriptor : DESCRIPTORS) { decoder.register(descriptor, type); } encoder.register(type); } } ././@LongLink0100644 0000000 0000000 00000000161 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpValueType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/AmqpVa0100644 0000000 0000000 00000004420 14303440055 033476 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.messaging; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.messaging.AmqpValue; import org.apache.qpid.proton.codec.AbstractDescribedType; import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DescribedTypeConstructor; import org.apache.qpid.proton.codec.EncoderImpl; public class AmqpValueType extends AbstractDescribedType implements DescribedTypeConstructor { private static final Object[] DESCRIPTORS = { UnsignedLong.valueOf(0x0000000000000077L), Symbol.valueOf("amqp:amqp-value:*"), }; private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000077L); AmqpValueType(EncoderImpl encoder) { super(encoder); } public UnsignedLong getDescriptor() { return DESCRIPTOR; } @Override protected Object wrap(AmqpValue val) { return val.getValue(); } public AmqpValue newInstance(Object described) { return new AmqpValue( described ); } public Class getTypeClass() { return AmqpValue.class; } public static void register(Decoder decoder, EncoderImpl encoder) { AmqpValueType type = new AmqpValueType(encoder); for(Object descriptor : DESCRIPTORS) { decoder.register(descriptor, type); } encoder.register(type); } } ././@LongLink0100644 0000000 0000000 00000000175 14303440055 011634 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/ApplicationPropertiesType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/Applic0100644 0000000 0000000 00000004724 14303440055 033530 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.messaging; import java.util.Map; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.messaging.ApplicationProperties; import org.apache.qpid.proton.codec.AbstractDescribedType; import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DescribedTypeConstructor; import org.apache.qpid.proton.codec.EncoderImpl; public class ApplicationPropertiesType extends AbstractDescribedType implements DescribedTypeConstructor { private static final Object[] DESCRIPTORS = { UnsignedLong.valueOf(0x0000000000000074L), Symbol.valueOf("amqp:application-properties:map"), }; private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000074L); public ApplicationPropertiesType(EncoderImpl encoder) { super(encoder); } public UnsignedLong getDescriptor() { return DESCRIPTOR; } @Override protected Map wrap(ApplicationProperties val) { return val.getValue(); } public ApplicationProperties newInstance(Object described) { return new ApplicationProperties( (Map) described ); } public Class getTypeClass() { return ApplicationProperties.class; } public static void register(Decoder decoder, EncoderImpl encoder) { ApplicationPropertiesType type = new ApplicationPropertiesType(encoder); for(Object descriptor : DESCRIPTORS) { decoder.register(descriptor, type); } encoder.register(type); } } ././@LongLink0100644 0000000 0000000 00000000154 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DataType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DataTy0100644 0000000 0000000 00000004407 14303440055 033504 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.messaging; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.messaging.Data; import org.apache.qpid.proton.codec.AbstractDescribedType; import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DescribedTypeConstructor; import org.apache.qpid.proton.codec.EncoderImpl; public class DataType extends AbstractDescribedType implements DescribedTypeConstructor { private static final Object[] DESCRIPTORS = { UnsignedLong.valueOf(0x0000000000000075L), Symbol.valueOf("amqp:data:binary"), }; private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000075L); DataType(EncoderImpl encoder) { super(encoder); } public UnsignedLong getDescriptor() { return DESCRIPTOR; } @Override protected Binary wrap(Data val) { return val.getValue(); } public Data newInstance(Object described) { return new Data( (Binary) described ); } public Class getTypeClass() { return Data.class; } public static void register(Decoder decoder, EncoderImpl encoder) { DataType type = new DataType(encoder); for(Object descriptor : DESCRIPTORS) { decoder.register(descriptor, type); } encoder.register(type); } } ././@LongLink0100644 0000000 0000000 00000000165 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnCloseType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/Delete0100644 0000000 0000000 00000004607 14303440055 033522 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.messaging; import java.util.Collections; import java.util.List; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.messaging.DeleteOnClose; import org.apache.qpid.proton.codec.AbstractDescribedType; import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DescribedTypeConstructor; import org.apache.qpid.proton.codec.EncoderImpl; public class DeleteOnCloseType extends AbstractDescribedType implements DescribedTypeConstructor { private static final Object[] DESCRIPTORS = { UnsignedLong.valueOf(0x000000000000002bL), Symbol.valueOf("amqp:delete-on-close:list"), }; private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x000000000000002bL); private DeleteOnCloseType(EncoderImpl encoder) { super(encoder); } public UnsignedLong getDescriptor() { return DESCRIPTOR; } @Override protected List wrap(DeleteOnClose val) { return Collections.EMPTY_LIST; } public DeleteOnClose newInstance(Object described) { return DeleteOnClose.getInstance(); } public Class getTypeClass() { return DeleteOnClose.class; } public static void register(Decoder decoder, EncoderImpl encoder) { DeleteOnCloseType type = new DeleteOnCloseType(encoder); for(Object descriptor : DESCRIPTORS) { decoder.register(descriptor, type); } encoder.register(type); } } ././@LongLink0100644 0000000 0000000 00000000201 14303440055 011622 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoLinksOrMessagesType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/Delete0100644 0000000 0000000 00000005045 14303440055 033517 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.messaging; import java.util.Collections; import java.util.List; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.messaging.DeleteOnNoLinksOrMessages; import org.apache.qpid.proton.codec.AbstractDescribedType; import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DescribedTypeConstructor; import org.apache.qpid.proton.codec.EncoderImpl; public class DeleteOnNoLinksOrMessagesType extends AbstractDescribedType implements DescribedTypeConstructor { private static final Object[] DESCRIPTORS = { UnsignedLong.valueOf(0x000000000000002eL), Symbol.valueOf("amqp:delete-on-no-links-or-messages:list"), }; private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x000000000000002eL); private DeleteOnNoLinksOrMessagesType(EncoderImpl encoder) { super(encoder); } public UnsignedLong getDescriptor() { return DESCRIPTOR; } @Override protected List wrap(DeleteOnNoLinksOrMessages val) { return Collections.EMPTY_LIST; } public DeleteOnNoLinksOrMessages newInstance(Object described) { return DeleteOnNoLinksOrMessages.getInstance(); } public Class getTypeClass() { return DeleteOnNoLinksOrMessages.class; } public static void register(Decoder decoder, EncoderImpl encoder) { DeleteOnNoLinksOrMessagesType type = new DeleteOnNoLinksOrMessagesType(encoder); for(Object descriptor : DESCRIPTORS) { decoder.register(descriptor, type); } encoder.register(type); } } ././@LongLink0100644 0000000 0000000 00000000167 14303440055 011635 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoLinksType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/Delete0100644 0000000 0000000 00000004675 14303440055 033527 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.messaging; import java.util.Collections; import java.util.List; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.messaging.DeleteOnNoLinks; import org.apache.qpid.proton.codec.AbstractDescribedType; import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DescribedTypeConstructor; import org.apache.qpid.proton.codec.EncoderImpl; public class DeleteOnNoLinksType extends AbstractDescribedType implements DescribedTypeConstructor { private static final Object[] DESCRIPTORS = { UnsignedLong.valueOf(0x000000000000002cL), Symbol.valueOf("amqp:delete-on-no-links:list"), }; private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x000000000000002cL); private DeleteOnNoLinksType(EncoderImpl encoder) { super(encoder); } public UnsignedLong getDescriptor() { return DESCRIPTOR; } @Override protected List wrap(DeleteOnNoLinks val) { return Collections.EMPTY_LIST; } @Override public DeleteOnNoLinks newInstance(Object described) { return DeleteOnNoLinks.getInstance(); } @Override public Class getTypeClass() { return DeleteOnNoLinks.class; } public static void register(Decoder decoder, EncoderImpl encoder) { DeleteOnNoLinksType type = new DeleteOnNoLinksType(encoder); for(Object descriptor : DESCRIPTORS) { decoder.register(descriptor, type); } encoder.register(type); } } ././@LongLink0100644 0000000 0000000 00000000172 14303440055 011631 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeleteOnNoMessagesType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/Delete0100644 0000000 0000000 00000004743 14303440055 033523 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.messaging; import java.util.Collections; import java.util.List; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.messaging.DeleteOnNoMessages; import org.apache.qpid.proton.codec.AbstractDescribedType; import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DescribedTypeConstructor; import org.apache.qpid.proton.codec.EncoderImpl; public class DeleteOnNoMessagesType extends AbstractDescribedType implements DescribedTypeConstructor { private static final Object[] DESCRIPTORS = { UnsignedLong.valueOf(0x000000000000002dL), Symbol.valueOf("amqp:delete-on-no-messages:list"), }; private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x000000000000002dL); private DeleteOnNoMessagesType(EncoderImpl encoder) { super(encoder); } public UnsignedLong getDescriptor() { return DESCRIPTOR; } @Override protected List wrap(DeleteOnNoMessages val) { return Collections.EMPTY_LIST; } @Override public DeleteOnNoMessages newInstance(Object described) { return DeleteOnNoMessages.getInstance(); } @Override public Class getTypeClass() { return DeleteOnNoMessages.class; } public static void register(Decoder decoder, EncoderImpl encoder) { DeleteOnNoMessagesType type = new DeleteOnNoMessagesType(encoder); for(Object descriptor : DESCRIPTORS) { decoder.register(descriptor, type); } encoder.register(type); } } ././@LongLink0100644 0000000 0000000 00000000173 14303440055 011632 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/DeliveryAnnotationsType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/Delive0100644 0000000 0000000 00000004671 14303440055 033531 0ustar00rootroot0000000 0000000 /* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */ package org.apache.qpid.proton.codec.messaging; import java.util.Map; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.messaging.DeliveryAnnotations; import org.apache.qpid.proton.codec.AbstractDescribedType; import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DescribedTypeConstructor; import org.apache.qpid.proton.codec.EncoderImpl; public class DeliveryAnnotationsType extends AbstractDescribedType implements DescribedTypeConstructor { private static final Object[] DESCRIPTORS = { UnsignedLong.valueOf(0x0000000000000071L), Symbol.valueOf("amqp:delivery-annotations:map"), }; private static final UnsignedLong DESCRIPTOR = UnsignedLong.valueOf(0x0000000000000071L); public DeliveryAnnotationsType(EncoderImpl encoder) { super(encoder); } public UnsignedLong getDescriptor() { return DESCRIPTOR; } @Override protected Map wrap(DeliveryAnnotations val) { return val.getValue(); } public DeliveryAnnotations newInstance(Object described) { return new DeliveryAnnotations( (Map) described ); } public Class getTypeClass() { return DeliveryAnnotations.class; } public static void register(Decoder decoder, EncoderImpl encoder) { DeliveryAnnotationsType type = new DeliveryAnnotationsType(encoder); for(Object descriptor : DESCRIPTORS) { decoder.register(descriptor, type); } encoder.register(type); } } ././@LongLink0100644 0000000 0000000 00000000170 14303440055 011627 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathAcceptedType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPa0100644 0000000 0000000 00000010317 14303440055 033471 0ustar00rootroot0000000 0000000 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.qpid.proton.codec.messaging; import java.util.Collection; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.messaging.Accepted; import org.apache.qpid.proton.codec.AMQPType; import org.apache.qpid.proton.codec.DecodeException; import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DecoderImpl; import org.apache.qpid.proton.codec.EncoderImpl; import org.apache.qpid.proton.codec.EncodingCodes; import org.apache.qpid.proton.codec.FastPathDescribedTypeConstructor; import org.apache.qpid.proton.codec.TypeEncoding; import org.apache.qpid.proton.codec.WritableBuffer; public class FastPathAcceptedType implements AMQPType, FastPathDescribedTypeConstructor { private static final byte DESCRIPTOR_CODE = 0x24; private static final Object[] DESCRIPTORS = { UnsignedLong.valueOf(DESCRIPTOR_CODE), Symbol.valueOf("amqp:accepted:list"), }; private static final byte[] ACCEPTED_ENCODED_BYTES = new byte[] { EncodingCodes.DESCRIBED_TYPE_INDICATOR, EncodingCodes.SMALLULONG, DESCRIPTOR_CODE, EncodingCodes.LIST0 }; private final AcceptedType acceptedType; public FastPathAcceptedType(EncoderImpl encoder) { this.acceptedType = new AcceptedType(encoder); } public EncoderImpl getEncoder() { return acceptedType.getEncoder(); } public DecoderImpl getDecoder() { return acceptedType.getDecoder(); } @Override public boolean encodesJavaPrimitive() { return false; } @Override public Class getTypeClass() { return Accepted.class; } @Override public TypeEncoding getEncoding(Accepted accepted) { return acceptedType.getEncoding(accepted); } @Override public TypeEncoding getCanonicalEncoding() { return acceptedType.getCanonicalEncoding(); } @Override public Collection> getAllEncodings() { return acceptedType.getAllEncodings(); } @Override public Accepted readValue() { DecoderImpl decoder = getDecoder(); byte typeCode = decoder.getBuffer().get(); switch (typeCode) { case EncodingCodes.LIST0: break; case EncodingCodes.LIST8: decoder.getBuffer().get(); decoder.getBuffer().get(); break; case EncodingCodes.LIST32: decoder.getBuffer().getInt(); decoder.getBuffer().getInt(); break; default: throw new DecodeException("Incorrect type found in Accepted type encoding: " + typeCode); } return Accepted.getInstance(); } @Override public void skipValue() { getDecoder().readConstructor().skipValue(); } @Override public void write(Accepted accepted) { WritableBuffer buffer = getEncoder().getBuffer(); buffer.put(ACCEPTED_ENCODED_BYTES, 0, ACCEPTED_ENCODED_BYTES.length); } public static void register(Decoder decoder, EncoderImpl encoder) { FastPathAcceptedType type = new FastPathAcceptedType(encoder); for(Object descriptor : DESCRIPTORS) { decoder.register(descriptor, (FastPathDescribedTypeConstructor) type); } encoder.register(type); } } ././@LongLink0100644 0000000 0000000 00000000174 14303440055 011633 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathAmqpSequenceType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPa0100644 0000000 0000000 00000007040 14303440055 033470 0ustar00rootroot0000000 0000000 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.qpid.proton.codec.messaging; import java.util.Collection; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.messaging.AmqpSequence; import org.apache.qpid.proton.codec.AMQPType; import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DecoderImpl; import org.apache.qpid.proton.codec.EncoderImpl; import org.apache.qpid.proton.codec.EncodingCodes; import org.apache.qpid.proton.codec.FastPathDescribedTypeConstructor; import org.apache.qpid.proton.codec.TypeEncoding; import org.apache.qpid.proton.codec.WritableBuffer; public class FastPathAmqpSequenceType implements AMQPType, FastPathDescribedTypeConstructor { private static final byte DESCRIPTOR_CODE = 0x76; private static final Object[] DESCRIPTORS = { UnsignedLong.valueOf(DESCRIPTOR_CODE), Symbol.valueOf("amqp:amqp-sequence:list"), }; private final AmqpSequenceType sequenceType; public FastPathAmqpSequenceType(EncoderImpl encoder) { this.sequenceType = new AmqpSequenceType(encoder); } public EncoderImpl getEncoder() { return sequenceType.getEncoder(); } public DecoderImpl getDecoder() { return sequenceType.getDecoder(); } @Override public boolean encodesJavaPrimitive() { return false; } @Override public Class getTypeClass() { return AmqpSequence.class; } @Override public TypeEncoding getEncoding(AmqpSequence val) { return sequenceType.getEncoding(val); } @Override public TypeEncoding getCanonicalEncoding() { return sequenceType.getCanonicalEncoding(); } @Override public Collection> getAllEncodings() { return sequenceType.getAllEncodings(); } @Override public AmqpSequence readValue() { return new AmqpSequence(getDecoder().readList()); } @Override public void skipValue() { getDecoder().readConstructor().skipValue(); } @Override public void write(AmqpSequence sequence) { WritableBuffer buffer = getEncoder().getBuffer(); buffer.put(EncodingCodes.DESCRIBED_TYPE_INDICATOR); buffer.put(EncodingCodes.SMALLULONG); buffer.put(DESCRIPTOR_CODE); getEncoder().writeObject(sequence.getValue()); } public static void register(Decoder decoder, EncoderImpl encoder) { FastPathAmqpSequenceType type = new FastPathAmqpSequenceType(encoder); for (Object descriptor : DESCRIPTORS) { decoder.register(descriptor, (FastPathDescribedTypeConstructor) type); } encoder.register(type); } } ././@LongLink0100644 0000000 0000000 00000000171 14303440055 011630 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathAmqpValueType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPa0100644 0000000 0000000 00000006716 14303440055 033501 0ustar00rootroot0000000 0000000 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.qpid.proton.codec.messaging; import java.util.Collection; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.messaging.AmqpValue; import org.apache.qpid.proton.codec.AMQPType; import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DecoderImpl; import org.apache.qpid.proton.codec.EncoderImpl; import org.apache.qpid.proton.codec.EncodingCodes; import org.apache.qpid.proton.codec.FastPathDescribedTypeConstructor; import org.apache.qpid.proton.codec.TypeEncoding; import org.apache.qpid.proton.codec.WritableBuffer; public class FastPathAmqpValueType implements AMQPType, FastPathDescribedTypeConstructor { private static final byte DESCRIPTOR_CODE = 0x77; private static final Object[] DESCRIPTORS = { UnsignedLong.valueOf(DESCRIPTOR_CODE), Symbol.valueOf("amqp:amqp-value:*"), }; private final AmqpValueType valueType; public FastPathAmqpValueType(EncoderImpl encoder) { this.valueType = new AmqpValueType(encoder); } public EncoderImpl getEncoder() { return valueType.getEncoder(); } public DecoderImpl getDecoder() { return valueType.getDecoder(); } @Override public boolean encodesJavaPrimitive() { return false; } @Override public Class getTypeClass() { return AmqpValue.class; } @Override public TypeEncoding getEncoding(AmqpValue value) { return valueType.getEncoding(value); } @Override public TypeEncoding getCanonicalEncoding() { return valueType.getCanonicalEncoding(); } @Override public Collection> getAllEncodings() { return valueType.getAllEncodings(); } @Override public AmqpValue readValue() { return new AmqpValue(getDecoder().readObject()); } @Override public void skipValue() { getDecoder().readConstructor().skipValue(); } @Override public void write(AmqpValue value) { WritableBuffer buffer = getEncoder().getBuffer(); buffer.put(EncodingCodes.DESCRIBED_TYPE_INDICATOR); buffer.put(EncodingCodes.SMALLULONG); buffer.put(DESCRIPTOR_CODE); getEncoder().writeObject(value.getValue()); } public static void register(Decoder decoder, EncoderImpl encoder) { FastPathAmqpValueType type = new FastPathAmqpValueType(encoder); for(Object descriptor : DESCRIPTORS) { decoder.register(descriptor, (FastPathDescribedTypeConstructor) type); } encoder.register(type); } } ././@LongLink0100644 0000000 0000000 00000000205 14303440055 011626 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathApplicationPropertiesType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPa0100644 0000000 0000000 00000016767 14303440055 033510 0ustar00rootroot0000000 0000000 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.qpid.proton.codec.messaging; import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map; import org.apache.qpid.proton.ProtonException; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.messaging.ApplicationProperties; import org.apache.qpid.proton.codec.AMQPType; import org.apache.qpid.proton.codec.ArrayType; import org.apache.qpid.proton.codec.DecodeException; import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DecoderImpl; import org.apache.qpid.proton.codec.EncoderImpl; import org.apache.qpid.proton.codec.EncodingCodes; import org.apache.qpid.proton.codec.FastPathDescribedTypeConstructor; import org.apache.qpid.proton.codec.MapType; import org.apache.qpid.proton.codec.PrimitiveTypeEncoding; import org.apache.qpid.proton.codec.ReadableBuffer; import org.apache.qpid.proton.codec.StringType; import org.apache.qpid.proton.codec.TypeConstructor; import org.apache.qpid.proton.codec.TypeEncoding; import org.apache.qpid.proton.codec.WritableBuffer; public class FastPathApplicationPropertiesType implements AMQPType, FastPathDescribedTypeConstructor { private static final byte DESCRIPTOR_CODE = 0x74; private static final Object[] DESCRIPTORS = { UnsignedLong.valueOf(DESCRIPTOR_CODE), Symbol.valueOf("amqp:application-properties:map"), }; private final ApplicationPropertiesType propertiesType; private final StringType stringType; public FastPathApplicationPropertiesType(EncoderImpl encoder) { this.propertiesType = new ApplicationPropertiesType(encoder); this.stringType = (StringType) encoder.getTypeFromClass(String.class); } public EncoderImpl getEncoder() { return propertiesType.getEncoder(); } public DecoderImpl getDecoder() { return propertiesType.getDecoder(); } @Override public boolean encodesJavaPrimitive() { return false; } @Override public Class getTypeClass() { return ApplicationProperties.class; } @Override public TypeEncoding getEncoding(ApplicationProperties val) { return propertiesType.getEncoding(val); } @Override public TypeEncoding getCanonicalEncoding() { return propertiesType.getCanonicalEncoding(); } @Override public Collection> getAllEncodings() { return propertiesType.getAllEncodings(); } @Override public ApplicationProperties readValue() { DecoderImpl decoder = getDecoder(); ReadableBuffer buffer = decoder.getBuffer(); final int size; final int count; byte encodingCode = buffer.get(); switch (encodingCode) { case EncodingCodes.MAP8: size = buffer.get() & 0xFF; count = buffer.get() & 0xFF; break; case EncodingCodes.MAP32: size = buffer.getInt(); count = buffer.getInt(); break; case EncodingCodes.NULL: return new ApplicationProperties(null); default: throw new ProtonException("Expected Map type but found encoding: " + encodingCode); } if (count > buffer.remaining()) { throw new IllegalArgumentException("Map element count " + count + " is specified to be greater than the " + "amount of data available ("+ buffer.remaining() + ")"); } TypeConstructor valueConstructor = null; Map map = new LinkedHashMap<>(count); for (int i = 0; i < count / 2; i++) { String key = decoder.readString(null); if (key == null) { throw new DecodeException("String key in ApplicationProperties cannot be null"); } boolean arrayType = false; byte code = buffer.get(buffer.position()); switch (code) { case EncodingCodes.ARRAY8: case EncodingCodes.ARRAY32: arrayType = true; } valueConstructor = findNextDecoder(decoder, buffer, valueConstructor); final Object value; if (arrayType) { value = ((ArrayType.ArrayEncoding) valueConstructor).readValueArray(); } else { value = valueConstructor.readValue(); } map.put(key, value); } return new ApplicationProperties(map); } @Override public void skipValue() { getDecoder().readConstructor().skipValue(); } @Override public void write(ApplicationProperties val) { WritableBuffer buffer = getEncoder().getBuffer(); buffer.put(EncodingCodes.DESCRIBED_TYPE_INDICATOR); buffer.put(EncodingCodes.SMALLULONG); buffer.put(DESCRIPTOR_CODE); MapType mapType = (MapType) getEncoder().getType(val.getValue()); mapType.setKeyEncoding(stringType); try { mapType.write(val.getValue()); } finally { mapType.setKeyEncoding(null); } } public static void register(Decoder decoder, EncoderImpl encoder) { FastPathApplicationPropertiesType type = new FastPathApplicationPropertiesType(encoder); for (Object descriptor : DESCRIPTORS) { decoder.register(descriptor, type); } encoder.register(type); } private static TypeConstructor findNextDecoder(DecoderImpl decoder, ReadableBuffer buffer, TypeConstructor previousConstructor) { if (previousConstructor == null) { return decoder.readConstructor(); } else { byte encodingCode = buffer.get(buffer.position()); if (encodingCode == EncodingCodes.DESCRIBED_TYPE_INDICATOR || !(previousConstructor instanceof PrimitiveTypeEncoding)) { previousConstructor = decoder.readConstructor(); } else { PrimitiveTypeEncoding primitiveConstructor = (PrimitiveTypeEncoding) previousConstructor; if (encodingCode != primitiveConstructor.getEncodingCode()) { previousConstructor = decoder.readConstructor(); } else { // consume the encoding code byte for real encodingCode = buffer.get(); } } } if (previousConstructor == null) { throw new DecodeException("Unknown constructor found in Map encoding: "); } return previousConstructor; } } ././@LongLink0100644 0000000 0000000 00000000164 14303440055 011632 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathDataType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPa0100644 0000000 0000000 00000010620 14303440055 033466 0ustar00rootroot0000000 0000000 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.qpid.proton.codec.messaging; import java.util.Collection; import org.apache.qpid.proton.ProtonException; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.messaging.Data; import org.apache.qpid.proton.codec.AMQPType; import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DecoderImpl; import org.apache.qpid.proton.codec.EncoderImpl; import org.apache.qpid.proton.codec.EncodingCodes; import org.apache.qpid.proton.codec.FastPathDescribedTypeConstructor; import org.apache.qpid.proton.codec.ReadableBuffer; import org.apache.qpid.proton.codec.TypeEncoding; import org.apache.qpid.proton.codec.WritableBuffer; public class FastPathDataType implements AMQPType, FastPathDescribedTypeConstructor { private static final byte DESCRIPTOR_CODE = 0x75; private static final Object[] DESCRIPTORS = { UnsignedLong.valueOf(DESCRIPTOR_CODE), Symbol.valueOf("amqp:data:binary"), }; private final DataType dataType; public FastPathDataType(EncoderImpl encoder) { this.dataType = new DataType(encoder); } public EncoderImpl getEncoder() { return dataType.getEncoder(); } public DecoderImpl getDecoder() { return dataType.getDecoder(); } @Override public boolean encodesJavaPrimitive() { return false; } @Override public Class getTypeClass() { return dataType.getTypeClass(); } @Override public TypeEncoding getEncoding(Data val) { return dataType.getEncoding(val); } @Override public TypeEncoding getCanonicalEncoding() { return dataType.getCanonicalEncoding(); } @Override public Collection> getAllEncodings() { return dataType.getAllEncodings(); } @Override public Data readValue() { ReadableBuffer buffer = getDecoder().getBuffer(); byte encodingCode = buffer.get(); int size = 0; switch (encodingCode) { case EncodingCodes.VBIN8: size = buffer.get() & 0xFF; break; case EncodingCodes.VBIN32: size = buffer.getInt(); break; case EncodingCodes.NULL: return new Data(null); default: throw new ProtonException("Expected Binary type but found encoding: " + encodingCode); } if (size > buffer.remaining()) { throw new IllegalArgumentException("Binary data size " + size + " is specified to be greater than the " + "amount of data available ("+ buffer.remaining()+")"); } byte[] data = new byte[size]; buffer.get(data, 0, size); return new Data(new Binary(data)); } @Override public void skipValue() { getDecoder().readConstructor().skipValue(); } @Override public void write(Data data) { WritableBuffer buffer = getEncoder().getBuffer(); buffer.put(EncodingCodes.DESCRIBED_TYPE_INDICATOR); buffer.put(EncodingCodes.SMALLULONG); buffer.put(DESCRIPTOR_CODE); getEncoder().writeBinary(data.getValue()); } public static void register(Decoder decoder, EncoderImpl encoder) { FastPathDataType type = new FastPathDataType(encoder); for(Object descriptor : DESCRIPTORS) { decoder.register(descriptor, (FastPathDescribedTypeConstructor) type); } encoder.register(type); } } ././@LongLink0100644 0000000 0000000 00000000203 14303440055 011624 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathDeliveryAnnotationsType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPa0100644 0000000 0000000 00000016723 14303440055 033500 0ustar00rootroot0000000 0000000 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.qpid.proton.codec.messaging; import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map; import org.apache.qpid.proton.ProtonException; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.messaging.DeliveryAnnotations; import org.apache.qpid.proton.codec.AMQPType; import org.apache.qpid.proton.codec.ArrayType; import org.apache.qpid.proton.codec.DecodeException; import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DecoderImpl; import org.apache.qpid.proton.codec.EncoderImpl; import org.apache.qpid.proton.codec.EncodingCodes; import org.apache.qpid.proton.codec.FastPathDescribedTypeConstructor; import org.apache.qpid.proton.codec.MapType; import org.apache.qpid.proton.codec.PrimitiveTypeEncoding; import org.apache.qpid.proton.codec.ReadableBuffer; import org.apache.qpid.proton.codec.SymbolType; import org.apache.qpid.proton.codec.TypeConstructor; import org.apache.qpid.proton.codec.TypeEncoding; import org.apache.qpid.proton.codec.WritableBuffer; public class FastPathDeliveryAnnotationsType implements AMQPType, FastPathDescribedTypeConstructor { private static final byte DESCRIPTOR_CODE = 0x71; private static final Object[] DESCRIPTORS = { UnsignedLong.valueOf(DESCRIPTOR_CODE), Symbol.valueOf("amqp:delivery-annotations:map"), }; private final DeliveryAnnotationsType annotationsType; private final SymbolType symbolType; public FastPathDeliveryAnnotationsType(EncoderImpl encoder) { this.annotationsType = new DeliveryAnnotationsType(encoder); this.symbolType = (SymbolType) encoder.getTypeFromClass(Symbol.class); } public EncoderImpl getEncoder() { return annotationsType.getEncoder(); } public DecoderImpl getDecoder() { return annotationsType.getDecoder(); } @Override public boolean encodesJavaPrimitive() { return false; } @Override public Class getTypeClass() { return DeliveryAnnotations.class; } @Override public TypeEncoding getEncoding(DeliveryAnnotations val) { return annotationsType.getEncoding(val); } @Override public TypeEncoding getCanonicalEncoding() { return annotationsType.getCanonicalEncoding(); } @Override public Collection> getAllEncodings() { return annotationsType.getAllEncodings(); } @Override public DeliveryAnnotations readValue() { DecoderImpl decoder = getDecoder(); ReadableBuffer buffer = decoder.getBuffer(); final int size; final int count; byte encodingCode = buffer.get(); switch (encodingCode) { case EncodingCodes.MAP8: size = buffer.get() & 0xFF; count = buffer.get() & 0xFF; break; case EncodingCodes.MAP32: size = buffer.getInt(); count = buffer.getInt(); break; case EncodingCodes.NULL: return new DeliveryAnnotations(null); default: throw new ProtonException("Expected Map type but found encoding: " + encodingCode); } if (count > buffer.remaining()) { throw new IllegalArgumentException("Map element count " + count + " is specified to be greater than the " + "amount of data available (" + buffer.remaining() + ")"); } TypeConstructor valueConstructor = null; Map map = new LinkedHashMap<>(count); for(int i = 0; i < count / 2; i++) { Symbol key = decoder.readSymbol(null); if (key == null) { throw new DecodeException("String key in DeliveryAnnotations cannot be null"); } boolean arrayType = false; byte code = buffer.get(buffer.position()); switch (code) { case EncodingCodes.ARRAY8: case EncodingCodes.ARRAY32: arrayType = true; } valueConstructor = findNextDecoder(decoder, buffer, valueConstructor); final Object value; if (arrayType) { value = ((ArrayType.ArrayEncoding) valueConstructor).readValueArray(); } else { value = valueConstructor.readValue(); } map.put(key, value); } return new DeliveryAnnotations(map); } @Override public void skipValue() { getDecoder().readConstructor().skipValue(); } @Override public void write(DeliveryAnnotations val) { WritableBuffer buffer = getEncoder().getBuffer(); buffer.put(EncodingCodes.DESCRIBED_TYPE_INDICATOR); buffer.put(EncodingCodes.SMALLULONG); buffer.put(DESCRIPTOR_CODE); MapType mapType = (MapType) getEncoder().getType(val.getValue()); mapType.setKeyEncoding(symbolType); try { mapType.write(val.getValue()); } finally { mapType.setKeyEncoding(null); } } public static void register(Decoder decoder, EncoderImpl encoder) { FastPathDeliveryAnnotationsType type = new FastPathDeliveryAnnotationsType(encoder); for(Object descriptor : DESCRIPTORS) { decoder.register(descriptor, type); } encoder.register(type); } private static TypeConstructor findNextDecoder(DecoderImpl decoder, ReadableBuffer buffer, TypeConstructor previousConstructor) { if (previousConstructor == null) { return decoder.readConstructor(); } else { byte encodingCode = buffer.get(buffer.position()); if (encodingCode == EncodingCodes.DESCRIBED_TYPE_INDICATOR || !(previousConstructor instanceof PrimitiveTypeEncoding)) { previousConstructor = decoder.readConstructor(); } else { PrimitiveTypeEncoding primitiveConstructor = (PrimitiveTypeEncoding) previousConstructor; if (encodingCode != primitiveConstructor.getEncodingCode()) { previousConstructor = decoder.readConstructor(); } else { // consume the encoding code byte for real encodingCode = buffer.get(); } } } if (previousConstructor == null) { throw new DecodeException("Unknown constructor found in Map encoding: "); } return previousConstructor; } } ././@LongLink0100644 0000000 0000000 00000000166 14303440055 011634 Lustar 0000000 0000000 apache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPathFooterType.javaapache-qpid-proton-j-0.34.0-src/proton-j/src/main/java/org/apache/qpid/proton/codec/messaging/FastPa0100644 0000000 0000000 00000006743 14303440055 033501 0ustar00rootroot0000000 0000000 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.qpid.proton.codec.messaging; import java.util.Collection; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.UnsignedLong; import org.apache.qpid.proton.amqp.messaging.Footer; import org.apache.qpid.proton.codec.AMQPType; import org.apache.qpid.proton.codec.Decoder; import org.apache.qpid.proton.codec.DecoderImpl; import org.apache.qpid.proton.codec.EncoderImpl; import org.apache.qpid.proton.codec.EncodingCodes; import org.apache.qpid.proton.codec.FastPathDescribedTypeConstructor; import org.apache.qpid.proton.codec.MapType; import org.apache.qpid.proton.codec.TypeEncoding; import org.apache.qpid.proton.codec.WritableBuffer; public class FastPathFooterType implements AMQPType