diff --git a/modules/distribution/src/assembly/bin.xml b/modules/distribution/src/assembly/bin.xml index a3be24e6..2facff0d 100755 --- a/modules/distribution/src/assembly/bin.xml +++ b/modules/distribution/src/assembly/bin.xml @@ -451,16 +451,16 @@ - - - ../p2-profile/iot-core-profile/target/wso2carbon-core-${carbon.kernel.version}/wso2/deployment/server/jaggeryapps/social/ - - ${pom.artifactId}-${pom.version}/repository/deployment/server/jaggeryapps/social - - - **/jaggery.conf - - + + + + + + + + + + @@ -1610,13 +1610,13 @@ 755 - - src/core/jaggeryapps/social/jaggery.conf - - ${pom.artifactId}-${pom.version}/repository/deployment/server/jaggeryapps/social/ - - 755 - + + + + + + + diff --git a/modules/distribution/src/core/conf/datasources/master-datasources.xml b/modules/distribution/src/core/conf/datasources/master-datasources.xml index 0ce0ba70..bd21c19b 100755 --- a/modules/distribution/src/core/conf/datasources/master-datasources.xml +++ b/modules/distribution/src/core/conf/datasources/master-datasources.xml @@ -43,26 +43,27 @@ - - WSO2APPM_DB - The datasource used for App Manager database - - jdbc/WSO2APPM_DB - - - - jdbc:h2:repository/database/WSO2APPM_DB;DB_CLOSE_ON_EXIT=FALSE - wso2carbon - wso2carbon - org.h2.Driver - 50 - 60000 - true - SELECT 1 - 30000 - - - + + + + + + + + + + + + + + + + + + + + + WSO2AM_DB @@ -123,25 +124,26 @@ - - WSO2_SOCIAL_DB - The datasource used for Store social database - - jdbc/WSO2_SOCIAL_DB - - - - jdbc:h2:repository/database/WSO2_SOCIAL_DB;DB_CLOSE_ON_EXIT=FALSE - wso2carbon - wso2carbon - org.h2.Driver - 50 - 60000 - true - SELECT 1 - 30000 - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/scripts/mobile-qsg/src/main/java/org/wso2/mdm/qsg/AppOperations.java b/modules/scripts/mobile-qsg/src/main/java/org/wso2/mdm/qsg/AppOperations.java deleted file mode 100644 index ff5bda18..00000000 --- a/modules/scripts/mobile-qsg/src/main/java/org/wso2/mdm/qsg/AppOperations.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * 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.mdm.qsg; - -import org.json.simple.JSONArray; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; -import org.wso2.mdm.qsg.dto.EMMQSGConfig; -import org.wso2.mdm.qsg.dto.HTTPResponse; -import org.wso2.mdm.qsg.dto.MobileApplication; -import org.wso2.mdm.qsg.utils.Constants; -import org.wso2.mdm.qsg.utils.HTTPInvoker; -import org.wso2.mdm.qsg.utils.QSGUtils; - -import java.io.File; -import java.util.HashMap; - -/** - * This class holds the app-mgt related operations. - */ -public class AppOperations { - - private static String appmPublisherMobileBinariesUrl = "/api/appm/publisher/v1.1/apps/mobile/binaries"; - private static String appmPublisherResourcesUrl = "/api/appm/publisher/v1.1/apps/static-contents?appType=mobileapp"; - private static String appmPublisherAppsUrl = "/api/appm/publisher/v1.1/apps/mobileapp"; - - - public static MobileApplication uploadApplication(String platform, String appName, String appContentType) { - - String appUploadEndpoint = EMMQSGConfig.getInstance().getEmmHost() + appmPublisherMobileBinariesUrl; - String filePath = "apps" + File.separator + platform + File.separator + appName; - HTTPResponse httpResponse = HTTPInvoker.uploadFile(appUploadEndpoint, filePath, appContentType); - if (Constants.HTTPStatus.OK == httpResponse.getResponseCode()) { - JSONObject appMeta = null; - MobileApplication application = new MobileApplication(); - try { - appMeta = (JSONObject) new JSONParser().parse(httpResponse.getResponse()); - application.setPackageId((String) appMeta.get("package")); - application.setAppId(QSGUtils.getResourceId((String) appMeta.get("path"))); - application.setVersion((String) appMeta.get("version")); - application.setPlatform(platform); - } catch (ParseException e) { - e.printStackTrace(); - } - return application; - } - return null; - } - - public static MobileApplication getPublicApplication(String packageId, String version, String platform) { - MobileApplication application = new MobileApplication(); - application.setVersion(version); - application.setPackageId(packageId); - application.setPlatform(platform); - return application; - } - - private static String uploadAsset(String path) { - - String resUploadEndpoint = EMMQSGConfig.getInstance().getEmmHost() + appmPublisherResourcesUrl; - HTTPResponse httpResponse = HTTPInvoker.uploadFile(resUploadEndpoint, path, "image/jpeg"); - if (Constants.HTTPStatus.OK == httpResponse.getResponseCode()) { - JSONObject resp = null; - try { - resp = (JSONObject) new JSONParser().parse(httpResponse.getResponse()); - return (String) resp.get("id"); - } catch (ParseException e) { - e.printStackTrace(); - } - } - return null; - } - - public static MobileApplication uploadAssets(String platform, MobileApplication application) { - - String assetDir = "apps" + File.separator + platform + File.separator + "images"; - //Upload the icon file - String imgFile = assetDir + File.separator + "icon.jpg"; - String uploadPath = uploadAsset(imgFile); - if (uploadPath != null && !uploadPath.isEmpty()) { - application.setIcon(uploadPath); - } else { - System.out.println("Unable to upload the app icon file."); - return null; - } - - //Upload the banner file - imgFile = assetDir + File.separator + "banner.jpg"; - uploadPath = uploadAsset(imgFile); - if (uploadPath != null && !uploadPath.isEmpty()) { - application.setBanner(uploadPath); - } else { - System.out.println("Unable to upload the app banner file."); - return null; - } - - //Upload the screenshot1 file - imgFile = assetDir + File.separator + "screen1.jpg"; - uploadPath = uploadAsset(imgFile); - if (uploadPath != null && !uploadPath.isEmpty()) { - application.setScreenshot1(uploadPath); - } else { - System.out.println("Unable to upload the app screenshot1 file."); - return null; - } - - //Upload the screenshot2 file - imgFile = assetDir + File.separator + "screen2.jpg"; - uploadPath = uploadAsset(imgFile); - if (uploadPath != null && !uploadPath.isEmpty()) { - application.setScreenshot2(uploadPath); - } else { - System.out.println("Unable to upload the app screenshot2 file."); - return null; - } - - //Upload the screenshot3 file - imgFile = assetDir + File.separator + "screen3.jpg"; - uploadPath = uploadAsset(imgFile); - if (uploadPath != null && !uploadPath.isEmpty()) { - application.setScreenshot3(uploadPath); - } else { - System.out.println("Unable to upload the app screenshot3 file."); - return null; - } - return application; - } - - public static boolean addApplication(String name, MobileApplication mblApp, boolean isEnterpriseApp) { - HashMap headers = new HashMap(); - - String appEndpoint = EMMQSGConfig.getInstance().getEmmHost() + appmPublisherAppsUrl; - //Set the application payload - JSONObject application = new JSONObject(); - application.put("name", name); - application.put("description", "Sample application"); - application.put("type", "enterprise"); - //Set appMeta data - JSONObject appMeta = new JSONObject(); - appMeta.put("package", mblApp.getPackageId()); - appMeta.put("version", mblApp.getVersion()); - if (isEnterpriseApp) { - application.put("marketType", "enterprise"); - appMeta.put("path", mblApp.getAppId()); - } else { - application.put("marketType", "public"); - } - application.put("provider", "admin"); - application.put("displayName", name); - application.put("category", "Business"); - application.put("thumbnailUrl", mblApp.getIcon()); - application.put("version", mblApp.getVersion()); - application.put("banner", mblApp.getBanner()); - application.put("platform", mblApp.getPlatform()); - application.put("appType", mblApp.getPlatform()); - //application.put("appUrL", mblApp.getAppId()); - application.put("mediaType", "application/vnd.wso2-mobileapp+xml"); - - //Set screenshots - JSONArray screenshots = new JSONArray(); - screenshots.add(mblApp.getScreenshot1()); - screenshots.add(mblApp.getScreenshot2()); - screenshots.add(mblApp.getScreenshot3()); - application.put("appmeta", appMeta); - application.put("screenshots", screenshots); - - //Set the headers - headers.put(Constants.Header.CONTENT_TYPE, Constants.ContentType.APPLICATION_JSON); - HTTPResponse - httpResponse = - HTTPInvoker.sendHTTPPostWithOAuthSecurity(appEndpoint, application.toJSONString(), headers); - if (Constants.HTTPStatus.OK == httpResponse.getResponseCode()) { - return true; - } - return false; - } -} diff --git a/modules/scripts/mobile-qsg/src/main/java/org/wso2/mdm/qsg/QSGExecutor.java b/modules/scripts/mobile-qsg/src/main/java/org/wso2/mdm/qsg/QSGExecutor.java index 58a993df..5cde92b0 100644 --- a/modules/scripts/mobile-qsg/src/main/java/org/wso2/mdm/qsg/QSGExecutor.java +++ b/modules/scripts/mobile-qsg/src/main/java/org/wso2/mdm/qsg/QSGExecutor.java @@ -113,59 +113,6 @@ public class QSGExecutor { System.exit(0); } - - System.out.println("Upload the android application "); - //Upload the android application - MobileApplication application = AppOperations.uploadApplication(Constants.DeviceType.ANDROID, "con-app.apk", - "application/vnd.android.package-archive"); - if (application == null) { - System.out.println("Unable to upload the sample android application. Terminating the IoTS QSG now."); - System.exit(0); - } - //Upload the assets - application = AppOperations.uploadAssets(Constants.DeviceType.ANDROID, application); - if (application == null) { - System.out.println( - "Unable to upload the assets for sample android application. Terminating the IoTS QSG now."); - System.exit(0); - } - - System.out.println("Create the android application "); - //Create application entry in publisher - status = AppOperations.addApplication("WSO2Con-Android", application, true); - if (!status) { - System.out.println("Unable to create the android mobile application. Terminating the IoTS QSG now."); - System.exit(0); - } - - - System.out.println("Upload the iOS application "); - //Add the iOS policy - status = PolicyOperations.createPasscodePolicy("ios-passcode-policy1", Constants.DeviceType.IOS); - if (!status) { - System.out.println("Unable to create the ios passcode policy. Terminating the IoTS QSG now."); - System.exit(0); - } - - //Upload the ios application - MobileApplication iOSApplication = AppOperations.uploadApplication(Constants.DeviceType.IOS, "PNDemo.ipa","application/octet-stream"); - iOSApplication.setVersion("1.0.0"); - //Upload the assets - iOSApplication = AppOperations.uploadAssets(Constants.DeviceType.IOS, iOSApplication); - if (iOSApplication == null) { - System.out.println( - "Unable to upload the assets for sample iOS application. Terminating the IoTS QSG now."); - System.exit(0); - } - - System.out.println("Create the iOS application "); - //Create application entry in publisher - status = AppOperations.addApplication("WSO2Con-iOS", iOSApplication, true); - if (!status) { - System.out.println("Unable to create the iOS mobile application. Terminating the IoTS QSG now."); - System.exit(0); - } - System.out.println("Exit"); } }