当前位置: 首页>>代码示例>>Java>>正文


Java DescribedType类代码示例

本文整理汇总了Java中org.apache.qpid.proton.amqp.DescribedType的典型用法代码示例。如果您正苦于以下问题:Java DescribedType类的具体用法?Java DescribedType怎么用?Java DescribedType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DescribedType类属于org.apache.qpid.proton.amqp包,在下文中一共展示了DescribedType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: equals

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
@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;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:26,代码来源:DescribedTypeImpl.java

示例2: doTestDecodeUnknownDescribedTypeSeries

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
private void doTestDecodeUnknownDescribedTypeSeries(int size) throws IOException {
    for (int i = 0; i < size; ++i) {
        encoder.writeObject(NoLocalType.NO_LOCAL);
    }

    buffer.clear();

    for (int i = 0; i < size; ++i) {
        final Object result = decoder.readObject();

        assertNotNull(result);
        assertTrue(result instanceof DescribedType);

        DescribedType resultTye = (DescribedType) result;
        assertEquals(NoLocalType.NO_LOCAL.getDescriptor(), resultTye.getDescriptor());
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:18,代码来源:UnknownDescribedTypeCodecTest.java

示例3: findFilter

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
/**
 * Search for a particular filter using a set of known indentification values
 * in the Map of filters.
 *
 * @param filters   The filters map that should be searched.
 * @param filterIds The aliases for the target filter to be located.
 * @return the filter if found in the mapping or null if not found.
 */
public static Map.Entry<Symbol, DescribedType> findFilter(Map<Symbol, Object> filters, Object[] filterIds) {

   if (filterIds == null || filterIds.length == 0) {
      throw new IllegalArgumentException("Invalid empty Filter Ids array passed: ");
   }

   if (filters == null || filters.isEmpty()) {
      return null;
   }

   for (Map.Entry<Symbol, Object> filter : filters.entrySet()) {
      if (filter.getValue() instanceof DescribedType) {
         DescribedType describedType = ((DescribedType) filter.getValue());
         Object descriptor = describedType.getDescriptor();

         for (Object filterId : filterIds) {
            if (descriptor.equals(filterId)) {
               return new AbstractMap.SimpleImmutableEntry<>(filter.getKey(), describedType);
            }
         }
      }
   }

   return null;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:34,代码来源:AmqpSupport.java

示例4: receiveFrame

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
void receiveFrame(int type, int channel, DescribedType describedType, Binary payload)
{
    Handler handler = getFirstHandler();
    if(handler == null)
    {
        Object actualDescriptor = describedType.getDescriptor();
        Object mappedDescriptor = FrameDescriptorMapping.lookupMapping(actualDescriptor);

        throw new IllegalStateException("No handler! Received frame, descriptor=" + actualDescriptor + "/" + mappedDescriptor);
    }

    if(handler instanceof FrameHandler)
    {
        ((FrameHandler)handler).frame(type, channel, describedType, payload, this);
        removeFirstHandler();
    }
    else
    {
        throw new IllegalStateException("Received frame but the next handler is a " + handler);
    }
}
 
开发者ID:apache,项目名称:qpid-jms,代码行数:22,代码来源:TestAmqpPeer.java

示例5: expectLinkFlowRespondWithTransfer

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
public void expectLinkFlowRespondWithTransfer(final HeaderDescribedType headerDescribedType,
                                              final MessageAnnotationsDescribedType messageAnnotationsDescribedType,
                                              final PropertiesDescribedType propertiesDescribedType,
                                              ApplicationPropertiesDescribedType appPropertiesDescribedType,
                                              final DescribedType content,
                                              final int count,
                                              final boolean drain,
                                              final boolean sendDrainFlowResponse,
                                              Matcher<UnsignedInteger> creditMatcher,
                                              final Integer nextIncomingId,
                                              boolean addMessageNumberProperty)
{
    expectLinkFlowRespondWithTransfer(headerDescribedType, messageAnnotationsDescribedType, propertiesDescribedType,
                                      appPropertiesDescribedType, content, count, drain, sendDrainFlowResponse,
                                      creditMatcher, nextIncomingId, false, addMessageNumberProperty);
}
 
开发者ID:apache,项目名称:qpid-jms,代码行数:17,代码来源:TestAmqpPeer.java

示例6: verify

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
/**
 * @param receivedBinary
 *      The received Binary value that should be validated.
 *
 * @return the number of bytes consumed from the provided Binary
 *
 * @throws RuntimeException if the provided Binary does not match expectation in some way
 */
public int verify(Binary receivedBinary) throws RuntimeException
{
    int length = receivedBinary.getLength();
    Data data = Data.Factory.create();
    long decoded = data.decode(receivedBinary.asByteBuffer());
    if(decoded > Integer.MAX_VALUE)
    {
        throw new IllegalStateException("Decoded more bytes than Binary supports holding");
    }

    if(decoded < length && !_expectTrailingBytes)
    {
        throw new IllegalArgumentException("Expected to consume all bytes, but trailing bytes remain: Got "
                                    + length + ", consumed "+ decoded);
    }

    DescribedType decodedDescribedType = data.getDescribedType();
    verifyReceivedDescribedType(decodedDescribedType);

    //Need to cast to int, but verified earlier that it is < Integer.MAX_VALUE
    return (int) decoded;
}
 
开发者ID:apache,项目名称:qpid-jms,代码行数:31,代码来源:AbstractMessageSectionMatcher.java

示例7: configureSource

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
protected void configureSource(Source source) {
    Map<Symbol, DescribedType> filters = new HashMap<Symbol, DescribedType>();

    if (info.getSubscriptionName() != null && !info.getSubscriptionName().isEmpty()) {
        source.setExpiryPolicy(TerminusExpiryPolicy.NEVER);
        source.setDurable(TerminusDurability.UNSETTLED_STATE);
        source.setDistributionMode(COPY);
    } else {
        source.setDurable(TerminusDurability.NONE);
        source.setExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH);
    }

    if (info.isNoLocal()) {
        filters.put(JMS_NO_LOCAL_SYMBOL, AmqpJmsNoLocalType.NO_LOCAL);
    }

    if (info.getSelector() != null && !info.getSelector().trim().equals("")) {
        filters.put(JMS_SELECTOR_SYMBOL, new AmqpJmsSelectorType(info.getSelector()));
    }

    if (!filters.isEmpty()) {
        source.setFilter(filters);
    }
}
 
开发者ID:fusesource,项目名称:hawtjms,代码行数:25,代码来源:AmqpConsumer.java

示例8: equals

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
@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());

}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:12,代码来源:DecoderImpl.java

示例9: writeDescribedType

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
public void writeDescribedType(final DescribedType d)
{
    if(d == null)
    {
        writeNull();
    }
    else
    {
        _buffer.put(DESCRIBED_TYPE_OP);
        writeObject(d.getDescriptor());
        writeObject(d.getDescribed());
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:14,代码来源:EncoderImpl.java

示例10: writeObject

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
public void writeObject(final Object o)
{
    if (o == null)
    {
        getBuffer().put(EncodingCodes.NULL);
        return;
    }

    AMQPType type = _typeRegistry.get(o.getClass());

    if(type == null)
    {
        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());
        }
    }
    else
    {
        type.write(o);
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:40,代码来源:EncoderImpl.java

示例11: getValue

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
@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);
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:9,代码来源:DescribedTypeElement.java

示例12: getEncoding

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
public TypeEncoding<DescribedType> 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;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:13,代码来源:DynamicDescribedType.java

示例13: testDecodeUnknownDescribedType

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
@Test
public void testDecodeUnknownDescribedType() throws Exception {
    encoder.writeObject(NoLocalType.NO_LOCAL);

    buffer.clear();

    Object result = decoder.readObject();
    assertTrue(result instanceof DescribedType);
    DescribedType resultTye = (DescribedType) result;
    assertEquals(NoLocalType.NO_LOCAL.getDescriptor(), resultTye.getDescriptor());
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:12,代码来源:UnknownDescribedTypeCodecTest.java

示例14: testDescribedArray

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
@Test
public void testDescribedArray() throws IOException
{
    Decoder d = createDecoder(getBytes("described_array"));
    DescribedType a[] = (DescribedType[]) (d.readArray());
    for (int i = 0; i < 10; ++i)
    {
        assertEquals(Symbol.valueOf("int-array"), a[i].getDescriptor());
        assertEquals(i, a[i].getDescribed());
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:12,代码来源:InteropTest.java

示例15: configureSource

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
protected void configureSource(Source source) {
   Map<Symbol, DescribedType> filters = new HashMap<>();
   Symbol[] outcomes = new Symbol[] {Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL, Released.DESCRIPTOR_SYMBOL, Modified.DESCRIPTOR_SYMBOL};

   if (getSubscriptionName() != null && !getSubscriptionName().isEmpty()) {
      source.setExpiryPolicy(TerminusExpiryPolicy.NEVER);
      source.setDurable(TerminusDurability.UNSETTLED_STATE);
      source.setDistributionMode(COPY);
   } else {
      source.setDurable(TerminusDurability.NONE);
      source.setExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH);
   }

   source.setOutcomes(outcomes);

   Modified modified = new Modified();
   modified.setDeliveryFailed(true);
   modified.setUndeliverableHere(false);

   source.setDefaultOutcome(modified);

   if (isNoLocal()) {
      filters.put(NO_LOCAL_NAME, AmqpNoLocalFilter.NO_LOCAL);
   }

   if (getSelector() != null && !getSelector().trim().equals("")) {
      filters.put(JMS_SELECTOR_NAME, new AmqpJmsSelectorFilter(getSelector()));
   }

   if (!filters.isEmpty()) {
      source.setFilter(filters);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:34,代码来源:AmqpReceiver.java


注:本文中的org.apache.qpid.proton.amqp.DescribedType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。