/** * Looks for a UPNP device service definition object for the given service ID * * @param serviceURI the ID of the service * @return A matching UPNPService object or null */ public UPNPService getServiceByID(String serviceID) { if (services == null) return null; if (log.isDebugEnabled()) log.debug("searching for service ID:" + serviceID); for (Iterator<UPNPService> itr = services.iterator(); itr.hasNext(); ) { UPNPService service = itr.next(); if (service.getServiceId().equals(serviceID)) { return service; } } return null; }
/** * Looks for the all the UPNP device service definition object for the current UPNP device object. * This method can be used to retreive multiple same kind ( same service type ) of services with * different services id on a device * * @param serviceURI the URI of the service * @return A matching List of UPNPService objects or null */ public List<UPNPService> getServices(String serviceURI) { if (services == null) return null; List<UPNPService> rtrVal = new ArrayList<UPNPService>(); if (log.isDebugEnabled()) log.debug("searching for services URI:" + serviceURI); for (Iterator<UPNPService> itr = services.iterator(); itr.hasNext(); ) { UPNPService service = itr.next(); if (service.getServiceType().equals(serviceURI)) { rtrVal.add(service); } } if (rtrVal.isEmpty()) { return null; } return rtrVal; }