diff --git a/README.md b/README.md
index e07bdc3705..7b2b7e1b8c 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,8 @@
# carbon-device-mgt
-
+
+ - Java7
+ - Java8
WSO2 CONNECTED DEVICE MANAGEMENT COMPONENTS
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml
index 383f52c040..495ffbee35 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml
@@ -22,13 +22,13 @@
apimgt-extensionsorg.wso2.carbon.devicemgt
- 2.0.45-SNAPSHOT
+ 2.0.63-SNAPSHOT../pom.xml4.0.0org.wso2.carbon.apimgt.annotations
- 2.0.45-SNAPSHOT
+ 2.0.63-SNAPSHOTbundleWSO2 Carbon - API Management AnnotationsWSO2 Carbon - API Management Custom Annotation Module
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml
index 42028ef9f5..a84f27c301 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml
@@ -21,12 +21,12 @@
apimgt-extensionsorg.wso2.carbon.devicemgt
- 2.0.45-SNAPSHOT
+ 2.0.63-SNAPSHOT../pom.xml4.0.0
- 2.0.45-SNAPSHOT
+ 2.0.63-SNAPSHOTorg.wso2.carbon.apimgt.application.extension.apiwarWSO2 Carbon - API Application Management API
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/filter/ApiPermissionFilter.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/filter/ApiPermissionFilter.java
index 1f043c7b86..0c78488a2d 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/filter/ApiPermissionFilter.java
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/java/org/wso2/carbon/apimgt/application/extension/api/filter/ApiPermissionFilter.java
@@ -47,6 +47,7 @@ public class ApiPermissionFilter implements Filter {
private static final String PERMISSION_PREFIX = "/permission/admin";
private static List permissions;
private static final String WEBAPP_CONTEXT = "/api-application-registration";
+ private static final String DEFAULT_ADMIN_ROLE = "admin";
@Override
public void init(FilterConfig filterConfig) throws ServletException {
InputStream permissionStream = filterConfig.getServletContext().getResourceAsStream(PERMISSION_CONFIG_PATH);
@@ -122,7 +123,17 @@ public class ApiPermissionFilter implements Filter {
UserRealm userRealm = APIUtil.getRealmService().getTenantUserRealm(PrivilegedCarbonContext
.getThreadLocalCarbonContext().getTenantId());
String tenantAwareUsername = MultitenantUtils.getTenantAwareUsername(username);
- return userRealm.getAuthorizationManager().isUserAuthorized(tenantAwareUsername, permission, action);
+ boolean status = userRealm.getAuthorizationManager()
+ .isUserAuthorized(tenantAwareUsername, permission, action);
+ if (!status) {
+ String[] roles = userRealm.getUserStoreManager().getRoleListOfUser(tenantAwareUsername);
+ for (String role : roles) {
+ if (role.equals(DEFAULT_ADMIN_ROLE)) {
+ return true;
+ }
+ }
+ }
+ return status;
} catch (UserStoreException e) {
String errorMsg = String.format("Unable to authorize the user : %s", username);
log.error(errorMsg, e);
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/webapp/WEB-INF/web.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/webapp/WEB-INF/web.xml
index 3a900cd914..823bf51d73 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/webapp/WEB-INF/web.xml
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/src/main/webapp/WEB-INF/web.xml
@@ -59,6 +59,43 @@
ApiPermissionFilterorg.wso2.carbon.apimgt.application.extension.api.filter.ApiPermissionFilter
+
+
+ HttpHeaderSecurityFilter
+ org.apache.catalina.filters.HttpHeaderSecurityFilter
+
+ hstsEnabled
+ false
+
+
+
+
+ ContentTypeBasedCachePreventionFilter
+ org.wso2.carbon.ui.filters.cache.ContentTypeBasedCachePreventionFilter
+
+ patterns
+ text/html" ,application/json" ,text/plain
+
+
+ filterAction
+ enforce
+
+
+ httpHeaders
+ Cache-Control: no-store, no-cache, must-revalidate, private
+
+
+
+
+ HttpHeaderSecurityFilter
+ /*
+
+
+
+ ContentTypeBasedCachePreventionFilter
+ /*
+
+
ApiPermissionFilter/*
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml
index 0d0f89a335..5f115d7a1d 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml
@@ -22,12 +22,12 @@
apimgt-extensionsorg.wso2.carbon.devicemgt
- 2.0.45-SNAPSHOT
+ 2.0.63-SNAPSHOT../pom.xml4.0.0
- 2.0.45-SNAPSHOT
+ 2.0.63-SNAPSHOTorg.wso2.carbon.apimgt.application.extensionbundleWSO2 Carbon - API Application Management
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java
index 8cad8b016f..611679e512 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderService.java
@@ -26,6 +26,12 @@ import org.wso2.carbon.apimgt.application.extension.exception.APIManagerExceptio
*/
public interface APIManagementProviderService {
+ /**
+ * Check whether the tier is loaded for the tenant.
+ * @return
+ */
+ boolean isTierLoaded();
+
/**
* Generate and retreive application keys. if the application does exist then
* create it and subscribe to apis that are grouped with the tags.
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java
index b97146a02d..bc92961f64 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java
@@ -45,8 +45,22 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
private static final String CONTENT_TYPE = "application/json";
private static final int MAX_API_PER_TAG = 200;
private static final String APP_TIER_TYPE = "application";
- private static final Map tiersMap = new HashMap<>();
- private static final int MAX_ATTEMPTS = 20;
+
+ public boolean isTierLoaded() {
+ StoreClient storeClient = APIApplicationManagerExtensionDataHolder.getInstance().getIntegrationClientService()
+ .getStoreClient();
+ String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext()
+ .getTenantDomain();
+ try {
+
+ storeClient.getIndividualTier().tiersTierLevelTierNameGet(ApiApplicationConstants.DEFAULT_TIER,
+ APP_TIER_TYPE,
+ tenantDomain, CONTENT_TYPE, null, null);
+ return true;
+ } catch (FeignException e) {
+ return false;
+ }
+ }
@Override
public void removeAPIApplication(String applicationName, String username) throws APIManagerException {
@@ -72,31 +86,8 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
throws APIManagerException {
StoreClient storeClient = APIApplicationManagerExtensionDataHolder.getInstance().getIntegrationClientService()
.getStoreClient();
- //This is a fix to avoid race condition and trying to load tenant related tiers before invocation.
String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext()
.getTenantDomain();
- String tiersLoadedForTenant = tiersMap.get(tenantDomain);
-
- if (tiersLoadedForTenant == null) {
- boolean tierLoaded = false;
- int attempts = 0;
- do {
- try {
- storeClient.getIndividualTier()
- .tiersTierLevelTierNameGet(ApiApplicationConstants.DEFAULT_TIER, APP_TIER_TYPE,
- tenantDomain, CONTENT_TYPE, null, null);
- tiersMap.put(tenantDomain, "exist");
- tierLoaded = true;
- } catch (FeignException e) {
- attempts++;
- try {
- Thread.sleep(500);
- } catch (InterruptedException ex) {
- log.warn("Interrupted the waiting for tier availability.");
- }
- }
- } while ((!tierLoaded) && attempts < MAX_ATTEMPTS);
- }
ApplicationList applicationList = storeClient.getApplications()
.applicationsGet("", applicationName, 1, 0, CONTENT_TYPE, null);
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml
index f3b7a65b96..969a408d19 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml
@@ -21,13 +21,13 @@
apimgt-extensionsorg.wso2.carbon.devicemgt
- 2.0.45-SNAPSHOT
+ 2.0.63-SNAPSHOT../pom.xml4.0.0org.wso2.carbon.apimgt.handlers
- 2.0.45-SNAPSHOT
+ 2.0.63-SNAPSHOTbundleWSO2 Carbon - API Security Handler ComponentWSO2 Carbon - API Management Security Handler Module
@@ -76,6 +76,7 @@
WSO2 Carbon - API Security Handler Component
org.apache.axiom.*,
+ javax.security.cert.*,
javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional,
javax.xml.*,
org.apache.axis2.*,
@@ -90,7 +91,8 @@
org.w3c.dom,
org.apache.synapse,
org.apache.synapse.core.axis2,
- org.apache.synapse.rest
+ org.apache.synapse.rest,
+ org.wso2.carbon.certificate.mgt.core.impl
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandler.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandler.java
index c5fe71dd4a..2891e06179 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandler.java
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandler.java
@@ -31,11 +31,17 @@ import org.wso2.carbon.apimgt.handlers.invoker.RESTInvoker;
import org.wso2.carbon.apimgt.handlers.invoker.RESTResponse;
import org.wso2.carbon.apimgt.handlers.utils.AuthConstants;
import org.wso2.carbon.apimgt.handlers.utils.Utils;
+import org.wso2.carbon.certificate.mgt.core.impl.CertificateGenerator;
import org.wso2.carbon.context.PrivilegedCarbonContext;
+import javax.security.cert.CertificateEncodingException;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
@@ -140,6 +146,21 @@ public class AuthenticationHandler extends AbstractHandler {
if (log.isDebugEnabled()) {
log.debug("Verify response:" + response.getContent());
}
+ } else if (headers.containsKey(AuthConstants.MUTUAL_AUTH_HEADER)) {
+ javax.security.cert.X509Certificate[] certs =
+ (javax.security.cert.X509Certificate[]) axisMC.getProperty(AuthConstants.CLIENT_CERTIFICATE);
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+ ByteArrayInputStream bais = new ByteArrayInputStream(certs[0].getEncoded());
+ X509Certificate x509 = (X509Certificate) cf.generateCertificate(bais);
+ if (bais != null) {
+ bais.close();
+ }
+ if (x509 != null) {
+ headers.put(AuthConstants.PROXY_MUTUAL_AUTH_HEADER, CertificateGenerator.getCommonName(x509));
+ return true;
+ } else {
+ response = null;
+ }
} else if (headers.containsKey(AuthConstants.ENCODED_PEM)) {
String encodedPem = headers.get(AuthConstants.ENCODED_PEM).toString();
if (log.isDebugEnabled()) {
@@ -178,8 +199,13 @@ public class AuthenticationHandler extends AbstractHandler {
} catch (APIMCertificateMGTException e) {
log.error("Error while processing certificate.", e);
return false;
+ } catch (CertificateException e) {
+ log.error("Certificate issue occurred when generating converting PEM to x509Certificate", e);
+ return false;
+ } catch (CertificateEncodingException e) {
+ log.error("Error while attempting to encode certificate.", e);
+ return false;
}
-
}
@Override
@@ -205,4 +231,4 @@ public class AuthenticationHandler extends AbstractHandler {
map.put(CONTENT_TYPE, "application/json");
return map;
}
-}
+}
\ No newline at end of file
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/beans/DCR.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/beans/DCR.java
index 4091afcb9e..ae5e42b59a 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/beans/DCR.java
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/beans/DCR.java
@@ -24,14 +24,12 @@ package org.wso2.carbon.apimgt.handlers.beans;
*/
public class DCR {
- // Owner of the application
+ private String callbackUrl;
private String owner;
- // Client name
private String clientName;
- // Oauth Grant type
private String grantType;
- // Scope of the token
private String tokenScope;
+ private boolean isSaasApp;
public String getOwner() {
return owner;
@@ -64,5 +62,27 @@ public class DCR {
public void setTokenScope(String tokenScope) {
this.tokenScope = tokenScope;
}
+
+ public boolean getIsSaasApp() {
+ return isSaasApp;
+ }
+
+ public void setIsSaasApp(boolean isSaasApp) {
+ this.isSaasApp = isSaasApp;
+ }
+
+ public String getCallbackUrl() {
+ return callbackUrl;
+ }
+
+ public void setCallbackUrl(String callbackUrl) {
+ this.callbackUrl = callbackUrl;
+ }
+
+ public String toJSON() {
+ return "{\"callbackUrl\": \"" + callbackUrl + "\",\"clientName\": \"" + clientName + "\", \"tokenScope\": " +
+ "\"" + tokenScope + "\", \"owner\": \"" + owner + "\"," + "\"grantType\": \"" + grantType +
+ "\", \"saasApp\" :" + isSaasApp + " }\n";
+ }
}
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/AuthConstants.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/AuthConstants.java
index 531c7c11d5..74870c131f 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/AuthConstants.java
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/AuthConstants.java
@@ -35,5 +35,17 @@ public class AuthConstants {
// public static final String ANDROID_VERIFY_ENDPOINT = "android-verify-endpoint";
public static final String MDM_SIGNATURE = "mdm-signature";
public static final String PROXY_MUTUAL_AUTH_HEADER = "proxy-mutual-auth-header";
+ public static final String MUTUAL_AUTH_HEADER = "mutual-auth-header";
public static final String ENCODED_PEM = "encoded-pem";
+ public static final String CALLBACK_URL = "";
+ public static final String CLIENT_NAME = "IOT-API-MANAGER";
+ public static final String GRANT_TYPE = "refresh_token password client_credentials";
+ public static final String TOKEN_SCOPE = "default";
+ public static final String CONTENT_TYPE_HEADER = "Content-Type";
+ public static final String CONTENT_TYPE = "application/json";
+ public static final String AUTHORIZATION_HEADER = "Authorization";
+ public static final String BASIC_AUTH_PREFIX = "Basic ";
+ public static final String CLIENT_ID = "clientId";
+ public static final String CLIENT_SECRET = "clientSecret";
+ public static final String CLIENT_CERTIFICATE = "ssl.client.auth.cert.X509";
}
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/Utils.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/Utils.java
index 3e66ed7edd..d3c8ad3a9f 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/Utils.java
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/Utils.java
@@ -19,7 +19,6 @@
package org.wso2.carbon.apimgt.handlers.utils;
-import com.google.gson.Gson;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ws.security.util.Base64;
@@ -118,8 +117,7 @@ public class Utils {
tokenHeaders.put("Content-Type", "application/x-www-form-urlencoded");
RESTInvoker restInvoker = new RESTInvoker();
- RESTResponse response = restInvoker.invokePOST(tokenUrl, tokenHeaders, null,
- null, tokenContent);
+ RESTResponse response = restInvoker.invokePOST(tokenUrl, tokenHeaders, null, null, tokenContent);
if(log.isDebugEnabled()) {
log.debug("Token response:" + response.getContent());
}
@@ -144,31 +142,32 @@ public class Utils {
private static void getClientSecretes(IOTServerConfiguration iotServerConfiguration)
throws APIMCertificateMGTException {
try {
+ String username = iotServerConfiguration.getUsername();
+ String password = iotServerConfiguration.getPassword();
DCR dcr = new DCR();
dcr.setOwner(iotServerConfiguration.getUsername());
- dcr.setClientName("IOT-API-MANAGER");
- dcr.setGrantType("refresh_token password client_credentials");
- dcr.setTokenScope("default");
- Gson gson = new Gson();
- String dcrContent = gson.toJson(dcr);
- Map drcHeaders = new HashMap();
- drcHeaders.put("Content-Type", "application/json");
+ dcr.setClientName(AuthConstants.CLIENT_NAME);
+ dcr.setGrantType(AuthConstants.GRANT_TYPE);
+ dcr.setTokenScope(AuthConstants.TOKEN_SCOPE);
+ dcr.setCallbackUrl(AuthConstants.CALLBACK_URL);
+ dcr.setIsSaasApp(true);
+ String dcrContent = dcr.toJSON();
+ Map dcrHeaders = new HashMap();
+ String basicAuth = Base64.encode((username + ":" + password).getBytes());
+ dcrHeaders.put(AuthConstants.CONTENT_TYPE_HEADER, AuthConstants.CONTENT_TYPE);
+ dcrHeaders.put(AuthConstants.AUTHORIZATION_HEADER, AuthConstants.BASIC_AUTH_PREFIX + basicAuth);
URI dcrUrl = new URI(iotServerConfiguration.getDynamicClientRegistrationEndpoint());
RESTInvoker restInvoker = new RESTInvoker();
- RESTResponse response = restInvoker.invokePOST(dcrUrl, drcHeaders, null,
- null, dcrContent);
-
+ RESTResponse response = restInvoker.invokePOST(dcrUrl, dcrHeaders, null, null, dcrContent);
if (log.isDebugEnabled()) {
log.debug("DCR response :" + response.getContent());
}
JSONObject jsonResponse = new JSONObject(response.getContent());
- clientId = jsonResponse.getString("client_id");
- clientSecret = jsonResponse.getString("client_secret");
+ clientId = jsonResponse.getString(AuthConstants.CLIENT_ID);
+ clientSecret = jsonResponse.getString(AuthConstants.CLIENT_SECRET);
} catch (JSONException e) {
throw new APIMCertificateMGTException("Error occurred while converting the json to object", e);
- } catch (IOException e) {
- throw new APIMCertificateMGTException("Error occurred while trying to call DCR endpoint", e);
- } catch (URISyntaxException e) {
+ } catch (IOException | URISyntaxException e) {
throw new APIMCertificateMGTException("Error occurred while trying to call DCR endpoint", e);
}
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml
index b2d292e654..e90752fba8 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml
@@ -13,13 +13,13 @@
apimgt-extensionsorg.wso2.carbon.devicemgt
- 2.0.45-SNAPSHOT
+ 2.0.63-SNAPSHOT../pom.xml4.0.0org.wso2.carbon.apimgt.integration.client
- 2.0.45-SNAPSHOT
+ 2.0.63-SNAPSHOTbundleWSO2 Carbon - API Management Integration ClientWSO2 Carbon - API Management Integration Client
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/StoreClient.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/StoreClient.java
index 9c12b0cdaa..19633fa009 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/StoreClient.java
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/store/StoreClient.java
@@ -19,7 +19,9 @@ package org.wso2.carbon.apimgt.integration.client.store;
import feign.Feign;
import feign.Logger;
+import feign.Request;
import feign.RequestInterceptor;
+import feign.Retryer;
import feign.gson.GsonDecoder;
import feign.gson.GsonEncoder;
import feign.slf4j.Slf4jLogger;
@@ -28,6 +30,8 @@ import org.wso2.carbon.apimgt.integration.client.configs.APIMConfigReader;
import org.wso2.carbon.apimgt.integration.generated.client.store.api.*;
import org.wso2.carbon.core.util.Utils;
+import java.util.concurrent.TimeUnit;
+
/**
* API Store client, created using swagger gen.
*/
@@ -62,8 +66,10 @@ public class StoreClient {
individualSubscription = builder.target(SubscriptionIndividualApi.class, basePath);
subscriptionMultitpleApi = builder.target(SubscriptionMultitpleApi.class, basePath);
tags = builder.target(TagCollectionApi.class, basePath);
- tiers = builder.target(ThrottlingTierCollectionApi.class, basePath);
individualTier = builder.target(ThrottlingTierIndividualApi.class, basePath);
+ tiers = builder.retryer(new Retryer.Default(100L, TimeUnit.SECONDS.toMillis(1L), 1))
+ .options(new Request.Options(10000, 5000))
+ .target(ThrottlingTierCollectionApi.class, basePath);
}
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml
index 6ba32f2671..6b85588bb4 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml
@@ -13,13 +13,13 @@
apimgt-extensionsorg.wso2.carbon.devicemgt
- 2.0.45-SNAPSHOT
+ 2.0.63-SNAPSHOT../pom.xml4.0.0org.wso2.carbon.apimgt.integration.generated.client
- 2.0.45-SNAPSHOT
+ 2.0.63-SNAPSHOTbundleWSO2 Carbon - API Management Integration Generated ClientWSO2 Carbon - API Management Integration Client
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml
index 408c29e00d..7b1f639ddc 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml
@@ -22,13 +22,13 @@
apimgt-extensionsorg.wso2.carbon.devicemgt
- 2.0.45-SNAPSHOT
+ 2.0.63-SNAPSHOT../pom.xml4.0.0org.wso2.carbon.apimgt.webapp.publisher
- 2.0.45-SNAPSHOT
+ 2.0.63-SNAPSHOTbundleWSO2 Carbon - API Management Webapp PublisherWSO2 Carbon - API Management Webapp Publisher
diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml
index 9ba0dc3827..b57f64e0db 100644
--- a/components/apimgt-extensions/pom.xml
+++ b/components/apimgt-extensions/pom.xml
@@ -22,13 +22,13 @@
org.wso2.carbon.devicemgtcarbon-devicemgt
- 2.0.45-SNAPSHOT
+ 2.0.63-SNAPSHOT../../pom.xml4.0.0apimgt-extensions
- 2.0.45-SNAPSHOT
+ 2.0.63-SNAPSHOTpomWSO2 Carbon - API Management Extensions Componenthttp://wso2.org
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/pom.xml
similarity index 98%
rename from components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/pom.xml
rename to components/application-mgt/org.wso2.carbon.device.application.mgt.api/pom.xml
index ab6f88a5e3..40747d1341 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/pom.xml
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/pom.xml
@@ -22,12 +22,13 @@
application-mgtorg.wso2.carbon.devicemgt
- 2.0.45-SNAPSHOT
+ 2.0.63-SNAPSHOT../pom.xml4.0.0org.wso2.carbon.device.application.mgt.api
+ 2.0.63-SNAPSHOTwarWSO2 Carbon - Mobile Application Management APIWSO2 Carbon - Mobile Application Management API
@@ -46,7 +47,7 @@
maven-war-pluginWEB-INF/lib/*cxf*.jar
- api#application-mgt#v2.0
+ api#application-mgt#v1.0
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/beans/ErrorListItem.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/beans/ErrorListItem.java
similarity index 97%
rename from components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/beans/ErrorListItem.java
rename to components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/beans/ErrorListItem.java
index b120f18156..e69f62c2ca 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/beans/ErrorListItem.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/beans/ErrorListItem.java
@@ -16,7 +16,7 @@
* under the License.
*
*/
-package org.wso2.carbon.device.application.mgt.api.v2.beans;
+package org.wso2.carbon.device.application.mgt.api.beans;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/beans/ErrorResponse.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/beans/ErrorResponse.java
similarity index 98%
rename from components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/beans/ErrorResponse.java
rename to components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/beans/ErrorResponse.java
index 253c848e02..0b648b52c6 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/beans/ErrorResponse.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/beans/ErrorResponse.java
@@ -16,7 +16,7 @@
* under the License.
*
*/
-package org.wso2.carbon.device.application.mgt.api.v2.beans;
+package org.wso2.carbon.device.application.mgt.api.beans;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/common/ErrorHandler.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/ErrorHandler.java
similarity index 95%
rename from components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/common/ErrorHandler.java
rename to components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/ErrorHandler.java
index 9564d90f09..0b921d5ec1 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/common/ErrorHandler.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/ErrorHandler.java
@@ -16,7 +16,7 @@
* under the License.
*/
-package org.wso2.carbon.device.application.mgt.api.v2.common;
+package org.wso2.carbon.device.application.mgt.api.common;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/common/ErrorMessage.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/ErrorMessage.java
similarity index 94%
rename from components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/common/ErrorMessage.java
rename to components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/ErrorMessage.java
index 42cfb1f4d2..1856305ab6 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/common/ErrorMessage.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/ErrorMessage.java
@@ -16,7 +16,7 @@
* under the License.
*/
-package org.wso2.carbon.device.application.mgt.api.v2.common;
+package org.wso2.carbon.device.application.mgt.api.common;
public class ErrorMessage {
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/common/GsonMessageBodyHandler.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/GsonMessageBodyHandler.java
similarity index 98%
rename from components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/common/GsonMessageBodyHandler.java
rename to components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/GsonMessageBodyHandler.java
index ef8c4a8c70..8789e25a3d 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/common/GsonMessageBodyHandler.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/GsonMessageBodyHandler.java
@@ -16,7 +16,7 @@
* under the License.
*/
-package org.wso2.carbon.device.application.mgt.api.v2.common;
+package org.wso2.carbon.device.application.mgt.api.common;
import com.google.gson.Gson;
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/common/MDMAPIException.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/MDMAPIException.java
similarity index 95%
rename from components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/common/MDMAPIException.java
rename to components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/MDMAPIException.java
index def0093863..4637c6f3ec 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/common/MDMAPIException.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/MDMAPIException.java
@@ -16,7 +16,7 @@
* under the License.
*/
-package org.wso2.carbon.device.application.mgt.api.v2.common;
+package org.wso2.carbon.device.application.mgt.api.common;
/**
* Custom exception class for handling CDM API related exceptions.
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/apis/ApplicationManagementAPI.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/ApplicationManagementService.java
similarity index 92%
rename from components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/apis/ApplicationManagementAPI.java
rename to components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/ApplicationManagementService.java
index 7087d9da36..54af6d1cfe 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/apis/ApplicationManagementAPI.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/ApplicationManagementService.java
@@ -16,11 +16,11 @@
* under the License.
*
*/
-package org.wso2.carbon.device.application.mgt.api.v2.apis;
+package org.wso2.carbon.device.application.mgt.api.services;
import io.swagger.annotations.*;
-import org.wso2.carbon.device.application.mgt.api.v2.beans.ErrorResponse;
-import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList;
+import org.wso2.carbon.device.application.mgt.api.beans.ErrorResponse;
+import org.wso2.carbon.device.application.mgt.core.dto.ApplicationList;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
@@ -30,7 +30,7 @@ import javax.ws.rs.core.Response;
"such as get all the available devices, etc.")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
-public interface ApplicationManagementAPI {
+public interface ApplicationManagementService {
public final static String SCOPE = "scope";
@@ -90,4 +90,5 @@ public interface ApplicationManagementAPI {
);
+
}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/apis/impl/ApplicationManagementAPIImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementServiceImpl.java
similarity index 94%
rename from components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/apis/impl/ApplicationManagementAPIImpl.java
rename to components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementServiceImpl.java
index 49f8de3f8a..bf86b93a48 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/java/org/wso2/carbon/device/application/mgt/api/v2/apis/impl/ApplicationManagementAPIImpl.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementServiceImpl.java
@@ -16,25 +16,25 @@
* under the License.
*
*/
-package org.wso2.carbon.device.application.mgt.api.v2.apis.impl;
+package org.wso2.carbon.device.application.mgt.api.services.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList;
import org.wso2.carbon.device.application.mgt.core.dto.Filter;
-import org.wso2.carbon.device.application.mgt.core.services.ApplicationManager;
+import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList;
import org.wso2.carbon.device.application.mgt.core.util.ApplicationManagementUtil;
+import org.wso2.carbon.device.application.mgt.core.services.ApplicationManager;
import javax.ws.rs.*;
import javax.ws.rs.core.Response;
@Produces({ "application/json"})
@Consumes({ "application/json"})
-public class ApplicationManagementAPIImpl {
+public class ApplicationManagementServiceImpl {
public static final int DEFAULT_LIMIT = 20;
- private static Log log = LogFactory.getLog(ApplicationManagementAPIImpl.class);
+ private static Log log = LogFactory.getLog(ApplicationManagementServiceImpl.class);
@GET
@@ -43,7 +43,6 @@ public class ApplicationManagementAPIImpl {
public Response getApplications(@QueryParam("offset") int offset, @QueryParam("limit") int limit,
@QueryParam("q") String searchQuery) {
ApplicationManager applicationManager = ApplicationManagementUtil.getApplicationManagementService();
-
try {
if(limit == 0){
@@ -57,7 +56,6 @@ public class ApplicationManagementAPIImpl {
ApplicationList applications = applicationManager.getApplications(filter);
return Response.status(Response.Status.OK).entity(applications).build();
-
} catch (Exception e) {
String msg = "Error occurred while getting the application list";
log.error(msg, e);
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/webapp/META-INF/permissions.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/META-INF/permissions.xml
similarity index 100%
rename from components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/webapp/META-INF/permissions.xml
rename to components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/META-INF/permissions.xml
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/webapp/META-INF/webapp-classloading.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml
similarity index 100%
rename from components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/webapp/META-INF/webapp-classloading.xml
rename to components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml
similarity index 85%
rename from components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/webapp/WEB-INF/cxf-servlet.xml
rename to components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml
index 8cb974f518..65b5a921e7 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/webapp/WEB-INF/cxf-servlet.xml
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml
@@ -16,7 +16,7 @@ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
-
-
+
+
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/webapp/WEB-INF/web.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml
similarity index 100%
rename from components/application-mgt/org.wso2.carbon.device.application.mgt.api.v2/src/main/webapp/WEB-INF/web.xml
rename to components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml
index 5a7933cd2d..46a9c6e7dc 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml
@@ -21,13 +21,13 @@
org.wso2.carbon.devicemgtapplication-mgt
- 2.0.45-SNAPSHOT
+ 2.0.63-SNAPSHOT../pom.xml4.0.0org.wso2.carbon.device.application.mgt.core
- 2.0.45-SNAPSHOT
+ 2.0.63-SNAPSHOTbundleWSO2 Carbon - Application Management CoreWSO2 Carbon - Application Management Core
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/ApplicationList.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/ApplicationList.java
new file mode 100644
index 0000000000..c089cbb388
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/ApplicationList.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.wso2.carbon.device.application.mgt.core.dto;
+
+import java.util.List;
+
+public class ApplicationList {
+
+ private List applications;
+
+ private Pagination pagination;
+
+ public List getApplications() {
+ return applications;
+ }
+
+ public void setApplications(List applications) {
+ this.applications = applications;
+ }
+
+ public Pagination getPagination() {
+ return pagination;
+ }
+
+ public void setPagination(Pagination pagination) {
+ this.pagination = pagination;
+ }
+}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/ApplicationType.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/ApplicationType.java
new file mode 100644
index 0000000000..c6a9bb25ee
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dto/ApplicationType.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.wso2.carbon.device.application.mgt.core.dto;
+
+import org.wso2.carbon.device.application.mgt.core.jaxrs.Exclude;
+
+public class ApplicationType {
+
+ @Exclude
+ private int id;
+
+ private String name;
+
+ private String code;
+
+ private String parameters;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(String parameters) {
+ this.parameters = parameters;
+ }
+}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/log4j.properties b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/log4j.properties
new file mode 100644
index 0000000000..e415fd607d
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/log4j.properties
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 2016, 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.
+#
+
+#
+# This is the log4j configuration file used by WSO2 Carbon
+#
+# IMPORTANT : Please do not remove or change the names of any
+# of the Appender defined here. The layout pattern & log file
+# can be changed using the WSO2 Carbon Management Console, and those
+# settings will override the settings in this file.
+#
+
+log4j.rootLogger=DEBUG, STD_OUT
+
+# Redirect log messages to console
+log4j.appender.STD_OUT=org.apache.log4j.ConsoleAppender
+log4j.appender.STD_OUT.Target=System.out
+log4j.appender.STD_OUT.layout=org.apache.log4j.PatternLayout
+log4j.appender.STD_OUT.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/testng.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/testng.xml
new file mode 100644
index 0000000000..0af96a3777
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/testng.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/pom.xml
new file mode 100644
index 0000000000..f3401922bf
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/pom.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+ application-mgt
+ org.wso2.carbon.devicemgt
+ 2.0.63-SNAPSHOT
+ ../pom.xml
+
+
+ 4.0.0
+ org.wso2.carbon.device.application.mgt.ui
+ pom
+ 2.0.63-SNAPSHOT
+ WSO2 Carbon - Application Management Base UI
+ WSO2 Carbon - Application Management Base UI
+ http://wso2.org
+
+
+
+
+ maven-assembly-plugin
+ 2.5.5
+
+ ${project.artifactId}-${carbon.device.mgt.version}
+ false
+
+ src/assembly/src.xml
+
+
+
+
+ create-archive
+ package
+
+ single
+
+
+
+
+
+
+
+
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/assembly/src.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/assembly/src.xml
new file mode 100644
index 0000000000..86251cba50
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/assembly/src.xml
@@ -0,0 +1,48 @@
+
+
+
+ src
+
+ zip
+
+ false
+ ${basedir}/src
+
+
+
+ ${basedir}/src/main/resources/jaggeryapps/application-mgt
+ /jaggeryapps/application-mgt/
+ true
+
+
+
+ ${basedir}/src/main/resources/jaggeryapps/uuf-template-app
+ /jaggeryapps/appmgt-uuf-template-app/
+ true
+
+
+ ${basedir}/src/main/resources/jaggery-modules
+ /jaggery-modules/
+ true
+
+
+
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/module.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/module.xml
new file mode 100644
index 0000000000..485112332c
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/module.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/exception/exception.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/exception/exception.js
new file mode 100644
index 0000000000..a80361dec0
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/exception/exception.js
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) WSO2 Inc. (http://wso2.com) All Rights Reserved.
+ *
+ * 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.
+ */
+
+/**
+ * Description: The response of the currently invoked api enpoint is organized
+ */
+
+var exception = {};
+var log = new Log('exception_module');
+
+(function(exception) {
+ /**
+ *
+ * @param message The exception description
+ * @param code HTTP STATUS CODE related to the exception
+ * @return The error object
+ */
+ exception.buildExceptionObject = function(message, code) {
+ var error = {};
+ error.message = message;
+ error.code = code;
+ return error;
+ };
+
+ exception.handleError = function (exception, type, code){
+ var constants = require('rxt').constants;
+
+ if (type == constants.THROW_EXCEPTION_TO_CLIENT) {
+ log.debug(exception);
+ var e = exceptionModule.buildExceptionObject(exception, code);
+ throw e;
+ } else if (type == constants.LOG_AND_THROW_EXCEPTION) {
+ log.error(exception);
+ throw exception;
+ } else if (type == constants.LOG_EXCEPTION_AND_TERMINATE) {
+ log.error(exception);
+ var msg = 'An error occurred while serving the request!';
+ var e = exceptionModule.buildExceptionObject(msg, constants.STATUS_CODES.INTERNAL_SERVER_ERROR);
+ throw e;
+ } else if (type == constants.LOG_EXCEPTION_AND_CONTINUE) {
+ log.debug(exception);
+ }
+ else {
+ log.error(exception);
+ throw e;
+ }
+ };
+}(exception))
+
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/file/file.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/file/file.js
new file mode 100644
index 0000000000..f3aa6578f5
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/file/file.js
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2005-2014, 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.
+ *
+ */
+var file = {};
+(function() {
+ var log = new Log('utils-file');
+ var CONTENT_MAP = {
+ 'js': 'application/javascript',
+ 'css': 'text/css',
+ 'csv': 'text/csv',
+ 'html': 'text/html',
+ 'json': 'application/json',
+ 'png': 'image/png',
+ 'jpeg': 'image/jpeg',
+ 'gif': 'image/gif',
+ 'svg': 'image/svg+xml',
+ 'ttf': 'application/x-font-ttf',
+ 'eot': 'application/vnd.ms-fontobject',
+ 'woff': 'application/font-woff',
+ 'otf': 'application/x-font-otf',
+ 'zip': 'application/zip',
+ 'xml': 'text/xml',
+ 'xhtml': 'application/xhtml+xml',
+ 'pdf': 'application/pdf'
+ };
+ /**
+ * The function checks whether a directory contains a particular file
+ * @param dir The directory in which the file must be checked
+ * @param file A File object if the file exists,else null
+ */
+ file.getFileInDir = function(dir, fileName) {
+ var isFilePresent = false;
+ var files = dir.listFiles();
+ for (var index in files) {
+ if (files[index].getName() == fileName) {
+ return files[index];
+ }
+ }
+ return null;
+ };
+ /**
+ * The function returns the file extension of a filename
+ * @param file
+ * @return: The extension of the file
+ */
+ file.getExtension = function(file) {
+ var baseFileName = file.getName();
+ //Break up the name by .
+ var baseNameComponents = baseFileName.split('.');
+ var extension = baseNameComponents[baseNameComponents.length - 1];
+ return extension;
+ };
+ /**
+ * The function obtains the MIME type based on the extension
+ * @param The extension
+ * @return The mime type
+ */
+ file.getMimeType = function(extension) {
+ return CONTENT_MAP[extension];
+ };
+ /**
+ * The function returns the name of the file without the file extension
+ * @param file A file object
+ * @return: The name of the file without the extension
+ */
+ file.getFileName = function(file) {
+ //Get the name of the file
+ var baseFileName = file.getName();
+ //Break up the name by .
+ var baseNameComponents = baseFileName.split('.');
+ //Get all of the components except the last one
+ baseNameComponents.splice(baseNameComponents.length - 1, 1);
+ return baseNameComponents.join('.');
+ };
+ /**
+ * The function returns the contents of a directory as a JSON object.The name of the
+ * file is used as the property names without the extensions.
+ * NOTE: The method will not traverse sub folders.
+ * @param The directory to be inspected
+ * @return A JSON object which contains the files in the directory
+ */
+ file.getDirectoryContents = function(dir) {
+ var dirContents = {};
+ //Check if it is a directory
+ if (!dir.isDirectory()) {
+ log.info('Not a directory');
+ return dirContents;
+ }
+ //Obtain a list of all files
+ var files = this.getAllFiles(dir);
+ var name;
+ log.info('Files: ' + files);
+ //Create the directory object with each file been a property
+ for (var index in files) {
+ dirContents[this.getFileName(files[index])] = files[index];
+ }
+ return dirContents;
+ };
+ /**
+ * The function obtains a list of files that are not directories
+ * @param dir The directory to be inspected
+ * @return An array with all of the files in the directory
+ */
+ file.getAllFiles = function(dir) {
+ var filesInDir = [];
+ if (!dir.isDirectory()) {
+ return filesInDir;
+ }
+ //Obtain a list of all files
+ var files = dir.listFiles();
+ for (var index in files) {
+ log.info('Checking file: ' + files[index].getName());
+ //Check if the file is a directory
+ if (!files[index].isDirectory()) {
+ filesInDir.push(files[index]);
+ }
+ }
+ return filesInDir;
+ };
+ /**
+ * The function returns a list of all file names in a directory
+ * @param dir The directory to be inspected
+ * @return {An array containing the name of all files in a directory
+ */
+ file.getAllFileNames = function(dir) {
+ var files = dir.listFiles();
+ var list = [];
+ var fileName;
+ for (var index in files) {
+ if (files[index].isDirectory()) {
+ fileName=this.getFileName(files[index].getName());
+ list.push(fileName);
+ }
+ }
+ return list;
+ };
+ /**
+ * The function returns a list of all sub directories in a given directory
+ * @param dir The root directory
+ * @return: An array containing all sub directories
+ */
+ file.getAllSubDirs = function(dir) {
+ var files = dir.listFiles();
+ var subDirs = [];
+ for (var index in files) {
+ if (files[index].isDirectory()) {
+ subDirs.push(files[index]);
+ }
+ }
+ return subDirs;
+ };
+}());
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/patterns/patterns.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/patterns/patterns.js
new file mode 100644
index 0000000000..f0e55bb254
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/patterns/patterns.js
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2005-2014, 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.
+ *
+ */
+var patterns = {};
+
+(function () {
+
+ var DEF_ERR_ARITY = 3;
+ var DEF_HANDLE_ARITY = 2;
+ var log = new Log('utils.patterns.GenericPipe');
+
+ function GenericPipe(options) {
+ this.errHandlerArity = DEF_ERR_ARITY || options.errArity;
+ this.handlerArity = DEF_HANDLE_ARITY || options.handlerArity;
+ this.plugins = [];
+ this.finalHandler = function () {
+ };
+ }
+
+
+ /**
+ *The function registers the provided plugin
+ */
+ GenericPipe.prototype.plug = function (plugin, options) {
+ var options = options || {};
+ //Only a function
+ if (plugin instanceof Function) {
+ this.plugins.push({
+ handle: plugin,
+ options: options
+ });
+ }
+ //Is it a plugin object
+ else if (plugin instanceof Object) {
+ plugin.options = options;
+ this.plugins.push(plugin);
+ }
+
+ return this;
+ };
+
+ GenericPipe.prototype.finally = function (plugin) {
+ this.finalHandler = plugin;
+ return this;
+ };
+
+ GenericPipe.prototype.resolve = function (data, req, res, session) {
+ var context = {};
+ context.req = req;
+ context.res = res;
+ context.session = session;
+ context.data = data;
+ handle(context, this.plugins, this.errHandlerArity, this.handlerArity, this.finalHandler);
+ };
+
+ var handle = function (context, plugins, errArity, handlerArity, finallyHandler) {
+ var index = 0;
+ var currentPlugin;
+
+ var recursiveHandle = function (err) {
+
+ currentPlugin = plugins[index];
+
+ index++;
+
+ //Check if there is a plugin
+ if (!currentPlugin) {
+ //log.warn('No plugin found at index: ' + index);
+ return;
+ }
+
+ //Populate the options object for the plugin
+ context.options=currentPlugin.options;;
+
+ //Check if an error has been provided
+ if (err) {
+ //Can the current plugin handle the err
+ if (currentPlugin.handle.length == errArity) {
+ try {
+ currentPlugin.handle(err, context,recursiveHandle);
+ }
+ catch (e) {
+ recursiveHandle(e);
+ }
+ }
+ else {
+ recursiveHandle(err);
+ }
+ }
+ //There is no error so try to invoke the current plugin
+ else {
+ if (currentPlugin.handle.length == handlerArity) {
+ try {
+
+
+ currentPlugin.handle(context,recursiveHandle);
+ } catch (e) {
+ recursiveHandle(e);
+ }
+ }
+ else {
+ recursiveHandle();
+ }
+ }
+ };
+
+ recursiveHandle();
+ finallyHandler(context);
+ };
+
+ patterns.GenericPipe = GenericPipe;
+
+}());
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/reflection/reflection.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/reflection/reflection.js
new file mode 100644
index 0000000000..77ff58d49e
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/reflection/reflection.js
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2005-2014, 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.
+ *
+ */
+var reflection = {};
+/**
+ * Description: The script encapsulates any reflection related utility functions
+ */
+(function() {
+ var log = new Log('utils-reflection');
+ reflection.copyPropKeys = function(from, to) {
+ for (var key in from) {
+ if (from.hasOwnProperty(key)) {
+ to[key] = '';
+ }
+ }
+ return to;
+ };
+ /**
+ * The function recursively copies all property keys in an object
+ * @param from
+ * @param to
+ */
+ reflection.copyAllPropKeys = function(from, to) {
+ recurse(from, to, function(from, to, key) {
+ if (from[key] instanceof Object) {
+ to[key] = from[key];
+ } else {
+ to[key] = null;
+ }
+ });
+ };
+ reflection.copyAllPropValues = function(from, to) {
+ recurse(from, to, function(from, to, key) {
+ //Create an instance if the property does not exist
+ if (!to[key]) {
+ to[key] = {};
+ }
+ //Copy the values over
+ if (!(from[key] instanceof Object)) {
+ to[key] = from[key];
+ } else {
+ log.debug('Not copying values of key: ' + key);
+ }
+ });
+ };
+ /**
+ * The function will only copy public properties
+ * @param from
+ * @param to
+ */
+ reflection.copyPublicPropValues = function(from, to) {
+ recurse(from, to, function(from, to, key) {
+ //Ignore any hidden properties
+ if (key.charAt(0) == '_') {
+ log.warn('Drop key: ' + key);
+ return;
+ }
+ //Create an instance if the property does not exist
+ if (!to[key]) {
+ to[key] = {};
+ }
+ //Copy the values over
+ if (!(from[key] instanceof Object)) {
+ to[key] = from[key];
+ } else {
+ log.warn('Not copying values of key: ' + key);
+ }
+ });
+ };
+ reflection.inspect = function(from, to, cb) {
+ recurse(from, to, cb);
+ };
+ /**
+ * The function recursively traverses an object and then invokes the provided
+ * callback
+ * @param root
+ * @param clone
+ * @param cb
+ */
+ var recurse = function(root, clone, cb) {
+ var key;
+ //Check if the root is an object
+ if (!(root instanceof Object)) {
+ return;
+ } else {
+ var keys = Object.keys(root);
+ //Go through all the other keys in the current root
+ for (var index in keys) {
+ key = keys[index];
+ cb(root, clone, key);
+ recurse(root[key], clone[key], cb);
+ }
+ }
+ };
+ reflection.copyProps = function(from, to) {
+ for (var key in from) {
+ if (from.hasOwnProperty(key)) {
+ to[key] = from[key];
+ }
+ }
+ return to;
+ };
+ reflection.getProps = function(obj) {
+ var props = {};
+ for (var key in obj) {
+ if (!(obj[key] instanceof Function)) {
+ props[key] = obj[key];
+ }
+ }
+ return props;
+ };
+ reflection.printProps = function(obj) {
+ for (var key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ log.info('key: ' + key);
+ }
+ }
+ };
+ /**
+ * The function determines if a property is hidden based on _
+ * @param key
+ * @returns {boolean}
+ */
+ reflection.isHiddenProp = function(key) {
+ if (key == '') {
+ return false;
+ }
+ return (key.charAt(0) == '_') ? true : false;
+ };
+ var getDiff = function(a, b, diff) {};
+ /**
+ * The function calculates the differences between two simple JSON objects
+ * @param a The object with which b is compared
+ * @param b The target of the comparison
+ * @return An object which records the differences between the two objects
+ */
+ reflection.diff = function(a, b) {};
+ /**
+ * The function merges the two provided objects to create a new
+ * object.In the case where b has the same property as a; the property of b
+ * will have precedence
+ * @param {[type]} a [description]
+ * @param {[type]} b [description]
+ * @return A new object having the properties of both object a and b
+ */
+ reflection.merge = function(a, b) {
+ var newObj = {};
+ //Copy the properties of a first
+ for (var key in a) {
+ newObj[key] = b[key];
+ }
+ //Override with the properties of b
+ for (var key in b) {
+ newObj[key] = b[key];
+ }
+ return newObj;
+ };
+ /**
+ * The function allows a child class to override a select set of methods of
+ * a parent class.The original methods of the parent can be accessed
+ * using the this._super keyword
+ * @param {[type]} parent The parent class instance to be overriden
+ * @param {[type]} child The child class instance containing methods which will override the parent
+ */
+ reflection.override = function(parent, child) {
+ //Make a clone of the parent
+ var super = parse(stringify(parent));
+ for (var childKey in child) {
+ for (var parentKey in parent) {
+ //Only override those methods that are common
+ if (childKey === parentKey) {
+ var parentPtr = parent[parentKey];
+ var childPtr = child[childKey];
+ //Update the clone with the old parent method
+ super[parentKey] = parentPtr;
+ parent[parentKey] = childPtr;
+ /*parent[parentKey] = function() {
+ var result=childPtr.apply(this, arguments)||null;
+ return result;
+ };*/
+ }
+ }
+ }
+ //Allow the child object to call methods of the parent
+ parent._super = super;
+ };
+ reflection.overrideAll=function(parent,child){
+ //Make a clone of the parent
+ var super = parse(stringify(parent));
+ for (var childKey in child) {
+ for (var parentKey in parent) {
+ //Only override those methods that are common
+ if ( (child.hasOwnProperty(childKey))&&(parent.hasOwnProperty(parentKey)) ) {
+ var parentPtr = parent[parentKey];
+ var childPtr = child[childKey];
+ //Update the clone with the old parent method
+ super[parentKey] = parentPtr;
+ parent[parentKey] = childPtr;
+ /*parent[parentKey] = function() {
+ var result=childPtr.apply(this, arguments)||null;
+ return result;
+ };*/
+ }
+ }
+ }
+ //Allow the child object to call methods of the parent
+ parent._super = super;
+ };
+ reflection.isArray = function(object) {
+ if (Object.prototype.toString.call(object) === '[object Array]') {
+ return true;
+ }
+ return false;
+ };
+}());
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/request/request.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/request/request.js
new file mode 100644
index 0000000000..4218da70fd
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/request/request.js
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2005-2014, 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.
+ *
+ */
+var request = {};
+(function(request) {
+ var hasOwnProperty = function(obj, element) {
+ return Object.prototype.hasOwnProperty.call(obj, element);
+ };
+ var isObject = function(object) {;
+ return typeof object === 'object';
+ };
+ /*
+ * ECMA Standard (ECMA-262 : 5.1 Edition)*/
+ var decodes = function(encodedURI) {
+ return decodeURIComponent(encodedURI);
+ };
+ request.getQueryOptions = function(queryString) {
+ var opt={};
+ var sep = opt.sep || '&',
+ assign = opt.assign || '=',
+ compoArray = [];
+ var obj = {};
+ var decodedURI = decodes(queryString);
+ decodedURI.split(sep).forEach(function(comp) {
+ comp.split(assign).some(function(element, index, array) {
+ if (hasOwnProperty(obj, element.toString())) {
+ compoArray.push(obj[element]);
+ compoArray.push(array[1]);
+ obj[element] = compoArray;
+ } else {
+ Object.defineProperty(obj, element, {
+ enumerable: true,
+ writable: true,
+ value: array[1]
+ });
+ }
+ return true;
+ });
+ });
+ return obj;
+ };
+}(request))
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/response/response.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/response/response.js
new file mode 100644
index 0000000000..a8dae44247
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/response/response.js
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) WSO2 Inc. (http://wso2.com) All Rights Reserved.
+ *
+ * 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.
+ */
+
+/**
+ * Description: The response of the currently invoked api endpoint is organized
+ */
+
+var response = {};
+var log = new Log("response");
+
+(function(response) {
+
+ /**
+ * Build Error response
+ * @param resp jaggery-response object to retrieve to client
+ * @param code status code
+ * @param message message to the client side
+ * @return return response
+ */
+ response.buildErrorResponse = function(resp,code,message) {
+ var content={};
+ content.error = message;
+ resp = processResponse(resp,code,content);
+ return resp;
+ };
+
+ /**
+ * Build success response
+ * @param resp jaggery response object
+ * @param code status code
+ * @param data the result to client
+ * @return return response
+ */
+ response.buildSuccessResponse= function(resp, code, data){
+ var content={};
+ content.data = data;
+ resp = processResponse(resp,code,content);
+ return resp;
+ };
+
+ /**
+ * process General response
+ * @param resp jaggery response
+ * @param code status code
+ * @param data success result
+ * @return resp jaggery response
+ */
+ response.buildSuccessResponseForRxt= function(resp, code, data){
+ resp.status = code;
+ resp.content = data;
+ return resp;
+ };
+
+ /**
+ * General response builder
+ * @param resp jaggery response
+ * @param code status code
+ * @param content what ever the content to be sent as response
+ * @return resp jaggery response
+ */
+ function processResponse(resp, code, content){
+ resp.status = code;
+ resp.contentType = 'application/json';
+ resp.content = content;
+ return resp;
+
+ };
+
+ /**
+ *
+ * @param resp
+ * @param code
+ * @param data
+ * @return The http response
+ */
+ response.buildSuccessResponseForRxt= function(resp, code, data){
+ resp.contentType = 'application/json';
+ resp.status = code;
+ resp.content = data;
+ return resp;
+ };
+
+}(response))
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/time/time.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/time/time.js
new file mode 100644
index 0000000000..142d4fa73c
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/time/time.js
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2005-2014, 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.
+ *
+ */
+var time = {};
+(function(time) {
+ time.getCurrentTime = function(dateLength) {
+ var dateLength=dateLength||20;
+ var now = new String(new Date().valueOf());
+ var length = now.length;
+ var prefix = dateLength;
+ var onsetVal = '';
+ if (length != prefix) {
+ var onset = prefix - length;
+ for (var i = 0; i < onset; i++) {
+ onsetVal += '0';
+ }
+ }
+ return onsetVal + now;
+ };
+}(time));
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/url/url.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/url/url.js
new file mode 100644
index 0000000000..5f8154607a
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/url/url.js
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2005-2014, 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.
+ *
+ */
+var url = {};
+(function() {
+ var log=new Log('utils-url');
+ url.popServerDetails = function(obj) {
+ var process = require('process');
+ var localIP = process.getProperty('server.host');
+ var httpPort = process.getProperty('http.port');
+ var httpsPort = process.getProperty('https.port');
+ var value = '';
+ var carbonLocalIP = process.getProperty('carbon.local.ip');
+
+ for (var key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ value = obj[key];
+ if ((typeof value === 'string') && value.indexOf('%https.host%') > -1) {
+ value=value.replace('%https.host%', 'https://' + localIP + ':' + httpsPort);
+ } else if ((typeof value === 'string') && value.indexOf('%http.host%') > -1) {
+ value=value.replace('%http.host%', 'http://' + localIP + ':' + httpPort);
+ } else if ((typeof value === 'string') && value.indexOf('%https.carbon.local.ip%') > -1) {
+ value=value.replace('%https.carbon.local.ip%', 'https://' + carbonLocalIP + ':' + httpsPort);
+ } else if ((typeof value === 'string') && value.indexOf('%http.carbon.local.ip%') > -1) {
+ value=value.replace('%http.carbon.local.ip%', 'http://' + carbonLocalIP + ':' + httpPort);
+ }
+ obj[key] = value;
+ }
+ }
+ return obj;
+ };
+}(url));
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/xml/xml.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/xml/xml.js
new file mode 100644
index 0000000000..7caefe9d07
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggery-modules/utils/scripts/xml/xml.js
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2005-2014, 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.
+ *
+ */
+var xml = {};
+
+(function () {
+
+ var log=new Log('util.xml')
+
+ /*
+ The method is used to create a JSON object using
+ an xml object.
+ @xmlElement: An xml element object to be processed
+ @return: A pseudo object containing the properties of the
+ xml element.
+ */
+ var createJSONObject = function (xmlElement) {
+
+ var pseudo = {};
+
+ //Extract all attributes
+ var attributes = xmlElement.@*;
+
+ //Fill the pseudo object with the attributes of the element
+ for (var attributeKey in attributes) {
+ var attribute = attributes[attributeKey];
+ pseudo[attribute.localName()] = attribute.toString();
+ }
+
+ return pseudo;
+ };
+
+ /*
+ The function converts an E4X Xml object to a JSON object
+ This function has been adapted from the work of Oleg Podsechin available at
+ https://gist.github.com/olegp/642667
+ It uses a slightly modified version of his algorithm , therefore
+ all credit should be attributed to Oleg Podsechin.
+ IMPORTANT:
+ 1. It does not create a 1..1 mapping due to the differences
+ between Xml and JSON.It is IMPORTANT that you verify the structure
+ of the object generated before using it.
+ 2. The input xml object must not contain the xml header information
+ This is a known bug 336551 (Mozilla Developer Network)
+ Source: https://developer.mozilla.org/en/docs/E4X
+ Please remove the header prior to sending the xml object for processing.
+ @root: A starting element in an E4X Xml object
+ @return: A JSON object mirroring the provided Xml object
+ */
+ var recursiveConvertE4XtoJSON = function (root) {
+
+ log.debug('Root: ' + root.localName());
+
+ //Obtain child nodes
+ var children = root.*;
+
+ //The number of children
+ var numChildren = children.length();
+
+ //No children
+ if (numChildren == 0) {
+
+ //Extract contents
+ return createJSONObject(root);
+ }
+ else {
+
+ //Create an empty object
+ var rootObject = createJSONObject(root);
+
+ //Could be multiple children
+ for (var childElementKey in children) {
+
+ var child = children[childElementKey];
+
+ log.debug('Examining child: ' + child.localName());
+
+ //If the child just contains a single value then stop
+ if (child.localName() == undefined) {
+
+ log.debug('Child is undefined: ' + child.toString());
+
+ //Change the object to just a key value pair
+ rootObject[root.localName()] = child.toString();
+ return rootObject;
+ }
+
+ //Make a recursive call to construct the child element
+ var createdObject = recursiveConvertE4XtoJSON(child);
+
+ log.debug('Converted object: ' + stringify(createdObject));
+
+ //Check if the root object has the property
+ if (rootObject.hasOwnProperty(child.localName())) {
+
+ log.debug('key: ' + child.localName() + ' already present.');
+ rootObject[child.localName()].push(createdObject);
+ }
+ else {
+
+ log.debug('key: ' + child.localName() + ' not present.');
+ rootObject[child.localName()] = [];
+ rootObject[child.localName()].push(createdObject);
+
+ }
+ }
+
+ log.debug('root: ' + root.localName());
+
+ return rootObject;
+ }
+ };
+
+ /**
+ * The function is used to convert an E4X xml to JSON
+ * @param root
+ */
+ xml.convertE4XtoJSON = function (root) {
+ return recursiveConvertE4XtoJSON(root);
+ };
+
+
+}());
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error400-cloud.html b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error400-cloud.html
new file mode 100644
index 0000000000..3007e7d0be
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error400-cloud.html
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Oops something went wrong
+
400 - Bad request
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error400.html b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error400.html
new file mode 100644
index 0000000000..3b0349ef37
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/error-pages/error400.html
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+ Bad request - Error 400
+
+
+
+
+
+
+
Error 400
+
We are unable to understand the request and process it. Please re-check your request.
+
+
+
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/jaggery.conf b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/jaggery.conf
new file mode 100644
index 0000000000..12f3796fec
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/application-mgt/jaggery.conf
@@ -0,0 +1,101 @@
+{
+ "displayName": "Carbon Application Management App",
+ "logLevel": "info",
+ "initScripts": ["/app/modules/init.js"],
+ "urlMappings": [
+ {
+ "url": "/uuf/login",
+ "path": "/lib/modules/auth/login.jag"
+ },
+ {
+ "url": "/uuf/logout",
+ "path": "/lib/modules/auth/logout.jag"
+ },
+ {
+ "url": "/uuf/sso/acs",
+ "path": "/lib/modules/auth/acs.jag"
+ },
+ {
+ "url": "/public/*",
+ "path": "/lib/static-files.jag"
+ },
+ {
+ "url": "/unit/*",
+ "path": "/lib/units.jag"
+ },
+ {
+ "url": "/*",
+ "path": "/lib/pages.jag"
+ }
+ ],
+ "errorPages": {
+ "500": "/error-pages/error500.html",
+ "404": "/error-pages/error404.html",
+ "401": "/error-pages/error401.html",
+ "405": "/error-pages/error405.html",
+ "403": "/error-pages/error403.html",
+ "400": "/error-pages/error400.html"
+ },
+ "filters": [
+ {
+ "name": "ContentTypeBasedCachePreventionFilter",
+ "class": "org.wso2.carbon.ui.filters.cache.ContentTypeBasedCachePreventionFilter",
+ "params" : [
+ {"name" : "patterns", "value" : "text/html\" ,application/json\" ,text/plain"},
+ {"name" : "filterAction", "value" : "enforce"},
+ {"name" : "httpHeaders", "value" : "Cache-Control: no-store, no-cache, must-revalidate, private"}
+ ]
+ },
+ {
+ "name":"HttpHeaderSecurityFilter",
+ "class":"org.apache.catalina.filters.HttpHeaderSecurityFilter",
+ "params" : [{"name" : "hstsEnabled", "value" : "false"}]
+ },
+ {
+ "name" : "CSRFGuard",
+ "class" : "org.owasp.csrfguard.CsrfGuardFilter"
+ }
+
+ ],
+ "filterMappings": [
+ {
+ "name":"HttpHeaderSecurityFilter",
+ "url":"*"
+ },
+ {
+ "name" : "CSRFGuard",
+ "url" : "/*"
+ },
+ {
+ "name":"ContentTypeBasedCachePreventionFilter",
+ "url":"*"
+ }
+
+ ],
+ "listeners" : [
+ {
+ "class" : "org.owasp.csrfguard.CsrfGuardServletContextListener"
+ },
+ {
+ "class" : "org.owasp.csrfguard.CsrfGuardHttpSessionListener"
+ }
+ ],
+ "servlets" : [
+ {
+ "name" : "JavaScriptServlet",
+ "class" : "org.owasp.csrfguard.servlet.JavaScriptServlet"
+ }
+ ],
+ "servletMappings" : [
+ {
+ "name" : "JavaScriptServlet",
+ "url" : "/csrf.js"
+ }
+ ],
+ "contextParams" : [
+ {
+ "name" : "Owasp.CsrfGuard.Config",
+ "value" : "repository/conf/security/Owasp.CsrfGuard.dashboard.properties"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/app-conf.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/app-conf.json
new file mode 100644
index 0000000000..63bcd3f5f1
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/app-conf.json
@@ -0,0 +1,45 @@
+{
+ "appName": "UUF Template App",
+ "cachingEnabled": false,
+ "debuggingEnabled": false,
+ "permissionRoot": "/",
+ "loginPage": "uuf.page.sign-in",
+ "adminServicesUrl": "https://${server.ip}:${server.https_port}/admin/services/",
+ "authModule": {
+ "enabled": true,
+ "login": {
+ "onSuccess": {
+ "script": "/app/modules/login.js",
+ "page": "uuf.page.home"
+ },
+ "onFail": {
+ "script": "/app/modules/login.js",
+ "page": "uuf.page.sign-in"
+ }
+ },
+ "logout": {
+ "onSuccess": {
+ "script": "/app/modules/logout.js",
+ "page": "uuf.page.sign-in"
+ },
+ "onFail": {
+ "script": "/app/modules/logout.js",
+ "page": "uuf.page.home"
+ }
+ },
+ "sso": {
+ "enabled": false,
+ "issuer": "uuf",
+ "responseSigningEnabled": true,
+ "keyStoreName": "repository/resources/security/wso2carbon.jks",
+ "keyStorePassword": "wso2carbon",
+ "identityProviderAlias": "wso2carbon",
+ "identityProviderUrl": "https://${server.ip}:${server.https_port}/samlsso",
+ "intermediatePage": "uuf.page.sso-intermediate"
+ }
+ },
+ "errorPages": {
+ "404": "uuf.page.error",
+ "default": "uuf.page.error"
+ }
+}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/uuf-conf.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/uuf-conf.json
new file mode 100644
index 0000000000..72d2df1edf
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/uuf-conf.json
@@ -0,0 +1,4 @@
+{
+ "displayName": "UUF Template App",
+ "logLevel": "debug"
+}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.default.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.default.hbs
new file mode 100644
index 0000000000..a67a3e63eb
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.default.hbs
@@ -0,0 +1,67 @@
+{{!--
+* Copyright (c) 2016, 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.
+--}}
+
+
+
+
+
+
+
+
+ {{#defineZone "title"}}WSO2 Template{{/defineZone}}
+ {{defineZone "favicon"}}
+ {{defineZone "topCss"}}
+ {{defineZone "topJs"}}
+
+
+
+{{defineZone "header"}}
+
+
+
+
+ {{defineZone "navbars"}}
+
+
+
+
+{{defineZone "sidePanes"}}
+
+
+
+
+ {{defineZone "contentTitle"}}
+
+
+ {{defineZone "content"}}
+
+
+
+
+
+
+
+
+
+{{defineZone "bottomJs"}}
+
+
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.sign-in.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.sign-in.hbs
new file mode 100644
index 0000000000..3283927e56
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.sign-in.hbs
@@ -0,0 +1,56 @@
+{{!--
+* Copyright (c) 2016, 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.
+--}}
+
+
+
+
+
+
+
+
+ {{#defineZone "title"}}WSO2 Template{{/defineZone}}
+ {{defineZone "favicon"}}
+ {{defineZone "topCss"}}
+ {{defineZone "topJs"}}
+
+
+
+{{defineZone "header"}}
+
+
+
+
+
+
+ {{defineZone "content"}}
+
+
+
+
+
+
+
+
+
+{{defineZone "bottomJs"}}
+
+
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.hbs
new file mode 100644
index 0000000000..a4a31d008c
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.hbs
@@ -0,0 +1,38 @@
+{{!
+ Copyright (c) 2016, 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.
+}}
+{{#zone "title"}}Error | {{@app.conf.appName}}{{/zone}}
+
+{{#zone "breadcrumbs"}}
+
+{{/zone}}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.json
new file mode 100644
index 0000000000..c60eb52075
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.json
@@ -0,0 +1,6 @@
+{
+ "version": "1.0.0",
+ "uri": "/error/default",
+ "layout": "uuf.layout.default",
+ "isAnonymous": true
+}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/public/js/sign-in-validations.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/public/js/sign-in-validations.js
new file mode 100644
index 0000000000..2db2c795f7
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/public/js/sign-in-validations.js
@@ -0,0 +1,24 @@
+$(document).ready(function(){
+ $("#signInForm").validate({
+ rules: {
+ username: {
+ required: true,
+ minlength: 3
+ },
+ password: {
+ required: true,
+ minlength: 3
+ }
+ },
+ messages: {
+ username: {
+ required: "Please enter a username",
+ minlength: "Your username must consist of at least 3 characters"
+ },
+ password: {
+ required: "Please provide a password",
+ minlength: "Your password must be at least 3 characters long"
+ }
+ }
+ });
+});
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.hbs
new file mode 100644
index 0000000000..ba781f71b3
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.hbs
@@ -0,0 +1,63 @@
+{{!
+ Copyright (c) 2016, 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.
+}}
+{{#zone "title"}}Sign In | {{@app.conf.appName}}{{/zone}}
+
+{{~#zone "content"}}
+
+
+
+
+ {{#defineZone "signIn-title" scope="protected"}}Sign In to UUF Template App{{/defineZone}}
+
+
+
+ {{#if message}}
+
+ {{message}}!
+
+ {{/if}}
+
+
+
+
+{{/zone}}
+
+{{! sign-in form validation}}
+{{~unit "uuf.unit.lib.form-validation"}}
+{{~#zone "bottomJs"}}
+ {{~js "js/sign-in-validations.js"}}
+{{/zone}}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.js
new file mode 100644
index 0000000000..939e7c82b0
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.js
@@ -0,0 +1,30 @@
+function onRequest(context) {
+ var authModuleConfigs = context.app.conf["authModule"];
+ if (authModuleConfigs && (authModuleConfigs["enabled"].toString() == "true")) {
+ // Auth module is enabled.
+ if (context.user) {
+ // User is already logged in.
+ response.sendRedirect(context.app.context + "/");
+ exit();
+ } else {
+ // User is not logged in.
+ var ssoConfigs = authModuleConfigs["sso"];
+ if (ssoConfigs && (ssoConfigs["enabled"].toString() == "true")) {
+ // SSO is enabled in Auth module.
+ var redirectUri = context.app.context + "/uuf/login";
+ var queryString = request.getQueryString();
+ if (queryString && (queryString.length > 0)) {
+ redirectUri = redirectUri + "?" + queryString;
+ }
+ response.sendRedirect(encodeURI(redirectUri));
+ exit();
+ } else {
+ // Generic login process is enabled.
+ return {
+ message: request.getParameter("error"),
+ referer: request.getParameter("referer")
+ };
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.json
new file mode 100644
index 0000000000..4bafc2dbb9
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.json
@@ -0,0 +1,6 @@
+{
+ "version": "1.0.0",
+ "uri": "/signin",
+ "layout": "uuf.layout.sign-in",
+ "isAnonymous": true
+}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.hbs
new file mode 100644
index 0000000000..23e70695fc
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.hbs
@@ -0,0 +1,18 @@
+{{!
+ Copyright (c) 2016, 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.
+}}
+{{! This template won't be rendered. So nothing is here }}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.js
new file mode 100644
index 0000000000..527c977335
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.js
@@ -0,0 +1,16 @@
+function onRequest(context) {
+ var authModuleConfigs = context.app.conf["authModule"];
+ if (authModuleConfigs && (authModuleConfigs["enabled"].toString() == "true")) {
+ // Auth module is enabled.
+ if (context.user) {
+ // User is logged in.
+ response.sendRedirect(context.app.context + "/uuf/logout");
+ exit();
+ } else {
+ // User is already logged out.
+ response.sendRedirect(context.app.context + "/");
+ exit();
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.json
new file mode 100644
index 0000000000..0667f6f06d
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.json
@@ -0,0 +1,5 @@
+{
+ "version": "1.0.0",
+ "uri": "/signout",
+ "layout": "uuf.layout.sign-in"
+}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.hbs
new file mode 100644
index 0000000000..73de91e94d
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.hbs
@@ -0,0 +1,45 @@
+{{!
+ Copyright (c) 2016, 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.
+}}
+{{#zone "title"}}Sign In | {{@app.conf.appName}}{{/zone}}
+
+{{unit "uuf.unit.theme"}}
+{{unit "uuf.unit.header.logo"}}{{unit "uuf.unit.header"}}
+{{unit "uuf.unit.footer"}}
+
+{{#zone "content"}}
+
+
+ You are now being redirected to Identity Server. If the redirection fails, please click
+ on the button below.
+
+
+
+
+
+
+{{/zone}}
+
+{{#zone "bottomJs"}}
+
+{{/zone}}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.json
new file mode 100644
index 0000000000..e3c6cdde28
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.json
@@ -0,0 +1,6 @@
+{
+ "version": "1.0.0",
+ "uri": "//",
+ "layout": "uuf.layout.sign-in",
+ "isAnonymous": true
+}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.hbs
new file mode 100644
index 0000000000..51a365f77e
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.hbs
@@ -0,0 +1,27 @@
+{{!
+ Copyright (c) 2016, 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.
+}}
+
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.js
new file mode 100644
index 0000000000..aa4e1482f4
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.js
@@ -0,0 +1,15 @@
+function onRequest(context) {
+ var type = context.unit.params.type;
+ switch (type) {
+ case "success":
+ return {icon: "ok"};
+ case "info":
+ return {icon: "info"};
+ case "warning":
+ return {icon: "warning"};
+ case "danger":
+ return {icon: "error"};
+ default:
+ return {icon: "ok"};
+ }
+}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.json
new file mode 100644
index 0000000000..f2f22da9a9
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.json
@@ -0,0 +1,4 @@
+{
+ "version": "1.0.0",
+ "isAnonymous": true
+}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.hbs
new file mode 100644
index 0000000000..4e56417553
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.hbs
@@ -0,0 +1,24 @@
+{{!
+ Copyright (c) 2016, 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.
+}}
+{{#zone "favicon"}}
+ {{#if isCloud}}
+
+ {{else}}
+
+ {{/if}}
+{{/zone}}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.js
new file mode 100644
index 0000000000..76da4c18f0
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.js
@@ -0,0 +1,8 @@
+function onRequest(context) {
+
+ var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"];
+ var viewModel = {};
+ viewModel.isCloud = deviceMgtProps.isCloud;
+ return viewModel;
+
+}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.json
new file mode 100644
index 0000000000..6e8b1666ca
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.json
@@ -0,0 +1,8 @@
+{
+ "version": "1.0.0",
+ "pushedUris": [
+ "/",
+ "/{+any}"
+ ],
+ "isAnonymous": true
+}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/public/img/cloud-favicon.png b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/public/img/cloud-favicon.png
new file mode 100644
index 0000000000..e9d327e613
Binary files /dev/null and b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/public/img/cloud-favicon.png differ
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/public/img/favicon.png b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/public/img/favicon.png
new file mode 100644
index 0000000000..a1deab3581
Binary files /dev/null and b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/public/img/favicon.png differ
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.hbs
new file mode 100644
index 0000000000..e726ab6dd7
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.hbs
@@ -0,0 +1,23 @@
+{{!
+ Copyright (c) 2016, 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.
+}}
+{{#zone "footer"}}
+
+{{/zone}}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.json
new file mode 100644
index 0000000000..6e8b1666ca
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.json
@@ -0,0 +1,8 @@
+{
+ "version": "1.0.0",
+ "pushedUris": [
+ "/",
+ "/{+any}"
+ ],
+ "isAnonymous": true
+}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.hbs
new file mode 100644
index 0000000000..4ce5f300d4
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.hbs
@@ -0,0 +1,27 @@
+{{!
+ Copyright (c) 2016, 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.
+}}
+{{#zone "brand"}}
+
+
+
+
+{{/zone}}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.json
new file mode 100644
index 0000000000..38acf5dc9c
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.json
@@ -0,0 +1,9 @@
+{
+ "version": "1.0.0",
+ "index": 9100,
+ "pushedUris": [
+ "/",
+ "/{+any}"
+ ],
+ "isAnonymous": true
+}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/public/img/logo.png b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/public/img/logo.png
new file mode 100644
index 0000000000..8fc1947a6a
Binary files /dev/null and b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/public/img/logo.png differ
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.hbs
new file mode 100644
index 0000000000..d14d5dfed6
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.hbs
@@ -0,0 +1,39 @@
+{{!
+ Copyright (c) 2016, 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.
+}}
+{{#zone "userMenu"}}
+
+{{/zone}}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.json
new file mode 100644
index 0000000000..614b0890bd
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.json
@@ -0,0 +1,8 @@
+{
+ "version": "1.0.0",
+ "index": 9110,
+ "pushedUris": [
+ "/",
+ "/{+any}"
+ ]
+}
\ No newline at end of file
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.hbs b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.hbs
new file mode 100644
index 0000000000..af3e248189
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.hbs
@@ -0,0 +1,32 @@
+{{!
+ Copyright (c) 2016, 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.
+}}
+{{#zone "header"}}
+
+
+ * @type array
+ * @default []
+ */
+ "aanFeatures": [],
+
+ /**
+ * Store data information - see {@link DataTable.models.oRow} for detailed
+ * information.
+ * @type array
+ * @default []
+ */
+ "aoData": [],
+
+ /**
+ * Array of indexes which are in the current display (after filtering etc)
+ * @type array
+ * @default []
+ */
+ "aiDisplay": [],
+
+ /**
+ * Array of indexes for display - no filtering
+ * @type array
+ * @default []
+ */
+ "aiDisplayMaster": [],
+
+ /**
+ * Store information about each column that is in use
+ * @type array
+ * @default []
+ */
+ "aoColumns": [],
+
+ /**
+ * Store information about the table's header
+ * @type array
+ * @default []
+ */
+ "aoHeader": [],
+
+ /**
+ * Store information about the table's footer
+ * @type array
+ * @default []
+ */
+ "aoFooter": [],
+
+ /**
+ * Store the applied global search information in case we want to force a
+ * research or compare the old search to a new one.
+ * Note that this parameter will be set by the initialisation routine. To
+ * set a default use {@link DataTable.defaults}.
+ * @namespace
+ * @extends DataTable.models.oSearch
+ */
+ "oPreviousSearch": {},
+
+ /**
+ * Store the applied search for each column - see
+ * {@link DataTable.models.oSearch} for the format that is used for the
+ * filtering information for each column.
+ * @type array
+ * @default []
+ */
+ "aoPreSearchCols": [],
+
+ /**
+ * Sorting that is applied to the table. Note that the inner arrays are
+ * used in the following manner:
+ *
+ *
Index 0 - column number
+ *
Index 1 - current sorting direction
+ *
+ * Note that this parameter will be set by the initialisation routine. To
+ * set a default use {@link DataTable.defaults}.
+ * @type array
+ * @todo These inner arrays should really be objects
+ */
+ "aaSorting": null,
+
+ /**
+ * Sorting that is always applied to the table (i.e. prefixed in front of
+ * aaSorting).
+ * Note that this parameter will be set by the initialisation routine. To
+ * set a default use {@link DataTable.defaults}.
+ * @type array
+ * @default []
+ */
+ "aaSortingFixed": [],
+
+ /**
+ * Classes to use for the striping of a table.
+ * Note that this parameter will be set by the initialisation routine. To
+ * set a default use {@link DataTable.defaults}.
+ * @type array
+ * @default []
+ */
+ "asStripeClasses": null,
+
+ /**
+ * If restoring a table - we should restore its striping classes as well
+ * @type array
+ * @default []
+ */
+ "asDestroyStripes": [],
+
+ /**
+ * If restoring a table - we should restore its width
+ * @type int
+ * @default 0
+ */
+ "sDestroyWidth": 0,
+
+ /**
+ * Callback functions array for every time a row is inserted (i.e. on a draw).
+ * @type array
+ * @default []
+ */
+ "aoRowCallback": [],
+
+ /**
+ * Callback functions for the header on each draw.
+ * @type array
+ * @default []
+ */
+ "aoHeaderCallback": [],
+
+ /**
+ * Callback function for the footer on each draw.
+ * @type array
+ * @default []
+ */
+ "aoFooterCallback": [],
+
+ /**
+ * Array of callback functions for draw callback functions
+ * @type array
+ * @default []
+ */
+ "aoDrawCallback": [],
+
+ /**
+ * Array of callback functions for row created function
+ * @type array
+ * @default []
+ */
+ "aoRowCreatedCallback": [],
+
+ /**
+ * Callback functions for just before the table is redrawn. A return of
+ * false will be used to cancel the draw.
+ * @type array
+ * @default []
+ */
+ "aoPreDrawCallback": [],
+
+ /**
+ * Callback functions for when the table has been initialised.
+ * @type array
+ * @default []
+ */
+ "aoInitComplete": [],
+
+
+ /**
+ * Callbacks for modifying the settings to be stored for state saving, prior to
+ * saving state.
+ * @type array
+ * @default []
+ */
+ "aoStateSaveParams": [],
+
+ /**
+ * Callbacks for modifying the settings that have been stored for state saving
+ * prior to using the stored values to restore the state.
+ * @type array
+ * @default []
+ */
+ "aoStateLoadParams": [],
+
+ /**
+ * Callbacks for operating on the settings object once the saved state has been
+ * loaded
+ * @type array
+ * @default []
+ */
+ "aoStateLoaded": [],
+
+ /**
+ * Cache the table ID for quick access
+ * @type string
+ * @default Empty string
+ */
+ "sTableId": "",
+
+ /**
+ * The TABLE node for the main table
+ * @type node
+ * @default null
+ */
+ "nTable": null,
+
+ /**
+ * Permanent ref to the thead element
+ * @type node
+ * @default null
+ */
+ "nTHead": null,
+
+ /**
+ * Permanent ref to the tfoot element - if it exists
+ * @type node
+ * @default null
+ */
+ "nTFoot": null,
+
+ /**
+ * Permanent ref to the tbody element
+ * @type node
+ * @default null
+ */
+ "nTBody": null,
+
+ /**
+ * Cache the wrapper node (contains all DataTables controlled elements)
+ * @type node
+ * @default null
+ */
+ "nTableWrapper": null,
+
+ /**
+ * Indicate if when using server-side processing the loading of data
+ * should be deferred until the second draw.
+ * Note that this parameter will be set by the initialisation routine. To
+ * set a default use {@link DataTable.defaults}.
+ * @type boolean
+ * @default false
+ */
+ "bDeferLoading": false,
+
+ /**
+ * Indicate if all required information has been read in
+ * @type boolean
+ * @default false
+ */
+ "bInitialised": false,
+
+ /**
+ * Information about open rows. Each object in the array has the parameters
+ * 'nTr' and 'nParent'
+ * @type array
+ * @default []
+ */
+ "aoOpenRows": [],
+
+ /**
+ * Dictate the positioning of DataTables' control elements - see
+ * {@link DataTable.model.oInit.sDom}.
+ * Note that this parameter will be set by the initialisation routine. To
+ * set a default use {@link DataTable.defaults}.
+ * @type string
+ * @default null
+ */
+ "sDom": null,
+
+ /**
+ * Search delay (in mS)
+ * @type integer
+ * @default null
+ */
+ "searchDelay": null,
+
+ /**
+ * Which type of pagination should be used.
+ * Note that this parameter will be set by the initialisation routine. To
+ * set a default use {@link DataTable.defaults}.
+ * @type string
+ * @default two_button
+ */
+ "sPaginationType": "two_button",
+
+ /**
+ * The state duration (for `stateSave`) in seconds.
+ * Note that this parameter will be set by the initialisation routine. To
+ * set a default use {@link DataTable.defaults}.
+ * @type int
+ * @default 0
+ */
+ "iStateDuration": 0,
+
+ /**
+ * Array of callback functions for state saving. Each array element is an
+ * object with the following parameters:
+ *
+ *
function:fn - function to call. Takes two parameters, oSettings
+ * and the JSON string to save that has been thus far created. Returns
+ * a JSON string to be inserted into a json object
+ * (i.e. '"param": [ 0, 1, 2]')
+ *
string:sName - name of callback
+ *
+ * @type array
+ * @default []
+ */
+ "aoStateSave": [],
+
+ /**
+ * Array of callback functions for state loading. Each array element is an
+ * object with the following parameters:
+ *
+ *
function:fn - function to call. Takes two parameters, oSettings
+ * and the object stored. May return false to cancel state loading