public boolean removeThingUnreachable(String sThingName) { boolean bCorrect = true; try { mLogger.debug( "Component CM perform operation removeThingUnreachable. Item: " + sThingName + "."); String sThingServiceName = cmservice.sparqlRemoveDevice(sThingName); try { qosservice.thingRemoved(sThingServiceName); } catch (Exception e) { mLogger.error( "Component CM perform operation removeThing. It has not been executed correctly the call to qosservice.thingRemoved(" + sInstanceID + "). Exception: " + e.getMessage() + "."); } List<String> sThingServiceList = new ArrayList<String>(); sThingServiceList.add(sThingServiceName); try { rmservice.deleteThingServices(sThingServiceList); } catch (Exception e) { mLogger.error( "Component CM perform operation removeThing. It has not been executed correctly the call to TaaSRM.deleteThingServices(" + sThingServiceList.get(0) + "). Exception: " + e.getMessage() + "."); } } catch (Exception e) { mLogger.error( "Component CM perform operation removeThing. It has not been executed correctly the call to QoSservice.thingRemoved or TaaSRM.deleteThingServices. Exception: " + e.getMessage() + "."); oConfigOSGi.sendData( "The Thing Service " + sThingName + " has been removed unsucessfully!.", "error", "AdaptationCM"); } oConfigOSGi.sendData( "The Thing Service " + sThingName + " has been removed sucessfully!.", "info", "AdaptationCM"); return bCorrect; }
public boolean removeThing(List<String> sThingList) { boolean bCorrect = true; String sNameThread; try { mLogger.debug( "Component CM perform operation removeThing. Items: " + sThingList.size() + "."); for (int i = 0; i < sThingList.size(); i++) { String sThingName = sThingList.get(i); String sInstanceID = "sensor_" + sThingName + "_" + sThingName; String sThingServiceName = cmservice.getThingServiceName(sInstanceID); try { qosservice.unreachable(sThingServiceName); } catch (Exception e) { mLogger.error( "Component CM perform operation removeThing. It has not been executed correctly the call to qosservice.unreachable(" + sThingServiceName + "). The following exception has been returned: " + e.getMessage() + "."); } List<String> sThingServiceList = new ArrayList<String>(); sThingServiceList.add(sThingServiceName); // TODO - Javi aún no lo ha hecho // try { rmservice.unreachable(sThingServiceList);} // catch (Exception e) { mLogger.error("Component CM perform operation removeThing. It // has not been executed correctly the call to TaaSRM.deleteThingServices. Exception: " + // e.getMessage() + ".");} java.util.Date date = new java.util.Date(); sNameThread = "threadRemove_" + sThingName + "_" + new Timestamp(date.getTime()); mLogger.debug( "Component CM perform operation removeThing, starting " + sNameThread + " thread"); new ReminderReachableRemove(2, sThingName, cmservice); // TODO!!!! 5m } } catch (Exception e) { mLogger.error( "Component CM perform operation removeThing. It has not been executed correctly the call to QoSservice.thingRemoved or TaaSRM.deleteThingServices. Exception: " + e.getMessage() + "."); } return bCorrect; }