Search in sources :

Example 1 with DeleteOnNoMessages

use of org.apache.qpid.server.protocol.v1_0.type.messaging.DeleteOnNoMessages in project qpid-broker-j by apache.

the class Session_1_0 method convertDynamicNodePropertiesToAttributes.

private Map<String, Object> convertDynamicNodePropertiesToAttributes(final Link_1_0<?, ?> link, final Map properties, final String nodeName) {
    // TODO convert AMQP 1-0 node properties to queue attributes
    LifetimePolicy lifetimePolicy = properties == null ? null : (LifetimePolicy) properties.get(LIFETIME_POLICY);
    Map<String, Object> attributes = new HashMap<>();
    attributes.put(ConfiguredObject.ID, UUID.randomUUID());
    attributes.put(ConfiguredObject.NAME, nodeName);
    attributes.put(ConfiguredObject.DURABLE, true);
    if (lifetimePolicy instanceof DeleteOnNoLinks) {
        attributes.put(ConfiguredObject.LIFETIME_POLICY, org.apache.qpid.server.model.LifetimePolicy.DELETE_ON_NO_LINKS);
    } else if (lifetimePolicy instanceof DeleteOnNoLinksOrMessages) {
        attributes.put(ConfiguredObject.LIFETIME_POLICY, org.apache.qpid.server.model.LifetimePolicy.IN_USE);
    } else if (lifetimePolicy instanceof DeleteOnClose) {
        attributes.put(ConfiguredObject.LIFETIME_POLICY, org.apache.qpid.server.model.LifetimePolicy.DELETE_ON_CREATING_LINK_CLOSE);
        final CreatingLinkInfo linkInfo = new CreatingLinkInfoImpl(link.getRole() == Role.SENDER, link.getRemoteContainerId(), link.getName());
        attributes.put("creatingLinkInfo", linkInfo);
    } else if (lifetimePolicy instanceof DeleteOnNoMessages) {
        attributes.put(ConfiguredObject.LIFETIME_POLICY, org.apache.qpid.server.model.LifetimePolicy.IN_USE);
    } else {
        attributes.put(ConfiguredObject.LIFETIME_POLICY, org.apache.qpid.server.model.LifetimePolicy.DELETE_ON_CONNECTION_CLOSE);
    }
    return attributes;
}
Also used : LifetimePolicy(org.apache.qpid.server.protocol.v1_0.type.LifetimePolicy) CreatingLinkInfoImpl(org.apache.qpid.server.queue.CreatingLinkInfoImpl) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) DeleteOnNoMessages(org.apache.qpid.server.protocol.v1_0.type.messaging.DeleteOnNoMessages) DeleteOnNoLinksOrMessages(org.apache.qpid.server.protocol.v1_0.type.messaging.DeleteOnNoLinksOrMessages) DeleteOnClose(org.apache.qpid.server.protocol.v1_0.type.messaging.DeleteOnClose) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) AbstractConfiguredObject(org.apache.qpid.server.model.AbstractConfiguredObject) DeleteOnNoLinks(org.apache.qpid.server.protocol.v1_0.type.messaging.DeleteOnNoLinks) CreatingLinkInfo(org.apache.qpid.server.queue.CreatingLinkInfo)

Aggregations

HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 AbstractConfiguredObject (org.apache.qpid.server.model.AbstractConfiguredObject)1 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)1 LifetimePolicy (org.apache.qpid.server.protocol.v1_0.type.LifetimePolicy)1 DeleteOnClose (org.apache.qpid.server.protocol.v1_0.type.messaging.DeleteOnClose)1 DeleteOnNoLinks (org.apache.qpid.server.protocol.v1_0.type.messaging.DeleteOnNoLinks)1 DeleteOnNoLinksOrMessages (org.apache.qpid.server.protocol.v1_0.type.messaging.DeleteOnNoLinksOrMessages)1 DeleteOnNoMessages (org.apache.qpid.server.protocol.v1_0.type.messaging.DeleteOnNoMessages)1 CreatingLinkInfo (org.apache.qpid.server.queue.CreatingLinkInfo)1 CreatingLinkInfoImpl (org.apache.qpid.server.queue.CreatingLinkInfoImpl)1