if (retVal.contains(candidate)) continue;
for (ValidationService vs : getAllValidators()) {
if (!vs.getValidator().validate(new ValidationInformationImpl(
Operation.UNBIND, candidate))) {
throw new MultiException(new IllegalArgumentException("Descriptor " +
candidate + " did not pass the UNBIND validation"));
}
}
if (candidate.getAdvertisedContracts().contains(InstanceLifecycleListener.class.getName())) {
addOrRemoveOfInstanceListener = true;
}
if (candidate.getAdvertisedContracts().contains(InjectionResolver.class.getName())) {
addOrRemoveOfInjectionResolver = true;
}
if (candidate.getAdvertisedContracts().contains(ErrorService.class.getName())) {
addOrRemoveOfErrorHandler = true;
}
if (candidate.getAdvertisedContracts().contains(ClassAnalyzer.class.getName())) {
addOrRemoveOfClazzAnalyzer = true;
}
if (candidate.getAdvertisedContracts().contains(DynamicConfigurationListener.class.getName())) {
addOrRemoveOfConfigListener = true;
}
if (candidate.getAdvertisedContracts().contains(InterceptionService.class.getName())) {
addOrRemoveOfInterceptionService = true;
}
retVal.add(candidate);
}
}
for (SystemDescriptor<?> sd : dci.getAllDescriptors()) {
affectedContracts.addAll(getAllContracts(sd));
boolean checkScope = false;
if (sd.getAdvertisedContracts().contains(ValidationService.class.getName()) ||
sd.getAdvertisedContracts().contains(ErrorService.class.getName()) ||
sd.getAdvertisedContracts().contains(InterceptionService.class.getName()) ||
sd.getAdvertisedContracts().contains(InstanceLifecycleListener.class.getName())) {
// These get reified right away
reifyDescriptor(sd);
checkScope = true;
if (sd.getAdvertisedContracts().contains(ErrorService.class.getName())) {
addOrRemoveOfErrorHandler = true;
}
if (sd.getAdvertisedContracts().contains(InstanceLifecycleListener.class.getName())) {
addOrRemoveOfInstanceListener = true;
}
if (sd.getAdvertisedContracts().contains(InterceptionService.class.getName())) {
addOrRemoveOfInterceptionService = true;
}
}
if (sd.getAdvertisedContracts().contains(InjectionResolver.class.getName())) {
// This gets reified right away
reifyDescriptor(sd);
checkScope = true;
if (Utilities.getInjectionResolverType(sd) == null) {
throw new MultiException(new IllegalArgumentException(
"An implementation of InjectionResolver must be a parameterized type and the actual type" +
" must be an annotation"));
}
addOrRemoveOfInjectionResolver = true;
}
if (sd.getAdvertisedContracts().contains(DynamicConfigurationListener.class.getName())) {
// This gets reified right away
reifyDescriptor(sd);
checkScope = true;
addOrRemoveOfConfigListener = true;
}
if (sd.getAdvertisedContracts().contains(Context.class.getName())) {
// This one need not be reified, it will get checked later
checkScope = true;
}
if (sd.getAdvertisedContracts().contains(ClassAnalyzer.class.getName())) {
addOrRemoveOfClazzAnalyzer = true;
}
if (checkScope) {
String scope = (sd.getScope() == null) ? PerLookup.class.getName() : sd.getScope() ;
if (!scope.equals(Singleton.class.getName())) {
throw new MultiException(new IllegalArgumentException(
"The implementation class " + sd.getImplementation() + " must be in the Singleton scope"));
}
}
for (ValidationService vs : getAllValidators()) {
Validator validator = vs.getValidator();
if (validator == null) {
throw new MultiException(new IllegalArgumentException("Validator was null from validation service" + vs));
}
if (!vs.getValidator().validate(new ValidationInformationImpl(
Operation.BIND, sd))) {
throw new MultiException(new IllegalArgumentException("Descriptor " + sd + " did not pass the BIND validation"));
}
}
}
return new CheckConfigurationData(retVal,