// Path: src/main/java/kafka/cluster/LogConfigs.java
// public class LogConfigs {
//     public static final String SegmentBytesProp = "segment.bytes";
//     public static final String SegmentMsProp = "segment.ms";
//     public static final String SegmentIndexBytesProp = "segment.index.bytes";
//     public static final String FlushMessagesProp = "flush.messages";
//     public static final String FlushMsProp = "flush.ms";
//     public static final String RetentionBytesProp = "retention.bytes";
//     public static final String RententionMsProp = "retention.ms";
//     public static final String MaxMessageBytesProp = "max.message.bytes";
//     public static final String IndexIntervalBytesProp = "index.interval.bytes";
//     public static final String DeleteRetentionMsProp = "delete.retention.ms";
//     public static final String FileDeleteDelayMsProp = "file.delete.delay.ms";
//     public static final String MinCleanableDirtyRatioProp = "min.cleanable.dirty.ratio";
//     public static final String CleanupPolicyProp = "cleanup.policy";
// 
//     public static Set<String> ConfigNames = Sets.newHashSet(SegmentBytesProp,
//             SegmentMsProp,
//             SegmentIndexBytesProp,
//             FlushMessagesProp,
//             FlushMsProp,
//             RetentionBytesProp,
//             RententionMsProp,
//             MaxMessageBytesProp,
//             IndexIntervalBytesProp,
//             FileDeleteDelayMsProp,
//             DeleteRetentionMsProp,
//             MinCleanableDirtyRatioProp,
//             CleanupPolicyProp);
// 
// 
//     /**
//      * Parse the given properties instance into a LogConfig object
//      */
//     public static LogConfig fromProps(Properties props) {
//         return new LogConfig(/*segmentSize =*/ Integer.parseInt(props.getProperty(SegmentBytesProp)),
//                 /*segmentMs =*/ Long.parseLong(props.getProperty(SegmentMsProp)),
//                 /*flushInterval =*/ Long.parseLong(props.getProperty(FlushMessagesProp)),
//                 /*flushMs =*/ Long.parseLong(props.getProperty(FlushMsProp)),
//                 /*retentionSize =*/ Long.parseLong(props.getProperty(RetentionBytesProp)),
//                 /*retentionMs =*/ Long.parseLong(props.getProperty(RententionMsProp)),
//                 /*maxMessageSize = */ Integer.parseInt(props.getProperty(MaxMessageBytesProp)),
//                 /*maxIndexSize =*/ Integer.parseInt(props.getProperty(SegmentIndexBytesProp)),
//                 /*indexInterval =*/ Integer.parseInt(props.getProperty(IndexIntervalBytesProp)),
//                 /*fileDeleteDelayMs =*/ Integer.parseInt(props.getProperty(FileDeleteDelayMsProp)),
//                 /*deleteRetentionMs = */Long.parseLong(props.getProperty(DeleteRetentionMsProp)),
//                 /*minCleanableRatio =*/ Double.parseDouble(props.getProperty(MinCleanableDirtyRatioProp)),
//                /* dedupe =*/ props.getProperty(CleanupPolicyProp).trim().toLowerCase() == "dedupe");
//     }
// 
//     /**
//      * Create a log config instance using the given properties and defaults
//      */
//     public static LogConfig fromProps(Properties defaults, Properties overrides) {
//         Properties props = new Properties(defaults);
//         props.putAll(overrides);
//         return fromProps(props);
//     }
// 
//     /**
//      * Check that property names are valid
//      */
//     public static void validateNames(Properties props) {
//         for (Object name : props.keySet())
//             checkState(ConfigNames.contains(name), String.format("Unknown configuration \"%s\".", name));
//     }
// 
//     /**
//      * Check that the given properties contain only valid log config names, and that all values can be parsed.
//      */
//     public static void validate(Properties props) {
//         validateNames(props);
//         fromProps(new LogConfig().toProps(), props); // check that we can parse the values
//     }
// }
// 
// Path: src/main/java/kafka/common/TopicAndPartition.java
// public class TopicAndPartition {
//     public final String topic;
//     public final int partition;
// 
//     public TopicAndPartition(String topic, int partition) {
//         this.topic = topic;
//         this.partition = partition;
//     }
// 
//     public TopicAndPartition(Tuple2<String, Integer> tuple) {
//         this(tuple._1, tuple._2);
//     }
// 
//     public TopicAndPartition(Partition partition) {
//         this(partition.topic, partition.partitionId);
//     }
// 
//     public TopicAndPartition(Replica replica) {
//         this(replica.topic, replica.partitionId);
//     }
// 
//     public Tuple2<String, Integer> asTuple() {
//         return Tuple2.make(topic, partition);
//     }
// 
//     @Override
//     public String toString() {
//         return String.format("[%s,%d]", topic, partition);
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         TopicAndPartition that = (TopicAndPartition) o;
// 
//         if (partition != that.partition) return false;
//         if (topic != null ? !topic.equals(that.topic) : that.topic != null) return false;
// 
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         int result = topic != null ? topic.hashCode() : 0;
//         result = 31 * result + partition;
//         return result;
//     }
// }


import com.google.common.base.Predicate;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import kafka.cluster.Broker;
import kafka.cluster.LogConfigs;
import kafka.common.TopicAndPartition;
import kafka.consumer.Whitelist;
import kafka.utils.*;
import org.I0Itec.zkclient.ZkClient;
import java.io.IOException;
import java.util.*;
import static com.google.common.base.Preconditions.checkState;
package kafka.admin;




public class TopicCommand {
    public static void main(String[] args) throws IOException {
        final TopicCommandOptions opts = new TopicCommandOptions(args);

        // should have exactly one action
        int actions = Utils.count(Lists.newArrayList(opts.createOpt, opts.deleteOpt, opts.listOpt, opts.alterOpt, opts.describeOpt), new Predicate<OptionSpec<?>>() {
            @Override
            public boolean apply(OptionSpec<?> _) {
                return opts.options.has(_);
            }
// Path: src/main/java/kafka/cluster/LogConfigs.java
// public class LogConfigs {
//     public static final String SegmentBytesProp = "segment.bytes";
//     public static final String SegmentMsProp = "segment.ms";
//     public static final String SegmentIndexBytesProp = "segment.index.bytes";
//     public static final String FlushMessagesProp = "flush.messages";
//     public static final String FlushMsProp = "flush.ms";
//     public static final String RetentionBytesProp = "retention.bytes";
//     public static final String RententionMsProp = "retention.ms";
//     public static final String MaxMessageBytesProp = "max.message.bytes";
//     public static final String IndexIntervalBytesProp = "index.interval.bytes";
//     public static final String DeleteRetentionMsProp = "delete.retention.ms";
//     public static final String FileDeleteDelayMsProp = "file.delete.delay.ms";
//     public static final String MinCleanableDirtyRatioProp = "min.cleanable.dirty.ratio";
//     public static final String CleanupPolicyProp = "cleanup.policy";
// 
//     public static Set<String> ConfigNames = Sets.newHashSet(SegmentBytesProp,
//             SegmentMsProp,
//             SegmentIndexBytesProp,
//             FlushMessagesProp,
//             FlushMsProp,
//             RetentionBytesProp,
//             RententionMsProp,
//             MaxMessageBytesProp,
//             IndexIntervalBytesProp,
//             FileDeleteDelayMsProp,
//             DeleteRetentionMsProp,
//             MinCleanableDirtyRatioProp,
//             CleanupPolicyProp);
// 
// 
//     /**
//      * Parse the given properties instance into a LogConfig object
//      */
//     public static LogConfig fromProps(Properties props) {
//         return new LogConfig(/*segmentSize =*/ Integer.parseInt(props.getProperty(SegmentBytesProp)),
//                 /*segmentMs =*/ Long.parseLong(props.getProperty(SegmentMsProp)),
//                 /*flushInterval =*/ Long.parseLong(props.getProperty(FlushMessagesProp)),
//                 /*flushMs =*/ Long.parseLong(props.getProperty(FlushMsProp)),
//                 /*retentionSize =*/ Long.parseLong(props.getProperty(RetentionBytesProp)),
//                 /*retentionMs =*/ Long.parseLong(props.getProperty(RententionMsProp)),
//                 /*maxMessageSize = */ Integer.parseInt(props.getProperty(MaxMessageBytesProp)),
//                 /*maxIndexSize =*/ Integer.parseInt(props.getProperty(SegmentIndexBytesProp)),
//                 /*indexInterval =*/ Integer.parseInt(props.getProperty(IndexIntervalBytesProp)),
//                 /*fileDeleteDelayMs =*/ Integer.parseInt(props.getProperty(FileDeleteDelayMsProp)),
//                 /*deleteRetentionMs = */Long.parseLong(props.getProperty(DeleteRetentionMsProp)),
//                 /*minCleanableRatio =*/ Double.parseDouble(props.getProperty(MinCleanableDirtyRatioProp)),
//                /* dedupe =*/ props.getProperty(CleanupPolicyProp).trim().toLowerCase() == "dedupe");
//     }
// 
//     /**
//      * Create a log config instance using the given properties and defaults
//      */
//     public static LogConfig fromProps(Properties defaults, Properties overrides) {
//         Properties props = new Properties(defaults);
//         props.putAll(overrides);
//         return fromProps(props);
//     }
// 
//     /**
//      * Check that property names are valid
//      */
//     public static void validateNames(Properties props) {
//         for (Object name : props.keySet())
//             checkState(ConfigNames.contains(name), String.format("Unknown configuration \"%s\".", name));
//     }
// 
//     /**
//      * Check that the given properties contain only valid log config names, and that all values can be parsed.
//      */
//     public static void validate(Properties props) {
//         validateNames(props);
//         fromProps(new LogConfig().toProps(), props); // check that we can parse the values
//     }
// }
// 
// Path: src/main/java/kafka/common/TopicAndPartition.java
// public class TopicAndPartition {
//     public final String topic;
//     public final int partition;
// 
//     public TopicAndPartition(String topic, int partition) {
//         this.topic = topic;
//         this.partition = partition;
//     }
// 
//     public TopicAndPartition(Tuple2<String, Integer> tuple) {
//         this(tuple._1, tuple._2);
//     }
// 
//     public TopicAndPartition(Partition partition) {
//         this(partition.topic, partition.partitionId);
//     }
// 
//     public TopicAndPartition(Replica replica) {
//         this(replica.topic, replica.partitionId);
//     }
// 
//     public Tuple2<String, Integer> asTuple() {
//         return Tuple2.make(topic, partition);
//     }
// 
//     @Override
//     public String toString() {
//         return String.format("[%s,%d]", topic, partition);
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         TopicAndPartition that = (TopicAndPartition) o;
// 
//         if (partition != that.partition) return false;
//         if (topic != null ? !topic.equals(that.topic) : that.topic != null) return false;
// 
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         int result = topic != null ? topic.hashCode() : 0;
//         result = 31 * result + partition;
//         return result;
//     }
// }


// Path: src/main/java/kafka/admin/TopicCommand.java
import com.google.common.base.Predicate;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import kafka.cluster.Broker;
import kafka.cluster.LogConfigs;
import kafka.common.TopicAndPartition;
import kafka.consumer.Whitelist;
import kafka.utils.*;
import org.I0Itec.zkclient.ZkClient;
import java.io.IOException;
import java.util.*;
import static com.google.common.base.Preconditions.checkState;

package kafka.admin;




public class TopicCommand {
    public static void main(String[] args) throws IOException {
        final TopicCommandOptions opts = new TopicCommandOptions(args);

        // should have exactly one action
        int actions = Utils.count(Lists.newArrayList(opts.createOpt, opts.deleteOpt, opts.listOpt, opts.alterOpt, opts.describeOpt), new Predicate<OptionSpec<?>>() {
            @Override
            public boolean apply(OptionSpec<?> _) {
                return opts.options.has(_);
            }
        });