Return-Path: X-Original-To: apmail-curator-commits-archive@minotaur.apache.org Delivered-To: apmail-curator-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 91A761000F for ; Tue, 13 Jan 2015 12:45:12 +0000 (UTC) Received: (qmail 53533 invoked by uid 500); 13 Jan 2015 12:45:14 -0000 Delivered-To: apmail-curator-commits-archive@curator.apache.org Received: (qmail 53501 invoked by uid 500); 13 Jan 2015 12:45:14 -0000 Mailing-List: contact commits-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@curator.apache.org Delivered-To: mailing list commits@curator.apache.org Received: (qmail 53492 invoked by uid 99); 13 Jan 2015 12:45:14 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Jan 2015 12:45:14 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id D8CAC92D9E8; Tue, 13 Jan 2015 12:45:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: randgalt@apache.org To: commits@curator.apache.org Message-Id: <69f359c97ef54de0aca1c30fea8ebdac@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: curator git commit: Retain previous methods for backward compatibility Date: Tue, 13 Jan 2015 12:45:13 +0000 (UTC) Repository: curator Updated Branches: refs/heads/CURATOR-111 58328915a -> 9ccf2a3f7 Retain previous methods for backward compatibility Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/9ccf2a3f Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/9ccf2a3f Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/9ccf2a3f Branch: refs/heads/CURATOR-111 Commit: 9ccf2a3f7d5fb3808ede3c2a99af8d358b40815e Parents: 5832891 Author: randgalt Authored: Tue Jan 13 07:45:04 2015 -0500 Committer: randgalt Committed: Tue Jan 13 07:45:04 2015 -0500 ---------------------------------------------------------------------- .../framework/CuratorFrameworkFactory.java | 52 +++++++++++++++++--- 1 file changed, 46 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/9ccf2a3f/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java ---------------------------------------------------------------------- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java b/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java index 314d669..317426d 100644 --- a/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java +++ b/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java @@ -19,9 +19,8 @@ package org.apache.curator.framework; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; - import org.apache.curator.RetryPolicy; import org.apache.curator.ensemble.EnsembleProvider; import org.apache.curator.ensemble.fixed.FixedEnsembleProvider; @@ -36,7 +35,6 @@ import org.apache.curator.utils.DefaultZookeeperFactory; import org.apache.curator.utils.ZookeeperFactory; import org.apache.zookeeper.Watcher; import org.apache.zookeeper.ZooKeeper; - import java.net.InetAddress; import java.net.UnknownHostException; import java.util.Arrays; @@ -166,9 +164,7 @@ public class CuratorFrameworkFactory */ public Builder authorization(String scheme, byte[] auth) { - this.authInfos = Lists.newArrayList(); - this.authInfos.add(new AuthInfo(scheme, (auth != null) ? Arrays.copyOf(auth, auth.length) : null)); - return this; + return authorization(ImmutableList.of(new AuthInfo(scheme, (auth != null) ? Arrays.copyOf(auth, auth.length) : null))); } /** @@ -383,6 +379,50 @@ public class CuratorFrameworkFactory return namespace; } + @Deprecated + public String getAuthScheme() + { + switch ( authInfos.size() ) + { + case 0: + { + return null; + } + + case 1: + { + return authInfos.get(0).scheme; + } + + default: + { + throw new IllegalStateException("More than 1 auth has been added"); + } + } + } + + @Deprecated + public byte[] getAuthValue() + { + switch ( authInfos.size() ) + { + case 0: + { + return null; + } + + case 1: + { + return authInfos.get(0).getAuth(); + } + + default: + { + throw new IllegalStateException("More than 1 auth has been added"); + } + } + } + public List getAuthInfos() { return authInfos;