|
|
|
@ -25,8 +25,8 @@ import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager;
|
|
|
|
|
import org.wso2.carbon.device.application.mgt.core.dao.ApplicationDAO;
|
|
|
|
|
import org.wso2.carbon.device.application.mgt.core.dao.ApplicationReleaseDAO;
|
|
|
|
|
import org.wso2.carbon.device.application.mgt.core.dao.LifecycleStateDAO;
|
|
|
|
|
import org.wso2.carbon.device.application.mgt.core.dao.VisibilityDAO;
|
|
|
|
|
import org.wso2.carbon.device.application.mgt.core.dao.PlatformDAO;
|
|
|
|
|
import org.wso2.carbon.device.application.mgt.core.dao.VisibilityDAO;
|
|
|
|
|
import org.wso2.carbon.device.application.mgt.core.dao.impl.application.GenericApplicationDAOImpl;
|
|
|
|
|
import org.wso2.carbon.device.application.mgt.core.dao.impl.application.release.GenericApplicationReleaseDAOImpl;
|
|
|
|
|
import org.wso2.carbon.device.application.mgt.core.dao.impl.application.release.OracleApplicationDAOImpl;
|
|
|
|
@ -61,14 +61,14 @@ public class DAOFactory {
|
|
|
|
|
public static ApplicationDAO getApplicationDAO() {
|
|
|
|
|
if (databaseEngine != null) {
|
|
|
|
|
switch (databaseEngine) {
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_H2:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_MYSQL:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
|
|
|
|
|
return new GenericApplicationDAOImpl();
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_ORACLE:
|
|
|
|
|
return new OracleApplicationDAOImpl();
|
|
|
|
|
default:
|
|
|
|
|
throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine);
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_H2:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_MYSQL:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
|
|
|
|
|
return new GenericApplicationDAOImpl();
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_ORACLE:
|
|
|
|
|
return new OracleApplicationDAOImpl();
|
|
|
|
|
default:
|
|
|
|
|
throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
throw new IllegalStateException("Database engine has not initialized properly.");
|
|
|
|
@ -77,15 +77,15 @@ public class DAOFactory {
|
|
|
|
|
public static PlatformDAO getPlatformDAO() {
|
|
|
|
|
if (databaseEngine != null) {
|
|
|
|
|
switch (databaseEngine) {
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_H2:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_MYSQL:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
|
|
|
|
|
return new GenericPlatformDAOImpl();
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_MSSQL:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_ORACLE:
|
|
|
|
|
return new OracleMsSQLPlatformDAOImpl();
|
|
|
|
|
default:
|
|
|
|
|
throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine);
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_H2:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_MYSQL:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
|
|
|
|
|
return new GenericPlatformDAOImpl();
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_MSSQL:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_ORACLE:
|
|
|
|
|
return new OracleMsSQLPlatformDAOImpl();
|
|
|
|
|
default:
|
|
|
|
|
throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
throw new IllegalStateException("Database engine has not initialized properly.");
|
|
|
|
@ -94,13 +94,13 @@ public class DAOFactory {
|
|
|
|
|
public static LifecycleStateDAO getLifecycleStateDAO() {
|
|
|
|
|
if (databaseEngine != null) {
|
|
|
|
|
switch (databaseEngine) {
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_H2:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_MYSQL:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_ORACLE:
|
|
|
|
|
return new GenericLifecycleStateImpl();
|
|
|
|
|
default:
|
|
|
|
|
throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine);
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_H2:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_MYSQL:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_ORACLE:
|
|
|
|
|
return new GenericLifecycleStateImpl();
|
|
|
|
|
default:
|
|
|
|
|
throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
throw new IllegalStateException("Database engine has not initialized properly.");
|
|
|
|
@ -108,18 +108,19 @@ public class DAOFactory {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* To get the instance of ApplicationReleaseDAOImplementation of the particular database engine.
|
|
|
|
|
*
|
|
|
|
|
* @return specific ApplicationReleaseDAOImplementation
|
|
|
|
|
*/
|
|
|
|
|
public static ApplicationReleaseDAO getApplicationReleaseDAO() {
|
|
|
|
|
if (databaseEngine != null) {
|
|
|
|
|
switch (databaseEngine) {
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_H2:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_MYSQL:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_ORACLE:
|
|
|
|
|
return new GenericApplicationReleaseDAOImpl();
|
|
|
|
|
default:
|
|
|
|
|
throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine);
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_H2:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_MYSQL:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL:
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_ORACLE:
|
|
|
|
|
return new GenericApplicationReleaseDAOImpl();
|
|
|
|
|
default:
|
|
|
|
|
throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
throw new IllegalStateException("Database engine has not initialized properly.");
|
|
|
|
@ -127,9 +128,10 @@ public class DAOFactory {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* To get the instance of VisibilityDAOImplementation of the particular database engine.
|
|
|
|
|
*
|
|
|
|
|
* @return specific VisibilityDAOImplementation
|
|
|
|
|
*/
|
|
|
|
|
public static VisibilityDAO getVisibilityDAO(){
|
|
|
|
|
public static VisibilityDAO getVisibilityDAO() {
|
|
|
|
|
if (databaseEngine != null) {
|
|
|
|
|
switch (databaseEngine) {
|
|
|
|
|
case Constants.DataBaseTypes.DB_TYPE_H2:
|
|
|
|
|