protected Collection<D> find(ServiceType serviceType, D current) { Collection<S> services = findServices(serviceType, null, current); Collection<D> devices = new HashSet<>(); for (Service service : services) { devices.add((D) service.getDevice()); } return devices; }
protected <S extends Service> S buildInstance(S undescribedService, MutableService descriptor) throws ValidationException { return (S)descriptor.build(undescribedService.getDevice()); }
protected String getServicePath(Service service) { if (service.getServiceId() == null) { throw new IllegalStateException("Can't generate local URI prefix without service ID"); } StringBuilder s = new StringBuilder(); s.append(SERVICE); s.append("/"); s.append(service.getServiceId().getNamespace()); s.append("/"); s.append(service.getServiceId().getId()); return getDevicePath(service.getDevice()) + s.toString(); } }
@Override public void success(ActionInvocation invocation) { updateStatus( "Successfuly sent URI to: (Instance: " + instanceId + ") " + avTransportService.getDevice().getDetails().getFriendlyName() ); }
public List<ValidationError> validate() { List<ValidationError> errors = new ArrayList<>(); if (getName() == null || getName().length() == 0) { errors.add(new ValidationError( getClass(), "name", "StateVariable without name of: " + getService() )); } else if (!ModelUtil.isValidUDAName(getName())) { log.warning("UPnP specification violation of: " + getService().getDevice()); log.warning("Invalid state variable name: " + this); } errors.addAll(getTypeDetails().validate()); return errors; }
private void generateSpecVersion(Service serviceModel, Document descriptor, Element rootElement) { Element specVersionElement = appendNewElement(descriptor, rootElement, ELEMENT.specVersion); appendNewElementIfNotNull(descriptor, specVersionElement, ELEMENT.major, serviceModel.getDevice().getVersion().getMajor()); appendNewElementIfNotNull(descriptor, specVersionElement, ELEMENT.minor, serviceModel.getDevice().getVersion().getMinor()); }
@Override public <S extends Service> S describe(S undescribedService, String descriptorXml) throws DescriptorBindingException, ValidationException { if (descriptorXml == null || descriptorXml.length() == 0) { throw new DescriptorBindingException("Null or empty descriptor"); } try { log.fine("Reading service from XML descriptor"); SAXParser parser = new SAXParser(); MutableService descriptor = new MutableService(); hydrateBasic(descriptor, undescribedService); new RootHandler(descriptor, parser); parser.parse( new InputSource( // TODO: UPNP VIOLATION: Virgin Media Superhub sends trailing spaces/newlines after last XML element, need to trim() new StringReader(descriptorXml.trim()) ) ); // Build the immutable descriptor graph return (S)descriptor.build(undescribedService.getDevice()); } catch (ValidationException ex) { throw ex; } catch (Exception ex) { throw new DescriptorBindingException("Could not parse service descriptor: " + ex.toString(), ex); } }
protected Container createRootContainer(Service service) { Container rootContainer = new Container(); rootContainer.setId("0"); rootContainer.setTitle("Content Directory on " + service.getDevice().getDisplayString()); return rootContainer; }
public ServiceReference getReference() { return new ServiceReference(getDevice().getIdentity().getUdn(), getServiceId()); }
)); } else if (!ModelUtil.isValidUDAName(getName())) { log.warning("UPnP specification violation of: " + getAction().getService().getDevice()); log.warning("Invalid argument name: " + this); } else if (getName().length() > 32) { log.warning("UPnP specification violation of: " + getAction().getService().getDevice()); log.warning("Argument name should be less than 32 characters: " + this);
public MessageBoxController(Controller parentController, final ControlPoint controlPoint, final Service service) { super(new JFrame("MessageBoxService on: " + service.getDevice().getDetails().getFriendlyName()), parentController); this.controlPoint = controlPoint; this.service = service;
)); } else if (!ModelUtil.isValidUDAName(getName())) { log.warning("UPnP specification violation of: " + getService().getDevice()); log.warning("Invalid action name: " + this); log.warning("UPnP specification violation of :" + getService().getDevice()); log.warning("Input argument can not have <retval/>"); } else { if (retValueArgument != null) { log.warning("UPnP specification violation of: " + getService().getDevice()); log.warning("Only one argument of action '" + getName() + "' can be <retval/>"); ActionArgument a = getArguments()[j]; if (a.getDirection() == ActionArgument.Direction.OUT) { log.warning("UPnP specification violation of: " + getService().getDevice()); log.warning("Argument '" + retValueArgument.getName() + "' of action '" + getName() + "' is <retval/> but not the first OUT argument");
public void init(Service service) { this.service = service; view.setPresenter(this); view.setTitle("WAN IP Connection on " + service.getDevice().getRoot().getDetails().getFriendlyName()); portMappingPresenter.init( view.getPortMappingListView(), view.getPortMappingEditView(), service, this ); updateConnectionInfo(); }
public void init(Service service) { view.setPresenter(this); view.setTitle("Content Directory on " + service.getDevice().getDetails().getFriendlyName()); view.getTreeView().setPresenter(detailPresenter); view.getTreeView().init(controlPoint, service); detailPresenter.init(view.getDetailView()); }
view.setTitle(service.getDevice().getDetails().getFriendlyName());
view.setTitle(service.getDevice().getDetails().getFriendlyName());
protected IncomingActionResponseMessage invokeRemote(OutgoingActionRequestMessage requestMessage) throws RouterException { Device device = actionInvocation.getAction().getService().getDevice();
protected Collection<D> find(ServiceType serviceType, D current) { Collection<S> services = findServices(serviceType, null, current); Collection<D> devices = new HashSet(); for (Service service : services) { devices.add((D) service.getDevice()); } return devices; }
public URI getPath(Service service) { if (service.getServiceId() == null) { throw new IllegalStateException("Can't generate local URI prefix without service ID"); } StringBuilder s = new StringBuilder(); s.append(SERVICE); s.append("/"); s.append(service.getServiceId().getNamespace()); s.append("/"); s.append(service.getServiceId().getId()); return URI.create(getPath(service.getDevice()).toString() + s.toString()); }