diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/DAOFactory.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/DAOFactory.java index aac49c6a007..44953e909de 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/DAOFactory.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/DAOFactory.java @@ -26,10 +26,8 @@ import org.wso2.carbon.device.application.mgt.core.dao.LifecycleStateDAO; import org.wso2.carbon.device.application.mgt.core.dao.PlatformDAO; import org.wso2.carbon.device.application.mgt.core.dao.impl.application.H2ApplicationDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.application.MySQLApplicationDAOImpl; -import org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate.H2LifecycleStateDAOImpl; -import org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate.MySQLLifecycleStateDAOImpl; -import org.wso2.carbon.device.application.mgt.core.dao.impl.platform.H2PlatformDAOImpl; -import org.wso2.carbon.device.application.mgt.core.dao.impl.platform.MySQLPlatformDAOImpl; +import org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate.GenericLifecycleStateImpl; +import org.wso2.carbon.device.application.mgt.core.dao.impl.platform.GenericPlatformDAOImpl; import org.wso2.carbon.device.application.mgt.core.util.Constants; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; @@ -68,9 +66,8 @@ public class DAOFactory { if (databaseEngine != null) { switch (databaseEngine) { case Constants.DataBaseTypes.DB_TYPE_H2: - return new H2PlatformDAOImpl(); case Constants.DataBaseTypes.DB_TYPE_MYSQL: - return new MySQLPlatformDAOImpl(); + return new GenericPlatformDAOImpl(); default: throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine); } @@ -82,9 +79,8 @@ public class DAOFactory { if (databaseEngine != null) { switch (databaseEngine) { case Constants.DataBaseTypes.DB_TYPE_H2: - return new H2LifecycleStateDAOImpl(); case Constants.DataBaseTypes.DB_TYPE_MYSQL: - return new MySQLLifecycleStateDAOImpl(); + return new GenericLifecycleStateImpl(); default: throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine); } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/lifecyclestate/AbstractLifecycleStateDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/lifecyclestate/AbstractLifecycleStateDAOImpl.java deleted file mode 100644 index 917558fda66..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/lifecyclestate/AbstractLifecycleStateDAOImpl.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate; - -import org.wso2.carbon.device.application.mgt.core.dao.LifecycleStateDAO; -import org.wso2.carbon.device.application.mgt.core.dao.impl.AbstractDAOImpl; - -public abstract class AbstractLifecycleStateDAOImpl extends AbstractDAOImpl implements LifecycleStateDAO { - -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/lifecyclestate/MySQLLifecycleStateDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/lifecyclestate/GenericLifecycleStateImpl.java similarity index 91% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/lifecyclestate/MySQLLifecycleStateDAOImpl.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/lifecyclestate/GenericLifecycleStateImpl.java index 421fba789b9..41640e06691 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/lifecyclestate/MySQLLifecycleStateDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/lifecyclestate/GenericLifecycleStateImpl.java @@ -19,10 +19,10 @@ package org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate; import org.wso2.carbon.device.application.mgt.common.LifecycleState; -import org.wso2.carbon.device.application.mgt.common.Platform; import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException; +import org.wso2.carbon.device.application.mgt.core.dao.LifecycleStateDAO; import org.wso2.carbon.device.application.mgt.core.dao.common.Util; -import org.wso2.carbon.device.application.mgt.core.dao.impl.platform.AbstractPlatformDAOImpl; +import org.wso2.carbon.device.application.mgt.core.dao.impl.AbstractDAOImpl; import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException; import java.sql.Connection; @@ -30,7 +30,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -public class MySQLLifecycleStateDAOImpl extends AbstractLifecycleStateDAOImpl { +public class GenericLifecycleStateImpl extends AbstractDAOImpl implements LifecycleStateDAO { @Override public LifecycleState getLifeCycleStateByIdentifier(String identifier) throws ApplicationManagementDAOException { @@ -72,5 +72,4 @@ public class MySQLLifecycleStateDAOImpl extends AbstractLifecycleStateDAOImpl { } - -} \ No newline at end of file +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/lifecyclestate/H2LifecycleStateDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/lifecyclestate/H2LifecycleStateDAOImpl.java deleted file mode 100644 index 9333c8b4b52..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/lifecyclestate/H2LifecycleStateDAOImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate; - -import org.wso2.carbon.device.application.mgt.common.LifecycleState; -import org.wso2.carbon.device.application.mgt.common.Platform; -import org.wso2.carbon.device.application.mgt.core.dao.impl.platform.AbstractPlatformDAOImpl; -import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException; - -public class H2LifecycleStateDAOImpl extends AbstractLifecycleStateDAOImpl { - - - @Override - public LifecycleState getLifeCycleStateByIdentifier(String identifier) throws ApplicationManagementDAOException { - return null; - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/platform/AbstractPlatformDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/platform/AbstractPlatformDAOImpl.java deleted file mode 100644 index d6331064d60..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/platform/AbstractPlatformDAOImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.wso2.carbon.device.application.mgt.core.dao.impl.platform; - -import org.json.JSONException; -import org.wso2.carbon.device.application.mgt.common.Platform; -import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException; -import org.wso2.carbon.device.application.mgt.core.dao.PlatformDAO; -import org.wso2.carbon.device.application.mgt.core.dao.common.Util; -import org.wso2.carbon.device.application.mgt.core.dao.impl.AbstractDAOImpl; -import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException; -import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -public abstract class AbstractPlatformDAOImpl extends AbstractDAOImpl implements PlatformDAO { - - - -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/platform/MySQLPlatformDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/platform/GenericPlatformDAOImpl.java similarity index 98% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/platform/MySQLPlatformDAOImpl.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/platform/GenericPlatformDAOImpl.java index a0141a8ea95..32b71c35c0d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/platform/MySQLPlatformDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/platform/GenericPlatformDAOImpl.java @@ -21,7 +21,9 @@ package org.wso2.carbon.device.application.mgt.core.dao.impl.platform; import org.wso2.carbon.device.application.mgt.common.Platform; import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException; import org.wso2.carbon.device.application.mgt.common.exception.TransactionManagementException; +import org.wso2.carbon.device.application.mgt.core.dao.PlatformDAO; import org.wso2.carbon.device.application.mgt.core.dao.common.Util; +import org.wso2.carbon.device.application.mgt.core.dao.impl.AbstractDAOImpl; import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException; import org.wso2.carbon.device.application.mgt.core.exception.PlatformManagementDAOException; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; @@ -33,7 +35,7 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.List; -public class MySQLPlatformDAOImpl extends AbstractPlatformDAOImpl { +public class GenericPlatformDAOImpl extends AbstractDAOImpl implements PlatformDAO { @Override public Platform getPlatformByIdentifier(String identifier) throws ApplicationManagementDAOException { @@ -347,4 +349,4 @@ public class MySQLPlatformDAOImpl extends AbstractPlatformDAOImpl { } } -} \ No newline at end of file +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/platform/H2PlatformDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/platform/H2PlatformDAOImpl.java deleted file mode 100644 index 84c47f40900..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/platform/H2PlatformDAOImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.wso2.carbon.device.application.mgt.core.dao.impl.platform; - -import org.wso2.carbon.device.application.mgt.common.Platform; -import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException; -import org.wso2.carbon.device.application.mgt.core.exception.PlatformManagementDAOException; - -import java.util.List; - -public class H2PlatformDAOImpl extends AbstractPlatformDAOImpl { - - @Override - public Platform getPlatformByIdentifier(String identifier) throws ApplicationManagementDAOException { - return null; - } - - @Override - public void register(String tenantDomain, Platform platform) throws PlatformManagementDAOException { - - } - - @Override - public void unregister(String tenantDomain, String platformCode) throws PlatformManagementDAOException { - - } - - @Override - public void addMapping(String tenantDomain, List platformCode) throws PlatformManagementDAOException { - - } - - @Override - public void removeMapping(String tenantDomain, String platformCode) throws PlatformManagementDAOException { - - } - - @Override - public List getPlatforms(String tenantDomain) throws PlatformManagementDAOException { - return null; - } - - @Override - public Platform getPlatform(String tenantDomain, String platformCode) throws PlatformManagementDAOException { - return null; - } -}