Fix merge conflixts

feature/appm-store/pbac
lasanthaDLPDS 6 years ago
commit d293b5b1b8

15
.github/stale.yml vendored

@ -0,0 +1,15 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 10
# Don't close isssues or pulls
daysUntilClose: false
# Issues with these labels will never be considered stale
exemptLabels:
- Resolution/Postponed
# Label to use when marking an issue as stale
staleLabel: Resolution/Stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

@ -22,13 +22,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Annotations</name>
<description>WSO2 Carbon - API Management Custom Annotation Module</description>

@ -21,12 +21,12 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<artifactId>org.wso2.carbon.apimgt.application.extension.api</artifactId>
<packaging>war</packaging>
<name>WSO2 Carbon - API Application Management API</name>

@ -22,12 +22,12 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<artifactId>org.wso2.carbon.apimgt.application.extension</artifactId>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Application Management</name>

@ -129,6 +129,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
for (APIInfo apiInfo : apiList.getList()) {
String id = apiInfo.getProvider().replace("@", "-AT-")
+ "-" + apiInfo.getName() + "-" + apiInfo.getVersion();
id = id.replace(" ", "+");
boolean subscriptionExist = false;
if (subscriptionList.getList() != null && subscriptionList.getList().size() > 0) {
for (Subscription subs : subscriptionList.getList()) {

@ -21,13 +21,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.handlers</artifactId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Security Handler Component</name>
<description>WSO2 Carbon - API Management Security Handler Module</description>
@ -140,4 +140,4 @@
</plugins>
</build>
</project>
</project>

@ -29,7 +29,7 @@
<Password>admin</Password>
<!--Dynamic client registration endpoint-->
<DynamicClientRegistrationEndpoint>https://${iot.keymanager.host}:${iot.keymanager.https.port}/client-registration/v0.11/register</DynamicClientRegistrationEndpoint>
<DynamicClientRegistrationEndpoint>https://${iot.keymanager.host}:${iot.keymanager.https.port}/client-registration/v0.12/register</DynamicClientRegistrationEndpoint>
<!--Oauth token endpoint-->
<OauthTokenEndpoint>https://${iot.keymanager.host}:${iot.keymanager.https.port}/oauth2/token</OauthTokenEndpoint>

@ -47,7 +47,7 @@ public class IOTServerConfigurationTest extends BaseAPIHandlerTest {
Assert.assertEquals(serverConfiguration.getUsername(), "testuser");
Assert.assertEquals(serverConfiguration.getPassword(), "testuserpwd");
Assert.assertEquals(serverConfiguration.getDynamicClientRegistrationEndpoint(),
"https://${iot.keymanager.host}:${iot.keymanager.https.port}/client-registration/v0.11/register");
"https://${iot.keymanager.host}:${iot.keymanager.https.port}/client-registration/v0.12/register");
Assert.assertEquals(serverConfiguration.getOauthTokenEndpoint(),
"https://${iot.keymanager.host}:${iot.keymanager.https.port}/oauth2/token");
Assert.assertEquals(serverConfiguration.getApis().size(), 1);
@ -87,7 +87,7 @@ public class IOTServerConfigurationTest extends BaseAPIHandlerTest {
Assert.assertEquals(serverConfiguration.getPassword(), "testuserpwd");
Assert.assertEquals(serverConfiguration.getDynamicClientRegistrationEndpoint(),
"https://" + TestUtils.IOT_KEYMANAGER_HOST + ":" + TestUtils.IOT_KEYMANAGER_PORT
+ "/client-registration/v0.11/register");
+ "/client-registration/v0.12/register");
Assert.assertEquals(serverConfiguration.getOauthTokenEndpoint(),
"https://" + TestUtils.IOT_KEYMANAGER_HOST + ":" + TestUtils.IOT_KEYMANAGER_PORT
+ "/oauth2/token");

@ -29,7 +29,7 @@
<Password>testuserpwd</Password>
<!--Dynamic client registration endpoint-->
<DynamicClientRegistrationEndpoint>https://${iot.keymanager.host}:${iot.keymanager.https.port}/client-registration/v0.11/register</DynamicClientRegistrationEndpoint>
<DynamicClientRegistrationEndpoint>https://${iot.keymanager.host}:${iot.keymanager.https.port}/client-registration/v0.12/register</DynamicClientRegistrationEndpoint>
<!--Oauth token endpoint-->
<OauthTokenEndpoint>https://${iot.keymanager.host}:${iot.keymanager.https.port}/oauth2/token</OauthTokenEndpoint>

@ -29,7 +29,7 @@
<Password>testuserpwd</Password>
<!--Dynamic client registration endpoint-->
<DynamicClientRegistrationEndpoint>https://${iot.keymanager.host}:${iot.keymanager.https.port}/client-registration/v0.11/register</DynamicClientRegistrationEndpoint>
<DynamicClientRegistrationEndpoint>https://${iot.keymanager.host}:${iot.keymanager.https.port}/client-registration/v0.12/register</DynamicClientRegistrationEndpoint>
<!--Oauth token endpoint-->
<OauthTokenEndpoint>https://${iot.keymanager.host}:${iot.keymanager.https.port}/oauth2/token</OauthTokenEndpoint>

@ -29,7 +29,7 @@
<Password>testuserpwd</Password>
<!--Dynamic client registration endpoint-->
<DynamicClientRegistrationEndpoint>https://${iot.keymanager.host}:${iot.keymanager.https.port}/client-registration/v0.11/register</DynamicClientRegistrationEndpoint>
<DynamicClientRegistrationEndpoint>https://${iot.keymanager.host}:${iot.keymanager.https.port}/client-registration/v0.12/register</DynamicClientRegistrationEndpoint>
<!--Oauth token endpoint-->
<OauthTokenEndpoint>https://${iot.keymanager.host}:${iot.keymanager.https.port}/oauth2/token</OauthTokenEndpoint>

@ -13,13 +13,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.integration.client</artifactId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Integration Client</name>
<description>WSO2 Carbon - API Management Integration Client</description>
@ -72,10 +72,20 @@
javax.xml,
org.wso2.carbon.base,
javax.net.ssl,
org.apache.commons.lang,
android.util;resolution:=optional,
javax.annotation;resolution:=optional,
javax.net;resolution:=optional,
javax.security.auth.x500;resolution:=optional,
javax.crypto;resolution:=optional,
javax.crypto.spec;resolution:=optional
</Import-Package>
<Embed-Dependency>
jsr311-api,
feign-jaxrs
feign-jaxrs,
feign-okhttp,
okhttp,
okio
</Embed-Dependency>
</instructions>
</configuration>
@ -110,6 +120,18 @@
</build>
<dependencies>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-okhttp</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.logging</artifactId>

@ -22,6 +22,7 @@ import feign.auth.BasicAuthRequestInterceptor;
import feign.gson.GsonDecoder;
import feign.gson.GsonEncoder;
import feign.jaxrs.JAXRSContract;
import feign.okhttp.OkHttpClient;
import feign.slf4j.Slf4jLogger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -65,8 +66,9 @@ public class OAuthRequestInterceptor implements RequestInterceptor {
public OAuthRequestInterceptor() {
String username = APIMConfigReader.getInstance().getConfig().getUsername();
String password = APIMConfigReader.getInstance().getConfig().getPassword();
dcrClient = Feign.builder().client(Utils.getSSLClient()).logger(new Slf4jLogger()).logLevel(
Logger.Level.FULL).requestInterceptor(new BasicAuthRequestInterceptor(username, password))
dcrClient = Feign.builder().client(new OkHttpClient(Utils.getSSLClient())).logger(new Slf4jLogger())
.logLevel(Logger.Level.FULL).requestInterceptor(new BasicAuthRequestInterceptor(username,
password))
.contract(new JAXRSContract()).encoder(new GsonEncoder()).decoder(new GsonDecoder())
.target(DCRClient.class, Utils.replaceProperties(
APIMConfigReader.getInstance().getConfig().getDcrEndpoint()));

@ -22,6 +22,7 @@ import feign.Logger;
import feign.RequestInterceptor;
import feign.gson.GsonDecoder;
import feign.gson.GsonEncoder;
import feign.okhttp.OkHttpClient;
import feign.slf4j.Slf4jLogger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -35,12 +36,13 @@ import org.wso2.carbon.core.util.Utils;
public class PublisherClient {
private static final Log log = LogFactory.getLog(PublisherClient.class);
private APIsApi api = null;
private APIDocumentApi document = null;
private ApplicationsApi application = null;
private EnvironmentsApi environments = null;
private SubscriptionsApi subscriptions = null;
private TiersApi tiers = null;
private APIIndividualApi api = null;
private APICollectionApi apis = null;
private DocumentIndividualApi document = null;
private ApplicationIndividualApi application = null;
private EnvironmentCollectionApi environments = null;
private SubscriptionCollectionApi subscriptions = null;
private ThrottlingTierCollectionApi tiers = null;
/**
@ -48,41 +50,47 @@ public class PublisherClient {
*
*/
public PublisherClient(RequestInterceptor requestInterceptor) {
Feign.Builder builder = Feign.builder().client(
org.wso2.carbon.apimgt.integration.client.util.Utils.getSSLClient()).logger(new Slf4jLogger())
Feign.Builder builder = Feign.builder().client(new OkHttpClient(
org.wso2.carbon.apimgt.integration.client.util.Utils.getSSLClient())).logger(new
Slf4jLogger())
.logLevel(Logger.Level.FULL)
.requestInterceptor(requestInterceptor).encoder(new GsonEncoder()).decoder(new GsonDecoder());
String basePath = Utils.replaceSystemProperty(APIMConfigReader.getInstance().getConfig().getPublisherEndpoint());
api = builder.target(APIsApi.class, basePath);
document = builder.target(APIDocumentApi.class, basePath);
application = builder.target(ApplicationsApi.class, basePath);
environments = builder.target(EnvironmentsApi.class, basePath);
subscriptions = builder.target(SubscriptionsApi.class, basePath);
tiers = builder.target(TiersApi.class, basePath);
api = builder.target(APIIndividualApi.class, basePath);
apis = builder.target(APICollectionApi.class, basePath);
document = builder.target(DocumentIndividualApi.class, basePath);
application = builder.target(ApplicationIndividualApi.class, basePath);
environments = builder.target(EnvironmentCollectionApi.class, basePath);
subscriptions = builder.target(SubscriptionCollectionApi.class, basePath);
tiers = builder.target(ThrottlingTierCollectionApi.class, basePath);
}
public APIsApi getApi() {
public APIIndividualApi getApi() {
return api;
}
public APIDocumentApi getDocument() {
public APICollectionApi getApis() {
return apis;
}
public DocumentIndividualApi getDocument() {
return document;
}
public ApplicationsApi getApplication() {
public ApplicationIndividualApi getApplication() {
return application;
}
public EnvironmentsApi getEnvironments() {
public EnvironmentCollectionApi getEnvironments() {
return environments;
}
public SubscriptionsApi getSubscriptions() {
public SubscriptionCollectionApi getSubscriptions() {
return subscriptions;
}
public TiersApi getTiers() {
public ThrottlingTierCollectionApi getTiers() {
return tiers;
}
}

@ -24,6 +24,7 @@ import feign.RequestInterceptor;
import feign.Retryer;
import feign.gson.GsonDecoder;
import feign.gson.GsonEncoder;
import feign.okhttp.OkHttpClient;
import feign.slf4j.Slf4jLogger;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.apimgt.integration.client.configs.APIMConfigReader;
@ -52,8 +53,9 @@ public class StoreClient {
public StoreClient(RequestInterceptor requestInterceptor) {
Feign.Builder builder = Feign.builder().client(
org.wso2.carbon.apimgt.integration.client.util.Utils.getSSLClient()).logger(new Slf4jLogger())
Feign.Builder builder = Feign.builder().client(new OkHttpClient(
org.wso2.carbon.apimgt.integration.client.util.Utils.getSSLClient())).logger(new
Slf4jLogger())
.logLevel(Logger.Level.FULL)
.requestInterceptor(requestInterceptor).encoder(new GsonEncoder()).decoder(new GsonDecoder());
String basePath = Utils.replaceSystemProperty(APIMConfigReader.getInstance().getConfig().getStoreEndpoint());

@ -18,24 +18,38 @@
package org.wso2.carbon.apimgt.integration.client.util;
import okhttp3.OkHttpClient;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.base.ServerConfiguration;
import feign.Client;
import javax.net.ssl.*;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.security.*;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.SocketAddress;
import java.net.URI;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import feign.Logger;
import feign.Request;
import feign.Response;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.base.ServerConfiguration;
public class Utils {
@ -57,6 +71,10 @@ public class Utils {
private static final String SSLV3 = "SSLv3";
private static final String DEFAULT_HOST = "localhost";
private static final String DEFAULT_HOST_IP = "127.0.0.1";
//This method is only used if the mb features are within DAS.
public static String replaceProperties(String text) {
@ -73,17 +91,68 @@ public class Utils {
return text;
}
public static Client getSSLClient() {
boolean isIgnoreHostnameVerification = Boolean.parseBoolean(System.getProperty("org.wso2.ignoreHostnameVerification"));
if(isIgnoreHostnameVerification) {
return new Client.Default(getSimpleTrustedSSLSocketFactory(), new HostnameVerifier() {
@Override
public boolean verify(String s, SSLSession sslSession) {
return true;
public static OkHttpClient getSSLClient() {
boolean isIgnoreHostnameVerification = Boolean.parseBoolean(System.getProperty("org.wso2"
+ ".ignoreHostnameVerification"));
OkHttpClient okHttpClient;
final String proxyHost = System.getProperty("http.proxyHost");
final String proxyPort = System.getProperty("http.proxyPort");
final String nonProxyHostsValue = System.getProperty("http.nonProxyHosts");
final ProxySelector proxySelector = new ProxySelector() {
@Override
public java.util.List<Proxy> select(URI uri) {
List<Proxy> proxyList = new ArrayList<>();
String host = uri.getHost();
if (!StringUtils.isEmpty(host)) {
if (host.startsWith(DEFAULT_HOST_IP) || host.startsWith(DEFAULT_HOST) || StringUtils
.isEmpty(nonProxyHostsValue) || StringUtils.contains(nonProxyHostsValue, host) ||
StringUtils.isEmpty(proxyHost) || StringUtils.isEmpty(proxyPort)) {
proxyList.add(Proxy.NO_PROXY);
} else {
proxyList.add(new Proxy(Proxy.Type.HTTP,
new InetSocketAddress(proxyHost, Integer.parseInt(proxyPort))));
}
} else {
log.error("Host is null. Host could not be empty or null");
}
});
return proxyList;
}
@Override
public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {
throw new UnsupportedOperationException("Not supported yet.");
}
};
X509TrustManager trustAllCerts = new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return new java.security.cert.X509Certificate[0];
}
public void checkClientTrusted(
java.security.cert.X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(
java.security.cert.X509Certificate[] certs, String authType) {
}
};
if(isIgnoreHostnameVerification) {
okHttpClient = new OkHttpClient.Builder()
.sslSocketFactory(getSimpleTrustedSSLSocketFactory(), trustAllCerts)
.hostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String s, SSLSession sslSession) {
return true;
}
}).proxySelector(proxySelector).build();
return okHttpClient;
}else {
return new Client.Default(getTrustedSSLSocketFactory(), null);
SSLSocketFactory trustedSSLSocketFactory = getTrustedSSLSocketFactory();
okHttpClient = new OkHttpClient.Builder().sslSocketFactory(trustedSSLSocketFactory)
.proxySelector(proxySelector).build();
return okHttpClient;
}
}

@ -13,13 +13,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.integration.generated.client</artifactId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Integration Generated Client</name>
<description>WSO2 Carbon - API Management Integration Client</description>

@ -22,13 +22,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.webapp.publisher</artifactId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Webapp Publisher</name>
<description>WSO2 Carbon - API Management Webapp Publisher</description>

@ -50,10 +50,10 @@ public class APIPublisherServiceImpl implements APIPublisherService {
PublisherClient publisherClient = APIPublisherDataHolder.getInstance().getIntegrationClientService()
.getPublisherClient();
API api = getAPI(apiConfig);
APIList apiList = publisherClient.getApi().apisGet(100, 0, "name:" + api.getName(), CONTENT_TYPE, null);
APIList apiList = publisherClient.getApis().apisGet(100, 0, "name:" + api.getName(), CONTENT_TYPE, null);
if (!isExist(api, apiList)) {
api = publisherClient.getApi().apisPost(api, CONTENT_TYPE);
api = publisherClient.getApi().apisPost(api, CONTENT_TYPE, null);
if (CREATED_STATUS.equals(api.getStatus())) {
publisherClient.getApi().apisChangeLifecyclePost(PUBLISH_ACTION, api.getId(), null, null, null);
}

@ -27,7 +27,8 @@ import org.wso2.carbon.apimgt.integration.client.OAuthRequestInterceptor;
import org.wso2.carbon.apimgt.integration.client.model.OAuthApplication;
import org.wso2.carbon.apimgt.integration.client.publisher.PublisherClient;
import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService;
import org.wso2.carbon.apimgt.integration.generated.client.publisher.api.APIsApi;
import org.wso2.carbon.apimgt.integration.generated.client.publisher.api.APICollectionApi;
import org.wso2.carbon.apimgt.integration.generated.client.publisher.api.APIIndividualApi;
import org.wso2.carbon.apimgt.integration.generated.client.publisher.model.API;
import org.wso2.carbon.apimgt.integration.generated.client.publisher.model.APIInfo;
import org.wso2.carbon.apimgt.integration.generated.client.publisher.model.APIList;
@ -35,7 +36,8 @@ import org.wso2.carbon.apimgt.webapp.publisher.config.WebappPublisherConfig;
import org.wso2.carbon.apimgt.webapp.publisher.dto.ApiScope;
import org.wso2.carbon.apimgt.webapp.publisher.exception.APIManagerPublisherException;
import org.wso2.carbon.apimgt.webapp.publisher.internal.APIPublisherDataHolder;
import org.wso2.carbon.apimgt.webapp.publisher.utils.MockApi;
import org.wso2.carbon.apimgt.webapp.publisher.utils.MockAPICollectionApi;
import org.wso2.carbon.apimgt.webapp.publisher.utils.MockAPIIndividualApi;
import org.wso2.carbon.apimgt.webapp.publisher.utils.TestUtils;
import java.lang.reflect.Field;
@ -61,6 +63,12 @@ public class APIPublisherServiceTest extends BaseAPIPublisherTest {
APIManagerPublisherException {
APIConfig apiConfig = new APIConfig();
setApiConfigs(apiConfig, "testAPI-0");
PublisherClient publisherClient = APIPublisherDataHolder.getInstance().getIntegrationClientService().
getPublisherClient();
APICollectionApi collectionApi = Mockito.mock(MockAPICollectionApi.class, Mockito.CALLS_REAL_METHODS);
APIIndividualApi apIsApi = Mockito.mock(MockAPIIndividualApi.class, Mockito.CALLS_REAL_METHODS);
doReturn(collectionApi).when(publisherClient).getApis();
doReturn(apIsApi).when(publisherClient).getApi();
apiPublisherService.publishAPI(apiConfig);
}
@ -77,11 +85,13 @@ public class APIPublisherServiceTest extends BaseAPIPublisherTest {
PublisherClient publisherClient = APIPublisherDataHolder.getInstance().getIntegrationClientService().
getPublisherClient();
doReturn(publisherClient).when(integrationClientService).getPublisherClient();
APIsApi apIsApi = Mockito.mock(MockApi.class, Mockito.CALLS_REAL_METHODS);
APIIndividualApi apIsApi = Mockito.mock(MockAPIIndividualApi.class, Mockito.CALLS_REAL_METHODS);
APICollectionApi collectionApi = Mockito.mock(MockAPICollectionApi.class, Mockito.CALLS_REAL_METHODS);
doReturn(collectionApi).when(publisherClient).getApis();
doReturn(apIsApi).when(publisherClient).getApi();
API api = Mockito.mock(API.class, Mockito.CALLS_REAL_METHODS);
api.setStatus("CREATED");
doReturn(api).when(apIsApi).apisPost(Mockito.any(), Mockito.anyString());
doReturn(api).when(apIsApi).apisPost(Mockito.any(), Mockito.anyString(), Mockito.anyString());
apiPublisherService.publishAPI(apiConfig);
}
@ -97,18 +107,18 @@ public class APIPublisherServiceTest extends BaseAPIPublisherTest {
PublisherClient publisherClient = APIPublisherDataHolder.getInstance().getIntegrationClientService().
getPublisherClient();
doReturn(publisherClient).when(integrationClientService).getPublisherClient();
APIsApi apIsApi = Mockito.mock(MockApi.class, Mockito.CALLS_REAL_METHODS);
APIIndividualApi apIsApi = Mockito.mock(MockAPIIndividualApi.class, Mockito.CALLS_REAL_METHODS);
APICollectionApi collectionApi = Mockito.mock(MockAPICollectionApi.class, Mockito.CALLS_REAL_METHODS);
doReturn(collectionApi).when(publisherClient).getApis();
doReturn(apIsApi).when(publisherClient).getApi();
API api = Mockito.mock(API.class, Mockito.CALLS_REAL_METHODS);
api.setStatus("CREATED");
doReturn(api).when(apIsApi).apisPost(Mockito.any(), Mockito.anyString());
doReturn(api).when(apIsApi).apisPost(Mockito.any(), Mockito.anyString(), Mockito.anyString());
APIList apiList = Mockito.mock(APIList.class, Mockito.CALLS_REAL_METHODS);
APIInfo apiInfo = new APIInfo();
List<APIInfo> apiInfoList = new ArrayList<>();
apiInfoList.add(apiInfo);
apiList.list(apiInfoList);
doReturn(apiList).when(apIsApi).apisGet(Mockito.anyInt(), Mockito.anyInt(),
Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
doReturn(api).when(apIsApi).apisApiIdPut(Mockito.anyString(), Mockito.any(),
Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
apiPublisherService.publishAPI(apiConfig);
@ -126,11 +136,13 @@ public class APIPublisherServiceTest extends BaseAPIPublisherTest {
PublisherClient publisherClient = APIPublisherDataHolder.getInstance().getIntegrationClientService().
getPublisherClient();
doReturn(publisherClient).when(integrationClientService).getPublisherClient();
APIsApi apIsApi = Mockito.mock(MockApi.class, Mockito.CALLS_REAL_METHODS);
APIIndividualApi apIsApi = Mockito.mock(MockAPIIndividualApi.class, Mockito.CALLS_REAL_METHODS);
APICollectionApi collectionApi = Mockito.mock(MockAPICollectionApi.class, Mockito.CALLS_REAL_METHODS);
doReturn(collectionApi).when(publisherClient).getApis();
doReturn(apIsApi).when(publisherClient).getApi();
API api = Mockito.mock(API.class, Mockito.CALLS_REAL_METHODS);
api.setStatus("CREATED");
doReturn(api).when(apIsApi).apisPost(Mockito.any(), Mockito.anyString());
doReturn(api).when(apIsApi).apisPost(Mockito.any(), Mockito.anyString(), Mockito.anyString());
APIList apiList = Mockito.mock(APIList.class, Mockito.CALLS_REAL_METHODS);
APIInfo apiInfo = new APIInfo();
apiInfo.setName("testAPI-3");
@ -139,8 +151,6 @@ public class APIPublisherServiceTest extends BaseAPIPublisherTest {
List<APIInfo> apiInfoList = new ArrayList<>();
apiInfoList.add(apiInfo);
apiList.list(apiInfoList);
doReturn(apiList).when(apIsApi).apisGet(Mockito.anyInt(), Mockito.anyInt(),
Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
doReturn(api).when(apIsApi).apisApiIdPut(Mockito.anyString(), Mockito.any(),
Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
apiConfig.setSharedWithAllTenants(false);

@ -26,9 +26,9 @@ import org.wso2.carbon.apimgt.integration.client.IntegrationClientServiceImpl;
import org.wso2.carbon.apimgt.integration.client.internal.APIIntegrationClientDataHolder;
import org.wso2.carbon.apimgt.integration.client.publisher.PublisherClient;
import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService;
import org.wso2.carbon.apimgt.integration.generated.client.publisher.api.APIsApi;
import org.wso2.carbon.apimgt.integration.generated.client.publisher.api.APIIndividualApi;
import org.wso2.carbon.apimgt.webapp.publisher.internal.APIPublisherDataHolder;
import org.wso2.carbon.apimgt.webapp.publisher.utils.MockApi;
import org.wso2.carbon.apimgt.webapp.publisher.utils.MockAPIIndividualApi;
import org.wso2.carbon.base.MultitenantConstants;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.context.internal.OSGiDataHolder;
@ -87,7 +87,7 @@ public abstract class BaseAPIPublisherTest {
PublisherClient publisherClient = Mockito.mock(PublisherClient.class, Mockito.CALLS_REAL_METHODS);
doReturn(publisherClient).when(integrationClientService).getPublisherClient();
APIsApi api = new MockApi();
APIIndividualApi api = new MockAPIIndividualApi();
Field field = PublisherClient.class.getDeclaredField("api");
field.setAccessible(true);
field.set(publisherClient, api);

@ -0,0 +1,32 @@
/*
* 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.apimgt.webapp.publisher.utils;
import org.wso2.carbon.apimgt.integration.generated.client.publisher.api.APICollectionApi;
import org.wso2.carbon.apimgt.integration.generated.client.publisher.model.APIList;
/**
* Class to create MockApi for testing.
*/
public class MockAPICollectionApi implements APICollectionApi {
@Override
public APIList apisGet(Integer limit, Integer offset, String query, String accept, String ifNoneMatch) {
return null;
}
}

@ -17,9 +17,9 @@
*/
package org.wso2.carbon.apimgt.webapp.publisher.utils;
import org.wso2.carbon.apimgt.integration.generated.client.publisher.api.APIsApi;
import feign.Param;
import org.wso2.carbon.apimgt.integration.generated.client.publisher.api.APIIndividualApi;
import org.wso2.carbon.apimgt.integration.generated.client.publisher.model.API;
import org.wso2.carbon.apimgt.integration.generated.client.publisher.model.APIList;
import org.wso2.carbon.apimgt.integration.generated.client.publisher.model.FileInfo;
import java.io.File;
@ -27,7 +27,7 @@ import java.io.File;
/**
* Class to create MockApi for testing.
*/
public class MockApi implements APIsApi {
public class MockAPIIndividualApi implements APIIndividualApi {
@Override
public void apisApiIdDelete(String apiId, String ifMatch, String ifUnmodifiedSince) {
@ -75,12 +75,8 @@ public class MockApi implements APIsApi {
}
@Override
public APIList apisGet(Integer limit, Integer offset, String query, String accept, String ifNoneMatch) {
return null;
}
@Override
public API apisPost(API body, String contentType) {
public API apisPost(API body, @Param("contentType") String contentType, @Param("authorization") String authorization) {
return new API();
}
}

@ -0,0 +1,656 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright 2005-2017 WSO2 Inc. (http://wso2.com)
~
~ Licensed 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.
-->
<!--
This is the main server configuration file
${carbon.home} represents the carbon.home system property.
Other system properties can be specified in a similar manner.
-->
<Server xmlns="http://wso2.org/projects/carbon/carbon.xml">
<!--
Product Name
-->
<Name>${product.name}</Name>
<!--
machine readable unique key to identify each product
-->
<ServerKey>${product.key}</ServerKey>
<!--
Product Version
-->
<Version>${product.version}</Version>
<!--
Host name or IP address of the machine hosting this server
e.g. www.wso2.org, 192.168.1.10
This is will become part of the End Point Reference of the
services deployed on this server instance.
-->
<!--HostName>www.wso2.org</HostName-->
<!--
Host name to be used for the Carbon management console
-->
<!--MgtHostName>mgt.wso2.org</MgtHostName-->
<!--
The URL of the back end server. This is where the admin services are hosted and
will be used by the clients in the front end server.
This is required only for the Front-end server. This is used when seperating BE server from FE server
-->
<ServerURL>local:/${carbon.context}/services/</ServerURL>
<!--
<ServerURL>https://${carbon.local.ip}:${carbon.management.port}${carbon.context}/services/</ServerURL>
-->
<!--
The URL of the index page. This is where the user will be redirected after signing in to the
carbon server.
-->
<!-- IndexPageURL>/carbon/admin/index.jsp</IndexPageURL-->
<!--
For cApp deployment, we have to identify the roles that can be acted by the current server.
The following property is used for that purpose. Any number of roles can be defined here.
Regular expressions can be used in the role.
Ex : <Role>.*</Role> means this server can act any role
-->
<ServerRoles>
<Role>${default.server.role}</Role>
</ServerRoles>
<!-- uncommnet this line to subscribe to a bam instance automatically -->
<!--<BamServerURL>https://bamhost:bamport/services/</BamServerURL>-->
<!--
The fully qualified name of the server
-->
<Package>org.wso2.carbon</Package>
<!--
Webapp context root of WSO2 Carbon management console.
-->
<WebContextRoot>/</WebContextRoot>
<!--
Proxy context path is a useful parameter to add a proxy path when a Carbon server is fronted by reverse proxy. In addtion
to the proxy host and proxy port this parameter allows you add a path component to external URLs. e.g.
URL of the Carbon server -> https://10.100.1.1:9443/carbon
URL of the reverse proxy -> https://prod.abc.com/appserver/carbon
appserver - proxy context path. This specially required whenever you are generating URLs to displace in
Carbon UI components.
-->
<!--
<MgtProxyContextPath></MgtProxyContextPath>
<ProxyContextPath></ProxyContextPath>
-->
<!-- In-order to get the registry http Port from the back-end when the default http transport is not the same-->
<!--RegistryHttpPort>9763</RegistryHttpPort-->
<!--
Number of items to be displayed on a management console page. This is used at the
backend server for pagination of various items.
-->
<ItemsPerPage>15</ItemsPerPage>
<!-- The endpoint URL of the cloud instance management Web service -->
<!--<InstanceMgtWSEndpoint>https://ec2.amazonaws.com/</InstanceMgtWSEndpoint>-->
<!--
Ports used by this server
-->
<Ports>
<!-- Ports offset. This entry will set the value of the ports defined below to
the define value + Offset.
e.g. Offset=2 and HTTPS port=9443 will set the effective HTTPS port to 9445
-->
<Offset>0</Offset>
<!-- The JMX Ports -->
<JMX>
<!--The port RMI registry is exposed-->
<RMIRegistryPort>9999</RMIRegistryPort>
<!--The port RMI server should be exposed-->
<RMIServerPort>11111</RMIServerPort>
</JMX>
<!-- Embedded LDAP server specific ports -->
<EmbeddedLDAP>
<!-- Port which embedded LDAP server runs -->
<LDAPServerPort>10389</LDAPServerPort>
<!-- Port which KDC (Kerberos Key Distribution Center) server runs -->
<KDCServerPort>8000</KDCServerPort>
</EmbeddedLDAP>
<!--
Override datasources JNDIproviderPort defined in bps.xml and datasources.properties files
-->
<!--<JNDIProviderPort>2199</JNDIProviderPort>-->
<!--Override receive port of thrift based entitlement service.-->
<ThriftEntitlementReceivePort>10500</ThriftEntitlementReceivePort>
</Ports>
<!--
JNDI Configuration
-->
<JNDI>
<!--
The fully qualified name of the default initial context factory
-->
<DefaultInitialContextFactory>org.wso2.carbon.tomcat.jndi.CarbonJavaURLContextFactory</DefaultInitialContextFactory>
<!--
The restrictions that are done to various JNDI Contexts in a Multi-tenant environment
-->
<Restrictions>
<!--
Contexts that will be available only to the super-tenant
-->
<!-- <SuperTenantOnly>
<UrlContexts>
<UrlContext>
<Scheme>foo</Scheme>
</UrlContext>
<UrlContext>
<Scheme>bar</Scheme>
</UrlContext>
</UrlContexts>
</SuperTenantOnly> -->
<!--
Contexts that are common to all tenants
-->
<AllTenants>
<UrlContexts>
<UrlContext>
<Scheme>java</Scheme>
</UrlContext>
<!-- <UrlContext>
<Scheme>foo</Scheme>
</UrlContext> -->
</UrlContexts>
</AllTenants>
<!--
All other contexts not mentioned above will be available on a per-tenant basis
(i.e. will not be shared among tenants)
-->
</Restrictions>
</JNDI>
<!--
Property to determine if the server is running an a cloud deployment environment.
This property should only be used to determine deployment specific details that are
applicable only in a cloud deployment, i.e when the server deployed *-as-a-service.
-->
<IsCloudDeployment>false</IsCloudDeployment>
<!--
Property to determine whether usage data should be collected for metering purposes
-->
<EnableMetering>false</EnableMetering>
<!-- The Max time a thread should take for execution in seconds -->
<MaxThreadExecutionTime>600</MaxThreadExecutionTime>
<!--
A flag to enable or disable Ghost Deployer. By default this is set to false. That is
because the Ghost Deployer works only with the HTTP/S transports. If you are using
other transports, don't enable Ghost Deployer.
-->
<GhostDeployment>
<Enabled>false</Enabled>
</GhostDeployment>
<!--
Eager loading or lazy loading is a design pattern commonly used in computer programming which
will initialize an object upon creation or load on-demand. In carbon, lazy loading is used to
load tenant when a request is received only. Similarly Eager loading is used to enable load
existing tenants after carbon server starts up. Using this feature, you will be able to include
or exclude tenants which are to be loaded when server startup.
We can enable only one LoadingPolicy at a given time.
1. Tenant Lazy Loading
This is the default behaviour and enabled by default. With this policy, tenants are not loaded at
server startup, but loaded based on-demand (i.e when a request is received for a tenant).
The default tenant idle time is 30 minutes.
2. Tenant Eager Loading
This is by default not enabled. It can be be enabled by un-commenting the <EagerLoading> section.
The eager loading configurations supported are as below. These configurations can be given as the
value for <Include> element with eager loading.
(i)Load all tenants when server startup - *
(ii)Load all tenants except foo.com & bar.com - *,!foo.com,!bar.com
(iii)Load only foo.com & bar.com to be included - foo.com,bar.com
-->
<Tenant>
<LoadingPolicy>
<LazyLoading>
<IdleTime>30</IdleTime>
</LazyLoading>
<!-- <EagerLoading>
<Include>*,!foo.com,!bar.com</Include>
</EagerLoading>-->
</LoadingPolicy>
</Tenant>
<!--
Caching related configurations
-->
<Cache>
<!-- Default cache timeout in minutes -->
<DefaultCacheTimeout>15</DefaultCacheTimeout>
</Cache>
<!--
Axis2 related configurations
-->
<Axis2Config>
<!--
Location of the Axis2 Services & Modules repository
This can be a directory in the local file system, or a URL.
e.g.
1. /home/wso2wsas/repository/ - An absolute path
2. repository - In this case, the path is relative to CARBON_HOME
3. file:///home/wso2wsas/repository/
4. http://wso2wsas/repository/
-->
<RepositoryLocation>${carbon.home}/repository/deployment/server/</RepositoryLocation>
<!--
Deployment update interval in seconds. This is the interval between repository listener
executions.
-->
<DeploymentUpdateInterval>15</DeploymentUpdateInterval>
<!--
Location of the main Axis2 configuration descriptor file, a.k.a. axis2.xml file
This can be a file on the local file system, or a URL
e.g.
1. /home/repository/axis2.xml - An absolute path
2. conf/axis2.xml - In this case, the path is relative to CARBON_HOME
3. file:///home/carbon/repository/axis2.xml
4. http://repository/conf/axis2.xml
-->
<ConfigurationFile>${carbon.home}/repository/conf/axis2/axis2.xml</ConfigurationFile>
<!--
ServiceGroupContextIdleTime, which will be set in ConfigurationContex
for multiple clients which are going to access the same ServiceGroupContext
Default Value is 30 Sec.
-->
<ServiceGroupContextIdleTime>30000</ServiceGroupContextIdleTime>
<!--
This repository location is used to crete the client side configuration
context used by the server when calling admin services.
-->
<ClientRepositoryLocation>${carbon.home}/repository/deployment/client/</ClientRepositoryLocation>
<!-- This axis2 xml is used in createing the configuration context by the FE server
calling to BE server -->
<clientAxis2XmlLocation>${carbon.home}/repository/conf/axis2/axis2_client.xml</clientAxis2XmlLocation>
<!-- If this parameter is set, the ?wsdl on an admin service will not give the admin service wsdl. -->
<HideAdminServiceWSDLs>true</HideAdminServiceWSDLs>
<!--WARNING-Use With Care! Uncommenting bellow parameter would expose all AdminServices in HTTP transport.
With HTTP transport your credentials and data routed in public channels are vulnerable for sniffing attacks.
Use bellow parameter ONLY if your communication channels are confirmed to be secured by other means -->
<!--HttpAdminServices>*</HttpAdminServices-->
</Axis2Config>
<!--
The default user roles which will be created when the server
is started up for the first time.
-->
<ServiceUserRoles>
<Role>
<Name>admin</Name>
<Description>Default Administrator Role</Description>
</Role>
<Role>
<Name>user</Name>
<Description>Default User Role</Description>
</Role>
</ServiceUserRoles>
<!--
Enable following config to allow Emails as usernames.
-->
<!--EnableEmailUserName>true</EnableEmailUserName-->
<!--
Security configurations
-->
<Security>
<!--
KeyStore which will be used for encrypting/decrypting passwords
and other sensitive information.
-->
<KeyStore>
<!-- Keystore file location-->
<Location>${carbon.home}/repository/resources/security/wso2carbon.jks</Location>
<!-- Keystore type (JKS/PKCS12 etc.)-->
<Type>JKS</Type>
<!-- Keystore password-->
<Password>wso2carbon</Password>
<!-- Private Key alias-->
<KeyAlias>wso2carbon</KeyAlias>
<!-- Private Key password-->
<KeyPassword>wso2carbon</KeyPassword>
</KeyStore>
<!--
System wide trust-store which is used to maintain the certificates of all
the trusted parties.
-->
<TrustStore>
<!-- trust-store file location -->
<Location>${carbon.home}/repository/resources/security/client-truststore.jks</Location>
<!-- trust-store type (JKS/PKCS12 etc.) -->
<Type>JKS</Type>
<!-- trust-store password -->
<Password>wso2carbon</Password>
</TrustStore>
<!--
The Authenticator configuration to be used at the JVM level. We extend the
java.net.Authenticator to make it possible to authenticate to given servers and
proxies.
-->
<NetworkAuthenticatorConfig>
<!--
Below is a sample configuration for a single authenticator. Please note that
all child elements are mandatory. Not having some child elements would lead to
exceptions at runtime.
-->
<!-- <Credential> -->
<!--
the pattern that would match a subset of URLs for which this authenticator
would be used
-->
<!-- <Pattern>regularExpression</Pattern> -->
<!--
the type of this authenticator. Allowed values are:
1. server
2. proxy
-->
<!-- <Type>proxy</Type> -->
<!-- the username used to log in to server/proxy -->
<!-- <Username>username</Username> -->
<!-- the password used to log in to server/proxy -->
<!-- <Password>password</Password> -->
<!-- </Credential> -->
</NetworkAuthenticatorConfig>
<!--
The Tomcat realm to be used for hosted Web applications. Allowed values are;
1. UserManager
2. Memory
If this is set to 'UserManager', the realm will pick users & roles from the system's
WSO2 User Manager. If it is set to 'memory', the realm will pick users & roles from
CARBON_HOME/repository/conf/tomcat/tomcat-users.xml
-->
<TomcatRealm>UserManager</TomcatRealm>
<!--Option to disable storing of tokens issued by STS-->
<DisableTokenStore>false</DisableTokenStore>
<!--
Security token store class name. If this is not set, default class will be
org.wso2.carbon.security.util.SecurityTokenStore
-->
<!--TokenStoreClassName>org.wso2.carbon.identity.sts.store.DBTokenStore</TokenStoreClassName-->
</Security>
<!--
The temporary work directory
-->
<WorkDirectory>${carbon.home}/tmp/work</WorkDirectory>
<!--
House-keeping configuration
-->
<HouseKeeping>
<!--
true - Start House-keeping thread on server startup
false - Do not start House-keeping thread on server startup.
The user will run it manually as and when he wishes.
-->
<AutoStart>true</AutoStart>
<!--
The interval in *minutes*, between house-keeping runs
-->
<Interval>10</Interval>
<!--
The maximum time in *minutes*, temp files are allowed to live
in the system. Files/directories which were modified more than
"MaxTempFileLifetime" minutes ago will be removed by the
house-keeping task
-->
<MaxTempFileLifetime>30</MaxTempFileLifetime>
</HouseKeeping>
<!--
Configuration for handling different types of file upload & other file uploading related
config parameters.
To map all actions to a particular FileUploadExecutor, use
<Action>*</Action>
-->
<FileUploadConfig>
<!--
The total file upload size limit in MB
-->
<TotalFileSizeLimit>100</TotalFileSizeLimit>
<Mapping>
<Actions>
<Action>keystore</Action>
<Action>certificate</Action>
<Action>*</Action>
</Actions>
<Class>org.wso2.carbon.ui.transports.fileupload.AnyFileUploadExecutor</Class>
</Mapping>
<Mapping>
<Actions>
<Action>jarZip</Action>
</Actions>
<Class>org.wso2.carbon.ui.transports.fileupload.JarZipUploadExecutor</Class>
</Mapping>
<Mapping>
<Actions>
<Action>dbs</Action>
</Actions>
<Class>org.wso2.carbon.ui.transports.fileupload.DBSFileUploadExecutor</Class>
</Mapping>
<Mapping>
<Actions>
<Action>tools</Action>
</Actions>
<Class>org.wso2.carbon.ui.transports.fileupload.ToolsFileUploadExecutor</Class>
</Mapping>
<Mapping>
<Actions>
<Action>toolsAny</Action>
</Actions>
<Class>org.wso2.carbon.ui.transports.fileupload.ToolsAnyFileUploadExecutor</Class>
</Mapping>
</FileUploadConfig>
<!--
Processors which process special HTTP GET requests such as ?wsdl, ?policy etc.
In order to plug in a processor to handle a special request, simply add an entry to this
section.
The value of the Item element is the first parameter in the query string(e.g. ?wsdl)
which needs special processing
The value of the Class element is a class which implements
org.wso2.carbon.transport.HttpGetRequestProcessor
-->
<HttpGetRequestProcessors>
<Processor>
<Item>info</Item>
<Class>org.wso2.carbon.core.transports.util.InfoProcessor</Class>
</Processor>
<Processor>
<Item>wsdl</Item>
<Class>org.wso2.carbon.core.transports.util.Wsdl11Processor</Class>
</Processor>
<Processor>
<Item>wsdl2</Item>
<Class>org.wso2.carbon.core.transports.util.Wsdl20Processor</Class>
</Processor>
<Processor>
<Item>xsd</Item>
<Class>org.wso2.carbon.core.transports.util.XsdProcessor</Class>
</Processor>
</HttpGetRequestProcessors>
<!-- Deployment Synchronizer Configuration. t Enabled value to true when running with "svn based" dep sync.
In master nodes you need to set both AutoCommit and AutoCheckout to true
and in worker nodes set only AutoCheckout to true.
-->
<DeploymentSynchronizer>
<Enabled>false</Enabled>
<AutoCommit>false</AutoCommit>
<AutoCheckout>true</AutoCheckout>
<RepositoryType>svn</RepositoryType>
<SvnUrl>http://svnrepo.example.com/repos/</SvnUrl>
<SvnUser>username</SvnUser>
<SvnPassword>password</SvnPassword>
<SvnUrlAppendTenantId>true</SvnUrlAppendTenantId>
</DeploymentSynchronizer>
<!-- Deployment Synchronizer Configuration. Uncomment the following section when running with "registry based" dep sync.
In master nodes you need to set both AutoCommit and AutoCheckout to true
and in worker nodes set only AutoCheckout to true.
-->
<!--<DeploymentSynchronizer>
<Enabled>true</Enabled>
<AutoCommit>false</AutoCommit>
<AutoCheckout>true</AutoCheckout>
</DeploymentSynchronizer>-->
<!-- Mediation persistence configurations. Only valid if mediation features are available i.e. ESB -->
<!--<MediationConfig>
<LoadFromRegistry>false</LoadFromRegistry>
<SaveToFile>false</SaveToFile>
<Persistence>enabled</Persistence>
<RegistryPersistence>enabled</RegistryPersistence>
</MediationConfig>-->
<!--
Server intializing code, specified as implementation classes of org.wso2.carbon.core.ServerInitializer.
This code will be run when the Carbon server is initialized
-->
<ServerInitializers>
<!--<Initializer></Initializer>-->
</ServerInitializers>
<!--
Indicates whether the Carbon Servlet is required by the system, and whether it should be
registered
-->
<RequireCarbonServlet>${require.carbon.servlet}</RequireCarbonServlet>
<!--
Carbon H2 OSGI Configuration
By default non of the servers start.
name="web" - Start the web server with the H2 Console
name="webPort" - The port (default: 8082)
name="webAllowOthers" - Allow other computers to connect
name="webSSL" - Use encrypted (HTTPS) connections
name="tcp" - Start the TCP server
name="tcpPort" - The port (default: 9092)
name="tcpAllowOthers" - Allow other computers to connect
name="tcpSSL" - Use encrypted (SSL) connections
name="pg" - Start the PG server
name="pgPort" - The port (default: 5435)
name="pgAllowOthers" - Allow other computers to connect
name="trace" - Print additional trace information; for all servers
name="baseDir" - The base directory for H2 databases; for all servers
-->
<!--H2DatabaseConfiguration>
<property name="web" />
<property name="webPort">8082</property>
<property name="webAllowOthers" />
<property name="webSSL" />
<property name="tcp" />
<property name="tcpPort">9092</property>
<property name="tcpAllowOthers" />
<property name="tcpSSL" />
<property name="pg" />
<property name="pgPort">5435</property>
<property name="pgAllowOthers" />
<property name="trace" />
<property name="baseDir">${carbon.home}</property>
</H2DatabaseConfiguration-->
<!--Disabling statistics reporter by default-->
<StatisticsReporterDisabled>true</StatisticsReporterDisabled>
<!-- Enable accessing Admin Console via HTTP -->
<!-- EnableHTTPAdminConsole>true</EnableHTTPAdminConsole -->
<!--
Default Feature Repository of WSO2 Carbon.
-->
<FeatureRepository>
<RepositoryName>default repository</RepositoryName>
<RepositoryURL>${p2.repo.url}</RepositoryURL>
</FeatureRepository>
<!--
Configure API Management
-->
<APIManagement>
<!--Uses the embedded API Manager by default. If you want to use an external
API Manager instance to manage APIs, configure below externalAPIManager-->
<Enabled>true</Enabled>
<!--Uncomment and configure API Gateway and
Publisher URLs to use external API Manager instance-->
<!--ExternalAPIManager>
<APIGatewayURL>http://localhost:8281</APIGatewayURL>
<APIPublisherURL>http://localhost:8281/publisher</APIPublisherURL>
</ExternalAPIManager-->
<LoadAPIContextsInServerStartup>true</LoadAPIContextsInServerStartup>
</APIManagement>
</Server>

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>apimgt-extensions</artifactId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - API Management Extensions Component</name>
<url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent>
<artifactId>certificate-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>certificate-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ /*
~ * Copyright (c) ${date}, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ * 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
@ -24,7 +24,7 @@
<parent>
<artifactId>certificate-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -1,6 +1,6 @@
/*
*
* Copyright (c) ${date}, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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
@ -16,6 +16,7 @@
* under the License.
*
*/
package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans;
import com.fasterxml.jackson.annotation.JsonProperty;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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
@ -16,6 +16,7 @@
* under the License.
*
*/
package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans;
import com.fasterxml.jackson.annotation.JsonProperty;
@ -43,7 +44,6 @@ public class CertificateList extends BasePaginatedResult {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{\n");
sb.append(" count: ").append(getCount()).append(",\n");
sb.append(" next: ").append(getNext()).append(",\n");
sb.append(" previous: ").append(getPrevious()).append(",\n");
@ -51,5 +51,5 @@ public class CertificateList extends BasePaginatedResult {
sb.append("]}\n");
return sb.toString();
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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
@ -16,6 +16,7 @@
* under the License.
*
*/
package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans;
import com.fasterxml.jackson.annotation.JsonProperty;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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
@ -16,6 +16,7 @@
* under the License.
*
*/
package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans;
import com.fasterxml.jackson.annotation.JsonProperty;

@ -16,7 +16,6 @@
* under the License.
*/
package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans;
public class ValidationResponse {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,6 +1,6 @@
/*
*
* Copyright (c) ${date}, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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
@ -17,6 +17,7 @@
* under the License.
* /
*/
package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.swagger.extension;
import io.swagger.annotations.SwaggerDefinition;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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
@ -16,6 +16,7 @@
* under the License.
*
*/
package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.util;
import javax.servlet.*;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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
@ -16,6 +16,7 @@
* under the License.
*
*/
package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.util;
import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.ErrorResponse;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ 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

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ 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

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ /*
~ * Copyright (c) ${date}, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ * 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

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ 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

@ -21,13 +21,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt</artifactId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.certificate.mgt.core</artifactId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Certificate Management Core</name>
<description>WSO2 Carbon - Certificate Management Core</description>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ /*
~ * Copyright (c) ${date}, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ * 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
@ -24,7 +24,7 @@
<parent>
<artifactId>certificate-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -1,6 +1,6 @@
/*
*
* Copyright (c) ${date}, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,3 +1,21 @@
/*
* 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.certificate.mgt.jaxrs.api.impl;
import org.apache.commons.codec.binary.Base64;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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
@ -16,6 +16,7 @@
* under the License.
*
*/
package org.wso2.carbon.certificate.mgt.jaxrs.beans;
import com.fasterxml.jackson.annotation.JsonProperty;
@ -69,11 +70,9 @@ public class ErrorListItem {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("errorItem {\n");
sb.append(" code: ").append(code).append("\n");
sb.append(" message: ").append(message).append("\n");
sb.append("}\n");
return sb.toString();
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ 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

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ 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

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ /*
~ * Copyright (c) ${date}, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ * 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

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ 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

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt</artifactId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Certificate Management Component</name>
<url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -21,6 +21,8 @@ package org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.push.notification.NotificationContext;
@ -37,10 +39,13 @@ import java.util.List;
public class FCMNotificationStrategy implements NotificationStrategy {
private static final Log log = LogFactory.getLog(FCMNotificationStrategy.class);
private static final String NOTIFIER_TYPE_FCM = "FCM";
private static final String FCM_TOKEN = "FCM_TOKEN";
private static final String FCM_ENDPOINT = "https://fcm.googleapis.com/fcm/send";
private static final String FCM_API_KEY = "fcmAPIKey";
private static final int TIME_TO_LIVE = 60;
private static final int TIME_TO_LIVE = 5 * 60; //Set FCM TTL to 5 minutes
private static final int HTTP_STATUS_CODE_OK = 200;
private final PushNotificationConfig config;
@ -56,9 +61,16 @@ public class FCMNotificationStrategy implements NotificationStrategy {
@Override
public void execute(NotificationContext ctx) throws PushNotificationExecutionFailedException {
try {
Device device =
FCMDataHolder.getInstance().getDeviceManagementProviderService().getDeviceWithTypeProperties(ctx.getDeviceId());
this.sendWakeUpCall(ctx.getOperation().getCode(), device);
if (NOTIFIER_TYPE_FCM.equals(config.getType())) {
Device device = FCMDataHolder.getInstance().getDeviceManagementProviderService()
.getDeviceWithTypeProperties(ctx.getDeviceId());
this.sendWakeUpCall(ctx.getOperation().getCode(), device);
} else {
if (log.isDebugEnabled()) {
log.debug("Not using FCM notifier as notifier type is set to " + config.getType() +
" in Platform Configurations.");
}
}
} catch (DeviceManagementException e) {
throw new PushNotificationExecutionFailedException("Error occurred while retrieving device information", e);
} catch (IOException e) {
@ -76,12 +88,12 @@ public class FCMNotificationStrategy implements NotificationStrategy {
}
private void sendWakeUpCall(String message,
Device device) throws IOException, PushNotificationExecutionFailedException {
private void sendWakeUpCall(String message, Device device) throws IOException,
PushNotificationExecutionFailedException {
OutputStream os = null;
byte[] bytes = getFCMRequest(message, getFCMToken(device.getProperties())).getBytes();
HttpURLConnection conn = null;
HttpURLConnection conn;
try {
conn = (HttpURLConnection) new URL(FCM_ENDPOINT).openConnection();
conn.setRequestProperty("Content-Type", "application/json");
@ -96,6 +108,9 @@ public class FCMNotificationStrategy implements NotificationStrategy {
}
}
int status = conn.getResponseCode();
if (log.isDebugEnabled()) {
log.debug("Result code: " + status + ", Message: " + conn.getResponseMessage());
}
if (status != HTTP_STATUS_CODE_OK) {
throw new PushNotificationExecutionFailedException("Push notification sending failed with the HTTP " +
"error code '" + status + "'");

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -0,0 +1,43 @@
/*
* Copyright (c) 2018, 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.mgt.extensions.push.notification.provider.mqtt;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import java.io.File;
/**
* Util class to initialize carbon-context.
*/
public class CarbonContextInitializationUtil {
private final static String CARBON_HOME = "carbon.home";
public static void initializeCarbonContext() {
if (System.getProperty(CARBON_HOME) == null) {
File file = new File("src/test/resources");
if (file.exists()) {
System.setProperty(CARBON_HOME, file.getAbsolutePath());
}
}
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(
org.wso2.carbon.base.MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(
org.wso2.carbon.base.MultitenantConstants.SUPER_TENANT_ID);
}
}

@ -35,8 +35,8 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/*
Unit tests for MQTTBasedPushNotificationProvider class
/**
* Unit tests for MQTTBasedPushNotificationProvider class
*/
public class MQTTBasedPushNotificationProviderTest {
private MQTTBasedPushNotificationProvider mqttBasedPushNotificationProvider;
@ -47,7 +47,7 @@ public class MQTTBasedPushNotificationProviderTest {
@BeforeClass
public void init() throws NoSuchFieldException, IllegalAccessException, IOException, RegistryException,
OutputEventAdapterException {
initializeCarbonContext();
CarbonContextInitializationUtil.initializeCarbonContext();
mqttBasedPushNotificationProvider = Mockito.mock(MQTTBasedPushNotificationProvider.class,
Mockito.CALLS_REAL_METHODS);
carbonOutputEventAdapterService = Mockito.mock(CarbonOutputEventAdapterService.class,
@ -55,19 +55,6 @@ public class MQTTBasedPushNotificationProviderTest {
Mockito.doReturn(true).when(carbonOutputEventAdapterService).isPolled(ADAPTER_NAME);
}
private void initializeCarbonContext() throws IOException, RegistryException {
if (System.getProperty("carbon.home") == null) {
File file = new File("src/test/resources");
if (file.exists()) {
System.setProperty("carbon.home", file.getAbsolutePath());
}
}
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(
org.wso2.carbon.base.MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(
org.wso2.carbon.base.MultitenantConstants.SUPER_TENANT_ID);
}
@Test(description = "test getType method")
public void testGetType() {
String type = mqttBasedPushNotificationProvider.getType();

@ -63,7 +63,7 @@ public class MQTTNotificationStrategyTest {
@BeforeClass
public void init() throws NoSuchFieldException, IllegalAccessException, IOException, RegistryException,
OutputEventAdapterException {
initializeCarbonContext();
CarbonContextInitializationUtil.initializeCarbonContext();
mqttNotificationStrategy = Mockito.mock(MQTTNotificationStrategy.class, Mockito.CALLS_REAL_METHODS);
carbonOutputEventAdapterService = Mockito.mock(CarbonOutputEventAdapterService.class,
Mockito.CALLS_REAL_METHODS);
@ -72,19 +72,6 @@ public class MQTTNotificationStrategyTest {
Mockito.doNothing().when(carbonOutputEventAdapterService).destroy(ADAPTER_NAME);
}
private void initializeCarbonContext() throws IOException, RegistryException {
if (System.getProperty("carbon.home") == null) {
File file = new File("src/test/resources");
if (file.exists()) {
System.setProperty("carbon.home", file.getAbsolutePath());
}
}
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(
org.wso2.carbon.base.MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(
org.wso2.carbon.base.MultitenantConstants.SUPER_TENANT_ID);
}
@Test(description = "Testing the constructor of MQTTNotificationStrategy class")
public void getNotificationStrategy() {
Map<String, String> properties = new HashMap<>();

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>carbon-devicemgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>3.0.217-SNAPSHOT</version>
<version>3.1.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -67,8 +67,8 @@ import javax.ws.rs.core.Response;
}
)
@Path("/activities")
@Api(value = "Activity Info Provider", description = "Activity related information manipulation. For example" +
" operation details and responses from devices.")
@Api(value = "Getting Activity Details", description = "Get the details of the operations/activities executed by the" +
" server on the registered devices during a defined time period.")
@Scopes(
scopes = {
@Scope(
@ -88,9 +88,9 @@ public interface ActivityInfoProviderService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Getting Details of an Activity",
notes = "Retrieve the details of a specific activity/operation, such as the meta information of " +
"an operation, including the responses from the devices.",
value = "Getting the Details of a Specific Activity",
notes = "Retrieve the details of a specific activity/operation, such as the meta information of an " +
"operation, and the responses from the devices.",
tags = "Activity Info Provider",
extensions = {
@Extension(properties = {
@ -142,7 +142,7 @@ public interface ActivityInfoProviderService {
Response getActivity(
@ApiParam(
name = "id",
value = "Activity id of the operation/activity.",
value = "Activity ID of the operation/activity.",
required = true,
defaultValue = "ACTIVITY_1")
@PathParam("id")
@ -161,9 +161,10 @@ public interface ActivityInfoProviderService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Getting Details of activities for given set of activity/operation Ids",
notes = "Retrieve the details of specific activity/operation Ids, such as the meta information of " +
"an operation, including the responses from the devices.",
value = "Getting Activity Details of Specified Activity/Operation IDs",
notes = "Retrieve the details of activities or operations, such as the meta information of an operation," +
" and the responses from the devices."+
"Define the activity or operation IDs as comma separated values.",
tags = "Activity Info Provider",
extensions = {
@Extension(properties = {
@ -213,7 +214,7 @@ public interface ActivityInfoProviderService {
Response getActivities(
@ApiParam(
name = "ids",
value = "Comma separated activity/operation ids",
value = "Comma separated activity/operation IDs",
required = true,
defaultValue = "ACTIVITY_0")
@QueryParam("ids") ActivityIdList activityIdList);
@ -224,9 +225,8 @@ public interface ActivityInfoProviderService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Getting Details of an Activity for a specific device",
notes = "Retrieve the details of a specific activity/operation, such as the meta information of " +
"an operation, including the responses from a given device",
value = "Getting a Specific Activity Details of a Device",
notes = "Retrieve the details of a specific activity/operation, that was sent to a specific device.",
tags = "Activity Info Provider",
extensions = {
@Extension(properties = {
@ -286,7 +286,7 @@ public interface ActivityInfoProviderService {
String id,
@ApiParam(
name = "devicetype",
value = "The device type name, such as ios, android, windows or fire-alarm.",
value = "The device type name, such as ios, android, windows, or fire-alarm.",
required = true)
@PathParam("devicetype")
@Size(max = 45)

@ -60,8 +60,8 @@ import javax.ws.rs.core.Response;
}
)
@Path("/configuration")
@Api(value = "Configuration Management", description = "The general platform configuration management capabilities are exposed " +
"through this API.")
@Api(value = "Configuration Management", description = "The general platform configuration management capabilities " +
"are exposed through this API.")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Scopes(scopes = {
@ -86,9 +86,9 @@ public interface ConfigurationManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Getting General Platform Configurations",
notes = "WSO2 EMM monitors policies to verify that the devices comply with the policies enforced on them. " +
"General platform configurations include the settings on how often the device need to be monitored. " +
"Using this REST API you can get the general platform level configurations.",
notes = "WSO2 EMM monitors policies to verify that the devices comply with the policies enforced on them." +
"General platform configurations include the settings on how often the device need to be " +
"monitored." + "Using this REST API you can get the general platform level configurations.",
tags = "Configuration Management",
extensions = {
@Extension(properties = {
@ -119,7 +119,8 @@ public interface ConfigurationManagementService {
),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client already has the latest version of the requested resource."),
message = "Not Modified. \n Empty body because the client already has the latest version of the " +
"requested resource."),
@ApiResponse(
code = 406,
message = "Not Acceptable.\n The requested media type is not supported."),
@ -146,8 +147,8 @@ public interface ConfigurationManagementService {
httpMethod = "PUT",
value = "Updating General Platform Configurations",
notes = "WSO2 EMM monitors policies to verify that the devices comply with the policies enforced on them." +
"General platform configurations include the settings on how often the the device need to be monitored." +
"Using this REST API you can update the general platform level configurations.",
"General platform configurations include the settings on how often the the device need to be " +
"monitored. Using this REST API you can update the general platform level configurations.",
tags = "Configuration Management",
extensions = {
@Extension(properties = {

@ -112,8 +112,8 @@ public interface DeviceAgentService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Create a device instance",
notes = "Create a device Instance",
value = "Creating a Device Instance",
notes = "Create a device instance using this API. Since this is not a physical device you are not able to try out device operations.",
tags = "Device Management",
extensions = {
@Extension(properties = {
@ -157,7 +157,7 @@ public interface DeviceAgentService {
"Server error occurred while retrieving the device details.",
response = ErrorResponse.class)
})
Response enrollDevice(@ApiParam(name = "device", value = "Device object with data.", required = true)
Response enrollDevice(@ApiParam(name = "device", value = "Define the payload to create a device instance. You can double click on the Example Value and define your values in it to create the instance.", required = true)
@Valid Device device);
@DELETE
@ -186,7 +186,7 @@ public interface DeviceAgentService {
"Server error occurred while dis-enrolling the device.")
})
Response disEnrollDevice(
@ApiParam(name = "type", value = "The unique device identifier.") @PathParam("type") String type,
@ApiParam(name = "type", value = "Define the device type, such as android, ios, or windows.") @PathParam("type") String type,
@ApiParam(name = "id", value = "The unique device identifier.") @PathParam("id") String id);
@PUT
@ -194,8 +194,8 @@ public interface DeviceAgentService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "PUT",
value = "modify device",
notes = "modify device",
value = "Updating the Device Details",
notes = "You are able to update the details of a device using the API.",
tags = "Device Agent Management",
extensions = {
@Extension(properties = {
@ -239,15 +239,15 @@ public interface DeviceAgentService {
"Server error occurred while retrieving the device details.",
response = ErrorResponse.class)
})
Response updateDevice(@ApiParam(name = "type", value = "The device type, such as ios, android or windows....etc", required = true)
Response updateDevice(@ApiParam(name = "type", value = "The device type, such as ios, android, or windows.", required = true)
@PathParam("type") String type,
@ApiParam(name = "id", value = "The device id.", required = true)
@ApiParam(name = "id", value = "The device ID.", required = true)
@PathParam("id") String deviceId,
@ApiParam(name = "device", value = "Device object with data.", required = true)
@ApiParam(name = "device", value = "Update the device details in the device object.", required = true)
@Valid Device updateDevice);
@POST
@Path("/events/publish/{type}/{deviceId}")
@Path("events/publish/{type}/{deviceId}")
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
consumes = MediaType.APPLICATION_JSON,
@ -303,11 +303,11 @@ public interface DeviceAgentService {
Map<String, Object> payloadData,
@ApiParam(
name = "type",
value = "name of the device type")
value = "The name of the device type, such as android, ios, or windows.")
@PathParam("type") String type,
@ApiParam(
name = "deviceId",
value = "deviceId of the device")
value = "The device ID.")
@PathParam("deviceId") String deviceId);
@POST
@ -317,7 +317,8 @@ public interface DeviceAgentService {
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Publishing Events data only",
notes = "Publish events received by the device client to the WSO2 Data Analytics Server (DAS) using this API.",
notes = "Publish events received by the device client to the WSO2 Data Analytics Server (DAS) using this" +
" API.",
tags = "Device Agent Management",
extensions = {
@Extension(properties = {
@ -343,7 +344,8 @@ public interface DeviceAgentService {
}),
@ApiResponse(
code = 303,
message = "See Other. \n The source can be retrieved from the URL specified in the location header.",
message = "See Other. \n The source can be retrieved from the URL specified in the " +
"location header.",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
@ -353,7 +355,8 @@ public interface DeviceAgentService {
message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The format of the requested entity was not supported."),
message = "Unsupported media type. \n The format of the requested entity was not " +
"supported."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n " +
@ -380,8 +383,8 @@ public interface DeviceAgentService {
produces = MediaType.APPLICATION_JSON,
consumes = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Get pending operation of the given device",
notes = "Returns the Operations.",
value = "Getting All the Pending Operations of a Device",
notes = "You can get all the list of pending operations of a device.",
tags = "Device Agent Management",
extensions = {
@Extension(properties = {
@ -405,7 +408,8 @@ public interface DeviceAgentService {
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
description = "Date and time the resource has been modified the last " +
"time.\n" +
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
@ -426,9 +430,9 @@ public interface DeviceAgentService {
"Server error occurred while retrieving information requested device.",
response = ErrorResponse.class)
})
Response getPendingOperations(@ApiParam(name = "type", value = "The device type, such as ios, android or windows.", required = true)
Response getPendingOperations(@ApiParam(name = "type", value = "The device type, such as ios, android, or windows.", required = true)
@PathParam("type") String type,
@ApiParam(name = "id", value = "The device id.", required = true)
@ApiParam(name = "id", value = "The device ID.", required = true)
@PathParam("id") String deviceId);
@GET
@ -437,8 +441,9 @@ public interface DeviceAgentService {
produces = MediaType.APPLICATION_JSON,
consumes = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Get pending operation of the given device",
notes = "Returns the Operation.",
value = "Getting the Next Pending Operations of a Device",
notes = "There can be many operations that are pending on the device end. Get the next pending operation " +
"of a specific device using this API.",
tags = "Device Agent Management",
extensions = {
@Extension(properties = {
@ -483,9 +488,10 @@ public interface DeviceAgentService {
"Server error occurred while retrieving information requested device.",
response = ErrorResponse.class)
})
Response getNextPendingOperation(@ApiParam(name = "type", value = "The device type, such as ios, android or windows.", required = true)
Response getNextPendingOperation(@ApiParam(name = "type", value = "The device type, such as ios, android, or " +
"windows.", required = true)
@PathParam("type") String type,
@ApiParam(name = "id", value = "The device id.", required = true)
@ApiParam(name = "id", value = "The device ID.", required = true)
@PathParam("id") String deviceId);
@PUT
@ -494,7 +500,7 @@ public interface DeviceAgentService {
produces = MediaType.APPLICATION_JSON,
consumes = MediaType.APPLICATION_JSON,
httpMethod = "PUT",
value = "Update Operation",
value = "Updating an Operation",
notes = "Update the Operations.",
tags = "Device Agent Management",
extensions = {
@ -539,11 +545,12 @@ public interface DeviceAgentService {
"Server error occurred while retrieving information requested device.",
response = ErrorResponse.class)
})
Response updateOperation(@ApiParam(name = "type", value = "The device type, such as ios, android or windows.", required = true)
Response updateOperation(@ApiParam(name = "type", value = "The device type, such as ios, android, or windows.",
required = true)
@PathParam("type") String type,
@ApiParam(name = "id", value = "The device id.", required = true)
@ApiParam(name = "id", value = "The device ID.", required = true)
@PathParam("id") String deviceId,
@ApiParam(name = "operation", value = "Operation object with data.", required = true)
@ApiParam(name = "operation", value = "Update the operation object with data.", required = true)
@Valid Operation operation);
@PUT
@ -552,7 +559,7 @@ public interface DeviceAgentService {
produces = MediaType.APPLICATION_JSON,
consumes = MediaType.APPLICATION_JSON,
httpMethod = "PUT",
value = "Update Properties",
value = "Updating Device Properties",
notes = "Update device properties.",
tags = "Device Agent Management",
extensions = {
@ -597,11 +604,12 @@ public interface DeviceAgentService {
"Server error occurred while retrieving information requested device.",
response = ErrorResponse.class)
})
Response updateDeviceProperties(@ApiParam(name = "type", value = "The device type, such as ios, android or windows.", required = true)
Response updateDeviceProperties(@ApiParam(name = "type", value = "The device type, such as ios, android, or " +
"windows.", required = true)
@PathParam("type") String type,
@ApiParam(name = "id", value = "The device id.", required = true)
@ApiParam(name = "id", value = "The device ID.", required = true)
@PathParam("id") String deviceId,
@ApiParam(name = "properties", value = "device properties list.", required = true)
@ApiParam(name = "properties", value = "The device properties list.", required = true)
@Valid List<Device.Property> properties);
@GET
@ -610,8 +618,9 @@ public interface DeviceAgentService {
produces = MediaType.APPLICATION_JSON,
consumes = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Get pending operation of the given device",
notes = "Returns the Operations.",
value = "Getting Specific Operations of a Device",
notes = "Device operations can be in the IN_PROGRESS, PENDING, COMPLETED, ERROR, or REPEATED status. " +
"You can use this API to get a list of all the operations that are in a specific status for a given device.",
tags = "Device Agent Management",
extensions = {
@Extension(properties = {
@ -656,9 +665,10 @@ public interface DeviceAgentService {
"Server error occurred while retrieving information requested device.",
response = ErrorResponse.class)
})
Response getOperationsByDeviceAndStatus(@ApiParam(name = "type", value = "The device type, such as ios, android or windows.", required = true)
Response getOperationsByDeviceAndStatus(@ApiParam(name = "type", value = "The device type, such as ios, android," +
" or windows.", required = true)
@PathParam("type") String type,
@ApiParam(name = "id", value = "The device id.", required = true)
@ApiParam(name = "id", value = "The device ID.", required = true)
@PathParam("id") String deviceId,
@ApiParam(name = "status", value = "status of the operation.", required = true)
@QueryParam("status")Operation.Status status);

@ -77,8 +77,8 @@ public interface DeviceEventManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Add Event Type Defnition",
notes = "Add the event definition for the device.",
value = "Adding the Event Type Definition",
notes = "Add the event definition for a device.",
tags = "Device Event Management",
extensions = {
@Extension(properties = {
@ -120,9 +120,11 @@ public interface DeviceEventManagementService {
response = ErrorResponse.class)
}
)
Response deployDeviceTypeEventDefinition(@ApiParam(name = "type", value = "name of the device type", required = false)
Response deployDeviceTypeEventDefinition(@ApiParam(name = "type", value = "The device type, such as android, ios," +
" and windows.", required = false)
@PathParam("type")String deviceType,
@ApiParam(name = "deviceTypeEvent", value = "DeviceTypeEvent object with data.", required = true)
@ApiParam(name = "deviceTypeEvent", value = "Add the data to complete " +
"the DeviceTypeEvent object.", required = true)
@Valid DeviceTypeEvent deviceTypeEvent);
@DELETE
@ -130,8 +132,8 @@ public interface DeviceEventManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "DELETE",
value = "Delete Event Type Defnition",
notes = "Delete the event definition for the device.",
value = "Delete Event Type Definition",
notes = "Delete the event definition of a device.",
tags = "Device Event Management",
extensions = {
@Extension(properties = {
@ -173,7 +175,8 @@ public interface DeviceEventManagementService {
response = ErrorResponse.class)
}
)
Response deleteDeviceTypeEventDefinitions(@ApiParam(name = "type", value = "name of the device type", required = false)
Response deleteDeviceTypeEventDefinitions(@ApiParam(name = "type", value = "The device type, such as android, " +
"ios, and windows.", required = false)
@PathParam("type")String deviceType);
@GET
@ -244,7 +247,7 @@ public interface DeviceEventManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Getting Last Known Device Events",
notes = "Get the Last Known events for the device.",
notes = "Get the last known events for the device.",
tags = "Device Event Management",
extensions = {
@Extension(properties = {
@ -287,17 +290,19 @@ public interface DeviceEventManagementService {
response = ErrorResponse.class)
}
)
Response getLastKnownData(@ApiParam(name = "deviceId", value = "id of the device ", required = false)
@PathParam("deviceId") String deviceId,
@ApiParam(name = "type", value = "name of the device type", required = false)
@PathParam("type") String deviceType);
Response getLastKnownData(@ApiParam(name = "deviceId", value = "id of the device ", required = true)
@PathParam("deviceId") String deviceId,
@ApiParam(name = "type", value = "name of the device type", required = true)
@PathParam("type") String deviceType,
@ApiParam(name = "limit", value = "limit of the records that needs to be picked up", required = false)
@QueryParam("limit") int limit);
@GET
@Path("/{type}")
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Getting Event Type Defnition",
value = "Getting Event Type Definition",
notes = "Get the event definition for the device.",
tags = "Device Event Management",
extensions = {
@ -341,7 +346,8 @@ public interface DeviceEventManagementService {
response = ErrorResponse.class)
}
)
Response getDeviceTypeEventDefinition(@ApiParam(name = "type", value = "name of the device type", required = false)
Response getDeviceTypeEventDefinition(@ApiParam(name = "type", value = "The type of the device, such as android," +
" ios, or windows.", required = false)
@PathParam("type")String deviceType) ;
}
}

@ -208,13 +208,13 @@ public interface DeviceManagementService {
Response getDevices(
@ApiParam(
name = "name",
value = "The device name, such as shamu, bullhead or angler Nexus device names. ",
value = "The device name. For example, Nexus devices can have names, suhc as shamu, bullhead or angler.",
required = false)
@Size(max = 45)
String name,
@ApiParam(
name = "type",
value = "The device type, such as ios, android or windows.",
value = "The device type, such as ios, android, or windows.",
required = false)
@QueryParam("type")
@Size(max = 45)
@ -227,7 +227,7 @@ public interface DeviceManagementService {
String user,
@ApiParam(
name = "userPattern",
value = "The pattern of username of the owner of the device.",
value = "Define a few letters of the username in the order they appear. For example, you want to get the devices that belong to the admin, you can give \\\"ad\\\" or \\\"min\\\" here and you will get the devices that are enrolled under a user who has the given combination as part of the username .",
required = false)
@QueryParam("userPattern")
String userPattern,
@ -303,8 +303,8 @@ public interface DeviceManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Getting Details of Registered Devices owned by authenticated user",
notes = "Provides details of devices enrolled by authenticated user.",
value = "Getting Details of Registered Devices Owned by an Authenticated User",
notes = "Provides details of devices enrolled by authenticated users.",
tags = "Device Management",
extensions = {
@Extension(properties = {
@ -460,8 +460,8 @@ public interface DeviceManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Get device enrollment status",
notes = "Get device enrollment status",
value = "Getting the Device Enrollment Status",
notes = "Get the device enrollment status and the device details of the device.",
tags = "Device Management",
extensions = {
@Extension(properties = {
@ -564,7 +564,7 @@ public interface DeviceManagementService {
Response getDeviceLocation(
@ApiParam(
name = "type",
value = "The device type name, such as ios, android, windows or fire-alarm.",
value = "The device type name, such as ios, android, windows, or fire-alarm.",
required = true)
@PathParam("type")
@Size(max = 45)
@ -592,7 +592,7 @@ public interface DeviceManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Getting the information of a Device",
value = "Getting the Information of a Device",
notes = "Get the information of a device by specifying the device type and device identifier.",
tags = "Device Management",
extensions = {
@ -641,7 +641,7 @@ public interface DeviceManagementService {
Response getDeviceInformation(
@ApiParam(
name = "type",
value = "The device type name, such as ios, android, windows or fire-alarm.",
value = "The device type name, such as ios, android, windows, or fire-alarm.",
required = true)
@PathParam("type")
@Size(max = 45)
@ -670,8 +670,8 @@ public interface DeviceManagementService {
produces = MediaType.APPLICATION_JSON,
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Update the device specified by device id",
notes = "Returns the status of the updated device operation.",
value = "Update the Displayed Name of the Device",
notes = "Use this API to rename a device so that it is easy for you to identify devices.",
tags = "Device Management",
extensions = {
@Extension(properties = {
@ -719,12 +719,12 @@ public interface DeviceManagementService {
Response renameDevice(
@ApiParam(
name = "device",
value = "The payload containing new name for device with updated name.",
value = "The payload containing the new name of the device.",
required = true)
Device device,
@ApiParam(
name = "device-type",
value = "The device type, such as ios, android or windows.",
value = "The device type, such as ios, android, or windows.",
required = true)
@PathParam("device-type")
@Size(max = 45)
@ -745,8 +745,8 @@ public interface DeviceManagementService {
produces = MediaType.APPLICATION_JSON,
consumes = MediaType.APPLICATION_JSON,
httpMethod = "DELETE",
value = "Remove the device specified by device id",
notes = "Returns the status of the deleted device operation.",
value = "Remove the Device Specified by the Device ID",
notes = "Returns the status of the deleted device operation and the details of the deleted device.",
tags = "Device Management",
extensions = {
@Extension(properties = {
@ -794,7 +794,7 @@ public interface DeviceManagementService {
Response deleteDevice(
@ApiParam(
name = "device-type",
value = "The device type, such as ios, android or windows.",
value = "The device type, such as ios, android, or windows.",
required = true)
@PathParam("device-type")
@Size(max = 45)
@ -1041,7 +1041,7 @@ public interface DeviceManagementService {
Response getInstalledApplications(
@ApiParam(
name = "type",
value = "The device type name, such as ios, android, windows or fire-alarm.",
value = "The device type name, such as ios, android, windows, or fire-alarm.",
required = true)
@PathParam("type")
@Size(max = 45)
@ -1190,7 +1190,7 @@ public interface DeviceManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Get the details of the policy that is enforced on a device.",
value = "Getting the Details of a Policy Enforced on a Device",
notes = "A policy is enforced on all the devices that register with WSO2 IoTS." +
"WSO2 IoTS filters the policies based on the device platform (device type)," +
"the device ownership type, the user role or name and finally, the policy that matches these filters will be enforced on the device.",
@ -1252,14 +1252,14 @@ public interface DeviceManagementService {
Response getEffectivePolicyOfDevice(
@ApiParam(
name = "type",
value = "The device type name, such as ios, android, windows or fire-alarm.",
value = "The device type name, such as ios, android, windows, or fire-alarm.",
required = true)
@PathParam("type")
@Size(max = 45)
String type,
@ApiParam(
name = "id",
value = "The device identifier.",
value = "The device ID.",
required = true)
@PathParam("id")
@Size(max = 45)
@ -1327,8 +1327,8 @@ public interface DeviceManagementService {
produces = MediaType.APPLICATION_JSON,
consumes = MediaType.APPLICATION_JSON,
httpMethod = "PUT",
value = "Change device status by device id.",
notes = "Returns the status of the changed device operation.",
value = "Changing the Status of a Device",
notes = "Change the status of a device from one state to another.",
tags = "Device Management",
extensions = {
@Extension(properties = {
@ -1376,21 +1376,21 @@ public interface DeviceManagementService {
Response changeDeviceStatus(
@ApiParam(
name = "type",
value = "The device type, such as ios, android or windows.",
value = "The device type, such as ios, android, or windows.",
required = true)
@PathParam("type")
@Size(max = 45)
String type,
@ApiParam(
name = "id",
value = "Device id",
value = "Device ID.",
required = true)
@PathParam("id")
@Size(max = 45)
String id,
@ApiParam(
name = "newStatus",
value = "New status of the device.",
value = "The available device statuses are CREATED, ACTIVE, INACTIVE, UNREACHABLE, UNCLAIMED, SUSPENDED, BLOCKED, REMOVED, and DISENROLLMENT_REQUESTED.",
required = true)
@QueryParam("newStatus")
EnrolmentInfo.Status newStatus);
@ -1401,8 +1401,8 @@ public interface DeviceManagementService {
produces = MediaType.APPLICATION_JSON,
consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Add operation to set of devices for a given device type",
notes = "Returns the Activity Related to the operation.",
value = "Sending an Operation to Specific Device Types",
notes = "You can send an operation to a group of devices that belong to a specific device type using this API. For example, you can send a ring operation to all the enrolled Android devices.",
tags = "Device Management",
extensions = {
@Extension(properties = {

@ -92,8 +92,8 @@ public interface GeoLocationBasedService {
consumes = "application/json",
produces = "application/json",
httpMethod = "GET",
value = "Retrieve Analytics for the device type",
notes = "",
value = "Getting the Location Details of a Device",
notes = "Get the location details of a device during a define time period.",
response = Response.class,
tags = "Geo Service Management",
extensions = {
@ -131,24 +131,24 @@ public interface GeoLocationBasedService {
Response getGeoDeviceStats(
@ApiParam(
name = "deviceId",
value = "The registered device Id.",
value = "The device ID.",
required = true)
@PathParam("deviceId") String deviceId,
@ApiParam(
name = "device-type",
value = "The device type, such as ios, android or windows.",
value = "The device type, such as ios, android, or windows.",
required = true)
@PathParam("deviceType")
@Size(max = 45)
String deviceType,
@ApiParam(
name = "from",
value = "Get stats from what time",
value = "Define the time to start getting the geo location history of the device in the Epoch or UNIX format.",
required = true)
@QueryParam("from") long from,
@ApiParam(
name = "to",
value = "Get stats up to what time",
value = "Define the time to finish getting the geo location history of the device in the Epoch or UNIX format.",
required = true)
@QueryParam("to") long to);
@ -156,13 +156,13 @@ public interface GeoLocationBasedService {
* Get data to show device locations in a map
*/
@GET
@Path("stats/deviceLocations")
@Path("stats/device-locations")
@ApiOperation(
consumes = "application/json",
produces = "application/json",
httpMethod = "GET",
value = "Retrieve locations of devices",
notes = "",
value = "Getting the Devices in a Defined Geofence",
notes = "Get the details of the devices that are within the defined geofence coordinates. The geofence you are defining is enclosed with four coordinates in the shape of a square or rectangle. This is done by defining two points of the geofence. The other two points are automatically created using the given points. You can define the zoom level or scale of the map too.",
response = Response.class,
tags = "Geo Service Management",
extensions = {
@ -198,30 +198,39 @@ public interface GeoLocationBasedService {
response = Response.class)
})
Response getGeoDeviceLocations(
@ApiParam(
name = "deviceType",
value = "Optional Device type name.")
@QueryParam("deviceType") String deviceType,
@ApiParam(
name = "minLat",
value = "minimum latitude",
required = true)
value = "Define the minimum latitude of the geofence.",
required = true,
defaultValue ="79.85213577747345")
@QueryParam("minLat") double minLat,
@ApiParam(
name = "maxLat",
value = "maxmimum latitude",
required = true)
value = "Define the maximum latitude of the geofence.",
required = true,
defaultValue ="79.85266149044037")
@QueryParam("maxLat") double maxLat,
@ApiParam(
name = "minLong",
value = "minimum longitude",
required = true)
value = "Define the minimum longitude of the geofence.",
required = true,
defaultValue ="6.909673257977737")
@QueryParam("minLong") double minLong,
@ApiParam(
name = "maxLong",
value = "maximum longitudeude",
required = true)
value = "Define the maximum longitude of the geofence",
required = true,
defaultValue ="6.909673257977737")
@QueryParam("maxLong") double maxLong,
@ApiParam(
name = "zoom",
value = "zoom level",
required = true)
value = "Define the level to zoom or scale the map. You can define any value between 1 to 14.",
required = true,
defaultValue ="2")
@QueryParam("zoom") int zoom);
@ -233,9 +242,9 @@ public interface GeoLocationBasedService {
@ApiOperation(
consumes = "application/json",
produces = "application/json",
httpMethod = "GET",
value = "Create Geo alerts for the device",
notes = "",
httpMethod = "POST",
value = "Retrieving a Specific Geo Alert Type from a Device",
notes = "Retrieve a specific geo alert from a device, such as getting a speed alert that was sent to a device.",
response = Response.class,
tags = "Geo Service Management",
extensions = {
@ -274,16 +283,70 @@ public interface GeoLocationBasedService {
@Valid Alert alert,
@ApiParam(
name = "deviceId",
value = "The registered device Id.",
value = "The device ID.",
required = true)
@PathParam("deviceId") String deviceId,
@ApiParam(
name = "device-type",
value = "The device type, such as ios, android or windows.",
value = "The device type, such as ios, android, or windows.",
required = true)
@PathParam("deviceType")
@Size(max = 45)
String deviceType,
@ApiParam(
name = "alertType",
value = "The alert type, such as Within, Speed,Exit, or Stationary.",
required = true)
@PathParam("alertType") String alertType);
/**
* Create Geo alerts for geo clusters
*/
@POST
@Path("/alerts/{alertType}")
@ApiOperation(
consumes = "application/json",
produces = "application/json",
httpMethod = "POST",
value = "Create Geo alerts for geo clusters",
notes = "Creating geo alerts for cluster of devices",
response = Response.class,
tags = "Geo Service Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage")
})
}
)
@ApiResponses(value = {
@ApiResponse(
code = 200,
message = "OK.",
response = Response.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Type",
description = "The content type of the body")
}),
@ApiResponse(
code = 400,
message = "Bad Request. \n A geo alert with this name already exists.",
response = Response.class),
@ApiResponse(
code = 401,
message = "Unauthorized. \n Unauthorized request."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Error on retrieving stats",
response = Response.class)
})
Response createGeoAlertsForGeoClusters(
@ApiParam(
name = "alert",
value = "The alert object",
required = true)
@Valid Alert alert,
@ApiParam(
name = "alertType",
value = "The alert type, such as Within, Speed, Stationary",
@ -298,9 +361,9 @@ public interface GeoLocationBasedService {
@ApiOperation(
consumes = "application/json",
produces = "application/json",
httpMethod = "GET",
value = "Update Geo alerts for the device",
notes = "",
httpMethod = "PUT",
value = "Updating the Geo Alerts of a Device",
notes = "Update the a geo alert that was sent to a device.",
response = Response.class,
tags = "Geo Service Management",
extensions = {
@ -339,16 +402,69 @@ public interface GeoLocationBasedService {
@Valid Alert alert,
@ApiParam(
name = "deviceId",
value = "The registered device Id.",
value = "The device ID.",
required = true)
@PathParam("deviceId") String deviceId,
@ApiParam(
name = "device-type",
value = "The device type, such as ios, android or windows.",
value = "The device type, such as ios, android, or windows.",
required = true)
@PathParam("deviceType")
@Size(max = 45)
String deviceType,
@ApiParam(
name = "alertType",
value = "The alert type, such as Within, Speed, Exit, or Stationary",
required = true)
@PathParam("alertType") String alertType);
/**
* Update Geo alerts for geo clusters
*/
@PUT
@Path("alerts/{alertType}")
@ApiOperation(
consumes = "application/json",
produces = "application/json",
httpMethod = "GET",
value = "Update Geo alerts for geo clusters",
notes = "Updating an existing geo alert that was defined for geo clusters",
response = Response.class,
tags = "Geo Service Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage")
})
}
)
@ApiResponses(value = {
@ApiResponse(
code = 200,
message = "OK.",
response = Response.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Type",
description = "The content type of the body")
}),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid Device Identifiers found.",
response = Response.class),
@ApiResponse(
code = 401,
message = "Unauthorized. \n Unauthorized request."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Error on retrieving stats",
response = Response.class)
})
Response updateGeoAlertsForGeoClusters(
@ApiParam(
name = "alert",
value = "The alert object",
required = true)
@Valid Alert alert,
@ApiParam(
name = "alertType",
value = "The alert type, such as Within, Speed, Stationary",
@ -364,8 +480,8 @@ public interface GeoLocationBasedService {
consumes = "application/json",
produces = "application/json",
httpMethod = "GET",
value = "Retrieve Geo alerts for the device",
notes = "",
value = "Getting a Geo Alert from a Device",
notes = "Retrieve a specific geo alert from a device, such as getting a speed alert that was sent to a device.",
response = Response.class,
tags = "Geo Service Management",
extensions = {
@ -403,22 +519,75 @@ public interface GeoLocationBasedService {
Response getGeoAlerts(
@ApiParam(
name = "deviceId",
value = "The registered device Id.",
value = "The device ID.",
required = true)
@PathParam("deviceId") String deviceId,
@ApiParam(
name = "device-type",
value = "The device type, such as ios, android or windows.",
value = "The device type, such as ios, android. or windows.",
required = true)
@PathParam("deviceType")
@Size(max = 45)
String deviceType,
@ApiParam(
name = "alertType",
value = "The alert type, such as Within, Speed, Exit, or Stationary",
required = true)
@PathParam("alertType") String alertType);
/**
* Retrieve Geo alerts for geo clusters
*/
@GET
@Path("alerts/{alertType}")
@ApiOperation(
consumes = "application/json",
produces = "application/json",
httpMethod = "GET",
value = "Retrieve Geo alerts for geo clusters",
notes = "Retrieve all the defined alerts for a specific alert type",
response = Response.class,
tags = "Geo Service Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage")
})
}
)
@ApiResponses(value = {
@ApiResponse(
code = 200,
message = "OK.",
response = Response.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Type",
description = "The content type of the body"),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests.")
}),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid Device Identifiers found.",
response = Response.class),
@ApiResponse(
code = 401,
message = "Unauthorized. \n Unauthorized request."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Error on retrieving stats",
response = Response.class)
})
Response getGeoAlertsForGeoClusters(
@ApiParam(
name = "alertType",
value = "The alert type, such as Within, Speed, Stationary",
required = true)
@PathParam("alertType") String alertType);
/**
* Retrieve Geo alerts history
*/
@ -428,8 +597,8 @@ public interface GeoLocationBasedService {
consumes = "application/json",
produces = "application/json",
httpMethod = "GET",
value = "Retrieve Geo alerts history for the device",
notes = "",
value = "Getting the Geo Service Alert History of a Device",
notes = "Get the geo alert history of a device during the defined time period.",
response = Response.class,
tags = "Geo Service Management",
extensions = {
@ -467,16 +636,73 @@ public interface GeoLocationBasedService {
Response getGeoAlertsHistory(
@ApiParam(
name = "deviceId",
value = "The registered device Id.",
value = "The device ID.",
required = true)
@PathParam("deviceId") String deviceId,
@ApiParam(
name = "device-type",
value = "The device type, such as ios, android or windows.",
value = "The device type, such as ios, android, or windows.",
required = true)
@PathParam("deviceType")
@Size(max = 45)
String deviceType,
@ApiParam(
name = "from",
value = "Define the time to start getting the geo location history of the device in the Epoch or UNIX format.",
required = true)
@QueryParam("from") long from,
@ApiParam(
name = "to",
value = "Define the time to finish getting the geo location history of the device in the Epoch or UNIX format.",
required = true)
@QueryParam("to") long to);
/**
* Retrieve Geo alerts history for geo clusters
*/
@GET
@Path("alerts/history")
@ApiOperation(
consumes = "application/json",
produces = "application/json",
httpMethod = "GET",
value = "Retrieve Geo alerts history for geo clusters",
notes = "Retrieving geo alert history of all defined alerts for geo clusters",
response = Response.class,
tags = "Geo Service Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage")
})
}
)
@ApiResponses(value = {
@ApiResponse(
code = 200,
message = "OK.",
response = Response.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Type",
description = "The content type of the body"),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource was last modified.\n" +
"Used by caches, or in conditional requests.")
}),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid Device Identifiers found.",
response = Response.class),
@ApiResponse(
code = 401,
message = "Unauthorized. \n Unauthorized request."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Error on retrieving stats",
response = Response.class)
})
Response getGeoAlertsHistoryForGeoClusters(
@ApiParam(
name = "from",
value = "Get stats from what time",
@ -488,14 +714,19 @@ public interface GeoLocationBasedService {
required = true)
@QueryParam("to") long to);
/**
* Remove geo alerts
*/
@DELETE
@Path("alerts/{alertType}/{deviceType}/{deviceId}")
@ApiOperation(
consumes = "application/json",
produces = "application/json",
httpMethod = "DELETE",
value = "Deletes Geo alerts for the device",
notes = "",
value = "Deleting a Geo Alert from a Device",
notes = "Delete a specific geo alert from a device, such as deleting a speed alert that was sent to the device.",
response = Response.class,
tags = "Geo Service Management",
extensions = {
@ -529,14 +760,69 @@ public interface GeoLocationBasedService {
Response removeGeoAlerts(
@ApiParam(
name = "deviceId",
value = "The registered device Id.",
value = "The device ID.",
required = true)
@PathParam("deviceId") String deviceId,
@ApiParam(
name = "deviceType",
value = "The device type, such as ios, android or windows.",
value = "The device type, such as ios, android, or windows.",
required = true)
@PathParam("deviceType") String deviceType,
@ApiParam(
name = "alertType",
value = "The alert type, such as Within, Speed, Exit, or Stationary",
required = true)
@PathParam("alertType") String alertType,
@ApiParam(
name = "queryName",
value = "When you define a geofence you define a fence name for it. That name needs to be defined" +
" here.",
required = true)
@QueryParam("queryName") String queryName);
/**
* Remove geo alerts for geo clusters
*/
@DELETE
@Path("alerts/{alertType}")
@ApiOperation(
consumes = "application/json",
produces = "application/json",
httpMethod = "DELETE",
value = "Deletes Geo alerts for geo clusters",
notes = "Deleting any type of a geo alert that was defined for geo clusters",
response = Response.class,
tags = "Geo Service Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:geo-service:alerts-manage")
})
}
)
@ApiResponses(value = {
@ApiResponse(
code = 200,
message = "OK.",
response = Response.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Type",
description = "The content type of the body")
}),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid Device Identifiers found.",
response = Response.class),
@ApiResponse(
code = 401,
message = "Unauthorized. \n Unauthorized request."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Error on retrieving stats",
response = Response.class)
})
Response removeGeoAlertsForGeoClusters(
@ApiParam(
name = "alertType",
value = "The alert type, such as Within, Speed, Stationary",

@ -72,8 +72,8 @@ import java.util.List;
),
tags = {
@Tag(name = "device_management", description = "Device group related REST-API. " +
"This can be used to manipulated device group related " +
"details.")
"This can be used to manipulated device group related " +
"details.")
}
)
@Scopes(
@ -166,7 +166,7 @@ import java.util.List;
)
@Path("/groups")
@Api(value = "Device Group Management", description = "This API carries all device group management related " +
"operations such as get all the available groups, etc.")
"operations such as get all the available groups, etc.")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public interface GroupManagementService {
@ -175,13 +175,13 @@ public interface GroupManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = HTTPConstants.HEADER_GET,
value = "Get the list of groups belongs to current user.",
notes = "Returns all permitted groups enrolled with the system.",
value = "Getting the List of Groups",
notes = "Returns all groups enrolled with the system.",
tags = "Device Group Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:groups")
})
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:groups")
})
}
)
@ApiResponses(value = {
@ -194,16 +194,16 @@ public interface GroupManagementService {
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of " +
"the requested resource."),
"the requested resource."),
@ApiResponse(
code = 406,
message = "Not Acceptable.\n The requested media type is not supported."),
@ -213,8 +213,8 @@ public interface GroupManagementService {
response = ErrorResponse.class)
})
Response getGroups(@ApiParam(
name = "name",
value = "Name of the group.")
name = "name",
value = "Name of the group.")
@QueryParam("name")
String name,
@ApiParam(
@ -230,7 +230,8 @@ public interface GroupManagementService {
int offset,
@ApiParam(
name = "limit",
value = "Provide how many device details you require from the starting pagination index/offset.",
value = "Provide how many device details you require from the starting pagination " +
"index/offset.",
defaultValue = "5")
@QueryParam("limit")
int limit);
@ -240,13 +241,13 @@ public interface GroupManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = HTTPConstants.HEADER_GET,
value = "Get the count of groups belongs to current user.",
notes = "Returns count of all permitted groups enrolled with the system.",
value = "Getting the Number of Device Groups",
notes = "Get the number of device groups in the server that the current signed in user can access.",
tags = "Device Group Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:count")
})
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:count")
})
}
)
@ -260,16 +261,16 @@ public interface GroupManagementService {
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of " +
"the requested resource."),
"the requested resource."),
@ApiResponse(
code = 406,
message = "Not Acceptable.\n The requested media type is not supported."),
@ -284,13 +285,13 @@ public interface GroupManagementService {
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,
httpMethod = HTTPConstants.HEADER_POST,
value = "Add new device group to the system.",
notes = "Add device group with current user as the owner.",
value = "Adding a New Device Group",
notes = "Add device group with the current user as the owner.",
tags = "Device Group Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:add")
})
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:add")
})
}
)
@ApiResponses(
@ -308,16 +309,17 @@ public interface GroupManagementService {
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests.")
description = "Date and time the resource has been modified the last time" +
".\n" + "Used by caches, or in conditional requests.")
}
),
@ApiResponse(
code = 303,
message = "See Other. \n Source can be retrieved from the URL specified at the Location header.",
message = "See Other. \n Source can be retrieved from the URL specified at the Location " +
"header.",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
@ -332,17 +334,18 @@ public interface GroupManagementService {
response = ErrorResponse.class),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The entity of the request was in a not supported format."),
message = "Unsupported media type. \n The entity of the request was in a not supported " +
"format."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while adding a new device group.",
"Server error occurred while adding a new device group.",
response = ErrorResponse.class)
})
Response createGroup(@ApiParam(
name = "group",
value = "Group object with data.",
required = true)
name = "group",
value = "Define the group object with data.",
required = true)
@Valid DeviceGroup group);
@Path("/id/{groupId}")
@ -350,13 +353,13 @@ public interface GroupManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = HTTPConstants.HEADER_GET,
value = "View group specified.",
notes = "Returns details of group enrolled with the system.",
value = "Getting Details of a Specific Device Group",
notes = "Get the details of a specific device group.",
tags = "Device Group Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:groups-view")
})
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:groups-view")
})
}
)
@ApiResponses(value = {
@ -369,16 +372,16 @@ public interface GroupManagementService {
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of " +
"the requested resource."),
"the requested resource."),
@ApiResponse(
code = 404,
message = "Group found.",
@ -392,9 +395,9 @@ public interface GroupManagementService {
response = ErrorResponse.class)
})
Response getGroup(@ApiParam(
name = "groupId",
value = "ID of the group to view.",
required = true)
name = "groupId",
value = "The ID of the group.",
required = true)
@PathParam("groupId") int groupId);
@Path("/id/{groupId}")
@ -402,14 +405,13 @@ public interface GroupManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = HTTPConstants.HEADER_PUT,
value = "Update a group.",
notes = "If you wish to make changes to an existing group, that can be done by updating the group using " +
"this resource.",
value = "Updating a Device Group",
notes = "If you wish to make changes to an existing group, that can be done by updating the group using this API",
tags = "Device Group Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:update")
})
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:update")
})
}
)
@ApiResponses(value = {
@ -421,16 +423,16 @@ public interface GroupManagementService {
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of " +
"the requested resource."),
"the requested resource."),
@ApiResponse(
code = 404,
message = "Group not found.",
@ -444,13 +446,13 @@ public interface GroupManagementService {
response = ErrorResponse.class)
})
Response updateGroup(@ApiParam(
name = "groupId",
value = "ID of the group to be updated.",
required = true)
name = "groupId",
value = "ID of the group to be updated.",
required = true)
@PathParam("groupId") int groupId,
@ApiParam(
name = "group",
value = "Group object with data.",
value = "Update the content of the group object.",
required = true)
@Valid DeviceGroup deviceGroup);
@ -459,14 +461,13 @@ public interface GroupManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = HTTPConstants.HEADER_DELETE,
value = "Delete a group.",
notes = "If you wish to remove an existing group, that can be done by updating the group using " +
"this resource.",
value = "Deleting a Group",
notes = "If you wish to remove an existing group, that can be done by updating the group using this API.",
tags = "Device Group Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:remove")
})
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:remove")
})
}
)
@ApiResponses(value = {
@ -478,16 +479,16 @@ public interface GroupManagementService {
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of " +
"the requested resource."),
"the requested resource."),
@ApiResponse(
code = 404,
message = "Group not found.",
@ -501,9 +502,9 @@ public interface GroupManagementService {
response = ErrorResponse.class)
})
Response deleteGroup(@ApiParam(
name = "groupId",
value = "ID of the group to be deleted.",
required = true)
name = "groupId",
value = "ID of the group to be deleted.",
required = true)
@PathParam("groupId") int groupId);
@Path("/id/{groupId}/share")
@ -511,14 +512,14 @@ public interface GroupManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = HTTPConstants.HEADER_POST,
value = "Manage group sharing with a user.",
notes = "If you wish to share /un share an existing group with a user under defined sharing roles, " +
"that can be done using this resource.",
value = "Sharing a Group",
notes = "A device group can be shared with different user-roles. The users that belong to that role can " +
"then view the groups and the devices in it. Use this API to share a group among user roles.",
tags = "Device Group Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:share")
})
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:share")
})
}
)
@ApiResponses(value = {
@ -530,16 +531,16 @@ public interface GroupManagementService {
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of " +
"the requested resource."),
"the requested resource."),
@ApiResponse(
code = 404,
message = "Group not found.",
@ -553,9 +554,9 @@ public interface GroupManagementService {
response = ErrorResponse.class)
})
Response manageGroupSharing(@ApiParam(
name = "groupName",
value = "Name of the group to be shared or unshared.",
required = true)
name = "groupName",
value = "Name of the group to be shared or unshared.",
required = true)
@PathParam("groupId") int groupId,
@ApiParam(
name = "userRoles",
@ -568,13 +569,14 @@ public interface GroupManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = HTTPConstants.HEADER_GET,
value = "View list of roles of a device group.",
notes = "Returns details of roles which particular group has been shared with.",
value = "Getting the List of Roles the Group is Shared With",
notes = "A device group can be shared with different user-roles. The users that belong to that role can" +
"then view the groups and the devices in it. Using this API you get the list of roles the device group is shared with.",
tags = "Device Group Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:roles")
})
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:roles")
})
}
)
@ApiResponses(value = {
@ -610,9 +612,9 @@ public interface GroupManagementService {
response = ErrorResponse.class)
})
Response getRolesOfGroup(@ApiParam(
name = "groupId",
value = "ID of the group.",
required = true)
name = "groupId",
value = "ID of the group.",
required = true)
@PathParam("groupId") int groupId);
@Path("/id/{groupId}/devices")
@ -620,13 +622,13 @@ public interface GroupManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = HTTPConstants.HEADER_GET,
value = "View list of devices in the device group.",
notes = "Returns list of devices in the device group.",
value = "Getting the List of Devices in a Group",
notes = "Returns the list of devices in a device group.",
tags = "Device Group Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:devices")
})
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:devices")
})
}
)
@ApiResponses(value = {
@ -639,16 +641,16 @@ public interface GroupManagementService {
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of " +
"the requested resource."),
"the requested resource."),
@ApiResponse(
code = 404,
message = "Group not found.",
@ -662,9 +664,9 @@ public interface GroupManagementService {
response = ErrorResponse.class)
})
Response getDevicesOfGroup(@ApiParam(
name = "groupId",
value = "ID of the group.",
required = true)
name = "groupId",
value = "ID of the group.",
required = true)
@PathParam("groupId")
int groupId,
@ApiParam(
@ -675,7 +677,8 @@ public interface GroupManagementService {
int offset,
@ApiParam(
name = "limit",
value = "Provide how many device details you require from the starting pagination index/offset.",
value = "Provide how many group details you require from the starting " +
"pagination index/offset.",
defaultValue = "5")
@QueryParam("limit")
int limit);
@ -685,13 +688,13 @@ public interface GroupManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = HTTPConstants.HEADER_GET,
value = "View list of device count in the device group.",
notes = "Returns device count in the device group.",
value = "Getting the Number of Devices in a Group",
notes = "Get the number of devices in a group using this API.",
tags = "Device Group Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:devices-count")
})
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:devices-count")
})
}
)
@ApiResponses(value = {
@ -704,16 +707,16 @@ public interface GroupManagementService {
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of " +
"the requested resource."),
"the requested resource."),
@ApiResponse(
code = 404,
message = "No groups found.",
@ -727,23 +730,23 @@ public interface GroupManagementService {
response = ErrorResponse.class)
})
Response getDeviceCountOfGroup(@ApiParam(
name = "groupId",
value = "ID of the group.",
required = true)
@PathParam("groupId") int groupId);
name = "groupId",
value = "ID of the group.",
required = true)
@PathParam("groupId") int groupId);
@Path("/id/{groupId}/devices/add")
@POST
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = HTTPConstants.HEADER_POST,
value = "Add devices to group.",
notes = "Add existing devices to the device group.",
value = "Adding Devices to a Group",
notes = "Add the enrolled devices to a group.",
tags = "Device Group Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:devices-add")
})
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:devices-add")
})
}
)
@ApiResponses(value = {
@ -755,16 +758,16 @@ public interface GroupManagementService {
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of " +
"the requested resource."),
"the requested resource."),
@ApiResponse(
code = 404,
message = "No groups found.",
@ -778,9 +781,9 @@ public interface GroupManagementService {
response = ErrorResponse.class)
})
Response addDevicesToGroup(@ApiParam(
name = "groupId",
value = "ID of the group.",
required = true)
name = "groupId",
value = "ID of the group.",
required = true)
@PathParam("groupId") int groupId,
@ApiParam(
name = "deviceIdentifiers",
@ -793,13 +796,13 @@ public interface GroupManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = HTTPConstants.HEADER_DELETE,
value = "Remove devices from group.",
notes = "Remove existing devices from the device group.",
value = "Removing Devices from a Group",
notes = "Remove a device from a group using this API.",
tags = "Device Group Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:devices-remove")
})
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:devices-remove")
})
}
)
@ApiResponses(value = {
@ -811,16 +814,16 @@ public interface GroupManagementService {
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of " +
"the requested resource."),
"the requested resource."),
@ApiResponse(
code = 404,
message = "No groups found.",
@ -834,13 +837,14 @@ public interface GroupManagementService {
response = ErrorResponse.class)
})
Response removeDevicesFromGroup(@ApiParam(
name = "groupId",
value = "ID of the group.",
required = true)
name = "groupId",
value = "ID of the group.",
required = true)
@PathParam("groupId") int groupId,
@ApiParam(
name = "deviceIdentifiers",
value = "Device identifiers of the devices which needed to be removed.",
value = "The device identifiers of the devices that needed to be removed."+
" You can define many device IDs as comma separated values.",
required = true)
@Valid List<DeviceIdentifier> deviceIdentifiers);
@ -849,8 +853,8 @@ public interface GroupManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = HTTPConstants.HEADER_POST,
value = "Assign devices to groups",
notes = "Add existing device to device groups.",
value = "Adding a Device to Many Groups",
notes = "Add an already enrolled device to many groups, using this API.",
tags = "Device Group Management",
extensions = {
@Extension(properties = {
@ -867,16 +871,16 @@ public interface GroupManagementService {
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of " +
"the requested resource."),
"the requested resource."),
@ApiResponse(
code = 404,
message = "No groups found.",
@ -892,7 +896,9 @@ public interface GroupManagementService {
Response updateDeviceAssigningToGroups(
@ApiParam(
name = "deviceToGroupsAssignment",
value = "Device to groups assignment",
value = "In the payload, define the group IDs that you need to add the device to as comma " +
"separated values, and the device identifier and type of the device, such as android, " +
"ios, and windows, that needs to be added to the groups.",
required = true)
@Valid DeviceToGroupsAssignment deviceToGroupsAssignment);
@ -901,8 +907,9 @@ public interface GroupManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = HTTPConstants.HEADER_GET,
value = "List of groups that have the device",
notes = "List of groups that have the device.",
value = "Getting Device Groups that Include the Specific Device",
notes = " device can be added to one or many groups. This API gives you the list of groups the device " +
"has been added to.",
tags = "Device Group Management",
extensions = {
@Extension(properties = {
@ -919,16 +926,16 @@ public interface GroupManagementService {
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of " +
"the requested resource."),
"the requested resource."),
@ApiResponse(
code = 406,
message = "Not Acceptable.\n The requested media type is not supported."),
@ -940,13 +947,13 @@ public interface GroupManagementService {
Response getGroups(
@ApiParam(
name = "deviceId",
value = "Id of the device.",
value = "The device ID.",
required = true)
@QueryParam("deviceId")
String deviceId,
@ApiParam(
name = "deviceType",
value = "Type of the device.",
value = "The type of the device, such as android, ios, or windows.",
required = true)
@QueryParam("deviceType")
String deviceType);

@ -18,17 +18,17 @@
*/
package org.wso2.carbon.device.mgt.jaxrs.service.api;
import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Info;
import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.Extension;
import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Info;
import io.swagger.annotations.ResponseHeader;
import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Tag;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.mgt.common.notification.mgt.Notification;
@ -36,9 +36,15 @@ import org.wso2.carbon.device.mgt.jaxrs.NotificationList;
import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse;
import org.wso2.carbon.device.mgt.jaxrs.util.Constants;
import javax.validation.constraints.Max;
import javax.validation.constraints.Size;
import javax.ws.rs.*;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@ -91,9 +97,9 @@ public interface NotificationManagementService {
notes = "Get the details of all the notifications that were pushed to the devices registered with WSO2 EMM using this REST API.",
tags = "Device Notification Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:notifications:view")
})
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:notifications:view")
})
}
)
@ApiResponses(
@ -180,9 +186,9 @@ public interface NotificationManagementService {
+ "change from NEW to CHECKED. This API is used to update device notification status.",
tags = "Device Notification Management",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:notifications:mark-checked")
})
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:notifications:mark-checked")
})
}
)
@ApiResponses(
@ -207,8 +213,7 @@ public interface NotificationManagementService {
value = "The notification ID.",
required = true,
defaultValue = "1")
@PathParam("id") @Max(45)
int id);
@PathParam("id") int id);
@PUT
@ -216,9 +221,9 @@ public interface NotificationManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "PUT",
value = "Clear all notifications",
value = "Clearing All Notifications",
notes = "When a user needs to mark all the notifications as checked/read this " +
"function can be used to clear all notifications",
"function can be used to clear all notifications.",
tags = "Device Notification Management",
extensions = {
@Extension(properties = {

@ -136,7 +136,8 @@ import java.util.List;
)
}
)
@Api(value = "Device Policy Management", description = "This API includes the functionality around device policy management")
@Api(value = "Device Policy Management", description = "This API includes the functionality around device policy " +
"management")
@Path("/policies")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@ -148,8 +149,10 @@ public interface PolicyManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Adding a Policy",
notes = "Add a policy using this REST API command. When adding a policy you will have the option of saving the policy or saving and publishing the policy." +
"Using this REST API you are able to save a created Policy and this policy will be in the inactive state.",
notes = "Add a policy using this REST API command. When adding a policy you will have the option of " +
"saving the policy or saving and publishing the policy." +
"Using this REST API you are able to save a created Policy and this policy will be in the " +
"inactive state.",
tags = "Device Policy Management",
extensions = {
@Extension(properties = {
@ -181,7 +184,8 @@ public interface PolicyManagementService {
),
@ApiResponse(
code = 303,
message = "See Other. \n The source can be retrieved from the URL specified in the location header",
message = "See Other. \n The source can be retrieved from the URL specified in the " +
"location header",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
@ -192,11 +196,13 @@ public interface PolicyManagementService {
response = ErrorResponse.class),
@ApiResponse(
code = 401,
message = "Not Found. \n The user that is currently logged in is not authorized to add policies.",
message = "Not Found. \n The user that is currently logged in is not authorized to add " +
"policies.",
response = ErrorResponse.class),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The format of the requested entity was not supported."),
message = "Unsupported media type. \n The format of the requested entity was not " +
"supported."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n " +
@ -248,7 +254,8 @@ public interface PolicyManagementService {
),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client already has the latest version of the requested resource."),
message = "Not Modified. \n Empty body because the client already has the latest version " +
"of the requested resource."),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error.",
@ -322,7 +329,8 @@ public interface PolicyManagementService {
),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client already has the latest version of the requested resource.\n"),
message = "Not Modified. \n Empty body because the client already has the latest version " +
"of the requested resource.\n"),
@ApiResponse(
code = 404,
message = "Not Found. \n A specified policy was not found.",
@ -400,7 +408,8 @@ public interface PolicyManagementService {
response = ErrorResponse.class),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The format of the requested entity was not supported."),
message = "Unsupported media type. \n The format of the requested entity was not " +
"supported."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n " +
@ -451,7 +460,8 @@ public interface PolicyManagementService {
response = ErrorResponse.class),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The format of the requested entity was not supported.\n "
message = "Unsupported media type. \n The format of the requested entity was not " +
"supported.\n "
+ "supported format."),
@ApiResponse(
code = 500,
@ -474,7 +484,8 @@ public interface PolicyManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Activating Policies",
notes = "Publish a policy using this API to bring a policy that is in the inactive state to the active state.",
notes = "Publish a policy using this API to bring a policy that is in the inactive state to the active " +
"state.",
tags = "Device Policy Management",
extensions = {
@Extension(properties = {
@ -515,7 +526,8 @@ public interface PolicyManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Deactivating Policies",
notes = "Unpublish a policy using this API to bring a policy that is in the active state to the inactive state.",
notes = "Unpublish a policy using this API to bring a policy that is in the active state to the inactive " +
"state.",
tags = "Device Policy Management",
extensions = {
@Extension(properties = {
@ -655,7 +667,8 @@ public interface PolicyManagementService {
),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client already has the latest version of the requested resource.\n"),
message = "Not Modified. \n Empty body because the client already has the latest version " +
"of the requested resource.\n"),
@ApiResponse(
code = 404,
message = "Not Found. \n A specified policy was not found.",

@ -78,8 +78,8 @@ public interface RemoteSessionService {
consumes = "application/json",
produces = "application/json",
httpMethod = "GET",
value = "Retrieve Connection Information for the device type",
notes = "",
value = "Connecting to a Device",
notes = "You able to connect to a device to start a remote session using this API.",
response = Response.class,
tags = "Remote Session Service Management",
extensions = {
@ -117,12 +117,12 @@ public interface RemoteSessionService {
Response getRemoteSessionDeviceConnect(
@ApiParam(
name = "deviceId",
value = "The registered device Id.",
value = "The device ID.",
required = true)
@PathParam("deviceId") String deviceId,
@ApiParam(
name = "device-type",
value = "The device type, such as ios, android or windows.",
value = "The device type, such as ios, android, or windows.",
required = true)
@PathParam("deviceType")
@Size(max = 45)

@ -185,7 +185,7 @@ public interface RoleManagementService {
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Getting the List of Roles filtered by the given prefix",
value = "Getting the List of Roles Filtered by the Given Prefix",
notes = "WSO2 IoTS supports role-based access control (RBAC) and role management. Using this API you can the list of roles that are in WSO2 IoTS.\n" +
"Note: Internal roles, roles created for service-providers, and application related roles will not be given in the output.",
tags = "Role Management",
@ -482,7 +482,9 @@ public interface RoleManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Adding a combined Role",
notes = "WSO2 IoTS supports role-based access control (RBAC) and role management. Add a new combined role to WSO2 IoTS using this REST API.",
notes = "You are able to combine two roles that already exist and create one role. For example, you " +
"might want a role that has device owner and application management role permissions, you can" +
" now select these two roles and create another new role that has all their permissions.",
tags = "Role Management",
extensions = {
@Extension(properties = {
@ -511,7 +513,8 @@ public interface RoleManagementService {
"Used by caches, or in conditional requests.")}),
@ApiResponse(
code = 303,
message = "See Other. \n The source can be retrieved from the URL specified in the location header.",
message = "See Other. \n The source can be retrieved from the URL specified in the location " +
"header.",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
@ -597,7 +600,8 @@ public interface RoleManagementService {
name = "role",
value = "The properties required to update a role.\n" +
"NOTE: Don't change the role and the permissions of the admin user. " +
"If you want to try out this API by updating all the properties, create a new role and update the properties accordingly.",
"If you want to try out this API by updating all the properties, create a new role " +
"and update the properties accordingly.",
required = true) RoleInfo role,
@ApiParam(
name = "user-store",
@ -608,9 +612,12 @@ public interface RoleManagementService {
@DELETE
@Path("/{roleName}")
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON,
httpMethod = "DELETE",
value = "Deleting a Role",
notes = "Roles become obsolete over time due to various reasons. In a situation where your Organization identifies that a specific role is no longer required, you " +
notes = "Roles become obsolete over time due to various reasons. In a situation where your " +
"Organization identifies that a specific role is no longer required, you " +
"can delete a role using this REST API.",
tags = "Role Management",
extensions = {
@ -659,8 +666,10 @@ public interface RoleManagementService {
notes = "Defining users to a role at the point of creating a new role is optional. " +
"You can update the users that belong to a given role after you have created " +
"a role using this REST API.\n" +
"Example: Your Organization hires 30 new engineers. Updating the role details for each user can " +
"be cumbersome. Therefore, you can define all the new employees that belong to the engineering " +
"Example: Your Organization hires 30 new engineers. Updating the role details for each user " +
"can " +
"be cumbersome. Therefore, you can define all the new employees that belong to the " +
"engineering " +
"role using this API.",
tags = "Role Management",
extensions = {
@ -684,7 +693,8 @@ public interface RoleManagementService {
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
description = "Date and time the resource has been modified the last " +
"time.\n" +
"Used by caches, or in conditional requests.")}),
@ApiResponse(
code = 400,
@ -696,7 +706,8 @@ public interface RoleManagementService {
response = ErrorResponse.class),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The format of the requested entity was not supported.\n" +
message = "Unsupported media type. \n The format of the requested entity was not " +
"supported.\n" +
"supported format.",
response = ErrorResponse.class),
@ApiResponse(

@ -155,7 +155,8 @@ public interface UserManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Adding a User",
notes = "WSO2 IoTS supports user management. Add a new user to the WSO2 IoTS user management system via this REST API",
notes = "WSO2 IoTS supports user management. Add a new user to the WSO2 IoTS user management system via " +
"this REST API",
tags = "User Management",
extensions = {
@Extension(properties = {
@ -243,7 +244,8 @@ public interface UserManagementService {
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client already has the latest version of the requested resource."),
message = "Not Modified. \n Empty body because the client already has the latest version of the " +
"requested resource."),
@ApiResponse(
code = 404,
message = "Not Found. \n The specified resource does not exist.",
@ -351,7 +353,8 @@ public interface UserManagementService {
@ApiOperation(
httpMethod = "DELETE",
value = "Deleting a User",
notes = "When an employee leaves the organization, you can remove the user details from WSO2 IoTS using this REST API.",
notes = "When an employee leaves the organization, you can remove the user details from WSO2 IoTS using " +
"this REST API.",
tags = "User Management",
extensions = {
@Extension(properties = {
@ -378,7 +381,8 @@ public interface UserManagementService {
@ApiParam(
name = "username",
value = "Username of the user to be deleted.\n" +
"INFO: If you want to try out this API, make sure to create a new user and then remove that user. Do not remove the admin user.",
"INFO: If you want to try out this API, make sure to create a new user and then remove " +
"that user. Do not remove the admin user.",
required = true,
defaultValue = "[Create a new user named Jim, and then try out this API.]")
@PathParam("username") String username,
@ -394,7 +398,8 @@ public interface UserManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Getting the Role Details of a User",
notes = "A user can be assigned to one or more role in IoTS. Using this REST API you can get the role/roles a user is assigned to.",
notes = "A user can be assigned to one or more role in IoTS. Using this REST API you can get the " +
"role/roles a user is assigned to.",
tags = "User Management",
extensions = {
@Extension(properties = {
@ -422,7 +427,8 @@ public interface UserManagementService {
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client already has the latest version of the requested resource."),
message = "Not Modified. \n Empty body because the client already has the latest version of the " +
"requested resource."),
@ApiResponse(
code = 404,
message = "Not Found. \n The specified resource does not exist.\n",
@ -455,7 +461,8 @@ public interface UserManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Getting Details of Users",
notes = "You are able to manage users in WSO2 IoTS by adding, updating and removing users. If you wish to get the list of users registered with WSO2 IoTS, you can do so "
notes = "You are able to manage users in WSO2 IoTS by adding, updating and removing users. If you wish to" +
" get the list of users registered with WSO2 IoTS, you can do so "
+ "using this REST API",
tags = "User Management",
extensions = {
@ -492,7 +499,8 @@ public interface UserManagementService {
response = ErrorResponse.class),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Server error occurred while fetching the list of WSO2 IoTS users.",
message = "Internal Server Error. \n Server error occurred while fetching the list of WSO2 IoTS " +
"users.",
response = ErrorResponse.class)
})
Response getUsers(
@ -551,7 +559,8 @@ public interface UserManagementService {
response = ErrorResponse.class),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Server error occurred while fetching the total number of users in WSO2 IoTS.",
message = "Internal Server Error. \n Server error occurred while fetching the total number of " +
"users in WSO2 IoTS.",
response = ErrorResponse.class)
})
Response getUserCount();
@ -602,7 +611,8 @@ public interface UserManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Searching for a User Name",
notes = "If you are unsure of the user name of a user and need to retrieve the details of a specific user, you can "
notes = "If you are unsure of the user name of a user and need to retrieve the details of a specific " +
"user, you can "
+ "search for that user by giving a character or a few characters in the username. "
+ "You will be given a list of users having the user name in the exact order of the "
+ "characters you provided.",
@ -634,14 +644,16 @@ public interface UserManagementService {
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client already has the latest version of the requested resource."),
message = "Not Modified. \n Empty body because the client already has the latest version of the " +
"requested resource."),
@ApiResponse(
code = 406,
message = "Not Acceptable.\n The requested media type is not supported",
response = ErrorResponse.class),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Server error occurred while fetching the list of users that matched the given filter.",
message = "Internal Server Error. \n Server error occurred while fetching the list of users that " +
"matched the given filter.",
response = ErrorResponse.class)
})
Response getUserNames(
@ -727,7 +739,9 @@ public interface UserManagementService {
httpMethod = "POST",
value = "Sending Enrollment Invitations to Users",
notes = "Send the users a mail inviting them to enroll their devices using the REST API given below.\n" +
"Before running the REST API command to send the enrollment invitations to users make sure to configure WSO2 IoTS as explained in step 4, under the WSO2 IoTS general server configurations documentation.",
"Before running the REST API command to send the enrollment invitations to users make sure to " +
"configure WSO2 IoTS as explained in step 4, under the WSO2 IoTS general server configurations " +
"documentation.",
tags = "User Management",
extensions = {
@Extension(properties = {

@ -18,18 +18,11 @@
*/
package org.wso2.carbon.device.mgt.jaxrs.service.api.admin;
import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Info;
import io.swagger.annotations.ExtensionProperty;
import io.swagger.annotations.Extension;
import io.swagger.annotations.Tag;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.*;
import org.apache.axis2.transport.http.HTTPConstants;
import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse;
import org.wso2.carbon.device.mgt.jaxrs.beans.PasswordResetWrapper;
import org.wso2.carbon.device.mgt.jaxrs.util.Constants;
@ -61,6 +54,12 @@ import javax.ws.rs.core.Response;
description = "View Users",
key = "perm:admin-users:view",
permissions = {"/device-mgt/users/manage"}
),
@Scope(
name = "Delete Users Device Information",
description = "Delete users device details",
key = "perm:admin-users:remove",
permissions = {"/device-mgt/users/manage"}
)
}
)
@ -127,4 +126,136 @@ public interface UserManagementAdminService {
value = "Credential.",
required = true) PasswordResetWrapper credentials);
@DELETE
@Path("/{username}/devices")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON,
httpMethod = HTTPConstants.HEADER_DELETE,
value = "Delete a users associated devices.",
notes = "If you wish to remove an device details to comply with the privacy requirements, can be done with " +
"this resource.",
tags = "Device details remove",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:admin-users:remove")
})
}
)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. \n Users devices and details has been deleted successfully.",
responseHeaders = {
@ResponseHeader(
name = "Content-Type",
description = "The content type of the body."),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of " +
"the requested resource."),
@ApiResponse(
code = 404,
message = "Group not found.",
response = ErrorResponse.class),
@ApiResponse(
code = 406,
message = "Not Acceptable.\n The requested media type is not supported."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Server error occurred while removing the group.",
response = ErrorResponse.class)
})
Response deleteDeviceOfUser(@ApiParam(
name = "username",
value = "Username of the users devices to be deleted.",
required = true)
@PathParam("username") String username);
//device remove request would looks like follows
//DELETE devices/type/virtual_firealarm/id/us06ww93auzp
@DELETE
@Path("/type/{device-type}/id/{device-id}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
consumes = MediaType.APPLICATION_JSON,
httpMethod = "DELETE",
value = "Remove the information of device specified by device id",
notes = "Returns the status of the deleted device information.",
tags = "Device details remove privacy compliance",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = Constants.SCOPE, value = "perm:admin-users:remove")
})
}
)
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n Successfully deleted the device information.",
response = Device.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Type",
description = "The content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 304,
message = "Not Modified. Empty body because the client already has the latest " +
"version of the requested resource."),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error.",
response = ErrorResponse.class),
@ApiResponse(
code = 404,
message = "Not Found. \n No device is found under the provided type and id.",
response = ErrorResponse.class),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while retrieving information requested device.",
response = ErrorResponse.class)
})
Response deleteDevice(
@ApiParam(
name = "device-type",
value = "The device type, such as ios, android or windows.",
required = true)
@PathParam("device-type")
@Size(max = 45)
String deviceType,
@ApiParam(
name = "device-id",
value = "The device identifier of the device.",
required = true)
@PathParam("device-id")
@Size(max = 45)
String deviceId);
}

@ -521,7 +521,7 @@ public class DeviceAgentServiceImpl implements DeviceAgentService {
@Override
@PUT
@Path("/operations/{type}/{id}")
@Path("/properties/{type}/{id}")
public Response updateDeviceProperties(@PathParam("type") String type, @PathParam("id") String deviceId,
@Valid List<Device.Property> properties) {
try {
@ -542,13 +542,16 @@ public class DeviceAgentServiceImpl implements DeviceAgentService {
return Response.status(Response.Status.BAD_REQUEST).entity(msg).build();
}
DeviceMgtAPIUtils.getDeviceManagementService().updateProperties(deviceIdentifier, properties);
if (DeviceMgtAPIUtils.getDeviceManagementService().updateProperties(deviceIdentifier, properties)){
return Response.status(Response.Status.ACCEPTED).entity("Device properties updated.").build();
} else {
return Response.status(Response.Status.NOT_ACCEPTABLE).entity("Device properties not updated.").build();
}
} catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance";
log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
}
return null;
}
@GET

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save