public String getDestinationTypeAsString() { switch (getDestinationType()) { case QUEUE_TYPE: return "Queue"; case TOPIC_TYPE: return "Topic"; case TEMP_QUEUE_TYPE: return "TempQueue"; case TEMP_TOPIC_TYPE: return "TempTopic"; default: throw new IllegalArgumentException("Invalid destination type: " + getDestinationType()); } }
public static ActiveMQTopic getDestinationAdvisoryTopic(ActiveMQDestination destination) { switch (destination.getDestinationType()) { case ActiveMQDestination.QUEUE_TYPE: return QUEUE_ADVISORY_TOPIC; case ActiveMQDestination.TOPIC_TYPE: return TOPIC_ADVISORY_TOPIC; case ActiveMQDestination.TEMP_QUEUE_TYPE: return TEMP_QUEUE_ADVISORY_TOPIC; case ActiveMQDestination.TEMP_TOPIC_TYPE: return TEMP_TOPIC_ADVISORY_TOPIC; default: throw new RuntimeException("Unknown destination type: " + destination.getDestinationType()); } }
public static boolean matchesDestinations(ActiveMQDestination[] dests, final ActiveMQDestination destination) { if (dests != null && dests.length > 0) { for (ActiveMQDestination dest : dests) { DestinationFilter inclusionFilter = DestinationFilter.parseFilter(dest); if (dest != null && inclusionFilter.matches(destination) && dest.getDestinationType() == destination.getDestinationType()) { return true; } } } return false; }
public static ActiveMQDestination findMatchingDestination(ActiveMQDestination[] dests, ActiveMQDestination destination) { if (dests != null && dests.length > 0) { for (ActiveMQDestination dest : dests) { DestinationFilter inclusionFilter = DestinationFilter.parseFilter(dest); if (dest != null && inclusionFilter.matches(destination) && dest.getDestinationType() == destination.getDestinationType()) { return dest; } } } return null; }
protected JMSException createUnknownDestinationTypeException(ActiveMQDestination destination) { return new JMSException("Unknown destination type: " + destination.getDestinationType()); }
public ActiveMQDestination createDestination(String name) { return createDestination(name, getDestinationType()); }
public Region getRegion(ActiveMQDestination destination) throws JMSException { switch (destination.getDestinationType()) { case ActiveMQDestination.QUEUE_TYPE: return queueRegion; case ActiveMQDestination.TOPIC_TYPE: return topicRegion; case ActiveMQDestination.TEMP_QUEUE_TYPE: return tempQueueRegion; case ActiveMQDestination.TEMP_TOPIC_TYPE: return tempTopicRegion; default: throw createUnknownDestinationTypeException(destination); } }
public boolean matches(ActiveMQDestination destination) { if (destination.getDestinationType() != destinationType) return false; String[] path = DestinationPath.getDestinationPaths(destination); int length = prefixes.length; if (path.length == length) { for (int i = 0; i < length; i++) { String prefix = prefixes[i]; if (prefix != null && !prefix.equals(path[i])) { return false; } } return true; } return false; }
public void setCompositeDestinations(ActiveMQDestination[] destinations) { this.compositeDestinations = destinations; this.destinationPaths = null; this.hashValue = 0; this.isPattern = false; StringBuffer sb = new StringBuffer(); for (int i = 0; i < destinations.length; i++) { if (i != 0) { sb.append(COMPOSITE_SEPERATOR); } if (getDestinationType() == destinations[i].getDestinationType()) { sb.append(destinations[i].getPhysicalName()); } else { sb.append(destinations[i].getQualifiedName()); } } physicalName = sb.toString(); }
public static boolean matchesNetworkConfig(final NetworkBridgeConfiguration config, ActiveMQDestination destination) { List<ActiveMQDestination> includedDests = config.getDynamicallyIncludedDestinations(); if (includedDests != null && includedDests.size() > 0) { for (ActiveMQDestination dest : includedDests) { DestinationFilter inclusionFilter = DestinationFilter.parseFilter(dest); if (dest != null && inclusionFilter.matches(destination) && dest.getDestinationType() == destination.getDestinationType()) { return true; } } } return false; }
protected ActiveMQDestination convertDestination(ActiveMQDestination destination) { if (destination != null && destination.getPhysicalName().contains(pathSeparator)) { List<String> l = new ArrayList<String>(); StringTokenizer iter = new StringTokenizer(destination.getPhysicalName(), pathSeparator); while (iter.hasMoreTokens()) { String name = iter.nextToken().trim(); if (name.length() == 0) { continue; } l.add(name); } String newName = DestinationPath.toString(l.toArray(new String[l.size()])); return ActiveMQDestination.createDestination(newName, destination.getDestinationType()); } else { return destination; } }
for (ActiveMQDestination dest : dests) { DestinationFilter exclusionFilter = DestinationFilter.parseFilter(dest); if (dest != null && exclusionFilter.matches(destination) && dest.getDestinationType() == destination.getDestinationType()) { return false; for (ActiveMQDestination dest : dests) { DestinationFilter inclusionFilter = DestinationFilter.parseFilter(dest); if (dest != null && inclusionFilter.matches(destination) && dest.getDestinationType() == destination.getDestinationType()) { return true; for (ActiveMQDestination dest : dests) { DestinationFilter inclusionFilter = DestinationFilter.parseFilter(dest); if (dest != null && inclusionFilter.matches(destination) && dest.getDestinationType() == destination.getDestinationType()) { return true;
destinationBase = advisorySearchBase; } else { if ((destination.getDestinationType() & ActiveMQDestination.QUEUE_TYPE) == ActiveMQDestination.QUEUE_TYPE) { destinationBase = queueSearchMatchingFormat.format(new String[]{destination.getPhysicalName()}); if (queueSearchSubtreeBool) { if ((destination.getDestinationType() & ActiveMQDestination.TOPIC_TYPE) == ActiveMQDestination.TOPIC_TYPE) { destinationBase = topicSearchMatchingFormat.format(new String[]{destination.getPhysicalName()}); if (topicSearchSubtreeBool) {
public static DestinationFilter parseFilter(ActiveMQDestination destination) { if (destination.isComposite()) { return new CompositeDestinationFilter(destination); } String[] paths = DestinationPath.getDestinationPaths(destination); int idx = paths.length - 1; if (idx >= 0) { String lastPath = paths[idx]; if (lastPath.equals(ANY_DESCENDENT)) { return new PrefixDestinationFilter(paths, destination.getDestinationType()); } else { while (idx >= 0) { lastPath = paths[idx--]; if (lastPath.equals(ANY_CHILD)) { return new WildcardDestinationFilter(paths, destination.getDestinationType()); } } } } // if none of the paths contain a wildcard then use equality return new SimpleDestinationFilter(destination); }
public boolean matches(ActiveMQDestination destination) { if (destination.getDestinationType() != destinationType) return false; String[] path = DestinationPath.getDestinationPaths(destination.getPhysicalName()); int length = prefixes.length; if (path.length >= length) { int size = length - 1; for (int i = 0; i < size; i++) { if (!matches(prefixes[i],path[i])) { return false; } } return true; }else{ //want to look for the case where A matches A.> boolean match = true; for (int i = 0; (i < path.length && match); i++){ match = matches(prefixes[i], path[i]); } //paths get compacted - e.g. A.*.> will be compacted to A.> and by definition - the last element on //the prefix will be > if (match && prefixes.length == (path.length + 1)) { return true; } } return false; }
protected final Collection<Subscription> getRegionSubscriptions(ActiveMQDestination dest) { RegionBroker region_broker = (RegionBroker) brokerService.getRegionBroker(); Region region; Collection<Subscription> subs; region = null; switch (dest.getDestinationType()) { case ActiveMQDestination.QUEUE_TYPE: region = region_broker.getQueueRegion(); break; case ActiveMQDestination.TOPIC_TYPE: region = region_broker.getTopicRegion(); break; case ActiveMQDestination.TEMP_QUEUE_TYPE: region = region_broker.getTempQueueRegion(); break; case ActiveMQDestination.TEMP_TOPIC_TYPE: region = region_broker.getTempTopicRegion(); break; } if (region instanceof AbstractRegion) { subs = ((AbstractRegion) region).getSubscriptions().values(); } else { subs = null; } return subs; }
return 1; } else { if (destination.getDestinationType() == destination2.getDestinationType()) {
KahaDestination convert(ActiveMQDestination dest) { KahaDestination rc = new KahaDestination(); rc.setName(dest.getPhysicalName()); switch( dest.getDestinationType() ) { case ActiveMQDestination.QUEUE_TYPE: rc.setType(DestinationType.QUEUE); return rc; case ActiveMQDestination.TOPIC_TYPE: rc.setType(DestinationType.TOPIC); return rc; case ActiveMQDestination.TEMP_QUEUE_TYPE: rc.setType(DestinationType.TEMP_QUEUE); return rc; case ActiveMQDestination.TEMP_TOPIC_TYPE: rc.setType(DestinationType.TEMP_TOPIC); return rc; default: return null; } }
KahaDestination convert(ActiveMQDestination dest) { KahaDestination rc = new KahaDestination(); rc.setName(dest.getPhysicalName()); switch (dest.getDestinationType()) { case ActiveMQDestination.QUEUE_TYPE: rc.setType(DestinationType.QUEUE); return rc; case ActiveMQDestination.TOPIC_TYPE: rc.setType(DestinationType.TOPIC); return rc; case ActiveMQDestination.TEMP_QUEUE_TYPE: rc.setType(DestinationType.TEMP_QUEUE); return rc; case ActiveMQDestination.TEMP_TOPIC_TYPE: rc.setType(DestinationType.TEMP_TOPIC); return rc; default: return null; } }
ActiveMQDestination queryDestination = ActiveMQDestination.createDestination(destinationQuery,msgDest.getDestinationType()); Set<Destination> destinations = getDestinations(queryDestination);