public void removeAddressPart(final int pos) { SimpleString newAddress = new SimpleString(""); boolean started = false; for (int i = 0; i < addressParts.length; i++) { SimpleString addressPart = addressParts[i]; if (i != pos) { if (started) { newAddress = newAddress.concat('.'); } newAddress = newAddress.concat(addressPart); started = true; } } address = newAddress; addressParts = address.split(WildcardAddressManager.DELIM); containsWildCard = address.contains(WildcardAddressManager.SINGLE_WORD); }
/** * @return the sendRoles */ public String getSendRoles() { return sendRoles.toString(); }
@Override public boolean equals(final Object other) { if (this == other) { return true; } if (!(other instanceof QueueImpl)) return false; QueueImpl qother = (QueueImpl)other; return name.equals(qother.name); }
/** * Concatenates a SimpleString and a String * @param toAdd the String to concatenate with. * @return the concatenated SimpleString */ public SimpleString concat(final String toAdd) { return concat(new SimpleString(toAdd)); }
@Override public int getEncodeSize() { return addressMatch.sizeof() + SimpleString.sizeofNullableString(sendRoles) + SimpleString.sizeofNullableString(consumeRoles) + SimpleString.sizeofNullableString(createDurableQueueRoles) + SimpleString.sizeofNullableString(deleteDurableQueueRoles) + SimpleString.sizeofNullableString(createNonDurableQueueRoles) + SimpleString.sizeofNullableString(deleteNonDurableQueueRoles) + SimpleString.sizeofNullableString(manageRoles); }
/** * Concatenates 2 SimpleString's * @param toAdd the SimpleString to concatenate with. * @return the concatenated SimpleString */ public SimpleString concat(final SimpleString toAdd) { byte[] bytes = new byte[data.length + toAdd.getData().length]; System.arraycopy(data, 0, bytes, 0, data.length); System.arraycopy(toAdd.getData(), 0, bytes, data.length, toAdd.getData().length); return new SimpleString(bytes); }
public void putLongProperty(final String key, final long value) { properties.putLongProperty(new SimpleString(key), value); bufferValid = false; }
public void putStringProperty(final String key, final String value) { properties.putSimpleStringProperty(new SimpleString(key), SimpleString.toSimpleString(value)); bufferValid = false; }
/** * @param address * @throws Exception * @throws HornetQException */ private void validateDestination(SimpleString address) throws Exception, HornetQException { if ((address.startsWith(JMS_QUEUE_PREFIX) || address.startsWith(JMS_TOPIC_PREFIX)) && !address.equals(managementAddress)) { Bindings binding = server.getPostOffice().lookupBindingsForAddress(address); if (binding == null || binding.getBindings().size() == 0) { throw new HornetQException(HornetQException.ADDRESS_DOES_NOT_EXIST, "Address " + address + " has not been deployed"); } } }
public void unproposed(final SimpleString groupID) { if (groupID.toString().endsWith("." + this.getName())) { // this means this unproposed belongs to this routing, so we will // remove this group // This is removing the name and a . added, giving us the original groupID used // this is because a groupID is stored per queue, and only this queue is expiring at this point final SimpleString groupIDToRemove = (SimpleString)groupID.subSequence(0, groupID.length() - getName().length() - 1); // using an executor so we don't want to hold anyone just because of this getExecutor().execute(new Runnable() { public void run() { synchronized (QueueImpl.this) { if (groups.remove(groupIDToRemove) != null) { HornetQServerLogger.LOGGER.debug("Removing group after unproposal " + groupID + " from queue " + QueueImpl.this); } else { HornetQServerLogger.LOGGER.debug("Couldn't remove Removing group " + groupIDToRemove + " after unproposal on queue " + QueueImpl.this); } } } }); } }
public Enumeration getPropertyNames() throws JMSException { HashSet<String> set = new HashSet<String>(); for (SimpleString propName : message.getPropertyNames()) { if (!propName.startsWith(HornetQMessage.JMS) || propName.startsWith(HornetQMessage.JMSX) || propName.startsWith(HornetQMessage.JMS_)) { set.add(propName.toString()); } } set.add(HornetQMessage.JMSXDELIVERYCOUNT); return Collections.enumeration(set); }
/** * @see ClientRequestor#ClientRequestor(ClientSession, SimpleString) */ public ClientRequestor(final ClientSession session, final String requestAddress) throws Exception { this(session, SimpleString.toSimpleString(requestAddress)); }
public Identifier(final SimpleString name) { this.name = name; hash = name.hashCode(); value = null; }
private synchronized void doPutValue(final SimpleString key, final PropertyValue value) { if (key.startsWith(HQ_PROPNAME)) { internalProperties = true; } PropertyValue oldValue = properties.put(key, value); if (oldValue != null) { size += value.encodeSize() - oldValue.encodeSize(); } else { size += SimpleString.sizeofString(key) + value.encodeSize(); } }
filter.getFilterString().toString().equals(HornetQServerImpl.GENERIC_IGNORED_FILTER); SimpleString newName = queueBindingInfo.getQueueName().concat("-" + (duplicateID++)); HornetQServerLogger.LOGGER.queueDuplicatedRenaming(queueBindingInfo.getQueueName().toString(), newName.toString()); queueBindingInfo.replaceQueueName(newName);
public void clearProperties() throws JMSException { List<SimpleString> toRemove = new ArrayList<SimpleString>(); for (SimpleString propName : message.getPropertyNames()) { if (!propName.startsWith(HornetQMessage.JMS) || propName.startsWith(HornetQMessage.JMSX) || propName.startsWith(HornetQMessage.JMS_)) { toRemove.add(propName); } } for (SimpleString propName : toRemove) { message.removeProperty(propName); } propertiesReadOnly = false; }
@Override public int read(final char[] cbuf, final int off, final int len) throws IOException { synchronized (simpleString) { if (off < 0 || off > cbuf.length || len < 0 || off + len > cbuf.length || off + len < 0) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return 0; } int length = simpleString.length(); if (next >= length) { return -1; } int n = Math.min(length - next, len); simpleString.getChars(next, next + n, cbuf, off); next += n; return n; } }
/** * @return null if <code>filterStr</code> is null or an empty String and a valid filter else * @throws HornetQException if the string does not correspond to a valid filter */ public static Filter createFilter(final SimpleString filterStr) throws HornetQException { if (filterStr == null || filterStr.length() == 0) { return null; } else { return new FilterImpl(filterStr); } }
public RemoteQueueBindingImpl(final long id, final SimpleString address, final SimpleString uniqueName, final SimpleString routingName, final Long remoteQueueID, final SimpleString filterString, final Queue storeAndForwardQueue, final SimpleString bridgeName, final int distance) throws Exception { this.id = id; this.address = address; this.storeAndForwardQueue = storeAndForwardQueue; this.uniqueName = uniqueName; this.routingName = routingName; this.remoteQueueID = remoteQueueID; queueFilter = FilterImpl.createFilter(filterString); idsHeaderName = MessageImpl.HDR_ROUTE_TO_IDS.concat(bridgeName); this.distance = distance; }