private boolean isCandidate(ComponentInstance<? extends Component> instance) { return instance.canHost(componentType) && !isExcluded(instance); }
private ComponentInstance<? extends Component> rejectIfInvalid(ComponentInstance<? extends Component> host) { if (host == null) { throw new IllegalArgumentException("'null' is not a valid destination for installation"); } if (!host.canHost(type)) { final String error = String.format("Illegal installation: '%s' cannot host component of type '%s'", host.getName(), type.getName()); throw new IllegalArgumentException(error); } return host; }
/** * Find all the components that can possibly host the given internal * component instance * * @param component the component that needs a host * @return the list of components that can be host */ private List<ComponentInstance<?>> findAllCandidateHosts(InternalComponentInstance component) { assert component != null: "Unable to find host for 'null'"; final List<ComponentInstance<?>> candidates = new LinkedList<ComponentInstance<?>>(); for (ComponentInstance<?> eachComponent: component.getDeployment().getComponentInstances()) { if (eachComponent.canHost(component.getType())) { candidates.add(eachComponent); } } return candidates; }