You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2015/01/13 13:49:38 UTC
[08/10] curator git commit: Retain previous methods for backward
compatibility
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/master
Commit: 9ccf2a3f7d5fb3808ede3c2a99af8d358b40815e
Parents: 5832891
Author: randgalt <ra...@apache.org>
Authored: Tue Jan 13 07:45:04 2015 -0500
Committer: randgalt <ra...@apache.org>
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<AuthInfo> getAuthInfos()
{
return authInfos;