discovered.add(new DeviceDescriptorResource(namespace.getDescriptorPath(this), this)); new ServiceDescriptorResource(namespace.getDescriptorPath(service), service) );
protected void generateServiceList(Namespace namespace, Device deviceModel, Document descriptor, Element deviceElement) { if (!deviceModel.hasServices()) return; Element serviceListElement = appendNewElement(descriptor, deviceElement, ELEMENT.serviceList); for (Service service : deviceModel.getServices()) { Element serviceElement = appendNewElement(descriptor, serviceListElement, ELEMENT.service); appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceType, service.getServiceType()); appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceId, service.getServiceId()); if (service instanceof RemoteService) { RemoteService rs = (RemoteService) service; appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, rs.getDescriptorURI()); appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, rs.getControlURI()); appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, rs.getEventSubscriptionURI()); } else if (service instanceof LocalService) { LocalService ls = (LocalService) service; appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, namespace.getDescriptorPath(ls)); appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, namespace.getControlPath(ls)); appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, namespace.getEventSubscriptionPath(ls)); } } }
addIfNotNull(deviceNode, "Descriptor URL: ", ((RemoteDevice) device).getIdentity().getDescriptorURL(), true); } else if (device instanceof LocalDevice) { addIfNotNull(deviceNode, "Descriptor URI: ", namespace.getDescriptorPath(device)); addIfNotNull(serviceNode, "Descriptor URI: ", namespace.getDescriptorPath(ls)); addIfNotNull(serviceNode, "Control URI: ", namespace.getControlPath(ls)); addIfNotNull(serviceNode, "Event Subscription URI: ", namespace.getEventSubscriptionPath(ls));
protected Location getDescriptorLocation(NetworkAddress activeStreamServer, LocalDevice device) { return new Location( activeStreamServer, getUpnpService().getConfiguration().getNamespace().getDescriptorPath(device) ); }
discovered.add(new DeviceDescriptorResource(namespace.getDescriptorPath(this), this)); new ServiceDescriptorResource(namespace.getDescriptorPath(service), service) );
protected void execute() throws RouterException { List<NetworkAddress> activeStreamServers = getUpnpService().getRouter().getActiveStreamServers(null); if (activeStreamServers.size() == 0) { log.fine("Aborting notifications, no active stream servers found (network disabled?)"); return; } // Prepare it once, it's the same for each repetition List<Location> descriptorLocations = new ArrayList(); for (NetworkAddress activeStreamServer : activeStreamServers) { descriptorLocations.add( new Location( activeStreamServer, getUpnpService().getConfiguration().getNamespace().getDescriptorPath(getDevice()) ) ); } for (int i = 0; i < getBulkRepeat(); i++) { try { for (Location descriptorLocation : descriptorLocations) { sendMessages(descriptorLocation); } // UDA 1.0 is silent about this but UDA 1.1 recomments "a few hundred milliseconds" log.finer("Sleeping " + getBulkIntervalMilliseconds() + " milliseconds"); Thread.sleep(getBulkIntervalMilliseconds()); } catch (InterruptedException ex) { log.warning("Advertisement thread was interrupted: " + ex); } } }
protected void generateServiceList(Namespace namespace, Device deviceModel, Document descriptor, Element deviceElement) { if (!deviceModel.hasServices()) return; Element serviceListElement = appendNewElement(descriptor, deviceElement, ELEMENT.serviceList); for (Service service : deviceModel.getServices()) { Element serviceElement = appendNewElement(descriptor, serviceListElement, ELEMENT.service); appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceType, service.getServiceType()); appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceId, service.getServiceId()); if (service instanceof RemoteService) { RemoteService rs = (RemoteService) service; appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, rs.getDescriptorURI()); appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, rs.getControlURI()); appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, rs.getEventSubscriptionURI()); } else if (service instanceof LocalService) { LocalService ls = (LocalService) service; appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, namespace.getDescriptorPath(ls)); appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, namespace.getControlPath(ls)); appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, namespace.getEventSubscriptionPath(ls)); } } }
discovered.add(new DeviceDescriptorResource(namespace.getDescriptorPath(this), this)); new ServiceDescriptorResource(namespace.getDescriptorPath(service), service) );
protected void generateServiceList(Namespace namespace, Device deviceModel, Document descriptor, Element deviceElement) { if (!deviceModel.hasServices()) return; Element serviceListElement = appendNewElement(descriptor, deviceElement, ELEMENT.serviceList); for (Service service : deviceModel.getServices()) { Element serviceElement = appendNewElement(descriptor, serviceListElement, ELEMENT.service); appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceType, service.getServiceType()); appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceId, service.getServiceId()); if (service instanceof RemoteService) { RemoteService rs = (RemoteService) service; appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, rs.getDescriptorURI()); appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, rs.getControlURI()); appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, rs.getEventSubscriptionURI()); } else if (service instanceof LocalService) { LocalService ls = (LocalService) service; appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, namespace.getDescriptorPath(ls)); appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, namespace.getControlPath(ls)); appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, namespace.getEventSubscriptionPath(ls)); } } }