revert-70aa11f8
prabathabey 10 years ago
commit f2a80d3ede

@ -1,30 +0,0 @@
/**
* Copyright (c) 2012, 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 org.wso2.carbon.device.mgt.common;
public class DefaultOperation implements Operation {
@Override
public void init() {
}
@Override
public void execute() {
}
}

@ -1,33 +1,60 @@
/**
* Copyright (c) 2012, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
/*
* 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
* 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.
* 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;
/**
* This class needs to be implemented by all
*/
public interface Operation {
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Properties;
@XmlRootElement
public class Operation {
public enum Type {
CONFIG, MESSAGE, INFO
}
private String code;
private Properties properties;
private Type type;
@XmlElement
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
@XmlElement
public Properties getProperties() {
return properties;
}
/**
* Initializes any start-up resources required to execute a particular operation
*/
void init();
public void setProperties(Properties properties) {
this.properties = properties;
}
/**
* Executes the functionality configured within the method implementation
*/
void execute();
@XmlElement
public Type getType() {
return type;
}
public void setType(Type type) {
this.type = type;
}
}

@ -1,75 +0,0 @@
/**
* Copyright (c) 2014, 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 org.wso2.carbon.device.mgt.common;
import java.util.Properties;
public class OperationData {
public enum Type {
CONFIG, MESSAGE, STATE
}
private String name;
private boolean state;
private Properties properties;
private String text;
private Type type;
public OperationData(String name, Type type) {
this.type = type;
this.name = name;
}
public OperationData(String name, boolean state) {
this.name = name;
this.type = Type.STATE;
this.state = state;
}
public OperationData(String name, Properties properties) {
this.name = name;
this.type = Type.CONFIG;
this.properties = properties;
}
public OperationData(String name, String text) {
this.name = name;
this.type = Type.MESSAGE;
this.text = text;
}
public Type getType() {
return type;
}
public boolean getState() {
return state;
}
public String getText() {
return text;
}
public Properties getProperties() {
return properties;
}
public String getName() {
return name;
}
}

@ -1,24 +0,0 @@
/**
* Copyright (c) 2012, 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 org.wso2.carbon.device.mgt.common;
public class OperationFactory {
public static Operation getOperation(String type) {
return null;
}
}

@ -15,8 +15,33 @@
*/
package org.wso2.carbon.device.mgt.common;
import java.util.List;
/**
* This represents the Device Operation management functionality which should be implemented by
* the device type plugins.
*/
public interface OperationManager {
boolean executeOperation();
/**
* Method to add a operation to a device or a set of devices.
*
* @param operation Operation to be added
* @param devices List of DeviceIdentifiers to execute the operation
* @throws OperationManagementException If some unusual behaviour is observed while adding the
* operation
*/
public boolean addOperation(Operation operation, List<DeviceIdentifier> devices)
throws OperationManagementException;
/**
* Method to retrieve the list of available operations to a device.
*
* @param deviceId DeviceIdentifier of the device
* @throws OperationManagementException If some unusual behaviour is observed while fetching the
* operation list.
*/
public List<Operation> getOperations(DeviceIdentifier deviceId)
throws OperationManagementException;
}

@ -50,5 +50,4 @@ public class DeviceManagementRepository {
public Map<String, DeviceManagerService> getProviders() {
return providers;
}
}

@ -51,6 +51,7 @@ import org.wso2.carbon.user.core.service.RealmService;
*/
public class DeviceManagementServiceComponent {
public static final String SETUP_OPTION = "setup";
private static Log log = LogFactory.getLog(DeviceManagementServiceComponent.class);
private DeviceManagementRepository pluginRepository = new DeviceManagementRepository();
@ -67,7 +68,7 @@ public class DeviceManagementServiceComponent {
DeviceManagementDataHolder.getInstance().setDeviceManager(deviceManager);
/* If -Dsetup option enabled then create device management database schema */
String setupOption = System.getProperty("setup");
String setupOption = System.getProperty(SETUP_OPTION);
if (setupOption != null) {
if (log.isDebugEnabled()) {
log.debug("-Dsetup is enabled. Device management repository schema initialization is about " +

@ -15,10 +15,21 @@
*/
package org.wso2.carbon.device.mgt.mobile;
import org.wso2.carbon.device.mgt.common.OperationManager;
import org.wso2.carbon.device.mgt.common.*;
public abstract class AbstractMobileOperationManager implements OperationManager {
import java.util.List;
public abstract class AbstractMobileOperationManager implements OperationManager {
@Override
public List<Operation> getOperations(DeviceIdentifier deviceIdentifier)
throws OperationManagementException {
return null;
}
@Override
public boolean addOperation(Operation operation, List<DeviceIdentifier> devices) throws
OperationManagementException {
return true;
}
}

@ -20,7 +20,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.mobile.DataSourceListener;
import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import org.wso2.carbon.device.mgt.mobile.dao.impl.MobileDeviceDAOImpl;
import org.wso2.carbon.device.mgt.mobile.dao.impl.*;
import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
import org.wso2.carbon.device.mgt.mobile.internal.MobileDeviceManagementBundleActivator;
@ -52,6 +52,26 @@ public class MobileDeviceManagementDAOFactory implements DataSourceListener {
return new MobileDeviceDAOImpl(dataSource);
}
public static OperationDAO getOperationDAO(){
return new OperationDAOImpl(dataSource);
}
public static OperationPropertyDAO geOperationPropertyDAO(){
return new OperationPropertyDAOImpl(dataSource);
}
public static DeviceOperationDAO getDeviceOperationDAO(){
return new DeviceOperationDAOImpl(dataSource);
}
public static FeatureDAO getFeatureDAO(){
return new FeatureDAOImpl(dataSource);
}
public static FeaturePropertyDAO getFeaturePropertyDAO(){
return new FeaturePropertyDAOImpl(dataSource);
}
public static MobileDataSourceConfig getMobileDeviceManagementConfig() {
return mobileDataSourceConfig;
}

@ -13,10 +13,10 @@ public interface OperationDAO {
/**
* Add a new operation to plugin operation table.
* @param operation Operation object that holds data related to the operation to be inserted.
* @return The status of the operation. If the insert was successful or not.
* @return The last inserted Id is returned, if the insertion was unsuccessful -1 is returned.
* @throws MobileDeviceManagementDAOException
*/
boolean addOperation(Operation operation) throws MobileDeviceManagementDAOException;
int addOperation(Operation operation) throws MobileDeviceManagementDAOException;
/**
* Update a operation in the operation table.

@ -49,7 +49,9 @@ public class DeviceOperationDAOImpl implements DeviceOperationDAO {
}
} catch (SQLException e) {
String msg = "Error occurred while adding device id - '" +
deviceOperation.getDeviceId() + " and operation id - " + deviceOperation.getOperationId() + "of mapping table MBL_DEVICE_OPERATION";;
deviceOperation.getDeviceId() + " and operation id - " +
deviceOperation.getOperationId() + "of mapping table MBL_DEVICE_OPERATION";
;
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
@ -79,7 +81,8 @@ public class DeviceOperationDAOImpl implements DeviceOperationDAO {
}
} catch (SQLException e) {
String msg = "Error occurred while updating device id - '" +
deviceOperation.getDeviceId() + " and operation id - " + deviceOperation.getOperationId() + "of mapping table MBL_DEVICE_OPERATION";
deviceOperation.getDeviceId() + " and operation id - " +
deviceOperation.getOperationId() + "of mapping table MBL_DEVICE_OPERATION";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
@ -102,12 +105,13 @@ public class DeviceOperationDAOImpl implements DeviceOperationDAO {
stmt.setString(1, deviceId);
stmt.setInt(2, operationId);
int rows = stmt.executeUpdate();
if(rows>0){
if (rows > 0) {
status = true;
}
} catch (SQLException e) {
String msg = "Error occurred while deleting mapping table MBL_DEVICE_OPERATION with device id - '" +
deviceId + " and operation id - " + operationId;
String msg =
"Error occurred while deleting mapping table MBL_DEVICE_OPERATION with device id - '" +
deviceId + " and operation id - " + operationId;
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
@ -139,8 +143,9 @@ public class DeviceOperationDAOImpl implements DeviceOperationDAO {
break;
}
} catch (SQLException e) {
String msg = "Error occurred while fetching mapping table MBL_DEVICE_OPERATION entry with device id - '" +
deviceId + " and operation id - " + operationId;
String msg =
"Error occurred while fetching mapping table MBL_DEVICE_OPERATION entry with device id - '" +
deviceId + " and operation id - " + operationId;
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
@ -155,7 +160,7 @@ public class DeviceOperationDAOImpl implements DeviceOperationDAO {
Connection conn = null;
PreparedStatement stmt = null;
DeviceOperation deviceOperation = null;
List<DeviceOperation> deviceOperations=new ArrayList<DeviceOperation>();
List<DeviceOperation> deviceOperations = new ArrayList<DeviceOperation>();
try {
conn = this.getConnection();
String selectDBQuery =
@ -173,8 +178,9 @@ public class DeviceOperationDAOImpl implements DeviceOperationDAO {
break;
}
} catch (SQLException e) {
String msg = "Error occurred while fetching mapping table MBL_DEVICE_OPERATION entry with device id - '" +
deviceId;
String msg =
"Error occurred while fetching mapping table MBL_DEVICE_OPERATION entry with device id - '" +
deviceId;
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {

@ -64,6 +64,8 @@ public class MobileDeviceDAOImpl implements MobileDeviceDAO {
mobileDevice.setOsVersion(resultSet.getString(5));
mobileDevice.setModel(resultSet.getString(6));
mobileDevice.setVendor(resultSet.getString(7));
mobileDevice.setLatitude(resultSet.getString(8));
mobileDevice.setLongitude(resultSet.getString(9));
break;
}
} catch (SQLException e) {
@ -87,7 +89,7 @@ public class MobileDeviceDAOImpl implements MobileDeviceDAO {
conn = this.getConnection();
String createDBQuery =
"INSERT INTO MBL_DEVICE(MOBILE_DEVICE_ID, REG_ID, IMEI, IMSI, OS_VERSION," +
"DEVICE_MODEL, VENDOR) VALUES (?, ?, ?, ?, ?, ?, ?)";
"DEVICE_MODEL, VENDOR, LATITUDE, LONGITUDE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(createDBQuery);
stmt.setString(1, mobileDevice.getMobileDeviceId());
@ -97,6 +99,8 @@ public class MobileDeviceDAOImpl implements MobileDeviceDAO {
stmt.setString(5, mobileDevice.getOsVersion());
stmt.setString(6, mobileDevice.getModel());
stmt.setString(7, mobileDevice.getVendor());
stmt.setString(8, mobileDevice.getLatitude());
stmt.setString(8, mobileDevice.getLongitude());
int rows = stmt.executeUpdate();
if(rows>0){
status = true;
@ -122,7 +126,7 @@ public class MobileDeviceDAOImpl implements MobileDeviceDAO {
conn = this.getConnection();
String updateDBQuery =
"UPDATE MBL_DEVICE SET REG_ID = ?, IMEI = ?, IMSI = ?, OS_VERSION = ?," +
"DEVICE_MODEL = ?, VENDOR = ? WHERE MOBILE_DEVICE_ID = ?";
"DEVICE_MODEL = ?, VENDOR = ? , LATITUDE = ?, LONGITUDE = ? WHERE MOBILE_DEVICE_ID = ?";
stmt = conn.prepareStatement(updateDBQuery);
stmt.setString(1, mobileDevice.getRegId());
stmt.setString(2, mobileDevice.getImei());
@ -130,7 +134,9 @@ public class MobileDeviceDAOImpl implements MobileDeviceDAO {
stmt.setString(4, mobileDevice.getOsVersion());
stmt.setString(5, mobileDevice.getModel());
stmt.setString(6, mobileDevice.getVendor());
stmt.setString(7, mobileDevice.getMobileDeviceId());
stmt.setString(7, mobileDevice.getLatitude());
stmt.setString(8, mobileDevice.getLongitude());
stmt.setString(9, mobileDevice.getMobileDeviceId());
int rows = stmt.executeUpdate();
if(rows>0){
status = true;
@ -192,6 +198,8 @@ public class MobileDeviceDAOImpl implements MobileDeviceDAO {
mobileDevice.setOsVersion(resultSet.getString(5));
mobileDevice.setModel(resultSet.getString(6));
mobileDevice.setVendor(resultSet.getString(7));
mobileDevice.setLatitude(resultSet.getString(8));
mobileDevice.setLongitude(resultSet.getString(9));
mobileDevices.add(mobileDevice);
}
return mobileDevices;

@ -26,9 +26,9 @@ public class OperationDAOImpl implements OperationDAO {
}
@Override
public boolean addOperation(Operation operation)
public int addOperation(Operation operation)
throws MobileDeviceManagementDAOException {
boolean status = false;
int status = -1;
Connection conn = null;
PreparedStatement stmt = null;
try {
@ -36,12 +36,15 @@ public class OperationDAOImpl implements OperationDAO {
String createDBQuery =
"INSERT INTO MBL_OPERATION(FEATURE_CODE, CREATED_DATE) VALUES ( ?, ?)";
stmt = conn.prepareStatement(createDBQuery);
stmt = conn.prepareStatement(createDBQuery, new String[] { "OPERATION_ID" });
stmt.setString(1, operation.getFeatureCode());
stmt.setInt(2, operation.getCreatedDate());
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
ResultSet rs = stmt.getGeneratedKeys();
if (rs != null && rs.next()) {
status = rs.getInt(1);
}
}
} catch (SQLException e) {
String msg = "Error occurred while adding feature code - '" +

@ -30,6 +30,8 @@ public class MobileDevice implements Serializable {
private String osVersion;
private String model;
private String vendor;
private String latitude;
private String longitude;
public String getMobileDeviceId() {
return mobileDeviceId;
@ -86,4 +88,20 @@ public class MobileDevice implements Serializable {
public void setVendor(String vendor) {
this.vendor = vendor;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
}

@ -15,13 +15,25 @@
*/
package org.wso2.carbon.device.mgt.mobile.impl.android;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.Operation;
import org.wso2.carbon.device.mgt.common.OperationManagementException;
import org.wso2.carbon.device.mgt.mobile.AbstractMobileOperationManager;
import java.util.List;
public class AndroidMobileOperationManager extends AbstractMobileOperationManager {
@Override
public boolean executeOperation() {
return false;
}
@Override
public boolean addOperation(Operation operation, List<DeviceIdentifier> devices) throws
OperationManagementException {
return false;
}
@Override
public List<Operation> getOperations(DeviceIdentifier deviceIdentifier)
throws OperationManagementException {
return null;
}
}

@ -41,6 +41,8 @@ public class MobileDeviceManagementUtil {
private static final String MOBILE_DEVICE_VENDOR = "vendor";
private static final String MOBILE_DEVICE_OS_VERSION = "osVersion";
private static final String MOBILE_DEVICE_MODEL = "model";
private static final String MOBILE_DEVICE_LATITUDE = "latitude";
private static final String MOBILE_DEVICE_LONGITUDE = "longitude";
public static Document convertToDocument(File file) throws DeviceManagementException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
@ -86,6 +88,8 @@ public class MobileDeviceManagementUtil {
mobileDevice.setModel(getPropertyValue(device, MOBILE_DEVICE_MODEL));
mobileDevice.setOsVersion(getPropertyValue(device, MOBILE_DEVICE_OS_VERSION));
mobileDevice.setVendor(getPropertyValue(device, MOBILE_DEVICE_VENDOR));
mobileDevice.setLatitude(getPropertyValue(device,MOBILE_DEVICE_LATITUDE));
mobileDevice.setLongitude(getPropertyValue(device,MOBILE_DEVICE_LONGITUDE));
}
return mobileDevice;
}
@ -101,6 +105,8 @@ public class MobileDeviceManagementUtil {
propertyList.add(getProperty(MOBILE_DEVICE_MODEL,mobileDevice.getModel()));
propertyList.add(getProperty(MOBILE_DEVICE_OS_VERSION,mobileDevice.getOsVersion()));
propertyList.add(getProperty(MOBILE_DEVICE_VENDOR,mobileDevice.getVendor()));
propertyList.add(getProperty(MOBILE_DEVICE_LATITUDE,mobileDevice.getLatitude()));
propertyList.add(getProperty(MOBILE_DEVICE_LONGITUDE,mobileDevice.getLongitude()));
device.setProperties(propertyList);
device.setDeviceIdentifier(mobileDevice.getMobileDeviceId());
}

@ -28,7 +28,7 @@ public interface PolicyDAO {
int addPolicy(String deviceID, String deviceType, Policy policy) throws PolicyManagerDAOException;
void updatePolicy(int id) throws PolicyManagerDAOException;
void updatePolicy(int id, Policy policy) throws PolicyManagerDAOException;
Policy getPolicy() throws PolicyManagerDAOException;

@ -39,7 +39,6 @@ public class PolicyDAOImpl implements PolicyDAO {
@Override
public int addPolicy(Policy policy) throws PolicyManagerDAOException {
return 0;
}
@ -54,7 +53,7 @@ public class PolicyDAOImpl implements PolicyDAO {
}
@Override
public void updatePolicy(int id) throws PolicyManagerDAOException {
public void updatePolicy(int id, Policy policy) throws PolicyManagerDAOException {
}

@ -86,6 +86,7 @@ public class ServerDetails extends Activity {
getResources().getString(R.string.shared_pref_ip));
regId = Preference.get(context.getApplicationContext().getApplicationContext(), getResources().getString(R.string.shared_pref_regId));
//heck if we have the IP saved previously.
if (ipSaved != null) {
serverIP.setText(ipSaved);
CommonUtilities.setServerURL(ipSaved);

@ -0,0 +1,116 @@
/*
* 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);
}
}
}

@ -32,5 +32,4 @@ public class Test {
throw new DeviceManagementException("test ex");
}
}

@ -50,8 +50,9 @@ public class AndroidAPIUtils {
dmService = (DeviceManagementService) ctx.getOSGiService(DeviceManagementService.class, null);
if (dmService == null){
log.error("device management service not initialized");
throw new DeviceManagementServiceException("device management service not initialized");
String msg = "Device management service not initialized";
log.error(msg);
throw new DeviceManagementServiceException(msg);
}
PrivilegedCarbonContext.endTenantFlow();
return dmService;

@ -25,10 +25,6 @@
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<init-param>
<param-name>service-list-stylesheet</param-name>
<param-value>servicelist.css</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>

@ -128,7 +128,8 @@
</fileSet>
<fileSet>
<directory>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/resources/rxts/
<directory>
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/resources/rxts/
</directory>
<outputDirectory>wso2cdm-${project.version}/repository/resources/rxts/</outputDirectory>
</fileSet>
@ -205,8 +206,11 @@
</includes>
</fileSet>
<fileSet>
<directory>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/resources</directory>
<outputDirectory>${project.artifactId}-${project.version}/repository/resources</outputDirectory>
<directory>
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/resources
</directory>
<outputDirectory>${project.artifactId}-${project.version}/repository/resources
</outputDirectory>
</fileSet>
<!-- copy cdm jaggery app -->
<fileSet>
@ -241,6 +245,12 @@
</outputDirectory>
<fileMode>755</fileMode>
</file>
<file>
<source>../rest-api/target/wso2cdm-api.war</source>
<outputDirectory>wso2cdm-${pom.version}/repository/deployment/server/webapps
</outputDirectory>
<fileMode>755</fileMode>
</file>
<!-- <file>
<source>
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/tomcat/webapp-classloading.xml

@ -22,3 +22,5 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE
CONSTRAINT fk_DM_DEVICE_DM_DEVICE_TYPE2 FOREIGN KEY (DEVICE_TYPE_ID )
REFERENCES DM_DEVICE_TYPE (ID ) ON DELETE NO ACTION ON UPDATE NO ACTION
);
-- TO:DO - Remove this INSERT sql statement.
Insert into DM_DEVICE_TYPE (ID,NAME) VALUES (1, 'android');

@ -10,6 +10,8 @@ CREATE TABLE IF NOT EXISTS `MBL_DEVICE` (
`OS_VERSION` VARCHAR(45) NULL DEFAULT NULL ,
`DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL ,
`VENDOR` VARCHAR(45) NULL DEFAULT NULL ,
`LATITUDE` VARCHAR(45) NULL DEFAULT NULL,
`LONGITUDE` VARCHAR(45) NULL DEFAULT NULL,
PRIMARY KEY (`MOBILE_DEVICE_ID`) );

@ -0,0 +1,161 @@
<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/maven-v4_0_0.xsd">
<parent>
<groupId>org.wso2.cdmserver</groupId>
<artifactId>wso2cdmserver-product</artifactId>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon</groupId>
<artifactId>wso2cdm-api</artifactId>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>WSO2 CDM REST API</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
<version>2.3.2</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<packagingExcludes>WEB-INF/lib/*cxf*.jar</packagingExcludes>
<warName>${project.artifactId}</warName>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>deploy</id>
<build>
<defaultGoal>compile</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy todir="${basedir}/../../../repository/deployment/server/webapps"
overwrite="true">
<fileset dir="${basedir}/target">
<include name="${project.artifactId}.war"/>
</fileset>
</copy>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>client</id>
<build>
<defaultGoal>test</defaultGoal>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.utils</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
<version>2.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.device.mgt.core</artifactId>
<version>2.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.logging</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>1.9.0</version>
</dependency>
</dependencies>
<properties>
<cxf.version>2.6.1</cxf.version>
<junit.version>4.8.2</junit.version>
</properties>
</project>

@ -0,0 +1,111 @@
/*
* 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 org.wso2.carbon.cdm.api;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.cdm.api.common.CDMAPIException;
import org.wso2.carbon.cdm.api.context.DeviceOperationContext;
import org.wso2.carbon.cdm.api.util.CDMAPIUtils;
import org.wso2.carbon.cdm.api.util.Message;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementService;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import java.util.List;
/**
* Operation related 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
public List<org.wso2.carbon.device.mgt.common.Operation> getAllOperations()
throws CDMAPIException {
List<org.wso2.carbon.device.mgt.common.Operation> operations;
DeviceManagementService dmService;
OperationManager operationManager;
try {
dmService = CDMAPIUtils.getDeviceManagementService();
} catch (DeviceManagementServiceException deviceServiceMgtEx) {
String errorMsg = "Device management service error";
log.error(errorMsg, deviceServiceMgtEx);
throw new CDMAPIException(errorMsg, deviceServiceMgtEx);
}
try {
operationManager = dmService.getOperationManager(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
operations = operationManager.getOperations(null);
} catch (DeviceManagementException deviceMgtEx) {
String errorMsg = "Error occurred while fetching the operation manager.";
log.error(errorMsg, deviceMgtEx);
throw new CDMAPIException(errorMsg, deviceMgtEx);
} catch (OperationManagementException ex) {
String errorMsg = "Error occurred while fetching the operations for the device.";
log.error(errorMsg, ex);
throw new CDMAPIException(errorMsg, ex);
}
return operations;
}
@POST
public Message addOperation(DeviceOperationContext operationContext) throws CDMAPIException {
DeviceManagementService dmService;
OperationManager operationManager;
Message responseMsg = new Message();
try {
dmService = CDMAPIUtils.getDeviceManagementService();
} catch (DeviceManagementServiceException deviceServiceMgtEx) {
String errorMsg = "Device management service error";
log.error(errorMsg, deviceServiceMgtEx);
throw new CDMAPIException(errorMsg, deviceServiceMgtEx);
}
try {
operationManager = dmService.getOperationManager(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
boolean status = operationManager.addOperation(operationContext.getOperation(),
operationContext.getDevices());
if (status) {
Response.status(HttpStatus.SC_CREATED);
responseMsg.setResponseMessage("Operation has added successfully.");
} else {
Response.status(HttpStatus.SC_OK);
responseMsg.setResponseMessage("Failure in adding the Operation.");
}
return responseMsg;
} catch (DeviceManagementException deviceMgtEx) {
String errorMsg = "Error occurred while adding the operation";
log.error(errorMsg, deviceMgtEx);
throw new CDMAPIException(errorMsg, deviceMgtEx);
} catch (OperationManagementException ex) {
String errorMsg = "Error occurred while saving the operation";
log.error(errorMsg, ex);
throw new CDMAPIException(errorMsg, ex);
}
}
}

@ -0,0 +1,57 @@
/*
* 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 org.wso2.carbon.cdm.api.common;
/**
* Custom exception class for handling CDM API related exceptions.
*/
public class CDMAPIException extends Exception {
private static final long serialVersionUID = 7950151650447893900L;
private String errorMessage;
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public CDMAPIException(String msg, Exception nestedEx) {
super(msg, nestedEx);
setErrorMessage(msg);
}
public CDMAPIException(String message, Throwable cause) {
super(message, cause);
setErrorMessage(message);
}
public CDMAPIException(String msg) {
super(msg);
setErrorMessage(msg);
}
public CDMAPIException() {
super();
}
public CDMAPIException(Throwable cause) {
super(cause);
}
}

@ -0,0 +1,30 @@
/*
* 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 org.wso2.carbon.cdm.api.common;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
@Produces({ "application/json", "application/xml" })
public class ErrorHandler implements ExceptionMapper<CDMAPIException> {
public Response toResponse(CDMAPIException exception) {
ErrorMessage errorMessage = new ErrorMessage();
errorMessage.setErrorMessage(exception.getErrorMessage());
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
}
}

@ -0,0 +1,39 @@
/*
* 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 org.wso2.carbon.cdm.api.common;
public class ErrorMessage {
private String errorMessage;
private String errorCode;
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public String getErrorCode() {
return errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
}

@ -0,0 +1,52 @@
/*
* 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 org.wso2.carbon.cdm.api.context;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.Operation;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
/**
* Model object of DeviceOperation.
*/
@XmlRootElement
public class DeviceOperationContext {
private List<DeviceIdentifier> devices;
private Operation operation;
@XmlElement
public List<DeviceIdentifier> getDevices() {
return devices;
}
public void setDevices(List<DeviceIdentifier> devices) {
this.devices = devices;
}
@XmlElement
public Operation getOperation() {
return operation;
}
public void setOperation(Operation operation) {
this.operation = operation;
}
}

@ -0,0 +1,23 @@
/*
* 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 org.wso2.carbon.cdm.api.util;
/**
* Constants used by CDM REST API implementation.
*/
public class CDMAPIConstants {
}

@ -0,0 +1,51 @@
/*
* 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 org.wso2.carbon.cdm.api.util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.DeviceManagementServiceException;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementService;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
/**
* CDMAPIUtils class provides utility function used by CDM REST-API classes.
*/
public class CDMAPIUtils {
private static Log log = LogFactory.getLog(CDMAPIUtils.class);
public static DeviceManagementService getDeviceManagementService() throws DeviceManagementServiceException{
// until complete login this is use to load super tenant context
DeviceManagementService dmService;
PrivilegedCarbonContext.startTenantFlow();
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
ctx.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
ctx.setTenantId(MultitenantConstants.SUPER_TENANT_ID);
dmService = (DeviceManagementService) ctx.getOSGiService(DeviceManagementService.class, null);
if (dmService == null){
String msg = "device management service not initialized";
log.error(msg);
throw new DeviceManagementServiceException(msg);
}
PrivilegedCarbonContext.endTenantFlow();
return dmService;
}
}

@ -0,0 +1,46 @@
/*
* 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 org.wso2.carbon.cdm.api.util;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class Message {
private String responseCode;
private String responseMessage;
@XmlElement
public String getResponseMessage() {
return responseMessage;
}
public void setResponseMessage(String responseMessage) {
this.responseMessage = responseMessage;
}
@XmlElement
public String getResponseCode() {
return responseCode;
}
public void setResponseCode(String responseCode) {
this.responseCode = responseCode;
}
}

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright 2015 WSO2, Inc. (http://wso2.com)
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!--
This file defines class loading policy of the whole container. But this behaviour can be overridden by individual webapps by putting this file into the META-INF/ directory.
-->
<Classloading xmlns="http://wso2.org/projects/as/classloading">
<!-- Parent-first or child-first. Default behaviour is child-first.-->
<ParentFirst>false</ParentFirst>
<!--
Default environments that contains provides to all the webapps. This can be overridden by individual webapps by specifing required environments
Tomcat environment is the default and every webapps gets it even if they didn't specify it.
e.g. If a webapps requires CXF, they will get both Tomcat and CXF.
-->
<Environments>CXF,Carbon</Environments>
</Classloading>

@ -0,0 +1,40 @@
<?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.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<jaxrs:server id="operationService" address="/operations">
<jaxrs:serviceBeans>
<ref bean="operationServiceBean"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jsonProvider"/>
<ref bean="errorHandler"/>
</jaxrs:providers>
</jaxrs:server>
<bean id="operationServiceBean" class="org.wso2.carbon.cdm.api.Operation"/>
<bean id="jsonProvider" class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>
<bean id="errorHandler" class="org.wso2.carbon.cdm.api.common.ErrorHandler"/>
</beans>

@ -0,0 +1,37 @@
<?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.
-->
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<display-name>CDM-API</display-name>
<servlet>
<description>JAX-WS/JAX-RS CDM Endpoint</description>
<display-name>JAX-WS/JAX-RS Servlet</display-name>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
</web-app>

@ -34,7 +34,7 @@
<name>WSO2 Connected Device Manager (CDM) - Parent</name>
<modules>
<!--<module>modules/agents/android/jax-rs</module>-->
<module>modules/rest-api</module>
<module>modules/agents/windows/jax-rs</module>
<module>modules/agents/android/jax-rs</module>
<module>modules/p2-profile-gen</module>

Loading…
Cancel
Save