Merge branch 'application-mgt-new' of https://github.com/lasanthaDLPDS/carbon-device-mgt into application-mgt-new

feature/appm-store/pbac
inoshperera 6 years ago
commit e6f099d43b

@ -51,21 +51,8 @@
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
<Bundle-Description>Application Management Common Bundle</Bundle-Description>
<Import-Package>
org.osgi.framework,
org.osgi.service.component,
org.apache.commons.logging,
javax.xml.*,
org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}",
org.wso2.carbon.device.mgt.core.dto.*;version="${carbon.device.mgt.version}",
org.wso2.carbon.device.mgt.core.dao.*;version="${carbon.device.mgt.version}",
org.wso2.carbon.device.mgt.common.operation.mgt.*;version="${carbon.device.mgt.version}",
org.w3c.dom,
org.json,
org.xml.sax,
com.google.gson,
javax.naming,
javax.xml.bind.annotation,
javax.xml.bind,
io.swagger.annotations.*;resolution:=optional
</Import-Package>
<Export-Package>

@ -153,20 +153,20 @@ public interface ApplicationManager {
void addLifecycleState(int applicationId, String applicationUuid, LifecycleState state) throws ApplicationManagementException;
/**
* To validate the application existence for given application id
* Get the application if application is an accessible one.
*
* @param applicationId ID of the Application.
* @throws ApplicationManagementException Application Management Exception.
*/
Application validateApplication(int applicationId) throws ApplicationManagementException;
Application getApplicationIfAccessible(int applicationId) throws ApplicationManagementException;
/**
* To validate the application release existence for given application release UUID
* Get the application release for given UUID if application release is exists and application id is valid one.
*
* @param releaseUuid UUID of the Application Release.
* @throws ApplicationManagementException Application Management Exception.
*/
ApplicationRelease validateApplicationRelease(int applicationId, String releaseUuid) throws
ApplicationRelease getAppReleaseIfExists(int applicationId, String releaseUuid) throws
ApplicationManagementException;
/**
@ -188,7 +188,7 @@ public interface ApplicationManager {
* @return Updated Application Release.
* @throws ApplicationManagementException Application Management Exception.
*/
boolean isApplicationReleaseUpdateAcceptable(int appId, String appReleaseUuid)
boolean isAcceptableAppReleaseUpdate(int appId, String appReleaseUuid)
throws ApplicationManagementException;
/**

@ -57,7 +57,6 @@
org.osgi.framework,
org.osgi.service.component,
org.apache.commons.logging,
javax.xml.*,
javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional,
org.wso2.carbon.context.*,
org.wso2.carbon.utils.*,
@ -71,35 +70,26 @@
org.wso2.carbon.device.application.mgt.common.*,
org.wso2.carbon.device.mgt.core.*,
org.wso2.carbon.device.mgt.common.*,
org.apache.axis2.*,
org.wso2.carbon.user.core.*,
org.wso2.carbon.user.api.*,
org.wso2.carbon.ndatasource.core,
org.wso2.carbon,
javax.annotation,
org.bouncycastle.cert,
org.bouncycastle.cert.jcajce,
org.bouncycastle.cms,
org.bouncycastle.jce.provider,
org.bouncycastle.util,
org.xml.sax,
org.xml.sax.helpers,
org.apache.commons.io,
org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}",
org.apache.commons.codec.digest;version="${commons-codec.wso2.osgi.version.range}",
org.wso2.carbon.base,
org.wso2.carbon.device.mgt.core.dto.*;version="${carbon.device.mgt.version}",
org.wso2.carbon.device.mgt.core.dao.*;version="${carbon.device.mgt.version}",
net.dongliu.*
net.dongliu.apk.parser.*
</Import-Package>
<Embed-Dependency>apk-parser;scope=compile|runtime;inline=false</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Embed-StripGroup>true</Embed-StripGroup>
<!--<Embed-Transitive>true</Embed-Transitive>-->
<!--<Embed-StripGroup>true</Embed-StripGroup>-->
<Export-Package>
!org.wso2.carbon.device.application.mgt.core.internal.*,
org.wso2.carbon.device.application.mgt.core.*
</Export-Package>
<Axis2Deployer>PlatformDeployer</Axis2Deployer>
</instructions>
</configuration>
</plugin>

@ -40,6 +40,7 @@ import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionExcep
import org.wso2.carbon.device.application.mgt.common.exception.LifecycleManagementException;
import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager;
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.common.ApplicationManagementDAOFactory;
@ -70,6 +71,9 @@ public class ApplicationManagerImpl implements ApplicationManager {
private DeviceTypeDAO deviceTypeDAO;
private VisibilityDAO visibilityDAO;
private ApplicationDAO applicationDAO;
private ApplicationReleaseDAO applicationReleaseDAO;
private LifecycleStateDAO lifecycleStateDAO;
public ApplicationManagerImpl() {
initDataAccessObjects();
@ -79,6 +83,8 @@ public class ApplicationManagerImpl implements ApplicationManager {
this.deviceTypeDAO = ApplicationManagementDAOFactory.getDeviceTypeDAO();
this.visibilityDAO = ApplicationManagementDAOFactory.getVisibilityDAO();
this.applicationDAO = ApplicationManagementDAOFactory.getApplicationDAO();
this.lifecycleStateDAO = ApplicationManagementDAOFactory.getLifecycleStateDAO();
this.applicationReleaseDAO = ApplicationManagementDAOFactory.getApplicationReleaseDAO();
}
@Override
@ -92,7 +98,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
validateAppCreatingRequest(application);
validateReleaseCreatingRequest(application.getApplicationReleases().get(0));
validateAppReleasePayload(application.getApplicationReleases().get(0));
DeviceType deviceType;
ApplicationRelease applicationRelease;
List<ApplicationRelease> applicationReleases = new ArrayList<>();
@ -127,16 +133,13 @@ public class ApplicationManagerImpl implements ApplicationManager {
+ "the payload contains more than one");
}
applicationRelease = application.getApplicationReleases().get(0);
applicationRelease = ApplicationManagementDAOFactory.getApplicationReleaseDAO().
createRelease(applicationRelease, application.getId(), tenantId);
applicationRelease = this.applicationReleaseDAO
.createRelease(applicationRelease, application.getId(), tenantId);
LifecycleState lifecycleState = new LifecycleState();
lifecycleState.setUpdatedBy(userName);
lifecycleState.setCurrentState(AppLifecycleState.CREATED.toString());
lifecycleState.setPreviousState(AppLifecycleState.CREATED.toString());
addLifecycleState(application.getId(), applicationRelease.getUuid(), lifecycleState);
LifecycleStateDAO lifecycleStateDAO = ApplicationManagementDAOFactory.getLifecycleStateDAO();
lifecycleStateDAO.addLifecycleState(lifecycleState, application.getId(), applicationRelease.getId(), tenantId);
applicationRelease.setLifecycleState(lifecycleState);
applicationReleases.add(applicationRelease);
@ -157,12 +160,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
log.error(msg, e);
ConnectionManagerUtil.rollbackDBTransaction();
throw new ApplicationManagementException(msg, e);
} catch (LifeCycleManagementDAOException e) {
String msg = "Error occurred while adding application lifecycle state";
log.error(msg, e);
ConnectionManagerUtil.rollbackDBTransaction();
throw new ApplicationManagementException(msg, e);
}finally {
} finally {
ConnectionManagerUtil.closeDBConnection();
}
}
@ -185,13 +183,10 @@ public class ApplicationManagerImpl implements ApplicationManager {
if (!isAdminUser(userName, tenantId, CarbonConstants.UI_ADMIN_PERMISSION_COLLECTION)) {
applicationList = getRoleRestrictedApplicationList(applicationList, userName);
}
for (Application application : applicationList.getApplications()) {
applicationReleases = getReleases(application.getId());
application.setApplicationReleases(applicationReleases);
}
return applicationList;
} catch (UserStoreException e) {
throw new ApplicationManagementException(
@ -206,24 +201,30 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
@Override
public ApplicationRelease createRelease(int applicationId, ApplicationRelease applicationRelease) throws
ApplicationManagementException {
public ApplicationRelease createRelease(int applicationId, ApplicationRelease applicationRelease)
throws ApplicationManagementException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
Application application = validateApplication(applicationId);
validateReleaseCreatingRequest(applicationRelease);
Application application = getApplicationIfAccessible(applicationId);
validateAppReleasePayload(applicationRelease);
if (log.isDebugEnabled()) {
log.debug("Application release request is received for the application " + application.toString());
}
try {
ConnectionManagerUtil.beginDBTransaction();
// todo consider about lifecycle adding
applicationRelease = ApplicationManagementDAOFactory.getApplicationReleaseDAO().
createRelease(applicationRelease, application.getId(), tenantId);
applicationRelease = this.applicationReleaseDAO
.createRelease(applicationRelease, application.getId(), tenantId);
LifecycleState lifecycleState = new LifecycleState();
lifecycleState.setCurrentState(AppLifecycleState.CREATED.toString());
lifecycleState.setPreviousState(AppLifecycleState.CREATED.toString());
addLifecycleState(application.getId(), applicationRelease.getUuid(), lifecycleState);
ConnectionManagerUtil.commitDBTransaction();
return applicationRelease;
} catch (ApplicationManagementDAOException e) {
ConnectionManagerUtil.rollbackDBTransaction();
throw e;
throw new ApplicationManagementException(
"Error occured while adding application release into IoTS app management Application id of the "
+ "application release: " + applicationId, e);
} finally {
ConnectionManagerUtil.closeDBConnection();
}
@ -353,7 +354,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
public List<ApplicationRelease> getReleases(int applicationId) throws ApplicationManagementException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
Application application = validateApplication(applicationId);
Application application = getApplicationIfAccessible(applicationId);
List<ApplicationRelease> applicationReleases;
List<ApplicationRelease> filteredApplicationReleases = new ArrayList<>();
if (log.isDebugEnabled()) {
@ -362,8 +363,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
try {
ConnectionManagerUtil.openDBConnection();
applicationReleases = ApplicationManagementDAOFactory.getApplicationReleaseDAO()
.getReleases(application.getName(), application.getType(), tenantId);
applicationReleases = this.applicationReleaseDAO.getReleases(application.getName(), application.getType(), tenantId);
for (ApplicationRelease applicationRelease : applicationReleases) {
LifecycleState lifecycleState = ApplicationManagementDAOFactory.getLifecycleStateDAO().
getLatestLifeCycleStateByReleaseID(applicationRelease.getId());
@ -393,7 +393,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
"need to have admin permission");
}
if (validateApplication(applicationId) == null) {
if (getApplicationIfAccessible(applicationId) == null) {
throw new ApplicationManagementException("Invalid Application");
}
List<ApplicationRelease> applicationReleases = getReleases(applicationId);
@ -406,7 +406,6 @@ public class ApplicationManagerImpl implements ApplicationManager {
LifecycleState newAppLifecycleState = new LifecycleState();
newAppLifecycleState.setPreviousState(appLifecycleState.getCurrentState());
newAppLifecycleState.setCurrentState(AppLifecycleState.REMOVED.toString());
newAppLifecycleState.setUpdatedBy(userName);
addLifecycleState(applicationId, applicationRelease.getUuid(), newAppLifecycleState);
storedLocations.add(applicationRelease.getAppHashValue());
}
@ -425,16 +424,11 @@ public class ApplicationManagerImpl implements ApplicationManager {
@Override
public String deleteApplicationRelease(int applicationId, String releaseUuid)
throws ApplicationManagementException {
String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
Application application = validateApplication(applicationId);
Application application = getApplicationIfAccessible(applicationId);
if (application == null) {
throw new ApplicationManagementException("Invalid Application ID is received");
}
ApplicationRelease applicationRelease = validateApplicationRelease(applicationId, releaseUuid);
if (applicationRelease == null) {
throw new ApplicationManagementException("Invalid Application Release UUID is received");
}
ApplicationRelease applicationRelease = getAppReleaseIfExists(applicationId, releaseUuid);
LifecycleState appLifecycleState = getLifecycleState(applicationId, applicationRelease.getUuid());
String currentState = appLifecycleState.getCurrentState();
if (AppLifecycleState.DEPRECATED.toString().equals(currentState) || AppLifecycleState
@ -443,7 +437,6 @@ public class ApplicationManagerImpl implements ApplicationManager {
LifecycleState newAppLifecycleState = new LifecycleState();
newAppLifecycleState.setPreviousState(appLifecycleState.getCurrentState());
newAppLifecycleState.setCurrentState(AppLifecycleState.REMOVED.toString());
newAppLifecycleState.setUpdatedBy(userName);
addLifecycleState(applicationId, applicationRelease.getUuid(), newAppLifecycleState);
}else{
throw new ApplicationManagementException("Can't delete the application release, You have to move the " +
@ -487,15 +480,14 @@ public class ApplicationManagerImpl implements ApplicationManager {
throw new ValidationException("Username and tenant Id cannot be empty");
}
if (application.getAppCategory() == null) {
throw new ValidationException("Username and tenant Id cannot be empty");
throw new ValidationException("Application category can't be empty");
}
isValidApplicationType = isValidAppType(application);
if (!isValidApplicationType) {
throw new ValidationException(
"App Type contains in the application creating payload doesn't match with " +
"supported app types");
"App Type contains in the application creating payload doesn't match with supported app types");
}
validateApplicationExistence(application);
@ -537,12 +529,12 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
/**
* To validate the pre-request of the ApplicationRelease.
* Get the application if application is an accessible one.
*
* @param applicationId ID of the Application.
* @return Application related with the UUID
*/
public Application validateApplication(int applicationId) throws ApplicationManagementException {
public Application getApplicationIfAccessible(int applicationId) throws ApplicationManagementException {
if (applicationId <= 0) {
throw new ApplicationManagementException("Application id could,t be a negative integer. Hence please add " +
"valid application id.");
@ -568,7 +560,8 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
if (!isAppAllowed) {
throw new NotFoundException("Application of the " + applicationId + " does not exist.");
throw new NotFoundException("Application of the " + applicationId
+ " does not exist. Please check whether user have permissions to access the application.");
}
return application;
} catch (UserStoreException e) {
@ -580,12 +573,12 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
/**
* To validate the pre-request of the ApplicationRelease.
* Get the application release for given UUID if application release is exists and application id is valid one.
*
* @param applicationUuid UUID of the Application.
* @return Application related with the UUID
*/
public ApplicationRelease validateApplicationRelease(int applicationId, String applicationUuid) throws
public ApplicationRelease getAppReleaseIfExists(int applicationId, String applicationUuid) throws
ApplicationManagementException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
ApplicationRelease applicationRelease;
@ -600,8 +593,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
+ "parameter to get the relevant application.");
}
ConnectionManagerUtil.openDBConnection();
applicationRelease = ApplicationManagementDAOFactory.getApplicationReleaseDAO().getReleaseByIds
(applicationId, applicationUuid, tenantId);
applicationRelease = this.applicationReleaseDAO.getReleaseByIds(applicationId, applicationUuid, tenantId);
if (applicationRelease == null) {
throw new ApplicationManagementException("Doesn't exist a application release for application ID: " +
applicationId + "and application UUID: " +
@ -617,7 +609,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
@Override
public ApplicationRelease updateRelease(int appId, ApplicationRelease applicationRelease) throws
ApplicationManagementException {
String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
validateAppReleasePayload(applicationRelease);
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
if (log.isDebugEnabled()) {
log.debug("Updating the Application release. UUID: " + applicationRelease.getUuid() + ", " +
@ -625,10 +617,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
try {
ConnectionManagerUtil.openDBConnection();
// todo consider about lifecycle
applicationRelease = ApplicationManagementDAOFactory.getApplicationReleaseDAO()
.updateRelease(appId, applicationRelease, tenantId);
applicationRelease = this.applicationReleaseDAO.updateRelease(appId, applicationRelease, tenantId);
return applicationRelease;
} finally {
ConnectionManagerUtil.closeDBConnection();
@ -636,7 +625,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
@Override
public boolean isApplicationReleaseUpdateAcceptable(int appId, String appReleaseUuid)
public boolean isAcceptableAppReleaseUpdate(int appId, String appReleaseUuid)
throws ApplicationManagementException {
LifecycleState lifecycleState = getLifecycleState(appId, appReleaseUuid);
return AppLifecycleState.CREATED.toString().equals(lifecycleState.getCurrentState()) || AppLifecycleState
@ -673,12 +662,12 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
/**
* To validate a create release request to make sure all the pre-conditions satisfied.
* To validate a app release creating request and app updating request to make sure all the pre-conditions satisfied.
*
* @param applicationRelease ApplicationRelease that need to be created.
* @throws ApplicationManagementException Application Management Exception.
*/
private void validateReleaseCreatingRequest(ApplicationRelease applicationRelease)
private void validateAppReleasePayload(ApplicationRelease applicationRelease)
throws ApplicationManagementException {
if (applicationRelease.getVersion() == null) {
@ -693,9 +682,13 @@ public class ApplicationManagerImpl implements ApplicationManager {
LifecycleState lifecycleState;
try {
ConnectionManagerUtil.openDBConnection();
LifecycleStateDAO lifecycleStateDAO = ApplicationManagementDAOFactory.getLifecycleStateDAO();
ApplicationRelease applicationRelease = validateApplicationRelease(applicationId, applicationUuid);
lifecycleState = lifecycleStateDAO.getLatestLifeCycleStateByReleaseID(applicationRelease.getId());
lifecycleState = this.lifecycleStateDAO.getLatestLifeCycleStateByReleaseID(applicationId);
if (lifecycleState == null) {
throw new NotFoundException(
"Couldn't find the lifecycle data for appid: " + applicationId + " and app release UUID: "
+ applicationUuid);
}
lifecycleState.setNextStates(getNextLifecycleStates(lifecycleState.getCurrentState()));
} catch (ApplicationManagementDAOException e) {
throw new ApplicationManagementException("Failed to get lifecycle state", e);
@ -708,19 +701,20 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
@Override
public void addLifecycleState(int applicationId, String applicationUuid, LifecycleState state) throws
ApplicationManagementException {
public void addLifecycleState(int applicationId, String applicationUuid, LifecycleState state)
throws ApplicationManagementException {
try {
ConnectionManagerUtil.openDBConnection();
Application application = validateApplication(applicationId);
ApplicationRelease applicationRelease = validateApplicationRelease(applicationId, applicationUuid);
LifecycleStateDAO lifecycleStateDAO;
Application application = getApplicationIfAccessible(applicationId);
ApplicationRelease applicationRelease = getAppReleaseIfExists(applicationId, applicationUuid);
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
state.setUpdatedBy(userName);
if (state.getCurrentState() != null && state.getPreviousState() != null && state.getUpdatedBy() != null) {
if (state.getCurrentState() != null && state.getPreviousState() != null) {
validateLifecycleState(state);
lifecycleStateDAO = ApplicationManagementDAOFactory.getLifecycleStateDAO();
lifecycleStateDAO.addLifecycleState(state, application.getId(), applicationRelease.getId(), tenantId);
this.lifecycleStateDAO
.addLifecycleState(state, application.getId(), applicationRelease.getId(), tenantId);
}
} catch (LifeCycleManagementDAOException | DBConnectionException e) {
throw new ApplicationManagementException("Failed to add lifecycle state", e);
@ -828,7 +822,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
public Application updateApplication(Application application) throws ApplicationManagementException {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true);
Application existingApplication = validateApplication(application.getId());
Application existingApplication = getApplicationIfAccessible(application.getId());
List<UnrestrictedRole> addingRoleList;
List<UnrestrictedRole> removingRoleList;
List<Tag> addingTags;

@ -23,12 +23,12 @@ import com.dd.plist.NSDictionary;
import com.dd.plist.NSString;
import com.dd.plist.PropertyListFormatException;
import com.dd.plist.PropertyListParser;
import net.dongliu.apk.parser.ApkFile;
import net.dongliu.apk.parser.bean.ApkMeta;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.validator.routines.UrlValidator;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.application.mgt.common.ApplicationRelease;
import org.wso2.carbon.device.application.mgt.common.ApplicationType;
@ -41,16 +41,10 @@ import org.wso2.carbon.device.application.mgt.core.util.ArtifactsParser;
import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil;
import org.wso2.carbon.device.application.mgt.core.util.Constants;
import org.wso2.carbon.device.application.mgt.core.util.StorageManagementUtil;
import org.apache.commons.validator.routines.UrlValidator;
import org.xml.sax.SAXException;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import javax.xml.parsers.ParserConfigurationException;
import java.io.*;
import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
@ -59,8 +53,6 @@ import java.util.Objects;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.xml.parsers.ParserConfigurationException;
import static org.wso2.carbon.device.application.mgt.core.util.StorageManagementUtil.deleteDir;
import static org.wso2.carbon.device.application.mgt.core.util.StorageManagementUtil.saveFile;

@ -208,7 +208,7 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
attachments.add(screenshot.getDataHandler().getInputStream());
}
}
applicationRelease = applicationManager.validateApplicationRelease(appId, applicationUuid);
applicationRelease = applicationManager.getAppReleaseIfExists(appId, applicationUuid);
LifecycleState lifecycleState = applicationManager.getLifecycleState(appId, applicationRelease.getUuid());
if (AppLifecycleState.PUBLISHED.toString().equals(lifecycleState.getCurrentState()) ||
AppLifecycleState.DEPRECATED.toString().equals(lifecycleState.getCurrentState())) {
@ -222,7 +222,9 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
return Response.status(Response.Status.OK)
.entity("Successfully uploaded artifacts for the application " + applicationUuid).build();
} catch (NotFoundException e) {
String msg = "Couldn't found application release details and storage details";
String msg =
"Couldn't found application release details or storage details or lifecycle details. Application id: "
+ appId + " App release uuid: " + applicationUuid;
log.error(msg, e);
return APIUtil.getResponse(e, Response.Status.NOT_FOUND);
} catch (ApplicationManagementException e) {
@ -260,7 +262,7 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
return APIUtil.getResponse("Uploading artifacts for the application is failed " + applicationUuid,
Response.Status.BAD_REQUEST);
}
applicationRelease = applicationManager.validateApplicationRelease(applicationId, applicationUuid);
applicationRelease = applicationManager.getAppReleaseIfExists(applicationId, applicationUuid);
applicationRelease = applicationStorageManager
.updateReleaseArtifacts(applicationRelease, appType, deviceType,
binaryFile.getDataHandler().getInputStream());
@ -323,9 +325,9 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
List<InputStream> attachments = new ArrayList<>();
try {
Application application = applicationManager.validateApplication(applicationId);
Application application = applicationManager.getApplicationIfAccessible(applicationId);
if (!applicationManager.isApplicationReleaseUpdateAcceptable(application.getId(),
if (!applicationManager.isAcceptableAppReleaseUpdate(application.getId(),
applicationRelease.getUuid())) {
String msg = "Application release is in the " + applicationRelease.getLifecycleState().getCurrentState()
+ " state. Hence updating is not acceptable when application in this state";
@ -424,7 +426,13 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
ApplicationManager applicationManager = APIUtil.getApplicationManager();
try {
lifecycleState = applicationManager.getLifecycleState(applicationId, applicationUuid);
} catch (ApplicationManagementException e) {
} catch (NotFoundException e){
String msg = "Couldn't found application lifecycle details for appid: " + applicationId
+ " and app release UUID: " + applicationUuid;
log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).build();
}
catch (ApplicationManagementException e) {
String msg = "Error occurred while getting lifecycle state.";
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>application-mgt-feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.application.mgt.api.feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Application Management API Feature</name>
<url>http://wso2.org</url>

@ -1,8 +1,4 @@
instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application
.mgt.api_${feature.version}/webapps/api#application-mgt-publisher#v1.0.war,target:${installFolder}/../.
./deployment/server/webapps/api#application-mgt-publisher#v1.0.war,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application
.mgt.api_${feature.version}/webapps/api#application-mgt-store#v1.0.war,target:${installFolder}/../.
./deployment/server/webapps/api#application-mgt-store#v1.0.war,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application.mgt.api_${feature.version}/webapps/api#application-mgt-publisher#v1.0.war,target:${installFolder}/../../deployment/server/webapps/api#application-mgt-publisher#v1.0.war,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application.mgt.api_${feature.version}/webapps/api#application-mgt-store#v1.0.war,target:${installFolder}/../../deployment/server/webapps/api#application-mgt-store#v1.0.war,overwrite:true);\

@ -22,12 +22,12 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>application-mgt-feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.application.mgt.auth.handler.feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Application Management Authentication Handler Feature</name>
<description>This feature contains the Authentication Handler implementation for Publisher and Store.</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>application-mgt-feature</artifactId>
<version>3.0.46-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.application.mgt.extensions.feature</artifactId>
<packaging>pom</packaging>
<version>3.0.46-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<name>WSO2 Carbon - Application Management Extension Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Application Management Extension Feature</description>

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>application-mgt-feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.application.mgt.feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Application Management Aggregate Feature</name>
<url>http://wso2.org</url>
@ -45,14 +45,14 @@
<artifactId>org.wso2.carbon.device.application.mgt.publisher.ui.feature</artifactId>
<type>zip</type>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.orbit.org.scannotation</groupId>
<artifactId>scannotation</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>javax.servlet.jsp</groupId>-->
<!--<artifactId>javax.servlet.jsp-api</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.wso2.orbit.org.scannotation</groupId>-->
<!--<artifactId>scannotation</artifactId>-->
<!--</dependency>-->
</dependencies>
<build>
@ -79,10 +79,10 @@
<includedFeatureDef>org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.server.feature:${carbon.device.mgt.version}</includedFeatureDef>
<includedFeatureDef>org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.publisher.ui.feature:${carbon.device.mgt.version}</includedFeatureDef>
</includedFeatures>
<bundles>
<bundleDef>javax.servlet.jsp:javax.servlet.jsp-api</bundleDef>
<bundleDef>org.wso2.orbit.org.scannotation:scannotation:${scannotation.version}</bundleDef>
</bundles>
<!--<bundles>-->
<!--<bundleDef>javax.servlet.jsp:javax.servlet.jsp-api</bundleDef>-->
<!--<bundleDef>org.wso2.orbit.org.scannotation:scannotation:${scannotation.version}</bundleDef>-->
<!--</bundles>-->
</configuration>
</execution>
</executions>

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>application-mgt-feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.application.mgt.publisher.ui.feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Application Management Publisher UI Feature</name>
<url>http://wso2.org</url>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>application-mgt-feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.application.mgt.server.feature</artifactId>
<packaging>pom</packaging>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<name>WSO2 Carbon - Application Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for Back-end Application Management functionality
@ -44,16 +44,24 @@
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.application.mgt.core</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.application.mgt.api.feature</artifactId>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.application.mgt.auth.handler.feature</artifactId>
<type>zip</type>
</dependency>
<!--<dependency>-->
<!--<groupId>javax.servlet.jsp</groupId>-->
<!--<artifactId>javax.servlet.jsp-api</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.wso2.orbit.org.scannotation</groupId>-->
<!--<artifactId>scannotation</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.wso2.carbon.devicemgt</groupId>-->
<!--<artifactId>org.wso2.carbon.device.application.mgt.api.feature</artifactId>-->
<!--<type>zip</type>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.wso2.carbon.devicemgt</groupId>-->
<!--<artifactId>org.wso2.carbon.device.application.mgt.auth.handler.feature</artifactId>-->
<!--<type>zip</type>-->
<!--</dependency>-->
</dependencies>
<build>
@ -103,10 +111,10 @@
<propertyDef>org.eclipse.equinox.p2.type.group:false</propertyDef>
</properties>
</adviceFile>
<includedFeatures>
<includedFeatureDef>org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.api.feature:${carbon.device.mgt.version}</includedFeatureDef>
<includedFeatureDef>org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.auth.handler.feature:${carbon.device.mgt.version}</includedFeatureDef>
</includedFeatures>
<!--<includedFeatures>-->
<!--<includedFeatureDef>org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.api.feature:${carbon.device.mgt.version}</includedFeatureDef>-->
<!--<includedFeatureDef>org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.auth.handler.feature:${carbon.device.mgt.version}</includedFeatureDef>-->
<!--</includedFeatures>-->
<bundles>
<bundleDef>
org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.common:${carbon.device.mgt.version}
@ -114,12 +122,14 @@
<bundleDef>
org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.core:${carbon.device.mgt.version}
</bundleDef>
<!--<bundleDef>javax.servlet.jsp:javax.servlet.jsp-api</bundleDef>-->
<!--<bundleDef>org.wso2.orbit.org.scannotation:scannotation:${scannotation.version}</bundleDef>-->
</bundles>
<importBundles>
</importBundles>
<importFeatures>
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}</importFeatureDef>
</importFeatures>
<!--<importFeatures>-->
<!--<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}</importFeatureDef>-->
<!--</importFeatures>-->
</configuration>
</execution>
</executions>

@ -23,12 +23,12 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>application-mgt-feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.application.mgt.store.ui.feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Application Management Store UI Feature</name>
<url>http://wso2.org</url>

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>application-mgt-feature</artifactId>
<version>3.1.34-SNAPSHOT</version>
<version>3.1.40-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Application Management Feature</name>
<url>http://wso2.org</url>

@ -1740,7 +1740,6 @@
<artifactId>apk-parser</artifactId>
<version>${net.dongliu.version}</version>
</dependency>
<!--websocket dependency-->
<dependency>
<groupId>javax.websocket</groupId>
@ -2196,7 +2195,7 @@
<!-- app management related versions -->
<googlecode.plist.version>1.8</googlecode.plist.version>
<net.dongliu.version>2.4.2</net.dongliu.version>
<!--websocket related lib versions-->
<tomcat.websocket.version>7.0.85</tomcat.websocket.version>
<javax.websocket.version>1.0</javax.websocket.version>

Loading…
Cancel
Save