@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* * 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.
|
||||||
|
* /
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.common;
|
||||||
|
|
||||||
|
public class License {
|
||||||
|
|
||||||
|
private String licenseName;
|
||||||
|
private String licenseText;
|
||||||
|
private String licenseVersion;
|
||||||
|
|
||||||
|
public String getLicenseName() {
|
||||||
|
return licenseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLicenseName(String licenseName) {
|
||||||
|
this.licenseName = licenseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLicenseText() {
|
||||||
|
return licenseText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLicenseText(String licenseText) {
|
||||||
|
this.licenseText = licenseText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLicenseVersion() {
|
||||||
|
return licenseVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLicenseVersion(String licenseVersion) {
|
||||||
|
this.licenseVersion = licenseVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,24 +1,21 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014 WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
*
|
*
|
||||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* Version 2.0 (the "License"); you may not use this file except
|
* you may not use this file except in compliance with the License.
|
||||||
* in compliance with the License.
|
* You may obtain a copy of the License at
|
||||||
* You may obtain a copy of the License at
|
*
|
||||||
*
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
*
|
||||||
*
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* software distributed under the License is distributed on an
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* See the License for the specific language governing permissions and
|
||||||
* KIND, either express or implied. See the License for the
|
* limitations under the License.
|
||||||
* specific language governing permissions and limitations
|
*/
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.wso2.carbon.policy.mgt.core.util;
|
package org.wso2.carbon.policy.mgt.core.util;
|
||||||
|
|
||||||
public final class PolicyManagementConstants {
|
public final class PolicyManagementConstants {
|
||||||
|
|
||||||
public static final String DEVICE_CONFIG_XML_NAME = "cdm-config.xml";
|
public static final String DEVICE_CONFIG_XML_NAME = "cdm-config.xml";
|
||||||
}
|
}
|
||||||
|
@ -1,116 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015, 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cdm.api.android;
|
|
||||||
|
|
||||||
import cdm.api.android.common.AndroidAgentException;
|
|
||||||
import cdm.api.android.util.AndroidAPIUtils;
|
|
||||||
import cdm.api.android.util.Message;
|
|
||||||
import org.apache.commons.httpclient.HttpStatus;
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.wso2.carbon.device.mgt.common.*;
|
|
||||||
import org.wso2.carbon.device.mgt.core.service.DeviceManagementService;
|
|
||||||
|
|
||||||
import javax.ws.rs.*;
|
|
||||||
import javax.ws.rs.core.Response;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Android Device Operation REST-API implementation.
|
|
||||||
*/
|
|
||||||
@Produces({ "application/json", "application/xml" })
|
|
||||||
@Consumes({ "application/json", "application/xml" })
|
|
||||||
public class Operation {
|
|
||||||
|
|
||||||
private static Log log = LogFactory.getLog(Operation.class);
|
|
||||||
|
|
||||||
@GET
|
|
||||||
@Path("{id}")
|
|
||||||
public List<org.wso2.carbon.device.mgt.common.Operation> getAllOperations(
|
|
||||||
@PathParam("id") String id) throws
|
|
||||||
AndroidAgentException {
|
|
||||||
List<org.wso2.carbon.device.mgt.common.Operation> operations;
|
|
||||||
String msg;
|
|
||||||
DeviceManagementService dmService;
|
|
||||||
|
|
||||||
try {
|
|
||||||
dmService = AndroidAPIUtils.getDeviceManagementService();
|
|
||||||
} catch (DeviceManagementServiceException deviceMgtServiceEx) {
|
|
||||||
msg = "Device management service error";
|
|
||||||
log.error(msg, deviceMgtServiceEx);
|
|
||||||
throw new AndroidAgentException(msg, deviceMgtServiceEx);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
DeviceIdentifier deviceIdentifier = AndroidAPIUtils.convertToDeviceIdentifierObject(id);
|
|
||||||
operations = dmService.getOperationManager(
|
|
||||||
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID)
|
|
||||||
.getOperations(deviceIdentifier);
|
|
||||||
Response.status(HttpStatus.SC_OK);
|
|
||||||
return operations;
|
|
||||||
} catch (DeviceManagementException e) {
|
|
||||||
msg = "Error occurred while fetching the operation manager for the device type.";
|
|
||||||
log.error(msg, e);
|
|
||||||
Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
|
||||||
throw new AndroidAgentException(msg, e);
|
|
||||||
} catch (OperationManagementException e) {
|
|
||||||
msg = "Error occurred while fetching the operation list for the device.";
|
|
||||||
log.error(msg, e);
|
|
||||||
Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
|
||||||
throw new AndroidAgentException(msg, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PUT
|
|
||||||
public Message updateOperation() throws
|
|
||||||
AndroidAgentException {
|
|
||||||
String msg;
|
|
||||||
DeviceManagementService dmService;
|
|
||||||
Message responseMsg = new Message();
|
|
||||||
|
|
||||||
try {
|
|
||||||
dmService = AndroidAPIUtils.getDeviceManagementService();
|
|
||||||
|
|
||||||
} catch (DeviceManagementServiceException deviceMgtServiceEx) {
|
|
||||||
msg = "Device management service error";
|
|
||||||
log.error(msg, deviceMgtServiceEx);
|
|
||||||
throw new AndroidAgentException(msg, deviceMgtServiceEx);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
boolean result = dmService.getOperationManager("").addOperation(null, null);
|
|
||||||
if (result) {
|
|
||||||
Response.status(HttpStatus.SC_OK);
|
|
||||||
responseMsg.setResponseMessage("Device has already enrolled");
|
|
||||||
} else {
|
|
||||||
Response.status(HttpStatus.SC_NOT_FOUND);
|
|
||||||
responseMsg.setResponseMessage("Operation not found");
|
|
||||||
}
|
|
||||||
return responseMsg;
|
|
||||||
} catch (DeviceManagementException e) {
|
|
||||||
msg = "Error occurred while fetching the operation manager for the device type.";
|
|
||||||
log.error(msg, e);
|
|
||||||
Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
|
||||||
throw new AndroidAgentException(msg, e);
|
|
||||||
} catch (OperationManagementException e) {
|
|
||||||
msg = "Error occurred while updating the operation status for the device.";
|
|
||||||
log.error(msg, e);
|
|
||||||
Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
|
||||||
throw new AndroidAgentException(msg, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<artifactType type="application/vnd.wso2-license+xml" shortName="license" singularLabel="License" pluralLabel="Licenses"
|
||||||
|
hasNamespace="false" iconSet="10">
|
||||||
|
<storagePath>/license/@{overview_provider}/@{overview_name}/@{overview_version}</storagePath>
|
||||||
|
<nameAttribute>overview_name</nameAttribute>
|
||||||
|
<ui>
|
||||||
|
<list>
|
||||||
|
<column name="Provider">
|
||||||
|
<data type="path" value="overview_provider" href="@{storagePath}"/>
|
||||||
|
</column>
|
||||||
|
<column name="Name">
|
||||||
|
<data type="path" value="overview_name" href="@{storagePath}"/>
|
||||||
|
</column>
|
||||||
|
<column name="Version">
|
||||||
|
<data type="path" value="overview_version" href="@{storagePath}"/>
|
||||||
|
</column>
|
||||||
|
</list>
|
||||||
|
</ui>
|
||||||
|
<content>
|
||||||
|
<table name="Overview">
|
||||||
|
<field type="text" required="true">
|
||||||
|
<name>Provider</name>
|
||||||
|
</field>
|
||||||
|
<field type="text" required="true">
|
||||||
|
<name>Name</name>
|
||||||
|
</field>
|
||||||
|
<field type="text" required="true">
|
||||||
|
<name>Version</name>
|
||||||
|
</field>
|
||||||
|
<field type="text">
|
||||||
|
<name>Createdtime</name>
|
||||||
|
</field>
|
||||||
|
<field type="text-area">
|
||||||
|
<name>License</name>
|
||||||
|
</field>
|
||||||
|
</table>
|
||||||
|
</content>
|
||||||
|
</artifactType>
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 1015 B After Width: | Height: | Size: 1015 B |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |