@SuppressWarnings("unchecked") public Set<Object> getAdminACLs(ActiveMQDestination destination) { return adminACLs.get(destination); }
@SuppressWarnings("unchecked") public Set<Object> getReadACLs(ActiveMQDestination destination) { return readACLs.get(destination); }
@SuppressWarnings("unchecked") public Set<Object> getWriteACLs(ActiveMQDestination destination) { return writeACLs.get(destination); }
public List<MessageReference> getMessages(ActiveMQDestination destination) { Set set = null; synchronized (lock) { set = subscriptionIndex.get(destination); } List<MessageReference> answer = new ArrayList<MessageReference>(); for (Iterator iter = set.iterator(); iter.hasNext();) { MessageQueue queue = (MessageQueue) iter.next(); queue.appendMessages(answer); } return answer; }
/** * Returns the value which matches the given destination or null if there is * no matching value. If there are multiple values, the results are sorted * and the last item (the biggest) is returned. * * @param destination the destination to find the value for * @return the largest matching value or null if no value matches */ @SuppressWarnings({"rawtypes", "unchecked"}) public DestinationMapEntry chooseValue(final ActiveMQDestination destination) { Set<DestinationMapEntry> set = get(destination); if (set == null || set.isEmpty()) { return null; } //Comparator to sort in order - we want to pick the exact match by destination or the //closest parent that applies final Comparator<DestinationMapEntry> comparator = new Comparator<DestinationMapEntry>() { @Override public int compare(DestinationMapEntry entry1, DestinationMapEntry entry2) { return destination.equals(entry1.destination) ? -1 : (destination.equals(entry2.destination) ? 1 : entry1.compareTo(entry2)); } }; //Sort and filter out any children and non matching entries final SortedSet<DestinationMapEntry> sortedSet = set.stream() .filter(entry -> isMatchOrParent(destination, (DestinationMapEntry)entry)) .collect(Collectors.toCollection(() -> new TreeSet<DestinationMapEntry>(comparator))); return sortedSet.size() > 0 ? sortedSet.first() : null; }
@Override public Destination intercept(Destination destination) { final ActiveMQDestination activeMQDestination = destination.getActiveMQDestination(); Set matchingDestinations = destinationMap.get(activeMQDestination); List<Destination> destinations = new ArrayList<Destination>(); for (Iterator iter = matchingDestinations.iterator(); iter.hasNext();) { VirtualDestination virtualDestination = (VirtualDestination) iter.next(); Destination newDestination = virtualDestination.intercept(destination); destinations.add(newDestination); } if (!destinations.isEmpty()) { if (destinations.size() == 1) { return destinations.get(0); } else { // should rarely be used but here just in case return createCompositeDestination(destination, destinations); } } // check if the destination instead matches any mapped destinations Set mappedDestinations = mappedDestinationMap.get(activeMQDestination); if (!mappedDestinations.isEmpty()) { // create a mapped destination interceptor VirtualDestination virtualDestination = (VirtualDestination) mappedDestinations.toArray(new VirtualDestination[mappedDestinations.size()])[0]; return virtualDestination.interceptMappedDestination(destination); } return destination; }
@Override public void send(ProducerBrokerExchange producerExchange, final Message messageSend) throws Exception { ActiveMQDestination activeMQDestination = messageSend.getDestination(); if (!interceptorMap.isEmpty() && activeMQDestination != null) { Set<MessageInterceptor> set = interceptorMap.get(activeMQDestination); if (set != null && !set.isEmpty()) { for (MessageInterceptor mi : set) { mi.intercept(producerExchange, messageSend); } } else { super.send(producerExchange, messageSend); } } else { super.send(producerExchange, messageSend); } } }
@SuppressWarnings("unchecked") public Set<Object> getReadACLs(ActiveMQDestination destination) { return readACLs.get(destination); }
/** * Provide an exact or wildcard lookup of destinations in the region * * @return a set of matching destination objects. */ public Set<Destination> getDestinations(ActiveMQDestination destination) { synchronized (destinationsMutex) { return destinationMap.get(destination); } }
@SuppressWarnings("unchecked") public Set<Object> getWriteACLs(ActiveMQDestination destination) { return writeACLs.get(destination); }
@SuppressWarnings("unchecked") public Set<Object> getWriteACLs(ActiveMQDestination destination) { return writeACLs.get(destination); }
@SuppressWarnings("unchecked") public Set<Object> getAdminACLs(ActiveMQDestination destination) { return adminACLs.get(destination); }
@SuppressWarnings("unchecked") public Set<Object> getReadACLs(ActiveMQDestination destination) { return readACLs.get(destination); }
@SuppressWarnings("unchecked") public Set<Object> getAdminACLs(ActiveMQDestination destination) { return adminACLs.get(destination); }
@Override public Set<BrokerModel> getBrokersForDestination(ActiveMQDestination destination) { return (Set<BrokerModel>) destinationMap.get(destination); }
public List<MessageReference> getMessages(ActiveMQDestination destination) { Set set = null; synchronized (lock) { set = subscriptionIndex.get(destination); } List<MessageReference> answer = new ArrayList<MessageReference>(); for (Iterator iter = set.iterator(); iter.hasNext();) { MessageQueue queue = (MessageQueue) iter.next(); queue.appendMessages(answer); } return answer; }
public List<MessageReference> getMessages(ActiveMQDestination destination) { Set set = null; synchronized (lock) { set = subscriptionIndex.get(destination); } List<MessageReference> answer = new ArrayList<MessageReference>(); for (Iterator iter = set.iterator(); iter.hasNext();) { MessageQueue queue = (MessageQueue) iter.next(); queue.appendMessages(answer); } return answer; }
public List<MessageReference> getMessages(ActiveMQDestination destination) { Set set = null; synchronized (lock) { set = subscriptionIndex.get(destination); } List<MessageReference> answer = new ArrayList<MessageReference>(); for (Iterator iter = set.iterator(); iter.hasNext();) { MessageQueue queue = (MessageQueue) iter.next(); queue.appendMessages(answer); } return answer; }
public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception { synchronized (destinationsMutex) { for (Iterator iter = destinationMap.get(info.getDestination()).iterator(); iter.hasNext();) { Destination dest = (Destination) iter.next(); dest.addProducer(context, info); } } }
public boolean processMessage(MessageRouter messageRouter, Message message) { ActiveMQDestination destination = message.getDestination(); Set<MessageInterceptor> set = this.interceptorMap.get(destination); if (set != null && !set.isEmpty()) { Message copy = message.copy(); for (MessageInterceptor mi : set) { mi.intercept(messageRouter, message); } return true; } return false; }