X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fmessagebus-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmessagebus%2Fapp%2Futil%2FUtil.java;fp=opendaylight%2Fmd-sal%2Fmessagebus-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmessagebus%2Fapp%2Futil%2FUtil.java;h=0000000000000000000000000000000000000000;hb=e258e0fef2bc38e35f09354f0fdd5136c69ad1a7;hp=8546f9a9290646929c7580e016fbf6a65ab0cdf7;hpb=5f587c3e2bfabc09fec49463d04a6fbeba414e9c;p=controller.git diff --git a/opendaylight/md-sal/messagebus-util/src/main/java/org/opendaylight/controller/messagebus/app/util/Util.java b/opendaylight/md-sal/messagebus-util/src/main/java/org/opendaylight/controller/messagebus/app/util/Util.java deleted file mode 100644 index 8546f9a929..0000000000 --- a/opendaylight/md-sal/messagebus-util/src/main/java/org/opendaylight/controller/messagebus/app/util/Util.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.messagebus.app.util; - -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Pattern; -import org.opendaylight.yangtools.yang.common.RpcResult; -import org.opendaylight.yangtools.yang.common.RpcResultBuilder; -import org.opendaylight.yangtools.yang.model.api.SchemaPath; - -@Deprecated(forRemoval = true) -public final class Util { - private Util() { - } - - public static ListenableFuture> resultRpcSuccessFor(final T output) { - return Futures.immediateFuture(RpcResultBuilder.success(output).build()); - } - - /** - * Method filters qnames based on wildcard strings. - * - * @param list list of SchemaPaths - * @param pattern matching pattern - * @return list of filtered qnames - */ - public static List expandQname(final List list, final Pattern pattern) { - final List matchingQnames = new ArrayList<>(); - - for (final SchemaPath notification : list) { - final String namespace = notification.getLastComponent().getNamespace().toString(); - if (pattern.matcher(namespace).matches()) { - matchingQnames.add(notification); - } - } - return matchingQnames; - } - - /** - * CREDIT to http://www.rgagnon.com/javadetails/java-0515.html. - */ - public static String wildcardToRegex(final String wildcard) { - final StringBuilder s = new StringBuilder(wildcard.length()); - s.append('^'); - for (final char c : wildcard.toCharArray()) { - switch (c) { - case '*': - s.append(".*"); - break; - case '?': - s.append('.'); - break; - // escape special regexp-characters - case '(': - case ')': - case '[': - case ']': - case '$': - case '^': - case '.': - case '{': - case '}': - case '|': - case '\\': - s.append("\\"); - s.append(c); - break; - default: - s.append(c); - break; - } - } - s.append('$'); - return s.toString(); - } -}