if (ctx == null) {
throw new IllegalArgumentException("contextualization " +
"document given to validate is null");
}
Provides_Type provides = ctx.getProvides();
Requires_Type requires = ctx.getRequires();
if (provides == null && requires == null) {
throw new ContextBrokerException("Both provides and " +
"requires are missing. Will not contextualize this. " +
"If there is nothing to do, do not include " +
"contextualization document.");
}
if (provides != null) {
IdentityProvides_Type[] givenIDs = provides.getIdentity();
if (givenIDs == null || givenIDs.length == 0) {
throw new ContextBrokerException("Provides section is " +
"present but has no identity elements. Will not " +
"contextualize.");
}