public List<ValidationError> validateThis() { List<ValidationError> errors = new ArrayList<>(); if (getDescriptorURI() == null) { errors.add(new ValidationError( getClass(), "descriptorURI", "Descriptor location (SCPDURL) is required" )); } if (getControlURI() == null) { errors.add(new ValidationError( getClass(), "controlURI", "Control URL is required" )); } if (getEventSubscriptionURI() == null) { errors.add(new ValidationError( getClass(), "eventSubscriptionURI", "Event subscription URL is required" )); } return errors; }
protected void hydrateBasic(MutableService descriptor, Service undescribedService) { descriptor.serviceId = undescribedService.getServiceId(); descriptor.serviceType = undescribedService.getServiceType(); if (undescribedService instanceof RemoteService) { RemoteService rs = (RemoteService) undescribedService; descriptor.controlURI = rs.getControlURI(); descriptor.eventSubscriptionURI = rs.getEventSubscriptionURI(); descriptor.descriptorURI = rs.getDescriptorURI(); } }
controLURL = remoteService.getDevice().normalizeURI(remoteService.getControlURI()); } catch(IllegalArgumentException e) { failure(actionInvocation, null, "bad control URL: " + remoteService.getControlURI()); return ;
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)); } } }
RemoteService rs = (RemoteService) service; addIfNotNull(serviceNode, "Descriptor URL: ", rs.getDevice().normalizeURI(rs.getDescriptorURI()), true); addIfNotNull(serviceNode, "Control URL: ", rs.getDevice().normalizeURI(rs.getControlURI()), true); addIfNotNull(serviceNode, "Event Subscription URL: ", rs.getDevice().normalizeURI(rs.getEventSubscriptionURI()), true);
public List<ValidationError> validateThis() { List<ValidationError> errors = new ArrayList(); if (getDescriptorURI() == null) { errors.add(new ValidationError( getClass(), "descriptorURI", "Descriptor location (SCPDURL) is required" )); } if (getControlURI() == null) { errors.add(new ValidationError( getClass(), "controlURI", "Control URL is required" )); } if (getEventSubscriptionURI() == null) { errors.add(new ValidationError( getClass(), "eventSubscriptionURI", "Event subscription URL is required" )); } return errors; }
protected void hydrateBasic(MutableService descriptor, Service undescribedService) { descriptor.serviceId = undescribedService.getServiceId(); descriptor.serviceType = undescribedService.getServiceType(); if (undescribedService instanceof RemoteService) { RemoteService rs = (RemoteService) undescribedService; descriptor.controlURI = rs.getControlURI(); descriptor.eventSubscriptionURI = rs.getEventSubscriptionURI(); descriptor.descriptorURI = rs.getDescriptorURI(); } }
URL controLURL = remoteService.getDevice().normalizeURI(remoteService.getControlURI());
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)); } } }
public List<ValidationError> validateThis() { List<ValidationError> errors = new ArrayList<>(); if (getDescriptorURI() == null) { errors.add(new ValidationError( getClass(), "descriptorURI", "Descriptor location (SCPDURL) is required" )); } if (getControlURI() == null) { errors.add(new ValidationError( getClass(), "controlURI", "Control URL is required" )); } if (getEventSubscriptionURI() == null) { errors.add(new ValidationError( getClass(), "eventSubscriptionURI", "Event subscription URL is required" )); } return errors; }
@Override public void logRouterInfo() throws RouterException { final RemoteDevice device = service.getDevice(); final UDAVersion version = device.getVersion(); final DeviceDetails deviceDetails = device.getDetails(); logger.info("Service id: {}", service.getServiceId()); logger.info("Reference: {}", service.getReference()); logger.info("Display name: {}", device.getDisplayString()); logger.info("Version: {}.{}", version.getMajor(), version.getMinor()); logger.info("Control uri: {}", service.getControlURI()); logger.info("Descriptor uri: {}", service.getDescriptorURI()); logger.info("Event subscription uri: {}", service.getEventSubscriptionURI()); logger.info("Device base url: {}", deviceDetails.getBaseURL()); logger.info("Device presentation uri: {}", deviceDetails.getPresentationURI()); }
protected void hydrateBasic(MutableService descriptor, Service undescribedService) { descriptor.serviceId = undescribedService.getServiceId(); descriptor.serviceType = undescribedService.getServiceType(); if (undescribedService instanceof RemoteService) { RemoteService rs = (RemoteService) undescribedService; descriptor.controlURI = rs.getControlURI(); descriptor.eventSubscriptionURI = rs.getEventSubscriptionURI(); descriptor.descriptorURI = rs.getDescriptorURI(); } }
private URI getUri() { if (service.getDevice().getDetails().getPresentationURI() != null) { return service.getDevice().getDetails().getPresentationURI(); } if (service.getControlURI() != null) { return service.getControlURI(); } if (service.getDescriptorURI() != null) { return service.getDescriptorURI(); } if (service.getEventSubscriptionURI() != null) { return service.getEventSubscriptionURI(); } return null; }
controLURL = remoteService.getDevice().normalizeURI(remoteService.getControlURI()); } catch(IllegalArgumentException e) { failure(actionInvocation, null, "bad control URL: " + remoteService.getControlURI()); return ;
public <T> T run(final ClingAction<T> action) { // Figure out the remote URL where we'd like to send the action request to final URL controLURL = remoteService.getDevice().normalizeURI(remoteService.getControlURI()); final ActionInvocation<RemoteService> actionInvocation = action.getActionInvocation(); final SendingAction prot = controlPoint.getProtocolFactory().createSendingAction(actionInvocation, controLURL); prot.run(); final IncomingActionResponseMessage response = prot.getOutputMessage(); if (response == null) { throw new ClingRouterException("Got null response for action " + actionInvocation); } else if (response.getOperation().isFailed()) { throw new ClingOperationFailedException("Invocation " + actionInvocation + " failed with operation '" + response.getOperation() + "', body '" + response.getBodyString() + "'", response); } return action.convert(actionInvocation); }
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)); } } }