forked from community/device-mgt-core
parent
67c3c7f9a5
commit
c13975191e
@ -1,44 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* 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.common;
|
||||
|
||||
/**
|
||||
* DTO of the consumer key and secret
|
||||
*/
|
||||
public class Credential {
|
||||
String consumerKey;
|
||||
String consumerSecret;
|
||||
|
||||
public String getConsumerKey() {
|
||||
return consumerKey;
|
||||
}
|
||||
|
||||
public void setConsumerKey(String consumerKey) {
|
||||
this.consumerKey = consumerKey;
|
||||
}
|
||||
|
||||
public String getConsumerSecret() {
|
||||
return consumerSecret;
|
||||
}
|
||||
|
||||
public void setConsumerSecret(String consumerSecret) {
|
||||
this.consumerSecret = consumerSecret;
|
||||
}
|
||||
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
/*
|
||||
* 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.common.app.mgt;
|
||||
|
||||
import org.wso2.carbon.device.mgt.common.Application;
|
||||
import org.wso2.carbon.device.mgt.common.Credential;
|
||||
import org.wso2.carbon.device.mgt.common.Device;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This will handle the Application management side of MDM by acting a bridge between
|
||||
* MDM and App manager product.
|
||||
*/
|
||||
public interface AppManagerConnector {
|
||||
|
||||
/**
|
||||
* This will communicate with App manager and retrieve the list of apps in the store, when
|
||||
* the domain is given. The list is broken down into pages and retrieved.
|
||||
*
|
||||
* @param domain Tenant domain of the app list to be retrieved.
|
||||
* @param pageNumber Page number of the list.
|
||||
* @param size Number of items in one page.
|
||||
* @return The list of applications belongs to a domain.
|
||||
* @throws AppManagerConnectorException
|
||||
*/
|
||||
|
||||
Application[] getApplicationList(String domain, int pageNumber, int size) throws AppManagerConnectorException;
|
||||
|
||||
|
||||
/**
|
||||
* Updates the application, install/uninstall status of the a certain application, on a device.
|
||||
*
|
||||
* @param deviceId Device id of the device that the status belongs to.
|
||||
* @param application Application details of the app being updated.
|
||||
* @param status Installed/Uninstalled
|
||||
*/
|
||||
void updateApplicationStatus(DeviceIdentifier deviceId, Application application,
|
||||
String status) throws AppManagerConnectorException;
|
||||
|
||||
/**
|
||||
* Retrieve the status of an application on a device. Whether it is installed or not.
|
||||
*
|
||||
* @param deviceId Device id of the device that the status belongs to.
|
||||
* @param application Application details of the app being searched.
|
||||
* @return Status of the application on the device.
|
||||
*/
|
||||
String getApplicationStatus(DeviceIdentifier deviceId, Application application) throws AppManagerConnectorException;
|
||||
|
||||
/**
|
||||
* Create a new application and return client Id and secret.
|
||||
*
|
||||
* @return consumer Id and consumer key.
|
||||
* * @throws AppManagerConnectorException
|
||||
*/
|
||||
Credential getClientCredentials() throws AppManagerConnectorException;
|
||||
|
||||
void installApplication(Operation operation, List<DeviceIdentifier> deviceIdentifiers) throws
|
||||
AppManagerConnectorException;
|
||||
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
/*
|
||||
*
|
||||
* 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.common.app.mgt;
|
||||
|
||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This will handle the Application management side of MDM by acting a bridge between
|
||||
* MDM and App manager product.
|
||||
*/
|
||||
public interface ApplicationManager {
|
||||
|
||||
/**
|
||||
* This will communicate with App manager and retrieve the list of apps in the store, when
|
||||
* the domain is given. The list is broken down into pages and retrieved.
|
||||
*
|
||||
* @param domain Tenant domain of the app list to be retrieved.
|
||||
* @param pageNumber Page number of the list.
|
||||
* @param size Number of items in one page.
|
||||
* @return The list of applications belongs to a domain.
|
||||
* @throws ApplicationManagementException
|
||||
*/
|
||||
|
||||
Application[] getApplications(String domain, int pageNumber, int size) throws ApplicationManagementException;
|
||||
|
||||
|
||||
/**
|
||||
* Updates the application, install/uninstall status of the a certain application, on a device.
|
||||
*
|
||||
* @param deviceId Device id of the device that the status belongs to.
|
||||
* @param application Application details of the app being updated.
|
||||
* @param status Installed/Uninstalled
|
||||
*/
|
||||
void updateApplicationStatus(DeviceIdentifier deviceId, Application application,
|
||||
String status) throws ApplicationManagementException;
|
||||
|
||||
/**
|
||||
* Retrieve the status of an application on a device. Whether it is installed or not.
|
||||
*
|
||||
* @param deviceId Device id of the device that the status belongs to.
|
||||
* @param application Application details of the app being searched.
|
||||
* @return Status of the application on the device.
|
||||
*/
|
||||
String getApplicationStatus(DeviceIdentifier deviceId,
|
||||
Application application) throws ApplicationManagementException;
|
||||
|
||||
|
||||
void installApplication(Operation operation,
|
||||
List<DeviceIdentifier> deviceIdentifiers) throws ApplicationManagementException;
|
||||
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* 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.common.spi;
|
||||
|
||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||
import org.wso2.carbon.device.mgt.common.app.mgt.AppManagerConnectorException;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AppManager {
|
||||
|
||||
void installApplication(Operation operation, List<DeviceIdentifier> deviceIdentifiers)
|
||||
throws AppManagerConnectorException;
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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.common.spi;
|
||||
|
||||
import org.wso2.carbon.device.mgt.common.DeviceManager;
|
||||
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
|
||||
|
||||
/**
|
||||
* Composite interface that acts as the SPI exposing all device management as well as application management
|
||||
* functionalities
|
||||
*/
|
||||
public interface DeviceManagementService extends DeviceManager, ApplicationManager {
|
||||
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* 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.common.spi;
|
||||
|
||||
public interface DeviceMgtService extends DeviceManager, AppManager {
|
||||
|
||||
}
|
@ -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 interface OperationManagementServiceProvider {
|
||||
}
|
@ -1,224 +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.service;
|
||||
|
||||
import org.wso2.carbon.device.mgt.common.*;
|
||||
import org.wso2.carbon.device.mgt.common.license.mgt.License;
|
||||
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
|
||||
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DeviceManagementServiceImpl implements DeviceManagementService {
|
||||
|
||||
@Override
|
||||
public String getProviderType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeatureManager getFeatureManager() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean enrollDevice(Device device) throws DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().enrollDevice(device);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean modifyEnrollment(Device device) throws DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().modifyEnrollment(device);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().disenrollDevice(deviceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().isEnrolled(deviceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().isActive(deviceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setActive(DeviceIdentifier deviceId, boolean status) throws DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().setActive(deviceId, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Device> getAllDevices() throws DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getAllDevices();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Device> getAllDevices(String type) throws DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getAllDevices(type);
|
||||
}
|
||||
|
||||
public List<Device> getDeviceListOfUser(String username) throws DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDeviceListOfUser(username);
|
||||
}
|
||||
|
||||
public FeatureManager getFeatureManager(String type) throws DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getFeatureManager(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Device getCoreDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getCoreDevice(deviceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.wso2.carbon.device.mgt.common.Device getDevice(DeviceIdentifier deviceId)
|
||||
throws DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device) throws DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().
|
||||
updateDeviceInfo(deviceIdentifier, device);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().setOwnership(deviceId,
|
||||
ownershipType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClaimable(DeviceIdentifier deviceId) throws DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().isClaimable(deviceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public License getLicense(String deviceType, String languageCode) throws LicenseManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getLicense(deviceType,
|
||||
languageCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addLicense(String type, License license) throws LicenseManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().addLicense(type, license);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addOperation(Operation operation, List<DeviceIdentifier> devices)
|
||||
throws OperationManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().addOperation(operation, devices);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Operation> getOperations(DeviceIdentifier deviceId) throws OperationManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getOperations(deviceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Operation> getPendingOperations(
|
||||
DeviceIdentifier deviceId) throws OperationManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getPendingOperations(deviceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Operation getNextPendingOperation(DeviceIdentifier deviceId) throws OperationManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getNextPendingOperation(deviceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOperation(DeviceIdentifier deviceId, int operationId, Operation.Status operationStatus) throws
|
||||
OperationManagementException {
|
||||
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().updateOperation(deviceId, operationId,
|
||||
operationStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteOperation(int operationId) throws OperationManagementException {
|
||||
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().deleteOperation(operationId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Operation getOperationByDeviceAndOperationId(DeviceIdentifier deviceId,
|
||||
int operationId) throws OperationManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
|
||||
.getOperationByDeviceAndOperationId(deviceId, operationId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Operation> getOperationsByDeviceAndStatus(DeviceIdentifier identifier,
|
||||
Operation.Status status) throws OperationManagementException, DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getOperationsByDeviceAndStatus
|
||||
(identifier, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Operation getOperation(int operationId) throws OperationManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getOperation(operationId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendEnrolmentInvitation(EmailMessageProperties emailMessageProperties)
|
||||
throws DeviceManagementException {
|
||||
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
|
||||
.sendEnrolmentInvitation(emailMessageProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendRegistrationEmail(EmailMessageProperties emailMessageProperties) throws DeviceManagementException {
|
||||
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
|
||||
.sendRegistrationEmail(emailMessageProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Device> getAllDevicesOfUser(String userName)
|
||||
throws DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
|
||||
.getAllDevicesOfUser(userName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Device> getAllDevicesOfRole(String roleName)
|
||||
throws DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
|
||||
.getAllDevicesOfRole(roleName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDeviceCount() throws DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
|
||||
.getDeviceCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Device> getDevicesByName(String deviceName, int tenantId) throws DeviceManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
|
||||
.getDevicesByName(deviceName, tenantId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in new issue