avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r1556891 - in /avro/trunk: ./ lang/java/ lang/java/avro/ lang/java/avro/src/main/java/org/apache/avro/reflect/ lang/java/avro/src/main/java/org/apache/avro/specific/ lang/java/avro/src/main/java/org/apache/avro/util/ lang/java/compiler/ lan...
Date Thu, 09 Jan 2014 17:24:51 GMT
Author: cutting
Date: Thu Jan  9 17:24:50 2014
New Revision: 1556891

URL: http://svn.apache.org/r1556891
Log:
AVRO-987. Java: Make Avro OSGI-ready. Contributed by Ioannis Canellos.

Added:
    avro/trunk/lang/java/avro/src/main/java/org/apache/avro/util/ClassUtils.java   (with props)
Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/java/avro/pom.xml
    avro/trunk/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java
    avro/trunk/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java
    avro/trunk/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumReader.java
    avro/trunk/lang/java/compiler/pom.xml
    avro/trunk/lang/java/ipc/pom.xml
    avro/trunk/lang/java/mapred/pom.xml
    avro/trunk/lang/java/pom.xml
    avro/trunk/lang/java/protobuf/pom.xml
    avro/trunk/lang/java/protobuf/src/main/java/org/apache/avro/protobuf/ProtobufData.java
    avro/trunk/lang/java/protobuf/src/main/java/org/apache/avro/protobuf/ProtobufDatumReader.java
    avro/trunk/lang/java/thrift/pom.xml
    avro/trunk/lang/java/thrift/src/main/java/org/apache/avro/thrift/ThriftData.java
    avro/trunk/lang/java/thrift/src/main/java/org/apache/avro/thrift/ThriftDatumReader.java
    avro/trunk/lang/java/tools/pom.xml

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1556891&r1=1556890&r2=1556891&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Thu Jan  9 17:24:50 2014
@@ -78,6 +78,8 @@ Trunk (not yet released)
     AVRO-1426. Java: Add mapreduce word count example.
     (Jesse Anderson via cutting)
 
+    AVRO-987. Java: Make Avro OSGI-ready. (Ioannis Canellos via cutting)
+
   BUG FIXES
 
     AVRO-1368. Fix SpecificDatumWriter to, when writing a string

Modified: avro/trunk/lang/java/avro/pom.xml
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/avro/pom.xml?rev=1556891&r1=1556890&r2=1556891&view=diff
==============================================================================
--- avro/trunk/lang/java/avro/pom.xml (original)
+++ avro/trunk/lang/java/avro/pom.xml Thu Jan  9 17:24:50 2014
@@ -32,6 +32,18 @@
   <name>Apache Avro</name>
   <url>http://avro.apache.org</url>
   <description>Avro core components</description>
+  <packaging>bundle</packaging>
+
+  <properties>
+    <osgi.import>
+      !org.apache.avro*,
+      com.thoughtworks.paranamer,
+      org.codehaus.jackson*,
+      org.xerial.snappy;resolution:=optional,
+      *
+    </osgi.import>
+    <osgi.export>org.apache.avro*;version="${project.version}"</osgi.export>
+  </properties>
 
   <build>
     <resources>

Modified: avro/trunk/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java?rev=1556891&r1=1556890&r2=1556891&view=diff
==============================================================================
--- avro/trunk/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java (original)
+++ avro/trunk/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java Thu Jan
 9 17:24:50 2014
@@ -47,6 +47,7 @@ import org.apache.avro.generic.GenericCo
 import org.apache.avro.generic.GenericFixed;
 import org.apache.avro.generic.IndexedRecord;
 import org.apache.avro.io.BinaryData;
+import org.apache.avro.util.ClassUtils;
 import org.apache.avro.io.DatumReader;
 import org.apache.avro.io.DatumWriter;
 import org.apache.avro.specific.FixedSize;
@@ -308,7 +309,7 @@ public class ReflectData extends Specifi
     if (c != null)
        return c;
     try {
-      c = Class.forName(name);
+      c =  ClassUtils.forName(name);
       CLASS_CACHE.put(name, c);
     } catch (ClassNotFoundException e) {
       throw new AvroRuntimeException(e);

Modified: avro/trunk/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java?rev=1556891&r1=1556890&r2=1556891&view=diff
==============================================================================
--- avro/trunk/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java (original)
+++ avro/trunk/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java Thu
Jan  9 17:24:50 2014
@@ -34,6 +34,7 @@ import org.apache.avro.Protocol;
 import org.apache.avro.AvroRuntimeException;
 import org.apache.avro.AvroTypeException;
 import org.apache.avro.Schema.Type;
+import org.apache.avro.util.ClassUtils;
 import org.apache.avro.generic.GenericData;
 import org.apache.avro.io.DatumReader;
 import org.apache.avro.io.DatumWriter;
@@ -128,7 +129,7 @@ public class SpecificData extends Generi
       Class c = classCache.get(name);
       if (c == null) {
         try {
-          c = getClassLoader().loadClass(getClassName(schema));
+          c = ClassUtils.forName(getClassLoader(), getClassName(schema));
         } catch (ClassNotFoundException e) {
           c = NO_CLASS;
         }

Modified: avro/trunk/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumReader.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumReader.java?rev=1556891&r1=1556890&r2=1556891&view=diff
==============================================================================
--- avro/trunk/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumReader.java
(original)
+++ avro/trunk/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumReader.java
Thu Jan  9 17:24:50 2014
@@ -20,6 +20,7 @@ package org.apache.avro.specific;
 import org.apache.avro.Schema;
 import org.apache.avro.AvroRuntimeException;
 import org.apache.avro.generic.GenericDatumReader;
+import org.apache.avro.util.ClassUtils;
 
 /** {@link org.apache.avro.io.DatumReader DatumReader} for generated Java classes. */
 public class SpecificDatumReader<T> extends GenericDatumReader<T> {
@@ -91,7 +92,7 @@ public class SpecificDatumReader<T> exte
     String name = schema.getProp(prop);
     if (name == null) return null;
     try {
-      return Class.forName(name);
+      return ClassUtils.forName(getData().getClassLoader(), name);
     } catch (ClassNotFoundException e) {
       throw new AvroRuntimeException(e);
     }

Added: avro/trunk/lang/java/avro/src/main/java/org/apache/avro/util/ClassUtils.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/avro/src/main/java/org/apache/avro/util/ClassUtils.java?rev=1556891&view=auto
==============================================================================
--- avro/trunk/lang/java/avro/src/main/java/org/apache/avro/util/ClassUtils.java (added)
+++ avro/trunk/lang/java/avro/src/main/java/org/apache/avro/util/ClassUtils.java Thu Jan 
9 17:24:50 2014
@@ -0,0 +1,109 @@
+/**
+ * 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.avro.util;
+
+public class ClassUtils {
+
+  private ClassUtils() {
+  }
+
+  /**
+   * Loads a class using the class loader.
+   * 1. The class loader of the current class is being used.
+   * 2. The thread context class loader is being used.
+   * If both approaches fail, returns null.
+   *
+   * @param className The name of the class to load.
+   * @return The class or null if no class loader could load the class.
+   */
+  public static Class<?> forName(String className)
+    throws ClassNotFoundException {
+    return ClassUtils.forName(ClassUtils.class, className);
+  }
+
+  /**
+   * Loads a class using the class loader.
+   * 1. The class loader of the context class is being used.
+   * 2. The thread context class loader is being used.
+   * If both approaches fail, returns null.
+   *
+   * @param contextClass The name of a context class to use.
+   * @param className    The name of the class to load
+   * @return The class or null if no class loader could load the class.
+   */
+  public static Class<?> forName(Class<?> contextClass, String className)
+    throws ClassNotFoundException {
+    Class<?> c = null;
+    if (contextClass.getClassLoader() != null) {
+      c = forName(className, contextClass.getClassLoader());
+    }
+    if (c == null
+        && Thread.currentThread().getContextClassLoader() != null) {
+      c = forName(className, Thread.currentThread().getContextClassLoader());
+    }
+    if (c == null) {
+      throw new ClassNotFoundException("Failed to load class" + className);
+    }
+    return c;
+  }
+
+  /**
+   * Loads a class using the class loader.
+   * 1. The class loader of the context class is being used.
+   * 2. The thread context class loader is being used.
+   * If both approaches fail, returns null.
+   *
+   * @param classLoader The classloader to use.
+   * @param className    The name of the class to load
+   * @return The class or null if no class loader could load the class.
+   */
+  public static Class<?> forName(ClassLoader classLoader, String className)
+    throws ClassNotFoundException {
+    Class<?> c = null;
+    if (classLoader != null) {
+      c = forName(className, classLoader);
+    }
+    if (c == null && Thread.currentThread().getContextClassLoader() != null) {
+      c = forName(className, Thread.currentThread().getContextClassLoader());
+    }
+    if (c == null) {
+      throw new ClassNotFoundException("Failed to load class" + className);
+    }
+    return c;
+  }
+
+  /**
+   * Loads a {@link Class} from the specified {@link ClassLoader} without
+   * throwing {@link ClassNotFoundException}.
+   *
+   * @param className
+   * @param classLoader
+   * @return
+   */
+  private static Class<?> forName(String className, ClassLoader classLoader) {
+    Class<?> c = null;
+    if (classLoader != null && className != null) {
+      try {
+        c = Class.forName(className, true, classLoader);
+      } catch (ClassNotFoundException e) {
+        //Ignore and return null
+      }
+    }
+    return c;
+  }
+}

Propchange: avro/trunk/lang/java/avro/src/main/java/org/apache/avro/util/ClassUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: avro/trunk/lang/java/compiler/pom.xml
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/compiler/pom.xml?rev=1556891&r1=1556890&r2=1556891&view=diff
==============================================================================
--- avro/trunk/lang/java/compiler/pom.xml (original)
+++ avro/trunk/lang/java/compiler/pom.xml Thu Jan  9 17:24:50 2014
@@ -30,9 +30,22 @@
   <artifactId>avro-compiler</artifactId>
 
   <name>Apache Avro Compiler</name>
+  <packaging>bundle</packaging>
   <url>http://avro.apache.org</url>
   <description>Compilers for Avro IDL and Avro Specific Java API</description>
 
+  <properties>
+    <osgi.import>
+      !org.apache.avro.compiler*,
+      org.apache.avro*;version="${project.version}",
+      org.apache.commons.lang*,
+      org.apache.commons.velocity*,
+      org.apache.ant*,
+      *
+    </osgi.import>
+    <osgi.export>org.apache.avro.compiler*;version="${project.version}"</osgi.export>
+  </properties>
+
   <build>
     <resources>
       <resource>

Modified: avro/trunk/lang/java/ipc/pom.xml
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/ipc/pom.xml?rev=1556891&r1=1556890&r2=1556891&view=diff
==============================================================================
--- avro/trunk/lang/java/ipc/pom.xml (original)
+++ avro/trunk/lang/java/ipc/pom.xml Thu Jan  9 17:24:50 2014
@@ -32,6 +32,20 @@
   <name>Apache Avro IPC</name>
   <url>http://avro.apache.org</url>
   <description>Avro inter-process communication components</description>
+  <packaging>bundle</packaging>
+
+  <properties>
+    <osgi.import>
+      !org.apache.avro.ipc*,
+      org.apache.avro*;version="${project.version}",
+      org.jboss.netty*,
+      javax.servlet*;resolution:=optional,
+      org.mortbay*;resolution:=optional,
+      org.apache.velocity*;resolution:=optional,
+      *
+    </osgi.import>
+    <osgi.export>org.apache.avro.ipc*;version="${project.version}"</osgi.export>
+  </properties>
 
   <build>
     <resources>

Modified: avro/trunk/lang/java/mapred/pom.xml
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/mapred/pom.xml?rev=1556891&r1=1556890&r2=1556891&view=diff
==============================================================================
--- avro/trunk/lang/java/mapred/pom.xml (original)
+++ avro/trunk/lang/java/mapred/pom.xml Thu Jan  9 17:24:50 2014
@@ -31,6 +31,17 @@
 
   <name>Apache Avro Mapred API</name>
   <description>An org.apache.hadoop.mapred compatible API for using Avro Serializatin
in Hadoop</description>
+  <packaging>bundle</packaging>
+
+  <properties>
+    <osgi.import>
+      !org.apache.avro.mapred*,
+      org.apache.avro*;version="${project.version}",
+      org.apache.hadoop*,
+      *
+    </osgi.import>
+    <osgi.export>org.apache.avro.mapred*;version="${project.version}"</osgi.export>
+  </properties>
 
   <build>
     <plugins>

Modified: avro/trunk/lang/java/pom.xml
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/pom.xml?rev=1556891&r1=1556890&r2=1556891&view=diff
==============================================================================
--- avro/trunk/lang/java/pom.xml (original)
+++ avro/trunk/lang/java/pom.xml Thu Jan  9 17:24:50 2014
@@ -66,6 +66,7 @@
 
     <!-- version properties for plugins -->
     <checkstyle-plugin.version>2.8</checkstyle-plugin.version>
+    <bundle-plugin-version>2.1.0</bundle-plugin-version>
     <compiler-plugin.version>2.3.2</compiler-plugin.version>
     <exec-plugin.version>1.2.1</exec-plugin.version>
     <jar-plugin.version>2.3.2</jar-plugin.version>
@@ -277,6 +278,38 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-checkstyle-plugin</artifactId>
       </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>${bundle-plugin-version}</version>
+        <extensions>true</extensions>
+        <inherited>true</inherited>
+        <configuration>
+          <instructions>
+            <Bundle-Name>${project.name}</Bundle-Name>
+            <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+            <Export-Package>${osgi.export}</Export-Package>
+            <Import-Package>${osgi.import}</Import-Package>
+            <DynamicImport-Package>${osgi.dynamic.import}</DynamicImport-Package>
+            <Private-Package>${osgi.private}</Private-Package>
+            <Require-Bundle>${osgi.bundles}</Require-Bundle>
+            <Bundle-Activator>${osgi.activator}</Bundle-Activator>
+          </instructions>
+          <supportedProjectTypes>
+            <supportedProjectType>bundle</supportedProjectType>
+          </supportedProjectTypes>
+          <unpackBundle>true</unpackBundle>
+        </configuration>
+        <executions>
+          <execution>
+            <id>bundle-manifest</id>
+            <phase>process-classes</phase>
+            <goals>
+              <goal>manifest</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 

Modified: avro/trunk/lang/java/protobuf/pom.xml
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/protobuf/pom.xml?rev=1556891&r1=1556890&r2=1556891&view=diff
==============================================================================
--- avro/trunk/lang/java/protobuf/pom.xml (original)
+++ avro/trunk/lang/java/protobuf/pom.xml Thu Jan  9 17:24:50 2014
@@ -31,6 +31,17 @@
 
   <name>Apache Avro Protobuf Compatibility</name>
   <description>Permit serialization of Protobuf-generated classes as Avro data.</description>
+  <packaging>bundle</packaging>
+
+  <properties>
+    <osgi.import>
+      !org.apache.avro.protobuf*,
+      org.apache.avro*;version="${project.version}",
+      com.google.protobuf*;version="${project.version}",
+      *
+    </osgi.import>
+    <osgi.export>org.apache.avro.protobuf*;version="${project.version}"</osgi.export>
+  </properties>
 
   <profiles>
     <profile>

Modified: avro/trunk/lang/java/protobuf/src/main/java/org/apache/avro/protobuf/ProtobufData.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/protobuf/src/main/java/org/apache/avro/protobuf/ProtobufData.java?rev=1556891&r1=1556890&r2=1556891&view=diff
==============================================================================
--- avro/trunk/lang/java/protobuf/src/main/java/org/apache/avro/protobuf/ProtobufData.java
(original)
+++ avro/trunk/lang/java/protobuf/src/main/java/org/apache/avro/protobuf/ProtobufData.java
Thu Jan  9 17:24:50 2014
@@ -45,6 +45,7 @@ import com.google.protobuf.Descriptors.E
 import com.google.protobuf.Descriptors.FileDescriptor;
 import com.google.protobuf.DescriptorProtos.FileOptions;
 
+import org.apache.avro.util.ClassUtils;
 import org.codehaus.jackson.JsonFactory;
 import org.codehaus.jackson.JsonNode;
 import org.codehaus.jackson.map.ObjectMapper;
@@ -133,7 +134,7 @@ public class ProtobufData extends Generi
   @Override
   public Object newRecord(Object old, Schema schema) {
     try {
-      Class c = Class.forName(SpecificData.getClassName(schema));
+      Class c = ClassUtils.forName(SpecificData.getClassName(schema));
       if (c == null)
         return newRecord(old, schema);            // punt to generic
       if (c.isInstance(old))

Modified: avro/trunk/lang/java/protobuf/src/main/java/org/apache/avro/protobuf/ProtobufDatumReader.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/protobuf/src/main/java/org/apache/avro/protobuf/ProtobufDatumReader.java?rev=1556891&r1=1556890&r2=1556891&view=diff
==============================================================================
--- avro/trunk/lang/java/protobuf/src/main/java/org/apache/avro/protobuf/ProtobufDatumReader.java
(original)
+++ avro/trunk/lang/java/protobuf/src/main/java/org/apache/avro/protobuf/ProtobufDatumReader.java
Thu Jan  9 17:24:50 2014
@@ -25,6 +25,7 @@ import org.apache.avro.generic.GenericDa
 import org.apache.avro.specific.SpecificData;
 import org.apache.avro.io.Decoder;
 import org.apache.avro.io.ResolvingDecoder;
+import org.apache.avro.util.ClassUtils;
 
 import com.google.protobuf.ByteString;
 import com.google.protobuf.Message;
@@ -66,7 +67,7 @@ public class ProtobufDatumReader<T> exte
   @Override
   protected Object createEnum(String symbol, Schema schema) {
     try {
-      Class c = Class.forName(SpecificData.getClassName(schema));
+      Class c = ClassUtils.forName(SpecificData.getClassName(schema));
       if (c == null) return super.createEnum(symbol, schema); // punt to generic
       return ((ProtocolMessageEnum)Enum.valueOf(c, symbol)).getValueDescriptor();
     } catch (Exception e) {

Modified: avro/trunk/lang/java/thrift/pom.xml
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/thrift/pom.xml?rev=1556891&r1=1556890&r2=1556891&view=diff
==============================================================================
--- avro/trunk/lang/java/thrift/pom.xml (original)
+++ avro/trunk/lang/java/thrift/pom.xml Thu Jan  9 17:24:50 2014
@@ -31,6 +31,17 @@
 
   <name>Apache Avro Thrift Compatibility</name>
   <description>Permit serialization of Thrift-generated classes as Avro data.</description>
+  <packaging>bundle</packaging>
+
+  <properties>
+    <osgi.import>
+      !org.apache.avro.thrift*,
+      org.apache.avro*;version="${project.version}",
+      org.apache.thrift*,
+      *
+    </osgi.import>
+    <osgi.export>org.apache.avro.thrift*;version="${project.version}"</osgi.export>
+  </properties>
 
   <profiles>
     <profile>

Modified: avro/trunk/lang/java/thrift/src/main/java/org/apache/avro/thrift/ThriftData.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/thrift/src/main/java/org/apache/avro/thrift/ThriftData.java?rev=1556891&r1=1556890&r2=1556891&view=diff
==============================================================================
--- avro/trunk/lang/java/thrift/src/main/java/org/apache/avro/thrift/ThriftData.java (original)
+++ avro/trunk/lang/java/thrift/src/main/java/org/apache/avro/thrift/ThriftData.java Thu Jan
 9 17:24:50 2014
@@ -32,6 +32,7 @@ import org.apache.avro.specific.Specific
 import org.apache.avro.io.DatumReader;
 import org.apache.avro.io.DatumWriter;
 
+import org.apache.avro.util.ClassUtils;
 import org.apache.thrift.TBase;
 import org.apache.thrift.TEnum;
 import org.apache.thrift.TFieldIdEnum;
@@ -135,7 +136,7 @@ public class ThriftData extends GenericD
   @Override
   public Object newRecord(Object old, Schema schema) {
     try {
-      Class c = Class.forName(SpecificData.getClassName(schema));
+      Class c = ClassUtils.forName(SpecificData.getClassName(schema));
       if (c == null)
         return newRecord(old, schema);            // punt to generic
       if (c.isInstance(old))

Modified: avro/trunk/lang/java/thrift/src/main/java/org/apache/avro/thrift/ThriftDatumReader.java
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/thrift/src/main/java/org/apache/avro/thrift/ThriftDatumReader.java?rev=1556891&r1=1556890&r2=1556891&view=diff
==============================================================================
--- avro/trunk/lang/java/thrift/src/main/java/org/apache/avro/thrift/ThriftDatumReader.java
(original)
+++ avro/trunk/lang/java/thrift/src/main/java/org/apache/avro/thrift/ThriftDatumReader.java
Thu Jan  9 17:24:50 2014
@@ -26,6 +26,7 @@ import org.apache.avro.AvroRuntimeExcept
 import org.apache.avro.generic.GenericDatumReader;
 import org.apache.avro.specific.SpecificData;
 import org.apache.avro.io.Decoder;
+import org.apache.avro.util.ClassUtils;
 
 /** {@link org.apache.avro.io.DatumReader DatumReader} for generated Thrift
  * classes. */
@@ -55,7 +56,7 @@ public class ThriftDatumReader<T> extend
   @Override
   protected Object createEnum(String symbol, Schema schema) {
     try {
-      Class c = Class.forName(SpecificData.getClassName(schema));
+      Class c = ClassUtils.forName(SpecificData.getClassName(schema));
       if (c == null) return super.createEnum(symbol, schema); // punt to generic
       return Enum.valueOf(c, symbol);
     } catch (Exception e) {

Modified: avro/trunk/lang/java/tools/pom.xml
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/tools/pom.xml?rev=1556891&r1=1556890&r2=1556891&view=diff
==============================================================================
--- avro/trunk/lang/java/tools/pom.xml (original)
+++ avro/trunk/lang/java/tools/pom.xml Thu Jan  9 17:24:50 2014
@@ -32,6 +32,16 @@
   <name>Apache Avro Tools</name>
   <url>http://avro.apache.org</url>
   <description>Avro command line tools and utilities</description>
+  <packaging>bundle</packaging>
+
+  <properties>
+    <osgi.import>
+      !org.apache.avro.tools*,
+      org.apache.avro*;version="${project.version}",
+      *
+    </osgi.import>
+    <osgi.export>org.apache.avro.tools*;version="${project.version}"</osgi.export>
+  </properties>
 
   <build>
     <resources>



Mime
View raw message