Code cleanup

revert-dabc3590
prabathabey 10 years ago
parent cb05d53510
commit 7e253156f6

@ -33,9 +33,9 @@ import java.util.List;
/** /**
* This represents the Android implementation of DeviceManagerService. * This represents the Android implementation of DeviceManagerService.
*/ */
public class AndroidDeviceManagerService implements DeviceManager { public class AndroidDeviceManager implements DeviceManager {
private static final Log log = LogFactory.getLog(AndroidDeviceManagerService.class); private static final Log log = LogFactory.getLog(AndroidDeviceManager.class);
@Override @Override
public String getProviderType() { public String getProviderType() {
@ -44,7 +44,7 @@ public class AndroidDeviceManagerService implements DeviceManager {
@Override @Override
public FeatureManager getFeatureManager() { public FeatureManager getFeatureManager() {
return null; return new AndroidFeatureManager();
} }
@Override @Override

@ -0,0 +1,78 @@
/*
* 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.mobile.impl.android;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.device.mgt.common.FeatureManagementException;
import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.FeatureDAO;
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.FeatureManagementDAOException;
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.FeatureManagementDAOFactory;
import java.util.List;
public class AndroidFeatureManager implements FeatureManager {
private FeatureDAO featureDAO;
public AndroidFeatureManager() {
this.featureDAO = FeatureManagementDAOFactory.getFeatureDAO();
}
@Override
public boolean addFeature(Feature feature) throws DeviceManagementException {
try {
featureDAO.addFeature(feature);
return true;
} catch (FeatureManagementDAOException e) {
throw new DeviceManagementException("Error occurred while adding the feature", e);
}
}
@Override
public Feature getFeature(String name) throws DeviceManagementException {
try {
return featureDAO.getFeature(name);
} catch (FeatureManagementDAOException e) {
throw new DeviceManagementException("Error occurred while retrieving the feature", e);
}
}
@Override
public List<Feature> getFeatures() throws DeviceManagementException {
try {
return featureDAO.getFeatures();
} catch (FeatureManagementDAOException e) {
throw new DeviceManagementException("Error occurred while retrieving the list of features registered " +
"for Android platform", e);
}
}
@Override
public boolean removeFeature(String name) throws DeviceManagementException {
try {
featureDAO.removeFeature(name);
return true;
} catch (FeatureManagementDAOException e) {
throw new DeviceManagementException("Error occurred while removing the feature", e);
}
}
}

@ -0,0 +1,36 @@
/*
* 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.mobile.impl.android.dao;
import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.device.mgt.common.FeatureManagementException;
import java.util.List;
public interface FeatureDAO {
void addFeature(Feature feature) throws FeatureManagementDAOException;
void removeFeature(String name) throws FeatureManagementDAOException;
Feature getFeature(String name) throws FeatureManagementDAOException;
List<Feature> getFeatures() throws FeatureManagementDAOException;
}

@ -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.mobile.impl.android.dao;
public class FeatureManagementDAOException extends Exception {
}

@ -0,0 +1,29 @@
/*
* 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.mobile.impl.android.dao;
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.impl.FeatureDAOImpl;
public class FeatureManagementDAOFactory {
public static FeatureDAO getFeatureDAO() {
return new FeatureDAOImpl();
}
}

@ -0,0 +1,49 @@
/*
* 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.mobile.impl.android.dao.impl;
import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.FeatureDAO;
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.FeatureManagementDAOException;
import java.util.List;
public class FeatureDAOImpl implements FeatureDAO {
@Override
public void addFeature(Feature feature) throws FeatureManagementDAOException {
}
@Override
public void removeFeature(String name) throws FeatureManagementDAOException {
}
@Override
public Feature getFeature(String name) throws FeatureManagementDAOException {
return null;
}
@Override
public List<Feature> getFeatures() throws FeatureManagementDAOException {
return null;
}
}

@ -32,9 +32,9 @@ import java.util.List;
/** /**
* This represents the iOS implementation of DeviceManagerService. * This represents the iOS implementation of DeviceManagerService.
*/ */
public class IOSDeviceManagerService implements DeviceManager { public class IOSDeviceManager implements DeviceManager {
private static final Log log = LogFactory.getLog(IOSDeviceManagerService.class); private static final Log log = LogFactory.getLog(IOSDeviceManager.class);
@Override @Override
public String getProviderType() { public String getProviderType() {

@ -32,9 +32,9 @@ import java.util.List;
/** /**
* This represents the Windows implementation of DeviceManagerService. * This represents the Windows implementation of DeviceManagerService.
*/ */
public class WindowsDeviceManagerService implements DeviceManager { public class WindowsDeviceManager implements DeviceManager {
private static final Log log = LogFactory.getLog(WindowsDeviceManagerService.class); private static final Log log = LogFactory.getLog(WindowsDeviceManager.class);
@Override @Override
public String getProviderType() { public String getProviderType() {

@ -32,9 +32,9 @@ import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceConfigurationManager
import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceManagementConfig; import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceManagementConfig;
import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig; import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.mobile.impl.android.AndroidDeviceManagerService; import org.wso2.carbon.device.mgt.mobile.impl.android.AndroidDeviceManager;
import org.wso2.carbon.device.mgt.mobile.impl.ios.IOSDeviceManagerService; import org.wso2.carbon.device.mgt.mobile.impl.ios.IOSDeviceManager;
import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManagerService; import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManager;
import org.wso2.carbon.device.mgt.mobile.util.DeviceManagementAPIPublisherUtil; import org.wso2.carbon.device.mgt.mobile.util.DeviceManagementAPIPublisherUtil;
import java.util.ArrayList; import java.util.ArrayList;
@ -75,13 +75,13 @@ public class MobileDeviceManagementBundleActivator implements BundleActivator, B
androidServiceRegRef = androidServiceRegRef =
bundleContext.registerService(DeviceManager.class.getName(), bundleContext.registerService(DeviceManager.class.getName(),
new AndroidDeviceManagerService(), null); new AndroidDeviceManager(), null);
iOSServiceRegRef = iOSServiceRegRef =
bundleContext.registerService(DeviceManager.class.getName(), bundleContext.registerService(DeviceManager.class.getName(),
new IOSDeviceManagerService(), null); new IOSDeviceManager(), null);
windowsServiceRegRef = windowsServiceRegRef =
bundleContext.registerService(DeviceManager.class.getName(), bundleContext.registerService(DeviceManager.class.getName(),
new WindowsDeviceManagerService(), null); new WindowsDeviceManager(), null);
/* Initialize all API configurations with corresponding API Providers */ /* Initialize all API configurations with corresponding API Providers */
this.initAPIConfigs(); this.initAPIConfigs();

@ -34,9 +34,9 @@ import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceManagementConfig;
import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig; import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil; import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
import org.wso2.carbon.device.mgt.mobile.impl.android.AndroidDeviceManagerService; import org.wso2.carbon.device.mgt.mobile.impl.android.AndroidDeviceManager;
import org.wso2.carbon.device.mgt.mobile.impl.ios.IOSDeviceManagerService; import org.wso2.carbon.device.mgt.mobile.impl.ios.IOSDeviceManager;
import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManagerService; import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManager;
import org.wso2.carbon.device.mgt.mobile.util.DeviceManagementAPIPublisherUtil; import org.wso2.carbon.device.mgt.mobile.util.DeviceManagementAPIPublisherUtil;
import java.util.List; import java.util.List;
@ -96,14 +96,11 @@ public class MobileDeviceManagementServiceComponent {
} }
androidServiceRegRef = androidServiceRegRef =
bundleContext.registerService(DeviceManager.class.getName(), bundleContext.registerService(DeviceManager.class.getName(), new AndroidDeviceManager(), null);
new AndroidDeviceManagerService(), null);
iOSServiceRegRef = iOSServiceRegRef =
bundleContext.registerService(DeviceManager.class.getName(), bundleContext.registerService(DeviceManager.class.getName(), new IOSDeviceManager(), null);
new IOSDeviceManagerService(), null);
windowsServiceRegRef = windowsServiceRegRef =
bundleContext.registerService(DeviceManager.class.getName(), bundleContext.registerService(DeviceManager.class.getName(), new WindowsDeviceManager(), null);
new WindowsDeviceManagerService(), null);
serverStartupObserverRef = bundleContext.registerService(ServerStartupObserver.class, serverStartupObserverRef = bundleContext.registerService(ServerStartupObserver.class,
new MobileDeviceManagementStartupObserver(), null); new MobileDeviceManagementStartupObserver(), null);

Loading…
Cancel
Save