forked from community/device-mgt-core
commit
6a18d7ab4c
@ -0,0 +1,152 @@
|
||||
package org.wso2.carbon.device.application.mgt.api.services;/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import org.wso2.carbon.device.application.mgt.api.beans.ErrorResponse;
|
||||
import org.wso2.carbon.device.application.mgt.common.Platform;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
@Api(value = "Platform Management", description = "This API carries all platform management related operations " +
|
||||
"such as get all the available platform for a tenant, etc.")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("/platforms")
|
||||
public interface PlatformManagementAPI {
|
||||
public final static String SCOPE = "scope";
|
||||
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
produces = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "GET",
|
||||
value = "get all platforms",
|
||||
notes = "This will get all platforms that is visible for tenants",
|
||||
tags = "Platform Management",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = SCOPE, value = "perm:get-platform")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
code = 200,
|
||||
message = "OK. \n Successfully got platforms list.",
|
||||
response = Platform.class,
|
||||
responseContainer = "List"),
|
||||
@ApiResponse(
|
||||
code = 500,
|
||||
message = "Internal Server Error. \n Error occurred while getting the platform list.",
|
||||
response = ErrorResponse.class)
|
||||
})
|
||||
Response getPlatforms(
|
||||
@ApiParam(
|
||||
name = "status",
|
||||
allowableValues = "ENABLED, DISABLED, ALL",
|
||||
value = "Provide the status of platform for that tenant:\n" +
|
||||
"- ENABLED: The platforms that are currently enabled for the tenant\n" +
|
||||
"- DISABLED: The platforms that can be used by the tenant but disabled to be used for tenant\n" +
|
||||
"- ALL: All the list of platforms that can be used by the tenant",
|
||||
required = false)
|
||||
@QueryParam("status")
|
||||
@Size(max = 45)
|
||||
String status
|
||||
);
|
||||
|
||||
@GET
|
||||
@Path("/{code}")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
produces = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "GET",
|
||||
value = "get platform",
|
||||
notes = "This will get application which was registered with {code}",
|
||||
tags = "Platform Management",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = SCOPE, value = "perm:get-platform")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
code = 200,
|
||||
message = "OK. \n Successfully got requested platform.",
|
||||
response = Platform.class),
|
||||
@ApiResponse(
|
||||
code = 500,
|
||||
message = "Internal Server Error. \n Error occurred while getting the platform.",
|
||||
response = ErrorResponse.class)
|
||||
})
|
||||
Response getPlatform(
|
||||
@ApiParam(
|
||||
name = "code",
|
||||
required = true)
|
||||
@PathParam("code")
|
||||
@Size(max = 45)
|
||||
String code
|
||||
);
|
||||
|
||||
@POST
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
produces = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Add Platform",
|
||||
notes = "This will a platform for the tenant space",
|
||||
tags = "Platform Management",
|
||||
extensions = {
|
||||
@Extension(properties = {
|
||||
@ExtensionProperty(name = SCOPE, value = "perm:add-platform")
|
||||
})
|
||||
}
|
||||
)
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
code = 200,
|
||||
message = "OK. \n Successfully added the platform"),
|
||||
@ApiResponse(
|
||||
code = 400,
|
||||
message = "Bad Request. \n Invalid request parameters passed."),
|
||||
@ApiResponse(
|
||||
code = 500,
|
||||
message = "Internal Server Error. \n Error occurred while getting the platform list.",
|
||||
response = ErrorResponse.class)
|
||||
})
|
||||
Response addPlatform(
|
||||
@ApiParam(
|
||||
name = "platform",
|
||||
value = "The payload of the platform",
|
||||
required = true)
|
||||
Platform platform
|
||||
);
|
||||
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* 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.api.services.impl;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.device.application.mgt.api.APIUtil;
|
||||
import org.wso2.carbon.device.application.mgt.api.services.PlatformManagementAPI;
|
||||
import org.wso2.carbon.device.application.mgt.common.Platform;
|
||||
import org.wso2.carbon.device.application.mgt.common.exception.PlatformManagementException;
|
||||
import org.wso2.carbon.device.application.mgt.core.exception.PlatformManagementDAOException;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PlatformManagementAPIImpl implements PlatformManagementAPI {
|
||||
|
||||
private static final String ALL_STATUS = "ALL";
|
||||
private static final String ENABLED_STATUS = "ENABLED";
|
||||
private static final String DISABLED_STATUS = "DISABLED";
|
||||
|
||||
private static Log log = LogFactory.getLog(PlatformManagementAPIImpl.class);
|
||||
|
||||
|
||||
@Override
|
||||
public Response getPlatforms(@QueryParam("status") String status) {
|
||||
String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true);
|
||||
try {
|
||||
List<Platform> platforms = APIUtil.getPlatformManager().getPlatforms(tenantDomain);
|
||||
List<Platform> results;
|
||||
if (status != null) {
|
||||
if (status.contentEquals(ALL_STATUS)) {
|
||||
results = platforms;
|
||||
} else if (status.contentEquals(ENABLED_STATUS)) {
|
||||
results = new ArrayList<>();
|
||||
for (Platform platform : platforms) {
|
||||
if (platform.isEnabled()) {
|
||||
results.add(platform);
|
||||
}
|
||||
}
|
||||
} else if (status.contentEquals(DISABLED_STATUS)) {
|
||||
results = new ArrayList<>();
|
||||
for (Platform platform : platforms) {
|
||||
if (!platform.isEnabled()) {
|
||||
results.add(platform);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
results = platforms;
|
||||
}
|
||||
} else {
|
||||
results = platforms;
|
||||
}
|
||||
return Response.status(Response.Status.OK).entity(results).build();
|
||||
} catch (PlatformManagementException e) {
|
||||
log.error("Error while getting the platforms for tenant - " + tenantDomain, e);
|
||||
return APIUtil.getResponse(e, Response.Status.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Override
|
||||
@Path("/{code}")
|
||||
public Response getPlatform(@PathParam("code") String code) {
|
||||
String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true);
|
||||
try {
|
||||
Platform platform = APIUtil.getPlatformManager().getPlatform(tenantDomain, code);
|
||||
return Response.status(Response.Status.OK).entity(platform).build();
|
||||
} catch (PlatformManagementDAOException e) {
|
||||
return APIUtil.getResponse(e, Response.Status.INTERNAL_SERVER_ERROR);
|
||||
} catch (PlatformManagementException e) {
|
||||
return APIUtil.getResponse(e, Response.Status.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response addPlatform(Platform platform) {
|
||||
String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true);
|
||||
try {
|
||||
if (platform != null) {
|
||||
if (platform.validate()) {
|
||||
APIUtil.getPlatformManager().register(tenantDomain, platform);
|
||||
return Response.status(Response.Status.CREATED).build();
|
||||
} else {
|
||||
return APIUtil.getResponse("Invalid payload! Platform code and names are mandatory fields!", Response.Status.BAD_REQUEST);
|
||||
}
|
||||
} else {
|
||||
return APIUtil.getResponse("Invalid payload! Platform needs to be passed as payload!", Response.Status.BAD_REQUEST);
|
||||
}
|
||||
} catch (PlatformManagementException e) {
|
||||
return APIUtil.getResponse(e, Response.Status.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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.common.exception;
|
||||
|
||||
public class PlatformManagementException extends ApplicationManagementException {
|
||||
|
||||
public PlatformManagementException(String message, Throwable ex) {
|
||||
super(message, ex);
|
||||
}
|
||||
|
||||
public PlatformManagementException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* 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.deployer;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.util.List;
|
||||
|
||||
@XmlRootElement(name = "Platform")
|
||||
public class Platform {
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
private String description;
|
||||
private String icon;
|
||||
private boolean shared;
|
||||
private boolean tenantMapping;
|
||||
private List<Property> properties;
|
||||
|
||||
@XmlAttribute(name = "id")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@XmlElement(name = "Property")
|
||||
public List<Property> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setProperties(List<Property> properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "icon")
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "isShared")
|
||||
public boolean isShared() {
|
||||
return shared;
|
||||
}
|
||||
|
||||
public void setShared(boolean shared) {
|
||||
this.shared = shared;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "tenantMapping")
|
||||
public boolean isTenantMapping() {
|
||||
return tenantMapping;
|
||||
}
|
||||
|
||||
public void setTenantMapping(boolean tenantMapping) {
|
||||
this.tenantMapping = tenantMapping;
|
||||
}
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
/*
|
||||
* 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.deployer;
|
||||
|
||||
import org.apache.axis2.context.ConfigurationContext;
|
||||
import org.apache.axis2.deployment.AbstractDeployer;
|
||||
import org.apache.axis2.deployment.DeploymentException;
|
||||
import org.apache.axis2.deployment.repository.util.DeploymentFileData;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.context.CarbonContext;
|
||||
import org.wso2.carbon.device.application.mgt.common.exception.PlatformManagementException;
|
||||
import org.wso2.carbon.device.application.mgt.core.internal.DataHolder;
|
||||
import org.wso2.carbon.device.application.mgt.core.util.Constants;
|
||||
import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PlatformDeployer extends AbstractDeployer {
|
||||
|
||||
private static final Log log = LogFactory.getLog(PlatformDeployer.class);
|
||||
|
||||
@Override
|
||||
public void init(ConfigurationContext configurationContext) {
|
||||
File deployementDir = new File(MultitenantUtils.getAxis2RepositoryPath(CarbonContext.getThreadLocalCarbonContext().
|
||||
getTenantId()) + Constants.PLATFORMS_DEPLOYMENT_DIR_NAME);
|
||||
if (!deployementDir.exists()) {
|
||||
if (!deployementDir.mkdir()) {
|
||||
log.warn("Unable to create the deployment dir at: " + deployementDir.getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void deploy(DeploymentFileData deploymentFileData) throws DeploymentException {
|
||||
File deploymentFile = new File(deploymentFileData.getAbsolutePath());
|
||||
try {
|
||||
JAXBContext jaxbContext = JAXBContext.newInstance(Platform.class);
|
||||
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
|
||||
Platform platformConf = (Platform) unmarshaller.unmarshal(deploymentFile);
|
||||
if (platformConf.getName().contentEquals(getPlatformID(deploymentFile.getName()))) {
|
||||
org.wso2.carbon.device.application.mgt.common.Platform platform = convert(platformConf);
|
||||
DataHolder.getInstance().getPlatformManager().register(CarbonContext.getThreadLocalCarbonContext().getTenantDomain(), platform);
|
||||
} else {
|
||||
log.error("Unable to deploy the platform - " + deploymentFile.getAbsolutePath() + "!. Platform config file name - "
|
||||
+ deploymentFile.getName() + " should match with the 'id' provided within the platform configuration!");
|
||||
}
|
||||
} catch (JAXBException e) {
|
||||
log.error("Platform configuration file - " + deploymentFile.getAbsolutePath() + " is invalid!", e);
|
||||
} catch (PlatformManagementException e) {
|
||||
log.error("Unable to deploy the platform - " + deploymentFile.getAbsolutePath(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public void undeploy(String fileName) throws DeploymentException {
|
||||
String platformId = getPlatformID(fileName);
|
||||
try {
|
||||
DataHolder.getInstance().getPlatformManager().unregister(CarbonContext.getThreadLocalCarbonContext().getTenantDomain(), platformId, true);
|
||||
} catch (PlatformManagementException e) {
|
||||
log.error("Error occurred while undeploying the platform - " + fileName);
|
||||
}
|
||||
}
|
||||
|
||||
private static String getPlatformID(String deploymentFileName) {
|
||||
if (deploymentFileName.contains(Constants.PLATFORM_DEPLOYMENT_EXT)) {
|
||||
return deploymentFileName.substring(0, deploymentFileName.length() -
|
||||
Constants.PLATFORM_DEPLOYMENT_EXT.length());
|
||||
}
|
||||
return deploymentFileName;
|
||||
}
|
||||
|
||||
private org.wso2.carbon.device.application.mgt.common.Platform convert(Platform platformConfig) {
|
||||
org.wso2.carbon.device.application.mgt.common.Platform platform = new org.wso2.carbon.device.application.mgt.common.Platform();
|
||||
platform.setIdentifier(platformConfig.getId());
|
||||
platform.setName(platformConfig.getName());
|
||||
platform.setDescription(platformConfig.getDescription());
|
||||
platform.setIconName(platformConfig.getIcon());
|
||||
platform.setFileBased(true);
|
||||
platform.setShared(platformConfig.isShared());
|
||||
platform.setDefaultTenantMapping(platformConfig.isTenantMapping());
|
||||
platform.setEnabled(false);
|
||||
List<org.wso2.carbon.device.application.mgt.common.Platform.Property> properties = new ArrayList<>();
|
||||
for (Property propertyConfig : platformConfig.getProperties()) {
|
||||
org.wso2.carbon.device.application.mgt.common.Platform.Property property = new org.wso2.carbon.device.application.mgt.common.Platform.Property();
|
||||
property.setName(propertyConfig.getName());
|
||||
property.setDefaultValue(propertyConfig.getDefaultValue());
|
||||
property.setOptional(propertyConfig.isOptional());
|
||||
properties.add(property);
|
||||
}
|
||||
platform.setProperties(properties);
|
||||
return platform;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirectory(String s) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExtension(String s) {
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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.deployer;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlValue;
|
||||
|
||||
@XmlRootElement(name = "Property")
|
||||
public class Property {
|
||||
|
||||
private String name;
|
||||
private boolean optional;
|
||||
private String defaultValue;
|
||||
|
||||
@XmlValue
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "optional")
|
||||
public boolean isOptional() {
|
||||
return optional;
|
||||
}
|
||||
|
||||
public void setOptional(boolean optional) {
|
||||
this.optional = optional;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "default")
|
||||
public String getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void setDefaultValue(String defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.exception;
|
||||
|
||||
import org.wso2.carbon.device.application.mgt.common.exception.PlatformManagementException;
|
||||
|
||||
public class PlatformManagementDAOException extends PlatformManagementException {
|
||||
|
||||
public PlatformManagementDAOException(String message, Throwable ex) {
|
||||
super(message, ex);
|
||||
}
|
||||
|
||||
public PlatformManagementDAOException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
<!--
|
||||
~ Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) 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.
|
||||
-->
|
||||
<component xmlns="http://products.wso2.org/carbon">
|
||||
<deployers>
|
||||
<deployer>
|
||||
<directory>platforms</directory>
|
||||
<extension>xml</extension>
|
||||
<class>org.wso2.carbon.device.application.mgt.core.deployer.PlatformDeployer</class>
|
||||
</deployer>
|
||||
</deployers>
|
||||
</component>
|
@ -0,0 +1,6 @@
|
||||
<Platforms>
|
||||
<Platform id="android" name="Android" description="something...." icon="" isShared="true" tenantMapping="true">
|
||||
<Property optional="true">test</Property>
|
||||
<Property optional="false" default="xxxxx">number</Property>
|
||||
</Platform>
|
||||
</Platforms>
|
@ -0,0 +1,29 @@
|
||||
CREATE TABLE APPM_PLATFORM (
|
||||
ID INT NOT NULL AUTO_INCREMENT,
|
||||
CODE VARCHAR (100) NOT NULL,
|
||||
TENANT_DOMAIN VARCHAR (100) NOT NULL ,
|
||||
NAME VARCHAR (255) NOT NULL,
|
||||
DESCRIPTION LONGVARCHAR,
|
||||
IS_SHARED BOOLEAN,
|
||||
ICON_NAME VARCHAR (100),
|
||||
PRIMARY KEY (ID, CODE, TENANT_DOMAIN)
|
||||
);
|
||||
|
||||
CREATE TABLE APPM_PLATFORM_PROPERTIES (
|
||||
ID INT NOT NULL AUTO_INCREMENT,
|
||||
PLATFORM_ID INTEGER NOT NULL,
|
||||
PROP_NAME VARCHAR (100) NOT NULL,
|
||||
OPTIONAL BOOLEAN,
|
||||
DEFAUL_VALUE VARCHAR (255),
|
||||
FOREIGN KEY(PLATFORM_ID) REFERENCES APPM_PLATFORM(ID) ON DELETE CASCADE,
|
||||
PRIMARY KEY (ID, PLATFORM_ID, PROP_NAME)
|
||||
);
|
||||
|
||||
CREATE TABLE APPM_PLATFORM_TENANT_MAPPING (
|
||||
ID INT NOT NULL AUTO_INCREMENT,
|
||||
TENANT_DOMAIN VARCHAR (100) NOT NULL ,
|
||||
PLATFORM_CODE VARCHAR (100) NOT NULL,
|
||||
FOREIGN KEY(PLATFORM_CODE) REFERENCES APPM_PLATFORM(CODE) ON DELETE CASCADE,
|
||||
PRIMARY KEY (ID, TENANT_DOMAIN, PLATFORM_CODE)
|
||||
)
|
||||
|
@ -1,141 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>application-mgt</artifactId>
|
||||
<version>2.0.63-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>org.wso2.carbon.device.application.mgt.extensions</artifactId>
|
||||
<version>2.0.63-SNAPSHOT</version>
|
||||
<packaging>bundle</packaging>
|
||||
<name>WSO2 Carbon - Application Management Extensions</name>
|
||||
<description>WSO2 Carbon - Application Management Extensions</description>
|
||||
<url>http://wso2.org</url>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-scr-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
|
||||
<Bundle-Name>${project.artifactId}</Bundle-Name>
|
||||
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
|
||||
<Bundle-Description>Application Management Extensions Bundle</Bundle-Description>
|
||||
<Import-Package>
|
||||
org.osgi.framework,
|
||||
org.osgi.service.component,
|
||||
org.apache.commons.logging,
|
||||
javax.xml.*,
|
||||
javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional,
|
||||
org.wso2.carbon.context.*,
|
||||
org.wso2.carbon.utils.*,
|
||||
org.w3c.dom,
|
||||
org.json,
|
||||
javax.sql,
|
||||
com.google.gson,
|
||||
javax.naming,
|
||||
javax.xml.bind.annotation,
|
||||
javax.xml.bind,
|
||||
org.wso2.carbon.device.application.mgt.common.*,
|
||||
org.wso2.carbon.device.mgt.core.*,
|
||||
org.wso2.carbon.device.mgt.common.*,
|
||||
</Import-Package>
|
||||
<Export-Package>
|
||||
org.wso2.carbon.device.application.mgt.extensions.*
|
||||
</Export-Package>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.osgi</groupId>
|
||||
<artifactId>org.eclipse.osgi</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.osgi</groupId>
|
||||
<artifactId>org.eclipse.osgi.services</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.equinox</groupId>
|
||||
<artifactId>org.eclipse.equinox.common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon</groupId>
|
||||
<artifactId>org.wso2.carbon.logging</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon</groupId>
|
||||
<artifactId>org.wso2.carbon.utils</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec.wso2</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io.wso2</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json.wso2</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.device.application.mgt.common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
Loading…
Reference in new issue