All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aliyun.drc.client.DRCClientFactory Maven / Gradle / Ivy

There is a newer version: 5.0.0.1-cloud.beta
Show newest version
package com.aliyun.drc.client;

import java.io.IOException;
import java.io.Reader;
import java.util.Properties;

import com.aliyun.drc.client.impl.DRCClientImpl;

public class DRCClientFactory {

	public enum Type {
		MYSQL,
		OCEANBASE,
		NONE
	};

	public static DRCClient create(final Type type, final Object arg) throws IOException {

		switch (type) {
			case MYSQL:
			case OCEANBASE:
				if (arg instanceof String) {
					return new DRCClientImpl((String) arg);
				} else if (arg instanceof Reader) {
					return new DRCClientImpl((Reader) arg);
				} else if (arg instanceof Properties) {
					return new DRCClientImpl((Properties) arg);
				} else {
					return null;
				}
			default:
				return null;
		}
	}

	public static DRCClient create(final Object arg) throws IOException {
		return create(Type.MYSQL, arg);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy