Enable Fully Qualified Class Names for Adapter Data Sources

Change-Id: I49953d4570b828b7cecb2ec926e017d008b13ddc
Reviewed-on: https://asterix-gerrit.ics.uci.edu/837
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <hubailmor@gmail.com>
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/provider/DatasourceFactoryProvider.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/provider/DatasourceFactoryProvider.java
index 0f24f91..0954fca 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/provider/DatasourceFactoryProvider.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/provider/DatasourceFactoryProvider.java
@@ -74,7 +74,11 @@
                     streamSourceFactory = new TwitterFirehoseStreamFactory();
                     break;
                 default:
-                    throw new AsterixException("unknown input stream factory");
+                    try {
+                        streamSourceFactory = (IInputStreamFactory) Class.forName(streamSource).newInstance();
+                    } catch (Exception e) {
+                        throw new AsterixException("unknown input stream factory: " + streamSource, e);
+                    }
             }
         }
         return streamSourceFactory;
@@ -109,7 +113,11 @@
             case ExternalDataConstants.STREAM_SOCKET_CLIENT:
                 return new StreamRecordReaderFactory(new SocketClientInputStreamFactory());
             default:
-                throw new AsterixException("unknown record reader factory: " + reader);
+                try {
+                    return (IRecordReaderFactory<?>) Class.forName(reader).newInstance();
+                } catch (Exception e) {
+                    throw new AsterixException("unknown record reader factory: " + reader, e);
+                }
         }
     }
 }