summaryrefslogtreecommitdiff
path: root/java/common/src
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2007-09-19 23:29:44 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2007-09-19 23:29:44 +0000
commit05b3bf8f25b004ec8761c4d52a6740f60cbd9d2d (patch)
tree8c0e7030d95ec59cc409669ac091edf518fc869c /java/common/src
parent7ac52b8288273de98f3e97ee8e34776a61034bfc (diff)
downloadqpid-python-05b3bf8f25b004ec8761c4d52a6740f60cbd9d2d.tar.gz
merged the qpidity.url classes in to qpid.url and deleted qpidity.url
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@577464 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/common/src')
-rw-r--r--java/common/src/main/java/org/apache/qpid/url/BindingURLImpl.java (renamed from java/common/src/main/java/org/apache/qpidity/url/BindingURLImpl.java)8
-rw-r--r--java/common/src/main/java/org/apache/qpid/url/QpidBindingURL.java (renamed from java/common/src/main/java/org/apache/qpidity/url/BindingURL.java)4
-rw-r--r--java/common/src/main/java/org/apache/qpid/url/QpidURL.java (renamed from java/common/src/main/java/org/apache/qpidity/url/QpidURL.java)2
-rw-r--r--java/common/src/main/java/org/apache/qpid/url/QpidURLImpl.java (renamed from java/common/src/main/java/org/apache/qpidity/url/QpidURLImpl.java)2
-rw-r--r--java/common/src/main/java/org/apache/qpidity/url/URLHelper.java169
-rw-r--r--java/common/src/main/java/org/apache/qpidity/url/URLSyntaxException.java94
6 files changed, 8 insertions, 271 deletions
diff --git a/java/common/src/main/java/org/apache/qpidity/url/BindingURLImpl.java b/java/common/src/main/java/org/apache/qpid/url/BindingURLImpl.java
index 427e0f1413..2cf035f601 100644
--- a/java/common/src/main/java/org/apache/qpidity/url/BindingURLImpl.java
+++ b/java/common/src/main/java/org/apache/qpid/url/BindingURLImpl.java
@@ -5,9 +5,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -15,7 +15,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.qpidity.url;
+package org.apache.qpid.url;
import org.apache.qpidity.exchange.ExchangeDefaults;
import org.slf4j.LoggerFactory;
@@ -25,7 +25,7 @@ import java.util.HashMap;
import java.net.URI;
import java.net.URISyntaxException;
-public class BindingURLImpl implements BindingURL
+public class BindingURLImpl implements QpidBindingURL
{
private static final Logger _logger = LoggerFactory.getLogger(BindingURLImpl.class);
diff --git a/java/common/src/main/java/org/apache/qpidity/url/BindingURL.java b/java/common/src/main/java/org/apache/qpid/url/QpidBindingURL.java
index a795b05b22..00edbf1bc3 100644
--- a/java/common/src/main/java/org/apache/qpidity/url/BindingURL.java
+++ b/java/common/src/main/java/org/apache/qpid/url/QpidBindingURL.java
@@ -15,7 +15,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.qpidity.url;
+package org.apache.qpid.url;
import org.apache.qpid.framing.AMQShortString;
@@ -23,7 +23,7 @@ import org.apache.qpid.framing.AMQShortString;
Binding URL format:
<exch_class>://<exch_name>/[<destination>]/[<queue>]?<option>='<value>'[,<option>='<value>']*
*/
-public interface BindingURL
+public interface QpidBindingURL
{
public static final String OPTION_EXCLUSIVE = "exclusive";
public static final String OPTION_AUTODELETE = "autodelete";
diff --git a/java/common/src/main/java/org/apache/qpidity/url/QpidURL.java b/java/common/src/main/java/org/apache/qpid/url/QpidURL.java
index 579c13a4eb..1d94b31de2 100644
--- a/java/common/src/main/java/org/apache/qpidity/url/QpidURL.java
+++ b/java/common/src/main/java/org/apache/qpid/url/QpidURL.java
@@ -15,7 +15,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.qpidity.url;
+package org.apache.qpid.url;
import org.apache.qpidity.BrokerDetails;
diff --git a/java/common/src/main/java/org/apache/qpidity/url/QpidURLImpl.java b/java/common/src/main/java/org/apache/qpid/url/QpidURLImpl.java
index 20d5730d4f..b4a55e2bf4 100644
--- a/java/common/src/main/java/org/apache/qpidity/url/QpidURLImpl.java
+++ b/java/common/src/main/java/org/apache/qpid/url/QpidURLImpl.java
@@ -15,7 +15,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.qpidity.url;
+package org.apache.qpid.url;
import org.apache.qpidity.BrokerDetails;
import org.apache.qpidity.BrokerDetailsImpl;
diff --git a/java/common/src/main/java/org/apache/qpidity/url/URLHelper.java b/java/common/src/main/java/org/apache/qpidity/url/URLHelper.java
deleted file mode 100644
index eba1b0bbeb..0000000000
--- a/java/common/src/main/java/org/apache/qpidity/url/URLHelper.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.qpidity.url;
-
-import java.util.HashMap;
-
-public class URLHelper
-{
- public static char DEFAULT_OPTION_SEPERATOR = '&';
- public static char ALTERNATIVE_OPTION_SEPARATOR = ',';
- public static char BROKER_SEPARATOR = ';';
-
- public static void parseOptions(HashMap<String, String> optionMap, String options) throws URLSyntaxException
- {
- // options looks like this
- // brokerlist='tcp://host:port?option='value',option='value';vm://:3/virtualpath?option='value'',failover='method?option='value',option='value''
-
- if ((options == null) || (options.indexOf('=') == -1))
- {
- return;
- }
-
- int optionIndex = options.indexOf('=');
-
- String option = options.substring(0, optionIndex);
-
- int length = options.length();
-
- int nestedQuotes = 0;
-
- // to store index of final "'"
- int valueIndex = optionIndex;
-
- // Walk remainder of url.
- while ((nestedQuotes > 0) || (valueIndex < length))
- {
- valueIndex++;
-
- if (valueIndex >= length)
- {
- break;
- }
-
- if (options.charAt(valueIndex) == '\'')
- {
- if ((valueIndex + 1) < options.length())
- {
- if ((options.charAt(valueIndex + 1) == DEFAULT_OPTION_SEPERATOR)
- || (options.charAt(valueIndex + 1) == ALTERNATIVE_OPTION_SEPARATOR)
- || (options.charAt(valueIndex + 1) == BROKER_SEPARATOR)
- || (options.charAt(valueIndex + 1) == '\''))
- {
- nestedQuotes--;
-
- if (nestedQuotes == 0)
- {
- // We've found the value of an option
- break;
- }
- }
- else
- {
- nestedQuotes++;
- }
- }
- else
- {
- // We are at the end of the string
- // Check to see if we are corectly closing quotes
- if (options.charAt(valueIndex) == '\'')
- {
- nestedQuotes--;
- }
-
- break;
- }
- }
- }
-
- if ((nestedQuotes != 0) || (valueIndex < (optionIndex + 2)))
- {
- int sepIndex = 0;
-
- // Try and identify illegal separator character
- if (nestedQuotes > 1)
- {
- for (int i = 0; i < nestedQuotes; i++)
- {
- sepIndex = options.indexOf('\'', sepIndex);
- sepIndex++;
- }
- }
-
- if ((sepIndex >= options.length()) || (sepIndex == 0))
- {
- throw parseError(valueIndex, "Unterminated option", options);
- }
- else
- {
- throw parseError(sepIndex, "Unterminated option. Possible illegal option separator:'"
- + options.charAt(sepIndex) + "'", options);
- }
- }
-
- // optionIndex +2 to skip "='"
- String value = options.substring(optionIndex + 2, valueIndex);
-
- optionMap.put(option, value);
-
- if (valueIndex < (options.length() - 1))
- {
- // Recurse to get remaining options
- parseOptions(optionMap, options.substring(valueIndex + 2));
- }
- }
-
- public static URLSyntaxException parseError(int index, String error, String url)
- {
- return parseError(index, 1, error, url);
- }
-
- public static URLSyntaxException parseError(int index, int length, String error, String url)
- {
- return new URLSyntaxException(url, error, index, length);
- }
-
- public static String printOptions(HashMap<String, String> options)
- {
- if (options.isEmpty())
- {
- return "";
- }
- else
- {
- StringBuffer sb = new StringBuffer();
- sb.append('?');
- for (String key : options.keySet())
- {
- sb.append(key);
-
- sb.append("='");
-
- sb.append(options.get(key));
-
- sb.append("'");
- sb.append(DEFAULT_OPTION_SEPERATOR);
- }
-
- sb.deleteCharAt(sb.length() - 1);
-
- return sb.toString();
- }
- }
-}
diff --git a/java/common/src/main/java/org/apache/qpidity/url/URLSyntaxException.java b/java/common/src/main/java/org/apache/qpidity/url/URLSyntaxException.java
deleted file mode 100644
index bc65b70d14..0000000000
--- a/java/common/src/main/java/org/apache/qpidity/url/URLSyntaxException.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.qpidity.url;
-
-import java.net.URISyntaxException;
-
-public class URLSyntaxException extends URISyntaxException
-{
- private int _length;
-
- public URLSyntaxException(String url, String error, int index, int length)
- {
- super(url, error, index);
-
- _length = length;
- }
-
- private static String getPositionString(int index, int length)
- {
- StringBuffer sb = new StringBuffer(index + 1);
-
- for (int i = 0; i < index; i++)
- {
- sb.append(" ");
- }
-
- if (length > -1)
- {
- for (int i = 0; i < length; i++)
- {
- sb.append('^');
- }
- }
-
- return sb.toString();
- }
-
-
- public String toString()
- {
- StringBuffer sb = new StringBuffer();
-
- sb.append(getReason());
-
- if (getIndex() > -1)
- {
- if (_length != -1)
- {
- sb.append(" between indicies ");
- sb.append(getIndex());
- sb.append(" and ");
- sb.append(_length);
- }
- else
- {
- sb.append(" at index ");
- sb.append(getIndex());
- }
- }
-
- sb.append(" ");
- if (getIndex() != -1)
- {
- sb.append("\n");
- }
-
- sb.append(getInput());
-
- if (getIndex() != -1)
- {
- sb.append("\n");
- sb.append(getPositionString(getIndex(), _length));
- }
-
- return sb.toString();
- }
-
-
-}