Merge branch 'master' into 'master'

Improve dependency usage and source code

See merge request entgra/carbon-device-mgt!516
reporting
Dharmakeerthi Lasantha 5 years ago
commit 521e4f3098

@ -30,6 +30,7 @@ import javax.servlet.ServletContext;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE; import javax.ws.rs.DELETE;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.HEAD;
import javax.ws.rs.HttpMethod; import javax.ws.rs.HttpMethod;
import javax.ws.rs.OPTIONS; import javax.ws.rs.OPTIONS;
import javax.ws.rs.POST; import javax.ws.rs.POST;
@ -314,6 +315,9 @@ public class AnnotationProcessor {
if (annotation.annotationType().getName().equals(OPTIONS.class.getName())) { if (annotation.annotationType().getName().equals(OPTIONS.class.getName())) {
resource.setHttpVerb(HttpMethod.OPTIONS); resource.setHttpVerb(HttpMethod.OPTIONS);
} }
if (annotation.annotationType().getName().equals(HEAD.class.getName())) {
resource.setHttpVerb(HttpMethod.HEAD);
}
if (annotation.annotationType().getName().equals(DELETE.class.getName())) { if (annotation.annotationType().getName().equals(DELETE.class.getName())) {
resource.setHttpVerb(HttpMethod.DELETE); resource.setHttpVerb(HttpMethod.DELETE);
} }
@ -330,6 +334,8 @@ public class AnnotationProcessor {
return true; return true;
} else if (annotation.annotationType().getName().equals(OPTIONS.class.getName())) { } else if (annotation.annotationType().getName().equals(OPTIONS.class.getName())) {
return true; return true;
} else if (annotation.annotationType().getName().equals(HEAD.class.getName())) {
return true;
} else if (annotation.annotationType().getName().equals(DELETE.class.getName())) { } else if (annotation.annotationType().getName().equals(DELETE.class.getName())) {
return true; return true;
} else if (annotation.annotationType().getName().equals(PUT.class.getName())) { } else if (annotation.annotationType().getName().equals(PUT.class.getName())) {

@ -1,70 +0,0 @@
/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
*
* Entgra (Pvt) Ltd. 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.common;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import java.util.List;
public class ApplicationInstallResponseTmp {
@ApiModelProperty(
name = "successfulDevices",
value = "List of successful devices",
dataType = "List[org.wso2.carbon.device.mgt.common.DeviceIdentifier]"
)
private List<DeviceIdentifier> successfulDevices;
@ApiModelProperty(
name = "failedDevices",
value = "List of failed devices",
dataType = "List[org.wso2.carbon.device.mgt.common.DeviceIdentifier]"
)
private List<DeviceIdentifier> failedDevices;
@ApiModelProperty(
name = "activity",
value = "Activity corresponding to the operation"
)
private Activity activity;
public List<DeviceIdentifier> getSuccessfulDevices() {
return successfulDevices;
}
public void setSuccessfulDevices(List<DeviceIdentifier> successfulDevices) {
this.successfulDevices = successfulDevices;
}
public List<DeviceIdentifier> getFailedDevices() {
return failedDevices;
}
public void setFailedDevices(List<DeviceIdentifier> failedDevices) {
this.failedDevices = failedDevices;
}
public Activity getActivity() {
return activity;
}
public void setActivity(Activity activity) {
this.activity = activity;
}
}

@ -171,10 +171,26 @@
<dependency> <dependency>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.common</artifactId> <artifactId>org.wso2.carbon.device.mgt.common</artifactId>
<exclusions>
<exclusion>
<artifactId>objenesis</artifactId>
<groupId>org.objenesis</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.core</artifactId> <artifactId>org.wso2.carbon.device.mgt.core</artifactId>
<exclusions>
<exclusion>
<artifactId>org.wso2.securevault</artifactId>
<groupId>org.wso2.securevault</groupId>
</exclusion>
<exclusion>
<artifactId>axis2-client</artifactId>
<groupId>org.apache.axis2.wso2</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>
@ -183,10 +199,26 @@
<dependency> <dependency>
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.ndatasource.core</artifactId> <artifactId>org.wso2.carbon.ndatasource.core</artifactId>
<exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon</groupId> <groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.core</artifactId> <artifactId>org.wso2.carbon.core</artifactId>
<exclusions>
<exclusion>
<artifactId>stax2-api</artifactId>
<groupId>org.codehaus.woodstox</groupId>
</exclusion>
<exclusion>
<artifactId>woodstox-core-asl</artifactId>
<groupId>org.codehaus.woodstox</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
@ -201,6 +233,12 @@
<groupId>commons-validator</groupId> <groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId> <artifactId>commons-validator</artifactId>
<version>1.6</version> <version>1.6</version>
<exclusions>
<exclusion>
<artifactId>commons-collections</artifactId>
<groupId>commons-collections</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.cxf</groupId> <groupId>org.apache.cxf</groupId>
@ -213,12 +251,10 @@
<version>3.2.7</version> <version>3.2.7</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.tomcat.wso2</groupId> <groupId>org.apache.tomcat.wso2</groupId>
<artifactId>jdbc-pool</artifactId> <artifactId>jdbc-pool</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
@ -236,19 +272,82 @@
<version>1.4.0.wso2v1</version> <version>1.4.0.wso2v1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-pool.wso2</groupId> <groupId>commons-pool.wso2</groupId>
<artifactId>commons-pool</artifactId> <artifactId>commons-pool</artifactId>
<version>1.5.6.wso2v1</version> <version>1.5.6.wso2v1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.application.extension</artifactId> <artifactId>org.wso2.carbon.apimgt.application.extension</artifactId>
<exclusions>
<exclusion>
<artifactId>org.wso2.carbon.registry.servlet</artifactId>
<groupId>org.wso2.carbon.registry</groupId>
</exclusion>
<exclusion>
<artifactId>org.wso2.carbon.registry.admin.api</artifactId>
<groupId>org.wso2.carbon.registry</groupId>
</exclusion>
<exclusion>
<artifactId>org.wso2.carbon.registry.uddi</artifactId>
<groupId>org.wso2.carbon.registry</groupId>
</exclusion>
<exclusion>
<artifactId>org.wso2.carbon.registry.extensions</artifactId>
<groupId>org.wso2.carbon.registry</groupId>
</exclusion>
<exclusion>
<artifactId>commons-collections</artifactId>
<groupId>commons-collections</groupId>
</exclusion>
<exclusion>
<artifactId>commons-lang</artifactId>
<groupId>commons-lang</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>axiom-impl</artifactId>
<groupId>org.apache.ws.commons.axiom</groupId>
</exclusion>
<exclusion>
<artifactId>woodstox-core-asl</artifactId>
<groupId>org.codehaus.woodstox</groupId>
</exclusion>
<exclusion>
<artifactId>axiom-api</artifactId>
<groupId>org.apache.ws.commons.axiom</groupId>
</exclusion>
<exclusion>
<artifactId>commons-digester</artifactId>
<groupId>commons-digester</groupId>
</exclusion>
<exclusion>
<artifactId>commons-beanutils</artifactId>
<groupId>commons-beanutils</groupId>
</exclusion>
<exclusion>
<artifactId>org.wso2.securevault</artifactId>
<groupId>org.wso2.securevault</groupId>
</exclusion>
<exclusion>
<artifactId>jackson-databind</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
<exclusion>
<artifactId>org.wso2.carbon.feature.mgt.core</artifactId>
<groupId>org.wso2.carbon</groupId>
</exclusion>
<exclusion>
<artifactId>joda-time</artifactId>
<groupId>joda-time</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

@ -787,7 +787,8 @@ public interface ApplicationManagementPublisherAPI {
"ApplicationDTO artifact updating payload contains unacceptable or vulnerable data"), "ApplicationDTO artifact updating payload contains unacceptable or vulnerable data"),
@ApiResponse( @ApiResponse(
code = 404, code = 404,
message = "NOT FOUND. \n Couldn't found application/application release to update applocation release artifact."), message = "NOT FOUND. \n Couldn't found application/application release to update "
+ "application release artifact."),
@ApiResponse( @ApiResponse(
code = 500, code = 500,
message = "Internal Server Error. \n Error occurred while getting the application list.", message = "Internal Server Error. \n Error occurred while getting the application list.",

@ -75,7 +75,7 @@ import javax.ws.rs.core.Response;
@Path("/applications") @Path("/applications")
public class ApplicationManagementPublisherAPIImpl implements ApplicationManagementPublisherAPI { public class ApplicationManagementPublisherAPIImpl implements ApplicationManagementPublisherAPI {
private static Log log = LogFactory.getLog(ApplicationManagementPublisherAPIImpl.class); private static final Log log = LogFactory.getLog(ApplicationManagementPublisherAPIImpl.class);
@POST @POST
@Override @Override
@ -97,7 +97,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
} catch (UnexpectedServerErrorException e) { } catch (UnexpectedServerErrorException e) {
String msg = "Error Occured when getting supported device types by Entgra IoTS"; String msg = "Error Occured when getting supported device types by Entgra IoTS";
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (ApplicationManagementException e) { } catch (ApplicationManagementException e) {
String msg = "Error occurred while getting the application list for publisher "; String msg = "Error occurred while getting the application list for publisher ";
@ -127,7 +127,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} catch(ForbiddenException e){ } catch(ForbiddenException e){
String msg = "You don't have permission to access the application. application id: " + appId; String msg = "You don't have permission to access the application. application id: " + appId;
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.FORBIDDEN).entity(msg).build(); return Response.status(Response.Status.FORBIDDEN).entity(msg).build();
} }
catch (ApplicationManagementException e) { catch (ApplicationManagementException e) {
@ -158,7 +158,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
} catch(ForbiddenException e){ } catch(ForbiddenException e){
String msg = "You don't have permission to access the application release. application release UUID: : " String msg = "You don't have permission to access the application release. application release UUID: : "
+ uuid; + uuid;
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.FORBIDDEN).entity(msg).build(); return Response.status(Response.Status.FORBIDDEN).entity(msg).build();
} }
catch (ApplicationManagementException e) { catch (ApplicationManagementException e) {
@ -426,10 +426,10 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
.entity("Successfully uploaded artifacts for the application " + applicationReleaseUuid).build(); .entity("Successfully uploaded artifacts for the application " + applicationReleaseUuid).build();
} catch (NotFoundException e) { } catch (NotFoundException e) {
String msg = "Couldn't found an application release which has application release UUID " String msg = "Couldn't found an application release which has application release UUID "
+ applicationReleaseUuid + ". HEnce please verify the application release UUID again and execute " + applicationReleaseUuid + ". Hence please verify the application release UUID again and execute "
+ "the operation"; + "the operation";
log.error(msg, e); log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).build(); return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} catch (ApplicationManagementException e) { } catch (ApplicationManagementException e) {
String msg = "Error occurred while updating the application image artifacts for application release uuid: " String msg = "Error occurred while updating the application image artifacts for application release uuid: "
+ applicationReleaseUuid; + applicationReleaseUuid;
@ -441,7 +441,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
@Override @Override
@PUT @PUT
@Consumes({"multipart/mixed", MediaType.MULTIPART_FORM_DATA}) @Consumes({"multipart/mixed", MediaType.MULTIPART_FORM_DATA})
@Path("/ent-app-artifact/{deviceType}//{uuid}") @Path("/ent-app-artifact/{deviceType}/{uuid}")
public Response updateApplicationArtifact( public Response updateApplicationArtifact(
@PathParam("deviceType") String deviceType, @PathParam("deviceType") String deviceType,
@PathParam("uuid") String applicationReleaseUuid, @PathParam("uuid") String applicationReleaseUuid,
@ -456,15 +456,24 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
.entity("Successfully uploaded artifacts for the application release. UUID is " .entity("Successfully uploaded artifacts for the application release. UUID is "
+ applicationReleaseUuid).build(); + applicationReleaseUuid).build();
} catch (RequestValidatingException e) { } catch (RequestValidatingException e) {
log.error(e.getMessage(), e); String msg =
return Response.status(Response.Status.BAD_REQUEST).entity(e.getMessage()).build(); "Couldn't find the binary file with the request. Hence invoke the API with updating application"
+ " artifact";
log.error(msg, e);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
} catch (NotFoundException e) { } catch (NotFoundException e) {
log.error(e.getMessage(), e); String msg = "Couldn't find an application which has application release UUID: " + applicationReleaseUuid;
return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).build(); log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} catch (BadRequestException e) {
String msg = "Found an invalid device type: " + deviceType + " with the request";
log.error(msg);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
} catch (ApplicationManagementException e) { } catch (ApplicationManagementException e) {
log.error("Error occurred while updating the image artifacts of the application with the uuid " String msg = "Error occurred while updating the image artifacts of the application with the uuid "
+ applicationReleaseUuid, e); + applicationReleaseUuid;
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} }
} }
@ -479,8 +488,9 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
Application application = applicationManager.updateApplication(applicationId, applicationUpdateWrapper); Application application = applicationManager.updateApplication(applicationId, applicationUpdateWrapper);
return Response.status(Response.Status.OK).entity(application).build(); return Response.status(Response.Status.OK).entity(application).build();
} catch (NotFoundException e) { } catch (NotFoundException e) {
log.error(e.getMessage()); String msg = "Couldn't find an application for application id: " + applicationId;
return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).build(); log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} catch (BadRequestException e) { } catch (BadRequestException e) {
String msg = "Error occurred while modifying the application. Found bad request payload for updating the " String msg = "Error occurred while modifying the application. Found bad request payload for updating the "
+ "application"; + "application";
@ -711,11 +721,10 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
return Response.status(Response.Status.OK).entity(lifecycleStates).build(); return Response.status(Response.Status.OK).entity(lifecycleStates).build();
} catch (NotFoundException e) { } catch (NotFoundException e) {
String msg = "Couldn't found an application release for UUID: " + releaseUuid; String msg = "Couldn't found an application release for UUID: " + releaseUuid;
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} catch (ApplicationManagementException e) { } catch (ApplicationManagementException e) {
String msg = String msg = "Error occurred while getting lifecycle states for application release UUID: " + releaseUuid;
"Error occurred while getting lifecycle states for application release UUID: " + releaseUuid;
log.error(msg, e); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
} }
@ -761,7 +770,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
return Response.status(Response.Status.OK).entity(dataHandler.getLifecycleConfiguration()).build(); return Response.status(Response.Status.OK).entity(dataHandler.getLifecycleConfiguration()).build();
} catch (LifecycleManagementException e) { } catch (LifecycleManagementException e) {
String msg = "Error Occurred while accessing lifecycle manager."; String msg = "Error Occurred while accessing lifecycle manager.";
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} }
} }
@ -777,7 +786,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
return Response.status(Response.Status.OK).entity(tags).build(); return Response.status(Response.Status.OK).entity(tags).build();
} catch (ApplicationManagementException e) { } catch (ApplicationManagementException e) {
String msg = "Error Occurred while getting registered tags."; String msg = "Error Occurred while getting registered tags.";
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} }
} }
@ -796,15 +805,15 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
return Response.status(Response.Status.OK).entity(msg).build(); return Response.status(Response.Status.OK).entity(msg).build();
} catch (NotFoundException e) { } catch (NotFoundException e) {
String msg = e.getMessage(); String msg = e.getMessage();
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} catch (BadRequestException e) { } catch (BadRequestException e) {
String msg = e.getMessage(); String msg = e.getMessage();
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
} catch (ApplicationManagementException e) { } catch (ApplicationManagementException e) {
String msg = "Error Occurred while deleting registered tag."; String msg = "Error Occurred while deleting registered tag.";
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} }
} }
@ -822,15 +831,15 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
return Response.status(Response.Status.OK).entity(msg).build(); return Response.status(Response.Status.OK).entity(msg).build();
} catch (NotFoundException e) { } catch (NotFoundException e) {
String msg = e.getMessage(); String msg = e.getMessage();
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} catch (ForbiddenException e) { } catch (ForbiddenException e) {
String msg = e.getMessage(); String msg = e.getMessage();
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.FORBIDDEN).entity(msg).build(); return Response.status(Response.Status.FORBIDDEN).entity(msg).build();
} catch (ApplicationManagementException e) { } catch (ApplicationManagementException e) {
String msg = "Error Occurred while deleting unused tag."; String msg = "Error Occurred while deleting unused tag.";
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} }
} }
@ -849,15 +858,15 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
return Response.status(Response.Status.OK).entity(msg).build(); return Response.status(Response.Status.OK).entity(msg).build();
} catch (BadRequestException e) { } catch (BadRequestException e) {
String msg = e.getMessage(); String msg = e.getMessage();
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
} catch (NotFoundException e) { } catch (NotFoundException e) {
String msg = e.getMessage(); String msg = e.getMessage();
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} catch (ApplicationManagementException e) { } catch (ApplicationManagementException e) {
String msg = "Error Occurred while updating registered tag."; String msg = "Error Occurred while updating registered tag.";
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} }
} }
@ -874,11 +883,11 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
return Response.status(Response.Status.OK).entity(tags).build(); return Response.status(Response.Status.OK).entity(tags).build();
} catch (BadRequestException e) { } catch (BadRequestException e) {
String msg = e.getMessage(); String msg = e.getMessage();
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
} catch (ApplicationManagementException e) { } catch (ApplicationManagementException e) {
String msg = "Error Occurred while adding new tag."; String msg = "Error Occurred while adding new tag.";
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} }
} }
@ -896,11 +905,11 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
return Response.status(Response.Status.OK).entity(applicationTags).build(); return Response.status(Response.Status.OK).entity(applicationTags).build();
} catch (NotFoundException e) { } catch (NotFoundException e) {
String msg = e.getMessage(); String msg = e.getMessage();
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} catch (ApplicationManagementException e) { } catch (ApplicationManagementException e) {
String msg = "Error Occurred while adding new tags for application which has application ID: " + appId + "."; String msg = "Error Occurred while adding new tags for application which has application ID: " + appId + ".";
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} }
} }
@ -916,7 +925,7 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem
return Response.status(Response.Status.OK).entity(categories).build(); return Response.status(Response.Status.OK).entity(categories).build();
} catch (ApplicationManagementException e) { } catch (ApplicationManagementException e) {
String msg = "Error Occurred while getting registered categories."; String msg = "Error Occurred while getting registered categories.";
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} }
} }

@ -46,7 +46,7 @@ import java.util.List;
@Path("/admin/applications") @Path("/admin/applications")
public class ApplicationManagementPublisherAdminAPIImpl implements ApplicationManagementPublisherAdminAPI { public class ApplicationManagementPublisherAdminAPIImpl implements ApplicationManagementPublisherAdminAPI {
private static Log log = LogFactory.getLog(ApplicationManagementPublisherAdminAPIImpl.class); private static final Log log = LogFactory.getLog(ApplicationManagementPublisherAdminAPIImpl.class);
@DELETE @DELETE
@Consumes(MediaType.WILDCARD) @Consumes(MediaType.WILDCARD)
@ -56,8 +56,8 @@ public class ApplicationManagementPublisherAdminAPIImpl implements ApplicationMa
ApplicationManager applicationManager = APIUtil.getApplicationManager(); ApplicationManager applicationManager = APIUtil.getApplicationManager();
try { try {
applicationManager.deleteApplicationRelease(releaseUuid); applicationManager.deleteApplicationRelease(releaseUuid);
String responseMsg = "Successfully deleted the application release for uuid: " + releaseUuid + ""; return Response.status(Response.Status.OK)
return Response.status(Response.Status.OK).entity(responseMsg).build(); .entity("Successfully deleted the application release for uuid: " + releaseUuid).build();
} catch (NotFoundException e) { } catch (NotFoundException e) {
String msg = String msg =
"Couldn't found application release which is having application release UUID:" + releaseUuid; "Couldn't found application release which is having application release UUID:" + releaseUuid;
@ -84,11 +84,10 @@ public class ApplicationManagementPublisherAdminAPIImpl implements ApplicationMa
ApplicationManager applicationManager = APIUtil.getApplicationManager(); ApplicationManager applicationManager = APIUtil.getApplicationManager();
try { try {
applicationManager.deleteApplication(applicationId); applicationManager.deleteApplication(applicationId);
String responseMsg = "Successfully deleted the application which has ID: " + applicationId + ""; return Response.status(Response.Status.OK)
return Response.status(Response.Status.OK).entity(responseMsg).build(); .entity("Successfully deleted the application which has ID: " + applicationId).build();
} catch (NotFoundException e) { } catch (NotFoundException e) {
String msg = String msg = "Couldn't found application release which is having the ID:" + applicationId;
"Couldn't found application release which is having the ID:" + applicationId;
log.error(msg, e); log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} catch (ForbiddenException e) { } catch (ForbiddenException e) {
@ -111,15 +110,14 @@ public class ApplicationManagementPublisherAdminAPIImpl implements ApplicationMa
ApplicationManager applicationManager = APIUtil.getApplicationManager(); ApplicationManager applicationManager = APIUtil.getApplicationManager();
try { try {
applicationManager.deleteTag(tagName); applicationManager.deleteTag(tagName);
String msg = "Tag " + tagName + " is deleted successfully."; return Response.status(Response.Status.OK).entity("Tag " + tagName + " is deleted successfully.").build();
return Response.status(Response.Status.OK).entity(msg).build();
} catch (NotFoundException e) { } catch (NotFoundException e) {
String msg = e.getMessage(); String msg = e.getMessage();
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} catch (ApplicationManagementException e) { } catch (ApplicationManagementException e) {
String msg = "Error Occurred while deleting registered tag."; String msg = "Error Occurred while deleting registered tag.";
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} }
} }
@ -136,11 +134,11 @@ public class ApplicationManagementPublisherAdminAPIImpl implements ApplicationMa
return Response.status(Response.Status.OK).entity(categories).build(); return Response.status(Response.Status.OK).entity(categories).build();
} catch (BadRequestException e) { } catch (BadRequestException e) {
String msg = e.getMessage(); String msg = e.getMessage();
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
} catch (ApplicationManagementException e) { } catch (ApplicationManagementException e) {
String msg = "Error Occurred while adding new categories."; String msg = "Error Occurred while adding new categories.";
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} }
} }
@ -155,15 +153,15 @@ public class ApplicationManagementPublisherAdminAPIImpl implements ApplicationMa
ApplicationManager applicationManager = APIUtil.getApplicationManager(); ApplicationManager applicationManager = APIUtil.getApplicationManager();
try { try {
applicationManager.updateCategory(oldCategoryName, newCategoryName); applicationManager.updateCategory(oldCategoryName, newCategoryName);
String msg = "Category is updated from " + oldCategoryName + " to " + newCategoryName; return Response.status(Response.Status.OK)
return Response.status(Response.Status.OK).entity(msg).build(); .entity("Category is updated from " + oldCategoryName + " to " + newCategoryName).build();
} catch (NotFoundException e) { } catch (NotFoundException e) {
String msg = e.getMessage(); String msg = e.getMessage();
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} catch (ApplicationManagementException e) { } catch (ApplicationManagementException e) {
String msg = "Error Occurred while rename registered category."; String msg = "Error Occurred while rename registered category.";
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} }
} }
@ -177,15 +175,15 @@ public class ApplicationManagementPublisherAdminAPIImpl implements ApplicationMa
ApplicationManager applicationManager = APIUtil.getApplicationManager(); ApplicationManager applicationManager = APIUtil.getApplicationManager();
try { try {
applicationManager.deleteCategory(categoryName); applicationManager.deleteCategory(categoryName);
String msg = "Category " + categoryName + " is deleted successfully."; return Response.status(Response.Status.OK).entity("Category " + categoryName + " is deleted successfully.")
return Response.status(Response.Status.OK).entity(msg).build(); .build();
} catch (NotFoundException e) { } catch (NotFoundException e) {
String msg = e.getMessage(); String msg = e.getMessage();
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); return Response.status(Response.Status.NOT_FOUND).entity(msg).build();
} catch (ApplicationManagementException e) { } catch (ApplicationManagementException e) {
String msg = "Error Occurred while deleting registered category."; String msg = "Error Occurred while deleting registered category.";
log.error(msg); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} }
} }

@ -41,7 +41,7 @@ import javax.ws.rs.core.Response;
@Path("/admin/reviews") @Path("/admin/reviews")
public class ReviewManagementPublisherAdminAPIImpl implements ReviewManagementPublisherAdminAPI { public class ReviewManagementPublisherAdminAPIImpl implements ReviewManagementPublisherAdminAPI {
private static Log log = LogFactory.getLog(ReviewManagementPublisherAdminAPIImpl.class); private static final Log log = LogFactory.getLog(ReviewManagementPublisherAdminAPIImpl.class);
@Override @Override
@GET @GET

@ -45,7 +45,7 @@ import javax.ws.rs.core.Response;
@Path("/applications") @Path("/applications")
public class ApplicationManagementAPIImpl implements ApplicationManagementAPI { public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
private static Log log = LogFactory.getLog(ApplicationManagementAPIImpl.class); private static final Log log = LogFactory.getLog(ApplicationManagementAPIImpl.class);
@POST @POST
@Override @Override

@ -51,7 +51,7 @@ import javax.ws.rs.core.Response;
@Path("/reviews") @Path("/reviews")
public class ReviewManagementAPIImpl implements ReviewManagementAPI { public class ReviewManagementAPIImpl implements ReviewManagementAPI {
private static Log log = LogFactory.getLog(ReviewManagementAPIImpl.class); private static final Log log = LogFactory.getLog(ReviewManagementAPIImpl.class);
@Override @Override
@GET @GET

@ -64,7 +64,7 @@ import java.util.List;
@Path("/subscription") @Path("/subscription")
public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{ public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{
private static Log log = LogFactory.getLog(SubscriptionManagementAPIImpl.class); private static final Log log = LogFactory.getLog(SubscriptionManagementAPIImpl.class);
@Override @Override
@POST @POST

@ -39,7 +39,7 @@ import javax.ws.rs.core.Response;
@Path("/admin/reviews") @Path("/admin/reviews")
public class ReviewManagementStoreAdminAPIImpl implements ReviewManagementStoreAdminAPI { public class ReviewManagementStoreAdminAPIImpl implements ReviewManagementStoreAdminAPI {
private static Log log = LogFactory.getLog(ReviewManagementStoreAdminAPIImpl.class); private static final Log log = LogFactory.getLog(ReviewManagementStoreAdminAPIImpl.class);
@Override @Override
@DELETE @DELETE

@ -44,7 +44,7 @@ import javax.ws.rs.core.Response;
@Path("/admin/subscription") @Path("/admin/subscription")
public class SubscriptionManagementAdminAPIImpl implements SubscriptionManagementAdminAPI { public class SubscriptionManagementAdminAPIImpl implements SubscriptionManagementAdminAPI {
private static Log log = LogFactory.getLog(SubscriptionManagementAdminAPIImpl.class); private static final Log log = LogFactory.getLog(SubscriptionManagementAdminAPIImpl.class);
@GET @GET
@Consumes("application/json") @Consumes("application/json")

@ -142,6 +142,152 @@
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.application.mgt.core</artifactId> <artifactId>org.wso2.carbon.device.application.mgt.core</artifactId>
<scope>provided</scope> <scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>commons-httpclient</artifactId>
<groupId>commons-httpclient</groupId>
</exclusion>
<exclusion>
<artifactId>commons-lang</artifactId>
<groupId>commons-lang</groupId>
</exclusion>
<exclusion>
<artifactId>commons-collections</artifactId>
<groupId>commons-collections</groupId>
</exclusion>
<exclusion>
<artifactId>commons-digester</artifactId>
<groupId>commons-digester</groupId>
</exclusion>
<exclusion>
<artifactId>commons-beanutils</artifactId>
<groupId>commons-beanutils</groupId>
</exclusion>
<exclusion>
<artifactId>javax.annotation-api</artifactId>
<groupId>javax.annotation</groupId>
</exclusion>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
<exclusion>
<artifactId>org.wso2.securevault</artifactId>
<groupId>org.wso2.securevault</groupId>
</exclusion>
<exclusion>
<artifactId>wsdl4j</artifactId>
<groupId>wsdl4j.wso2</groupId>
</exclusion>
<exclusion>
<artifactId>commons-fileupload</artifactId>
<groupId>commons-fileupload</groupId>
</exclusion>
<exclusion>
<artifactId>jaxen</artifactId>
<groupId>jaxen</groupId>
</exclusion>
<exclusion>
<artifactId>validation-api</artifactId>
<groupId>javax.validation</groupId>
</exclusion>
<exclusion>
<artifactId>jackson-databind</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
<exclusion>
<artifactId>wsdl4j</artifactId>
<groupId>wsdl4j</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>woodstox-core-asl</artifactId>
<groupId>org.codehaus.woodstox</groupId>
</exclusion>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
<exclusion>
<artifactId>asm</artifactId>
<groupId>asm</groupId>
</exclusion>
<exclusion>
<artifactId>hibernate</artifactId>
<groupId>org.hibernate</groupId>
</exclusion>
<exclusion>
<artifactId>geronimo-jta_1.1_spec</artifactId>
<groupId>org.apache.geronimo.specs</groupId>
</exclusion>
<exclusion>
<artifactId>objenesis</artifactId>
<groupId>org.objenesis</groupId>
</exclusion>
<exclusion>
<artifactId>commons-pool</artifactId>
<groupId>commons-pool</groupId>
</exclusion>
<exclusion>
<artifactId>XmlSchema</artifactId>
<groupId>org.apache.ws.commons.schema</groupId>
</exclusion>
<exclusion>
<artifactId>geronimo-stax-api_1.0_spec</artifactId>
<groupId>org.apache.geronimo.specs.wso2</groupId>
</exclusion>
<exclusion>
<artifactId>org.eclipse.core.runtime</artifactId>
<groupId>org.eclipse.core</groupId>
</exclusion>
<exclusion>
<artifactId>org.wso2.carbon.feature.mgt.core</artifactId>
<groupId>org.wso2.carbon</groupId>
</exclusion>
<exclusion>
<artifactId>axis2-client</artifactId>
<groupId>org.apache.axis2.wso2</groupId>
</exclusion>
<exclusion>
<artifactId>joda-time</artifactId>
<groupId>joda-time</groupId>
</exclusion>
<exclusion>
<artifactId>stax2-api</artifactId>
<groupId>org.codehaus.woodstox</groupId>
</exclusion>
<exclusion>
<artifactId>asm</artifactId>
<groupId>org.ow2.asm</groupId>
</exclusion>
<exclusion>
<artifactId>maven-scm-provider-svnexe</artifactId>
<groupId>org.apache.maven.scm</groupId>
</exclusion>
<exclusion>
<artifactId>codemodel</artifactId>
<groupId>com.sun.codemodel</groupId>
</exclusion>
<exclusion>
<artifactId>jackson-mapper-asl</artifactId>
<groupId>org.codehaus.jackson</groupId>
</exclusion>
<exclusion>
<artifactId>cglib-nodep</artifactId>
<groupId>cglib</groupId>
</exclusion>
<exclusion>
<artifactId>plexus-utils</artifactId>
<groupId>org.codehaus.plexus</groupId>
</exclusion>
<exclusion>
<artifactId>httpcore</artifactId>
<groupId>org.apache.httpcomponents.wso2</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>

Loading…
Cancel
Save