Adding operation manager related changes

revert-70aa11f8
prabathabey 10 years ago
parent 021c27666c
commit 8662eb36e4

@ -21,7 +21,6 @@ package org.wso2.carbon.device.mgt.common.spi;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.OperationManager;
import java.util.List;
@ -29,10 +28,10 @@ import java.util.List;
* This represents the service provider interface that has to be implemented by any of new
* device type plugin implementation intended to be managed through CDM.
*/
public interface DeviceManagerService {
public interface DeviceManager {
/**
* Method to retrieve the provider type that implements DeviceManagerService interface.
* Method to retrieve the provider type that implements DeviceManager interface.
*
* @return Returns provider type
*/
@ -129,12 +128,4 @@ public interface DeviceManagerService {
*/
boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException;
/**
* Method to retrieve the Operation manager implementation associated with a given plugin.
*
* @return An appropriate instance of the underlying operation management implementation
* @throws DeviceManagementException
*/
OperationManager getOperationManager() throws DeviceManagementException;
}

@ -0,0 +1,62 @@
/*
* 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.core;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.core.config.license.License;
import org.wso2.carbon.device.mgt.core.license.mgt.LicenseManager;
import org.wso2.carbon.device.mgt.core.operation.mgt.OperationManager;
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException;
import java.util.List;
/**
* Proxy class for all Device Management related operations that take the corresponding plugin type in
* and resolve the appropriate plugin implementation
*/
public interface DeviceManagementService {
boolean enrollDevice(Device device) throws DeviceManagementException;
boolean modifyEnrollment(Device device) throws DeviceManagementException;
boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException;
boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException;
boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException;
boolean setActive(DeviceIdentifier deviceId, boolean status) throws DeviceManagementException;
List<Device> getAllDevices(String type) throws DeviceManagementException;
Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException;
boolean updateDeviceInfo(Device device) throws DeviceManagementException;
boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException;
OperationManager getOperationManager(String type) throws DeviceManagementException;
License getLicense(String type) throws DeviceManagementException;
boolean addLicense(String type, License license) throws DeviceManagementException;
}

@ -22,7 +22,11 @@ import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.OperationManager;
import org.wso2.carbon.device.mgt.core.config.license.License;
import org.wso2.carbon.device.mgt.core.license.mgt.LicenseManagementException;
import org.wso2.carbon.device.mgt.core.license.mgt.LicenseManager;
import org.wso2.carbon.device.mgt.core.license.mgt.LicenseManagerImpl;
import org.wso2.carbon.device.mgt.core.operation.mgt.OperationManager;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig;
import org.wso2.carbon.device.mgt.core.dao.DeviceDAO;
@ -32,24 +36,26 @@ import org.wso2.carbon.device.mgt.core.dao.DeviceTypeDAO;
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
import org.wso2.carbon.device.mgt.core.dto.DeviceType;
import org.wso2.carbon.device.mgt.core.dto.Status;
import org.wso2.carbon.device.mgt.core.operation.mgt.OperationManagerImpl;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
public class DeviceManagerImpl implements DeviceManager {
public class DeviceManagementServiceProviderImpl implements DeviceManager {
private static Log log = LogFactory.getLog(DeviceManagerImpl.class);
private DeviceDAO deviceDAO;
private DeviceTypeDAO deviceTypeDAO;
private DeviceManagementConfig config;
private DeviceManagementRepository pluginRepository;
private OperationManager operationManager;
private LicenseManager licenseManager;
public DeviceManagerImpl(DeviceManagementConfig config,
DeviceManagementRepository pluginRepository) {
this.config = config;
public DeviceManagementServiceProviderImpl(DeviceManagementRepository pluginRepository) {
this.pluginRepository = pluginRepository;
this.deviceDAO = DeviceManagementDAOFactory.getDeviceDAO();
this.deviceTypeDAO = DeviceManagementDAOFactory.getDeviceTypeDAO();
this.operationManager = new OperationManagerImpl();
this.licenseManager = new LicenseManagerImpl();
}
@Override
@ -66,9 +72,8 @@ public class DeviceManagerImpl implements DeviceManager {
deviceDto.setDeviceTypeId(deviceTypeId);
this.getDeviceDAO().addDevice(deviceDto);
} catch (DeviceManagementDAOException e) {
throw new DeviceManagementException(
"Error occurred while enrolling the device '" + device.getId() + "'",
e);
throw new DeviceManagementException("Error occurred while enrolling the device '" + device.getId() +
"'", e);
}
return status;
}
@ -81,9 +86,8 @@ public class DeviceManagerImpl implements DeviceManager {
try {
this.getDeviceDAO().updateDevice(DeviceManagementDAOUtil.convertDevice(device));
} catch (DeviceManagementDAOException e) {
throw new DeviceManagementException(
"Error occurred while modifying the device '" + device.getId() + "'",
e);
throw new DeviceManagementException("Error occurred while modifying the device '" + device.getId() +
"'", e);
}
return status;
}
@ -139,8 +143,8 @@ public class DeviceManagerImpl implements DeviceManager {
devicesList.add(convertedDevice);
}
} catch (DeviceManagementDAOException e) {
throw new DeviceManagementException(
"Error occurred while obtaining the device for type '" + type + "'", e);
throw new DeviceManagementException("Error occurred while obtaining the device for type '" + type +
"'", e);
}
return devicesList;
}
@ -165,9 +169,8 @@ public class DeviceManagerImpl implements DeviceManager {
}
}
} catch (DeviceManagementDAOException e) {
throw new DeviceManagementException(
"Error occurred while obtaining the device for id '" + deviceId.getId() + "'",
e);
throw new DeviceManagementException("Error occurred while obtaining the device for id '" +
deviceId.getId() + "'", e);
}
return convertedDevice;
}
@ -188,8 +191,28 @@ public class DeviceManagerImpl implements DeviceManager {
}
public OperationManager getOperationManager(String type) throws DeviceManagementException {
DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(type);
return dms.getOperationManager();
return operationManager;
}
@Override
public License getLicense(String type) throws DeviceManagementException {
try {
return licenseManager.getLicense(type, Locale.ENGLISH.getLanguage());
} catch (LicenseManagementException e) {
throw new DeviceManagementException("Error occurred while retrieving license configured for " +
"device type '" + type + "'", e);
}
}
@Override
public boolean addLicense(String type, License license) throws DeviceManagementException {
try {
return licenseManager.addLicense(type, license);
} catch (LicenseManagementException e) {
throw new DeviceManagementException("Error occurred while adding license for device type '" +
type + "'", e);
}
}
public DeviceDAO getDeviceDAO() {
@ -203,4 +226,5 @@ public class DeviceManagerImpl implements DeviceManager {
public DeviceManagementRepository getPluginRepository() {
return pluginRepository;
}
}

@ -1,58 +0,0 @@
/*
* 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.core;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.OperationManager;
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException;
import java.util.List;
/**
* Proxy class for all Device Management related operations that take the corresponding plugin type in
* and resolve the appropriate plugin implementation
*/
public interface DeviceManager {
public boolean enrollDevice(Device device) throws DeviceManagementException;
public boolean modifyEnrollment(Device device) throws DeviceManagementException;
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException;
public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException;
public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException;
public boolean setActive(DeviceIdentifier deviceId, boolean status)
throws DeviceManagementException;
public List<Device> getAllDevices(String type) throws DeviceManagementException;
public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException;
public boolean updateDeviceInfo(Device device) throws DeviceManagementException;
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType)
throws DeviceManagementException;
public OperationManager getOperationManager(String type) throws DeviceManagementException;
}

@ -0,0 +1,22 @@
/*
* Copyright (c) 2015, 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.core.license.mgt;
public class GenericArtifactManagerFactory {
}

@ -0,0 +1,27 @@
/*
* Copyright (c) 2015, 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.core.operation.mgt;
import org.wso2.carbon.device.mgt.common.Operation;
public class CommandOperation extends Operation {
}

@ -0,0 +1,22 @@
/*
* Copyright (c) 2015, 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.core.operation.mgt;
public class ConfigOperation {
}

@ -16,7 +16,7 @@
* under the License.
*/
package org.wso2.carbon.device.mgt.common;
package org.wso2.carbon.device.mgt.core.operation.mgt;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@ -15,7 +15,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.common;
package org.wso2.carbon.device.mgt.core.operation.mgt;
public class OperationExecutionException extends Exception {

@ -15,7 +15,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.common;
package org.wso2.carbon.device.mgt.core.operation.mgt;
public class OperationManagementException extends Exception {

@ -15,7 +15,9 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.common;
package org.wso2.carbon.device.mgt.core.operation.mgt;
import org.wso2.carbon.device.mgt.common.*;
import java.util.List;
@ -30,7 +32,7 @@ public interface OperationManager {
*
* @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
* @throws org.wso2.carbon.device.mgt.common.OperationManagementException If some unusual behaviour is observed while adding the
* operation
*/
public boolean addOperation(Operation operation, List<DeviceIdentifier> devices)
@ -60,7 +62,7 @@ public interface OperationManager {
* TODO: Move this into a separate FeatureManager
* @param deviceType - Device type
* @return a list of Feature objects.
* @throws FeatureManagementException
* @throws org.wso2.carbon.device.mgt.common.FeatureManagementException
*/
public List<Feature> getFeaturesForDeviceType(String deviceType) throws FeatureManagementException;

@ -0,0 +1,69 @@
/*
* Copyright (c) 2015, 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.core.operation.mgt;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationDAO;
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOException;
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory;
import java.util.List;
public class OperationManagerImpl implements OperationManager {
private OperationDAO commandOperationDAO = OperationManagementDAOFactory.getCommandOperationDAO();
private OperationDAO configOperationDAO = OperationManagementDAOFactory.getConfigOperationDAO();
private OperationDAO simpleOperationDAO = OperationManagementDAOFactory.getSimpleOperationDAO();
@Override
public boolean addOperation(Operation operation,
List<DeviceIdentifier> devices) throws OperationManagementException {
try {
return this.lookupOperationDAO(operation).addOperation(operation);
} catch (OperationManagementDAOException e) {
throw new OperationManagementException("Error occurred while adding operation", e);
}
}
@Override
public List<Operation> getOperations(DeviceIdentifier deviceId) throws OperationManagementException {
return null;
}
@Override
public List<Operation> getPendingOperations(DeviceIdentifier deviceId) throws OperationManagementException {
return null;
}
@Override
public List<Feature> getFeaturesForDeviceType(String deviceType) throws FeatureManagementException {
return null;
}
private OperationDAO lookupOperationDAO(Operation operation) {
if (operation instanceof CommandOperation) {
return commandOperationDAO;
} else if (operation instanceof ConfigOperation) {
return configOperationDAO;
} else {
return simpleOperationDAO;
}
}
}

@ -0,0 +1,22 @@
/*
* Copyright (c) 2015, 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.core.operation.mgt;
public class SimpleOperation {
}

@ -0,0 +1,22 @@
/*
* Copyright (c) 2015, 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.core.operation.mgt.dao;
public class OperationDAO {
}

@ -0,0 +1,23 @@
/*
* Copyright (c) 2015, 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.core.operation.mgt.dao;
public class OperationManagementDAOException extends Exception {
}

@ -0,0 +1,22 @@
/*
* Copyright (c) 2015, 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.core.operation.mgt.dao;
public class OperationManagementDAOFactory {
}

@ -0,0 +1,22 @@
/*
* Copyright (c) 2015, 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.core.operation.mgt.dao;
public class OperationManagementDAOUtil {
}

@ -0,0 +1,22 @@
/*
* Copyright (c) 2015, 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.core.operation.mgt.dao;
public class OperationMappingDAO {
}

@ -0,0 +1,22 @@
/*
* Copyright (c) 2015, 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.core.operation.mgt.dao.impl;
public class AbstractOperationDAO {
}

@ -0,0 +1,61 @@
/*
* Copyright (c) 2015, 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.core.operation.mgt.dao.impl;
import org.wso2.carbon.device.mgt.common.Operation;
import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation;
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOException;
import javax.sql.DataSource;
import java.util.List;
public class CommandOperationDAOImpl extends AbstractOperationDAO {
public CommandOperationDAOImpl(DataSource dataSource) {
super(dataSource);
}
@Override
public boolean addOperation(Operation operation) throws OperationManagementDAOException {
CommandOperation booleanOp = (CommandOperation) operation;
addOperationMetadata();
return false;
}
@Override
public boolean updateOperation(Operation operation) throws OperationManagementDAOException {
return false;
}
@Override
public boolean deleteOperation(int id) throws OperationManagementDAOException {
return false;
}
@Override
public Operation getOperation(int id) throws OperationManagementDAOException {
return null;
}
@Override
public List<Operation> getOperations() throws OperationManagementDAOException {
return null;
}
}

@ -0,0 +1,22 @@
/*
* Copyright (c) 2015, 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.core.operation.mgt.dao.impl;
public class ConfigOperationDAOImpl {
}

@ -0,0 +1,22 @@
/*
* Copyright (c) 2015, 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.core.operation.mgt.dao.impl;
public class OperationMappingDAOImpl {
}

@ -0,0 +1,22 @@
/*
* Copyright (c) 2015, 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.core.operation.mgt.dao.impl;
public class SimpleOperationDAOImpl {
}

@ -20,13 +20,13 @@ package org.wso2.carbon.device.mgt.core.service;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.OperationManager;
import org.wso2.carbon.device.mgt.core.operation.mgt.OperationManager;
import org.wso2.carbon.device.mgt.core.DeviceManager;
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
import java.util.List;
public class DeviceManagementService implements DeviceManager {
public class DeviceManagementServiceImpl implements DeviceManager {
@Override
public boolean enrollDevice(Device device) throws DeviceManagementException {
@ -40,8 +40,7 @@ public class DeviceManagementService implements DeviceManager {
@Override
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManager()
.disenrollDevice(deviceId);
return DeviceManagementDataHolder.getInstance().getDeviceManager().disenrollDevice(deviceId);
}
@Override
@ -55,10 +54,8 @@ public class DeviceManagementService implements DeviceManager {
}
@Override
public boolean setActive(DeviceIdentifier deviceId, boolean status)
throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManager()
.setActive(deviceId, status);
public boolean setActive(DeviceIdentifier deviceId, boolean status) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManager().setActive(deviceId, status);
}
@Override
@ -69,10 +66,7 @@ public class DeviceManagementService implements DeviceManager {
@Override
public org.wso2.carbon.device.mgt.common.Device getDevice(DeviceIdentifier deviceId)
throws DeviceManagementException {
Device device =
DeviceManagementDataHolder.getInstance().getDeviceManager().getDevice(deviceId);
return device;
return DeviceManagementDataHolder.getInstance().getDeviceManager().getDevice(deviceId);
}
@Override
@ -81,16 +75,13 @@ public class DeviceManagementService implements DeviceManager {
}
@Override
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType)
throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManager()
.setOwnership(deviceId, ownershipType);
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManager().setOwnership(deviceId, ownershipType);
}
@Override
public OperationManager getOperationManager(String type) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManager().
getOperationManager(type);
return DeviceManagementDataHolder.getInstance().getDeviceManager().getOperationManager(type);
}
}

@ -0,0 +1,22 @@
/*
* Copyright (c) 2015, 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.core;
public class DeviceManagementBaseTest {
}

@ -0,0 +1,22 @@
/*
* Copyright (c) 2015, 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.core;
public class DeviceOperationManagementTests {
}

@ -20,18 +20,17 @@ package org.wso2.carbon.device.mgt.core;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.OperationManager;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
import org.wso2.carbon.device.mgt.common.spi.DeviceManager;
import java.util.List;
public class TestDeviceManagerService implements DeviceManagerService {
public class TestDeviceManager implements DeviceManager {
public static final String DEVICE_TYPE_TEST = "Test";
@Override
public String getProviderType() {
return TestDeviceManagerService.DEVICE_TYPE_TEST;
return TestDeviceManager.DEVICE_TYPE_TEST;
}
@Override
@ -84,9 +83,4 @@ public class TestDeviceManagerService implements DeviceManagerService {
return false;
}
@Override
public OperationManager getOperationManager() throws DeviceManagementException {
return null;
}
}
Loading…
Cancel
Save