io.antmedia.console.datastore.ConsoleDataStoreFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ant-media-server Show documentation
Show all versions of ant-media-server Show documentation
Ant Media Server supports RTMP, RTSP, MP4, HLS, WebRTC, Adaptive Streaming, etc.
package io.antmedia.console.datastore;
import org.springframework.beans.factory.annotation.Value;
import io.antmedia.AppSettings;
public class ConsoleDataStoreFactory {
private AbstractConsoleDataStore dataStore;
@Value( "${"+AppSettings.SETTINGS_DB_APP_NAME+":#{null}}" )
private String appName;
@Value( "${"+io.antmedia.datastore.db.DataStoreFactory.SETTINGS_DB_NAME+":#{null}}" )
private String dbName;
@Value( "${"+io.antmedia.datastore.db.DataStoreFactory.SETTINGS_DB_TYPE+":#{null}}" )
private String dbType;
@Value( "${"+io.antmedia.datastore.db.DataStoreFactory.SETTINGS_DB_HOST+":#{null}}" )
private String dbHost;
@Value( "${"+io.antmedia.datastore.db.DataStoreFactory.SETTINGS_DB_USER+":#{null}}" )
private String dbUser;
@Value( "${"+io.antmedia.datastore.db.DataStoreFactory.SETTINGS_DB_PASS+":#{null}}" )
private String dbPassword;
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public String getDbName() {
return dbName;
}
public void setDbName(String dbName) {
this.dbName = dbName;
}
public String getDbType() {
return dbType;
}
public void setDbType(String dbType) {
this.dbType = dbType;
}
public String getDbHost() {
return dbHost;
}
public void setDbHost(String dbHost) {
this.dbHost = dbHost;
}
public String getDbUser() {
return dbUser;
}
public void setDbUser(String dbUser) {
this.dbUser = dbUser;
}
public String getDbPassword() {
return dbPassword;
}
public void setDbPassword(String dbPassword) {
this.dbPassword = dbPassword;
}
public AbstractConsoleDataStore getDataStore() {
if (dataStore == null) {
if(dbType.contentEquals("mongodb"))
{
dataStore = new MongoStore(dbHost, dbUser, dbPassword);
}
else if(dbType.contentEquals("mapdb"))
{
dataStore = new MapDBStore();
}
}
return dataStore;
}
}