@Override public String toString() { return "(" + getClass().getSimpleName() + ") Identity: " + getIdentity().toString() + ", Root: " + isRoot(); } }
public Resource[] getResources(Device device) throws ValidationException { if (!device.isRoot()) return null; Set<Resource> resources = new HashSet<>(); List<ValidationError> errors = new ArrayList<>(); log.fine("Discovering local resources of device graph"); Resource[] discoveredResources = device.discoverResources(this); for (Resource resource : discoveredResources) { log.finer("Discovered: " + resource); if (!resources.add(resource)) { log.finer("Local resource already exists, queueing validation error"); errors.add(new ValidationError( getClass(), "resources", "Local URI namespace conflict between resources of device: " + resource )); } } if (errors.size() > 0) { throw new ValidationException("Validation of device graph failed, call getErrors() on exception", errors); } return resources.toArray(new Resource[resources.size()]); }
protected Collection<D> findEmbeddedDevices(D current) { Collection<D> devices = new HashSet<>(); if (!current.isRoot() && current.getIdentity().getUdn() != null) devices.add(current); if (current.hasEmbeddedDevices()) { for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) { devices.addAll(findEmbeddedDevices(embeddedDevice)); } } return devices; }
Device nodeDevice = (Device) node.getUserObject(); if (nodeDevice.isRoot()) { if (rootDeviceIcon != null) { setIcon(new ImageIcon(rootDeviceIcon.getImage().getScaledInstance(24, 24, java.awt.Image.SCALE_SMOOTH)));
@Override public String toString() { return "(" + getClass().getSimpleName() + ") Identity: " + getIdentity().toString() + ", Root: " + isRoot(); } }
protected Collection<D> findEmbeddedDevices(D current) { Collection<D> devices = new HashSet(); if (!current.isRoot()) { devices.add(current); } if (current.hasEmbeddedDevices()) { for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) { devices.addAll(findEmbeddedDevices(embeddedDevice)); } } return devices; }
public Resource[] getResources(Device device) throws ValidationException { if (!device.isRoot()) return null; Set<Resource> resources = new HashSet<Resource>(); List<ValidationError> errors = new ArrayList<ValidationError>(); log.fine("Discovering local resources of device graph"); Resource[] discoveredResources = device.discoverResources(this); for (Resource resource : discoveredResources) { log.finer("Discovered: " + resource); if (!resources.add(resource)) { log.finer("Local resource already exists, queueing validation error"); errors.add(new ValidationError( getClass(), "resources", "Local URI namespace conflict between resources of device: " + resource )); } } if (errors.size() > 0) { throw new ValidationException("Validation of device graph failed, call getErrors() on exception", errors); } return resources.toArray(new Resource[resources.size()]); }
@Override public String toString() { return "(" + getClass().getSimpleName() + ") Identity: " + getIdentity().toString() + ", Root: " + isRoot(); } }
public Resource[] getResources(Device device) throws ValidationException { if (!device.isRoot()) return null; Set<Resource> resources = new HashSet<>(); List<ValidationError> errors = new ArrayList<>(); log.fine("Discovering local resources of device graph"); Resource[] discoveredResources = device.discoverResources(this); for (Resource resource : discoveredResources) { log.finer("Discovered: " + resource); if (!resources.add(resource)) { log.finer("Local resource already exists, queueing validation error"); errors.add(new ValidationError( getClass(), "resources", "Local URI namespace conflict between resources of device: " + resource )); } } if (errors.size() > 0) { throw new ValidationException("Validation of device graph failed, call getErrors() on exception", errors); } return resources.toArray(new Resource[resources.size()]); }
protected Collection<D> findEmbeddedDevices(D current) { Collection<D> devices = new HashSet<>(); if (!current.isRoot() && current.getIdentity().getUdn() != null) devices.add(current); if (current.hasEmbeddedDevices()) { for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) { devices.addAll(findEmbeddedDevices(embeddedDevice)); } } return devices; }