org.fourthline.cling.model.meta.Device.hasServices()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中org.fourthline.cling.model.meta.Device.hasServices()方法的一些代码示例,展示了Device.hasServices()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Device.hasServices()方法的具体详情如下:
包路径:org.fourthline.cling.model.meta.Device
类名称:Device
方法名:hasServices

Device.hasServices介绍

暂无

代码示例

代码示例来源:origin: 4thline/cling

protected Collection<S> findServices(ServiceType serviceType, ServiceId serviceId, D current) {
  Collection services = new HashSet<>();
  if (current.hasServices()) {
    for (Service service : current.getServices()) {
      if (isMatch(service, serviceType, serviceId))
        services.add(service);
    }
  }
  Collection<D> embeddedDevices = findEmbeddedDevices(current);
  if (embeddedDevices != null) {
    for (D embeddedDevice : embeddedDevices) {
      if (embeddedDevice.hasServices()) {
        for (Service service : embeddedDevice.getServices()) {
          if (isMatch(service, serviceType, serviceId))
            services.add(service);
        }
      }
    }
  }
  return services;
}

代码示例来源:origin: 4thline/cling

public List<ValidationError> validate() {
  List<ValidationError> errors = new ArrayList<>();
  if (getType() != null) {
    // Only validate the graph if we have a device type - that means we validate only if there
    // actually is a fully hydrated graph, not just a discovered device of which we haven't even
    // retrieved the descriptor yet. This assumes that the descriptor will ALWAYS contain a device
    // type. Now that is a risky assumption...
    errors.addAll(getVersion().validate());
    
    if(getIdentity() != null) {
      errors.addAll(getIdentity().validate());
    }
    if (getDetails() != null) {
      errors.addAll(getDetails().validate());
    }
    if (hasServices()) {
      for (Service service : getServices()) {
        if (service != null)
          errors.addAll(service.validate());
      }
    }
    if (hasEmbeddedDevices()) {
      for (Device embeddedDevice : getEmbeddedDevices()) {
        if (embeddedDevice != null)
          errors.addAll(embeddedDevice.validate());
      }
    }
  }
  return errors;
}

代码示例来源:origin: 4thline/cling

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));
    }
  }
}

代码示例来源:origin: 4thline/cling

if (device.hasServices()) {

代码示例来源:origin: kingthy/TVRemoteIME

protected Collection<S> findServices(ServiceType serviceType, ServiceId serviceId, D current) {
  Collection services = new HashSet();
  if (current.hasServices()) {
    for (Service service : current.getServices()) {
      if (isMatch(service, serviceType, serviceId))
        services.add(service);
    }
  }
  Collection<D> embeddedDevices = findEmbeddedDevices(current);
  if (embeddedDevices != null) {
    for (D embeddedDevice : embeddedDevices) {
      if (embeddedDevice.hasServices()) {
        for (Service service : embeddedDevice.getServices()) {
          if (isMatch(service, serviceType, serviceId))
            services.add(service);
        }
      }
    }
  }
  return services;
}

代码示例来源:origin: kingthy/TVRemoteIME

public List<ValidationError> validate() {
  List<ValidationError> errors = new ArrayList();
  if (getType() != null) {
    // Only validate the graph if we have a device type - that means we validate only if there
    // actually is a fully hydrated graph, not just a discovered device of which we haven't even
    // retrieved the descriptor yet. This assumes that the descriptor will ALWAYS contain a device
    // type. Now that is a risky assumption...
    errors.addAll(getVersion().validate());
    if (getDetails() != null) {
      errors.addAll(getDetails().validate());
    }
    if (hasServices()) {
      for (Service service : getServices()) {
        if (service != null)
          errors.addAll(service.validate());
      }
    }
    if (hasEmbeddedDevices()) {
      for (Device embeddedDevice : getEmbeddedDevices()) {
        if (embeddedDevice != null)
          errors.addAll(embeddedDevice.validate());
      }
    }
  }
  return errors;
}

代码示例来源:origin: kingthy/TVRemoteIME

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));
    }
  }
}

代码示例来源:origin: org.fourthline.cling/cling-core

protected Collection<S> findServices(ServiceType serviceType, ServiceId serviceId, D current) {
  Collection services = new HashSet<>();
  if (current.hasServices()) {
    for (Service service : current.getServices()) {
      if (isMatch(service, serviceType, serviceId))
        services.add(service);
    }
  }
  Collection<D> embeddedDevices = findEmbeddedDevices(current);
  if (embeddedDevices != null) {
    for (D embeddedDevice : embeddedDevices) {
      if (embeddedDevice.hasServices()) {
        for (Service service : embeddedDevice.getServices()) {
          if (isMatch(service, serviceType, serviceId))
            services.add(service);
        }
      }
    }
  }
  return services;
}

代码示例来源:origin: org.fourthline.cling/cling-core

public List<ValidationError> validate() {
  List<ValidationError> errors = new ArrayList<>();
  if (getType() != null) {
    // Only validate the graph if we have a device type - that means we validate only if there
    // actually is a fully hydrated graph, not just a discovered device of which we haven't even
    // retrieved the descriptor yet. This assumes that the descriptor will ALWAYS contain a device
    // type. Now that is a risky assumption...
    errors.addAll(getVersion().validate());
    
    if(getIdentity() != null) {
      errors.addAll(getIdentity().validate());
    }
    if (getDetails() != null) {
      errors.addAll(getDetails().validate());
    }
    if (hasServices()) {
      for (Service service : getServices()) {
        if (service != null)
          errors.addAll(service.validate());
      }
    }
    if (hasEmbeddedDevices()) {
      for (Device embeddedDevice : getEmbeddedDevices()) {
        if (embeddedDevice != null)
          errors.addAll(embeddedDevice.validate());
      }
    }
  }
  return errors;
}

代码示例来源:origin: org.fourthline.cling/cling-core

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));
    }
  }
}

相关文章