/*
 * Copyright 2009-2010 MBTE Sweden AB.
 *
 * Licensed 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 redis.clients.jedis;

import redis.clients.util.ShardInfo;
import redis.clients.util.Sharded;

public class JedisShardInfo extends ShardInfo<Jedis> {
    public String toString() {
        return host + ":" + port + "*" + getWeight();
    }
    
    private int timeout;
    private String host;
    private int port;
    private String password = null;
    private String name = null;

    public String getHost() {
        return host;
    }

    public int getPort() {
        return port;
    }

    public JedisShardInfo(String host) {
        this(host, Protocol.DEFAULT_PORT);
    }
    public JedisShardInfo(String host, String name) {
    	this(host, Protocol.DEFAULT_PORT, name);
    }
    	 
    public JedisShardInfo(String host, int port) {
        this(host, port, 2000);
    }
    
    public JedisShardInfo(String host, int port, String name) {
    	this(host, port, 2000, name);
    }
    
    public JedisShardInfo(String host, int port, int timeout) {
        this(host, port, timeout, Sharded.DEFAULT_WEIGHT);
    }
    
    public JedisShardInfo(String host, int port, int timeout, String name) {
    	this(host, port, timeout, Sharded.DEFAULT_WEIGHT);
    	this.name = name;
    }
    
    public JedisShardInfo(String host, int port, int timeout, int weight) {
        super(weight);
        this.host = host;
        this.port = port;
        this.timeout = timeout;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String auth) {
        this.password = auth;
    }

    public int getTimeout() {
        return timeout;
    }

    public void setTimeout(int timeout) {
        this.timeout = timeout;
    }
    
    public String getName() {
    	return name ;
    }

    @Override
    public Jedis createResource() {
        return new Jedis(this);
    }
}

@@ -1,609 +1,4 @@
-/*%0A * Copyright 2009-2010 MBTE Sweden AB.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A
 pack
@@ -238,28 +238,24 @@
 ht();%0A    %7D%0A
-    
 %0A    private
@@ -583,24 +583,25 @@
 ORT);%0A    %7D%0A
+%0A
     public J
@@ -638,33 +638,36 @@
 ing name) %7B%0A    
-%09
+    
 this(host, Proto
@@ -701,14 +701,8 @@
   %7D%0A
-    %09 
 %0A   
@@ -779,36 +779,32 @@
 t, 2000);%0A    %7D%0A
-    
 %0A    public Jedi
@@ -848,33 +848,36 @@
 ing name) %7B%0A    
-%09
+    
 this(host, port,
@@ -888,36 +888,32 @@
 0, name);%0A    %7D%0A
-    
 %0A    public Jedi
@@ -1018,36 +1018,32 @@
 _WEIGHT);%0A    %7D%0A
-    
 %0A    public Jedi
@@ -1104,25 +1104,28 @@
 name) %7B%0A    
-%09
+    
 this(host, p
@@ -1167,17 +1167,20 @@
 T);%0A    
-%09
+    
 this.nam
@@ -1187,36 +1187,32 @@
 e = name;%0A    %7D%0A
-    
 %0A    public Jedi
@@ -1673,20 +1673,16 @@
 ;%0A    %7D%0A
-    
 %0A    pub
@@ -1712,9 +1712,12 @@
     
-%09
+    
 retu
@@ -1723,17 +1723,16 @@
 urn name
- 
 ;%0A    %7D%0A

remove strange license header