checkValidity("<CPD URI>", uri);
boolean isNew = false;
chanRegStore = ChannelRegistryStoreFactory.getChannelRegistryStoreImpl();
ChannelType[] types = chanRegStore.getChannelTypes();
ChannelType chanType = null;
for(int i=0; i<types.length && chanType == null; i++)
{
if (types[i].getCpdUri().equals(uri))
chanType = types[i];
}
if (chanType == null) // new one being defined
{
isNew = true;
chanType = chanRegStore.newChannelType();
}
chanType.setJavaClass(clazz);
chanType.setName(name);
chanType.setDescription(description);
chanType.setCpdUri(uri);
chanRegStore.saveChannelType(chanType);
return "The \"" + name + "\" channel type has been "
+ (isNew ? "added" : "updated") + " successfully.";
}