use of org.apache.qpid.server.protocol.v1_0.type.messaging.DeleteOnNoLinksOrMessages 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;
}
Aggregations