| 245 | } |
| 246 | |
| 247 | public static DDFManager get(EngineType engineType, DataSourceDescriptor dataSourceDescriptor) throws DDFException { |
| 248 | if (engineType == null) { |
| 249 | engineType = EngineType.fromString(ConfigConstant.ENGINE_NAME_DEFAULT.toString()); |
| 250 | } |
| 251 | |
| 252 | String className = Config.getValue(engineType.name(), ConfigConstant.FIELD_DDF_MANAGER); |
| 253 | // if (Strings.isNullOrEmpty(className)) return null; |
| 254 | if (Strings.isNullOrEmpty(className)) { |
| 255 | throw new DDFException("ERROR: When initializaing ddfmanager, class " + |
| 256 | className + " not found"); |
| 257 | } |
| 258 | |
| 259 | try { |
| 260 | Class[] classType = new Class[2]; |
| 261 | classType[0] = dataSourceDescriptor.getClass(); |
| 262 | classType[1] = engineType.getClass(); |
| 263 | |
| 264 | DDFManager manager = (DDFManager) Class.forName(className).getDeclaredConstructor(classType) |
| 265 | .newInstance(dataSourceDescriptor, engineType); |
| 266 | UUID uuid = UUID.randomUUID(); |
| 267 | manager.setUUID(uuid); |
| 268 | return manager; |
| 269 | } catch (Exception e) { |
| 270 | |
| 271 | throw new DDFException(e); |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | public static DDFManager get(EngineType engineType, String uri) throws DDFException { |
| 276 | Preconditions.checkArgument(engineType != null, "Engine type cannot be null"); |