@Override public ServiceType[] getExclusiveServiceTypes() { return new ServiceType[]{ new UDAServiceType("SwitchPower") }; } // DOC:SERVICE_TYPE
@Override public void setString(String s) throws InvalidHeaderException { try { setValue(UDAServiceType.valueOf(s)); } catch (Exception ex) { throw new InvalidHeaderException("Invalid UDA service type header value, " + ex.getMessage()); } }
@Override protected ServiceType[] getSupportedServiceTypes() { return new ServiceType[]{new UDAServiceType("RenderingControl", 1)}; }
serviceType = UDAServiceType.valueOf(s); } catch (Exception ex) {
@Override protected ServiceType[] getSupportedServiceTypes() { return new ServiceType[]{new UDAServiceType("ContentDirectory", 1)}; }
@Override public void setString(String s) throws InvalidHeaderException { try { setValue(UDAServiceType.valueOf(s)); } catch (Exception ex) { throw new InvalidHeaderException("Invalid UDA service type header value, " + ex.getMessage()); } }
@Override protected ServiceType[] getSupportedServiceTypes() { return new ServiceType[]{new UDAServiceType("WANIPConnection", 1)}; }
serviceType = UDAServiceType.valueOf(s); } catch (Exception ex) {
@Override protected ServiceType[] getSupportedServiceTypes() { return new ServiceType[] {new UDAServiceType("AVTransport", 1)}; }
@Override public void setString(String s) throws InvalidHeaderException { try { setValue(UDAServiceType.valueOf(s)); } catch (Exception ex) { throw new InvalidHeaderException("Invalid UDA service type header value, " + ex.getMessage()); } }
@Override protected ServiceType[] getSupportedServiceTypes() { return new ServiceType[]{new UDAServiceType("SwitchPower", 1)}; }
serviceType = UDAServiceType.valueOf(s); } catch (Exception ex) {
public static UDAServiceType valueOf(String s) throws InvalidValueException { Matcher matcher = UDAServiceType.PATTERN.matcher(s); try { if (matcher.matches()) return new UDAServiceType(matcher.group(1), Integer.valueOf(matcher.group(2))); } catch (RuntimeException e) { throw new InvalidValueException(String.format( "Can't parse UDA service type string (namespace/type/version) '%s': %s", s, e.toString())); } throw new InvalidValueException("Can't parse UDA service type string (namespace/type/version): " + s); }
protected LocalService<SwitchPower> getSwitchPowerService() { if (upnpService == null) return null; LocalDevice binaryLightDevice; if ((binaryLightDevice = upnpService.getRegistry().getLocalDevice(udn, true)) == null) return null; return (LocalService<SwitchPower>) binaryLightDevice.findService(new UDAServiceType("SwitchPower", 1)); } // DOC:SERVICE_BINDING
public LocalService read(Class<?> clazz) throws LocalServiceBindingException { log.fine("Reading and binding annotations of service implementation class: " + clazz); // Read the service ID and service type from the annotation if (clazz.isAnnotationPresent(UpnpService.class)) { UpnpService annotation = clazz.getAnnotation(UpnpService.class); UpnpServiceId idAnnotation = annotation.serviceId(); UpnpServiceType typeAnnotation = annotation.serviceType(); ServiceId serviceId = idAnnotation.namespace().equals(UDAServiceId.DEFAULT_NAMESPACE) ? new UDAServiceId(idAnnotation.value()) : new ServiceId(idAnnotation.namespace(), idAnnotation.value()); ServiceType serviceType = typeAnnotation.namespace().equals(UDAServiceType.DEFAULT_NAMESPACE) ? new UDAServiceType(typeAnnotation.value(), typeAnnotation.version()) : new ServiceType(typeAnnotation.namespace(), typeAnnotation.value(), typeAnnotation.version()); boolean supportsQueryStateVariables = annotation.supportsQueryStateVariables(); Set<Class> stringConvertibleTypes = readStringConvertibleTypes(annotation.stringConvertibleTypes()); return read(clazz, serviceId, serviceType, supportsQueryStateVariables, stringConvertibleTypes); } else { throw new LocalServiceBindingException("Given class is not an @UpnpService"); } }
public static UDAServiceType valueOf(String s) throws InvalidValueException { Matcher matcher = UDAServiceType.PATTERN.matcher(s); if (matcher.matches()) { return new UDAServiceType(matcher.group(1), Integer.valueOf(matcher.group(2))); } else { throw new InvalidValueException("Can't parse UDA service type string (namespace/type/version): " + s); } }
public LocalService read(Class<?> clazz) throws LocalServiceBindingException { log.fine("Reading and binding annotations of service implementation class: " + clazz); // Read the service ID and service type from the annotation if (clazz.isAnnotationPresent(UpnpService.class)) { UpnpService annotation = clazz.getAnnotation(UpnpService.class); UpnpServiceId idAnnotation = annotation.serviceId(); UpnpServiceType typeAnnotation = annotation.serviceType(); ServiceId serviceId = idAnnotation.namespace().equals(UDAServiceId.DEFAULT_NAMESPACE) ? new UDAServiceId(idAnnotation.value()) : new ServiceId(idAnnotation.namespace(), idAnnotation.value()); ServiceType serviceType = typeAnnotation.namespace().equals(UDAServiceType.DEFAULT_NAMESPACE) ? new UDAServiceType(typeAnnotation.value(), typeAnnotation.version()) : new ServiceType(typeAnnotation.namespace(), typeAnnotation.value(), typeAnnotation.version()); boolean supportsQueryStateVariables = annotation.supportsQueryStateVariables(); Set<Class> stringConvertibleTypes = readStringConvertibleTypes(annotation.stringConvertibleTypes()); return read(clazz, serviceId, serviceType, supportsQueryStateVariables, stringConvertibleTypes); } else { throw new LocalServiceBindingException("Given class is not an @UpnpService"); } }
@Override public ServiceType[] getExclusiveServiceTypes() { // only care the these service below return new ServiceType[]{ new UDAServiceType(UpnpServiceType.CONTENT_DIRECTORY), }; }
@Override public ServiceType[] getExclusiveServiceTypes() { // only care the these service below return new ServiceType[]{ new UDAServiceType(UpnpServiceType.AVTRANSPORT), new UDAServiceType(UpnpServiceType.RENDERING_CONTROL), }; }
@Override public ServiceType[] getExclusiveServiceTypes() { // only care the these service below return new ServiceType[]{ new UDAServiceType(UpnpServiceType.AVTRANSPORT), new UDAServiceType(UpnpServiceType.RENDERING_CONTROL), new UDAServiceType(UpnpServiceType.CONTENT_DIRECTORY), }; }