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