[13/26] kafka git commit: KAFKA-2774: Rename Copycat to Kafka Connect

2015-11-08 Thread gwenshap
http://git-wip-us.apache.org/repos/asf/kafka/blob/417e283d/copycat/api/src/main/java/org/apache/kafka/copycat/data/CopycatSchema.java
--
diff --git 
a/copycat/api/src/main/java/org/apache/kafka/copycat/data/CopycatSchema.java 
b/copycat/api/src/main/java/org/apache/kafka/copycat/data/CopycatSchema.java
deleted file mode 100644
index 104abf1..000
--- a/copycat/api/src/main/java/org/apache/kafka/copycat/data/CopycatSchema.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 org.apache.kafka.copycat.data;
-
-import org.apache.kafka.copycat.errors.DataException;
-
-import java.math.BigDecimal;
-import java.nio.ByteBuffer;
-import java.util.*;
-
-public class CopycatSchema implements Schema {
-/**
- * Maps Schema.Types to a list of Java classes that can be used to 
represent them.
- */
-private static final Map SCHEMA_TYPE_CLASSES = new 
HashMap<>();
-/**
- * Maps known logical types to a list of Java classes that can be used to 
represent them.
- */
-private static final Map LOGICAL_TYPE_CLASSES = new 
HashMap<>();
-
-/**
- * Maps the Java classes to the corresponding Schema.Type.
- */
-private static final Map JAVA_CLASS_SCHEMA_TYPES = new 
HashMap<>();
-
-static {
-SCHEMA_TYPE_CLASSES.put(Type.INT8, Arrays.asList((Class) Byte.class));
-SCHEMA_TYPE_CLASSES.put(Type.INT16, Arrays.asList((Class) 
Short.class));
-SCHEMA_TYPE_CLASSES.put(Type.INT32, Arrays.asList((Class) 
Integer.class));
-SCHEMA_TYPE_CLASSES.put(Type.INT64, Arrays.asList((Class) Long.class));
-SCHEMA_TYPE_CLASSES.put(Type.FLOAT32, Arrays.asList((Class) 
Float.class));
-SCHEMA_TYPE_CLASSES.put(Type.FLOAT64, Arrays.asList((Class) 
Double.class));
-SCHEMA_TYPE_CLASSES.put(Type.BOOLEAN, Arrays.asList((Class) 
Boolean.class));
-SCHEMA_TYPE_CLASSES.put(Type.STRING, Arrays.asList((Class) 
String.class));
-// Bytes are special and have 2 representations. byte[] causes 
problems because it doesn't handle equals() and
-// hashCode() like we want objects to, so we support both byte[] and 
ByteBuffer. Using plain byte[] can cause
-// those methods to fail, so ByteBuffers are recommended
-SCHEMA_TYPE_CLASSES.put(Type.BYTES, Arrays.asList((Class) 
byte[].class, (Class) ByteBuffer.class));
-SCHEMA_TYPE_CLASSES.put(Type.ARRAY, Arrays.asList((Class) List.class));
-SCHEMA_TYPE_CLASSES.put(Type.MAP, Arrays.asList((Class) Map.class));
-SCHEMA_TYPE_CLASSES.put(Type.STRUCT, Arrays.asList((Class) 
Struct.class));
-
-for (Map.Entry schemaClasses : 
SCHEMA_TYPE_CLASSES.entrySet()) {
-for (Class schemaClass : schemaClasses.getValue())
-JAVA_CLASS_SCHEMA_TYPES.put(schemaClass, 
schemaClasses.getKey());
-}
-
-LOGICAL_TYPE_CLASSES.put(Decimal.LOGICAL_NAME, Arrays.asList((Class) 
BigDecimal.class));
-LOGICAL_TYPE_CLASSES.put(Date.LOGICAL_NAME, Arrays.asList((Class) 
java.util.Date.class));
-LOGICAL_TYPE_CLASSES.put(Time.LOGICAL_NAME, Arrays.asList((Class) 
java.util.Date.class));
-LOGICAL_TYPE_CLASSES.put(Timestamp.LOGICAL_NAME, Arrays.asList((Class) 
java.util.Date.class));
-// We don't need to put these into JAVA_CLASS_SCHEMA_TYPES since 
that's only used to determine schemas for
-// schemaless data and logical types will have ambiguous schemas (e.g. 
many of them use the same Java class) so
-// they should not be used without schemas.
-}
-
-// The type of the field
-private final Type type;
-private final boolean optional;
-private final Object defaultValue;
-
-private final List fields;
-private final Map fieldsByName;
-
-private final Schema keySchema;
-private final Schema valueSchema;
-
-// Optional name and version provide a built-in way to indicate what type 
of data is included. Most
-// useful for structs to indicate the semantics of the struct and map it 
to some existing underlying
-// serializer-specific schema. 

[13/26] kafka git commit: KAFKA-2774: Rename Copycat to Kafka Connect

2015-11-08 Thread gwenshap
http://git-wip-us.apache.org/repos/asf/kafka/blob/f2031d40/copycat/api/src/main/java/org/apache/kafka/copycat/data/CopycatSchema.java
--
diff --git 
a/copycat/api/src/main/java/org/apache/kafka/copycat/data/CopycatSchema.java 
b/copycat/api/src/main/java/org/apache/kafka/copycat/data/CopycatSchema.java
deleted file mode 100644
index 104abf1..000
--- a/copycat/api/src/main/java/org/apache/kafka/copycat/data/CopycatSchema.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 org.apache.kafka.copycat.data;
-
-import org.apache.kafka.copycat.errors.DataException;
-
-import java.math.BigDecimal;
-import java.nio.ByteBuffer;
-import java.util.*;
-
-public class CopycatSchema implements Schema {
-/**
- * Maps Schema.Types to a list of Java classes that can be used to 
represent them.
- */
-private static final Map SCHEMA_TYPE_CLASSES = new 
HashMap<>();
-/**
- * Maps known logical types to a list of Java classes that can be used to 
represent them.
- */
-private static final Map LOGICAL_TYPE_CLASSES = new 
HashMap<>();
-
-/**
- * Maps the Java classes to the corresponding Schema.Type.
- */
-private static final Map JAVA_CLASS_SCHEMA_TYPES = new 
HashMap<>();
-
-static {
-SCHEMA_TYPE_CLASSES.put(Type.INT8, Arrays.asList((Class) Byte.class));
-SCHEMA_TYPE_CLASSES.put(Type.INT16, Arrays.asList((Class) 
Short.class));
-SCHEMA_TYPE_CLASSES.put(Type.INT32, Arrays.asList((Class) 
Integer.class));
-SCHEMA_TYPE_CLASSES.put(Type.INT64, Arrays.asList((Class) Long.class));
-SCHEMA_TYPE_CLASSES.put(Type.FLOAT32, Arrays.asList((Class) 
Float.class));
-SCHEMA_TYPE_CLASSES.put(Type.FLOAT64, Arrays.asList((Class) 
Double.class));
-SCHEMA_TYPE_CLASSES.put(Type.BOOLEAN, Arrays.asList((Class) 
Boolean.class));
-SCHEMA_TYPE_CLASSES.put(Type.STRING, Arrays.asList((Class) 
String.class));
-// Bytes are special and have 2 representations. byte[] causes 
problems because it doesn't handle equals() and
-// hashCode() like we want objects to, so we support both byte[] and 
ByteBuffer. Using plain byte[] can cause
-// those methods to fail, so ByteBuffers are recommended
-SCHEMA_TYPE_CLASSES.put(Type.BYTES, Arrays.asList((Class) 
byte[].class, (Class) ByteBuffer.class));
-SCHEMA_TYPE_CLASSES.put(Type.ARRAY, Arrays.asList((Class) List.class));
-SCHEMA_TYPE_CLASSES.put(Type.MAP, Arrays.asList((Class) Map.class));
-SCHEMA_TYPE_CLASSES.put(Type.STRUCT, Arrays.asList((Class) 
Struct.class));
-
-for (Map.Entry schemaClasses : 
SCHEMA_TYPE_CLASSES.entrySet()) {
-for (Class schemaClass : schemaClasses.getValue())
-JAVA_CLASS_SCHEMA_TYPES.put(schemaClass, 
schemaClasses.getKey());
-}
-
-LOGICAL_TYPE_CLASSES.put(Decimal.LOGICAL_NAME, Arrays.asList((Class) 
BigDecimal.class));
-LOGICAL_TYPE_CLASSES.put(Date.LOGICAL_NAME, Arrays.asList((Class) 
java.util.Date.class));
-LOGICAL_TYPE_CLASSES.put(Time.LOGICAL_NAME, Arrays.asList((Class) 
java.util.Date.class));
-LOGICAL_TYPE_CLASSES.put(Timestamp.LOGICAL_NAME, Arrays.asList((Class) 
java.util.Date.class));
-// We don't need to put these into JAVA_CLASS_SCHEMA_TYPES since 
that's only used to determine schemas for
-// schemaless data and logical types will have ambiguous schemas (e.g. 
many of them use the same Java class) so
-// they should not be used without schemas.
-}
-
-// The type of the field
-private final Type type;
-private final boolean optional;
-private final Object defaultValue;
-
-private final List fields;
-private final Map fieldsByName;
-
-private final Schema keySchema;
-private final Schema valueSchema;
-
-// Optional name and version provide a built-in way to indicate what type 
of data is included. Most
-// useful for structs to indicate the semantics of the struct and map it 
to some existing underlying
-// serializer-specific schema.