Fixed issues in api publishing

revert-70aa11f8
mharindu 8 years ago
parent bca1b4b059
commit 83c2a1f0ee

@ -138,7 +138,7 @@ public class APIPublisherUtil {
// api scope and uri template scope
for (Scope scope : scopes) {
for (URITemplate template : uriTemplates) {
if (scope.getKey().equals(template.getScope().getKey())) {
if (template.getScope() != null && scope.getKey().equals(template.getScope().getKey())) {
template.setScope(scope);
}
}
@ -252,7 +252,7 @@ public class APIPublisherUtil {
if (log.isDebugEnabled()) {
log.debug("'managed-api-endpoint' attribute is not configured");
}
String endpointContext = servletContext.getContextPath();
String endpointContext = apiDef.getContext();
endpoint = APIPublisherUtil.getApiEndpointUrl(endpointContext);
}
apiConfig.setEndpoint(endpoint);

@ -159,7 +159,7 @@ public class AnnotationProcessor {
}
Method[] annotatedMethods = clazz.getDeclaredMethods();
resourceList = getApiResources(rootContext, subContext, annotatedMethods);
resourceList = getApiResources(rootContext, annotatedMethods);
apiResourceConfig.setResources(resourceList);
} catch (Throwable throwable) {
log.error("Error encountered while scanning for annotations", throwable);
@ -211,13 +211,11 @@ public class AnnotationProcessor {
* Get Resources for each API
*
* @param resourceRootContext
* @param apiRootContext
* @param annotatedMethods
* @return
* @throws Throwable
*/
private List<APIResource> getApiResources(String resourceRootContext, String apiRootContext,
Method[] annotatedMethods) throws Throwable {
private List<APIResource> getApiResources(String resourceRootContext, Method[] annotatedMethods) throws Throwable {
List<APIResource> resourceList = new ArrayList<>();
String subCtx = null;
for (Method method : annotatedMethods) {
@ -228,8 +226,10 @@ public class AnnotationProcessor {
Annotation methodContextAnno = method.getAnnotation(pathClazz);
if (methodContextAnno != null) {
subCtx = invokeMethod(pathClazzMethods[0], methodContextAnno, STRING);
} else {
subCtx = "/*";
}
resource.setUriTemplate(makeContextURLReady(apiRootContext) + makeContextURLReady(subCtx));
resource.setUriTemplate(makeContextURLReady(subCtx));
resource.setUri(APIPublisherUtil.getServerBaseUrl() + makeContextURLReady(resourceRootContext) +
makeContextURLReady(subCtx));
@ -266,7 +266,6 @@ public class AnnotationProcessor {
}
resourceList.add(resource);
}
subCtx = null;
}
return resourceList;
}

@ -33,7 +33,7 @@ import javax.ws.rs.core.Response;
/**
* All the certificate related tasks such as saving certificates, can be done through this endpoint.
*/
@API(name = "Certificate", version = "1.0.0", context = "/certificates", tags = {"devicemgt_admin"})
@API(name = "Certificate", version = "1.0.0", context = "/devicemgt_admin/certificates", tags = {"devicemgt_admin"})
// Below Api is for swagger annotations
@Api(value = "Certificate", description = "Certificate related tasks such as saving certificates, " +

@ -30,7 +30,7 @@ import javax.ws.rs.core.Response;
* General Tenant Configuration REST-API implementation.
* All end points support JSON, XMl with content negotiation.
*/
@API(name = "Configuration", version = "1.0.0", context = "/configuration", tags = {"devicemgt_admin"})
@API(name = "Configuration", version = "1.0.0", context = "/devicemgt_admin/configuration", tags = {"devicemgt_admin"})
// Below Api is for swagger annotations
@Path("/configuration")

@ -30,7 +30,7 @@ import javax.ws.rs.core.Response;
/**
* Device related operations such as get all the available devices, etc.
*/
@API(name = "Configuration", version = "1.0.0", context = "/devices", tags = {"devicemgt_admin"})
@API(name = "Device", version = "1.0.0", context = "/devicemgt_admin/devices", tags = {"devicemgt_admin"})
// Below Api is for swagger annotations
@Path("/devices")

@ -35,7 +35,7 @@ import java.util.List;
/**
* Device information related operations.
*/
@API(name = "Device Information", version = "1.0.0", context = "/information", tags = {"devicemgt_admin"})
@API(name = "Device Information", version = "1.0.0", context = "/devicemgt_admin/information", tags = {"devicemgt_admin"})
// Below Api is for swagger annotations
@Path("/information")
@ -65,7 +65,7 @@ public interface DeviceInformation {
@POST
@Path("{list}")
@Path("list")
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
@ -80,6 +80,7 @@ public interface DeviceInformation {
@ApiResponse(code = 400, message = ""),
@ApiResponse(code = 500, message = "Internal Server Error")
})
@Permission(scope = "device-info", permissions = {"/permission/admin/device-mgt/admin/devices/list"})
Response getDevicesInfo(@ApiParam(name = "deviceIdentifiers", value = "List of device identifiers",
required = true) List<DeviceIdentifier> deviceIdentifiers);

@ -30,7 +30,7 @@ import javax.ws.rs.core.Response;
* DeviceNotification management REST-API implementation.
* All end points support JSON, XMl with content negotiation.
*/
@API(name = "Device Notification", version = "1.0.0", context = "/notifications", tags = {"devicemgt_admin"})
@API(name = "Device Notification", version = "1.0.0", context = "/devicemgt_admin/notifications", tags = {"devicemgt_admin"})
// Below Api is for swagger annotations
@Api(value = "DeviceNotification", description = "Device notification related operations can be found here.")

@ -31,7 +31,7 @@ import javax.ws.rs.core.Response;
/**
* Device search related operations such as getting device information.
*/
@API(name = "Device Search", version = "1.0.0", context = "/search", tags = {"devicemgt_admin"})
@API(name = "Device Search", version = "1.0.0", context = "/devicemgt_admin/search", tags = {"devicemgt_admin"})
// Below Api is for swagger annotations
@Path("/search")

@ -28,7 +28,7 @@ import javax.ws.rs.core.Response;
/**
* Features
*/
@API(name = "Device Search", version = "1.0.0", context = "/features", tags = {"devicemgt_admin"})
@API(name = "Device Search", version = "1.0.0", context = "/devicemgt_admin/features", tags = {"devicemgt_admin"})
// Below Api is for swagger annotations
@Api(value = "Feature", description = "Feature management related operations can be found here.")

@ -37,7 +37,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import java.util.List;
@API(name = "Group", version = "1.0.0", context = "/groups", tags = {"devicemgt_admin"})
@API(name = "Group", version = "1.0.0", context = "/devicemgt_admin/groups", tags = {"devicemgt_admin"})
// Below Api is for swagger annotations
@Path("/groups")

@ -28,7 +28,7 @@ import javax.ws.rs.core.Response;
/**
* This class represents license related operations.
*/
@API(name = "License", version = "1.0.0", context = "/license", tags = {"devicemgt_admin"})
@API(name = "License", version = "1.0.0", context = "/devicemgt_admin/license", tags = {"devicemgt_admin"})
// Below Api is for swagger annotations
@Api(value = "License")

@ -32,7 +32,7 @@ import javax.ws.rs.core.Response;
/**
*
*/
@API(name = "Operation", version = "1.0.0", context = "/operations", tags = {"devicemgt_admin"})
@API(name = "Operation", version = "1.0.0", context = "/devicemgt_admin/operations", tags = {"devicemgt_admin"})
// Below Api is for swagger annotations
@Path("/operations")

@ -29,7 +29,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;
@API(name = "Policy", version = "1.0.0", context = "/policies", tags = {"devicemgt_admin"})
@API(name = "Policy", version = "1.0.0", context = "/devicemgt_admin/policies", tags = {"devicemgt_admin"})
// Below Api is for swagger annotations
@Path("/policies")

@ -30,7 +30,7 @@ import javax.ws.rs.core.Response;
/**
* These end points provide profile related operations.
*/
@API(name = "Profile", version = "1.0.0", context = "/profiles", tags = {"devicemgt_admin"})
@API(name = "Profile", version = "1.0.0", context = "/devicemgt_admin/profiles", tags = {"devicemgt_admin"})
// Below Api is for swagger annotations
@Api(value = "Profile")

@ -28,7 +28,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;
@API(name = "Role", version = "1.0.0", context = "/roles", tags = {"devicemgt_admin"})
@API(name = "Role", version = "1.0.0", context = "/devicemgt_admin/roles", tags = {"devicemgt_admin"})
// Below Api is for swagger annotations
@Path("/roles")

@ -32,7 +32,7 @@ import java.util.List;
/**
* This represents the JAX-RS services of User related functionality.
*/
@API(name = "User", version = "1.0.0", context = "/users", tags = {"devicemgt_admin"})
@API(name = "User", version = "1.0.0", context = "/devicemgt_admin/users", tags = {"devicemgt_admin"})
// Below Api is for swagger annotations
@Path("/users")

Loading…
Cancel
Save