*/
public static void createQueue(String queueName, String owner)
throws RegistryClientException {
try {
RegistryService registryService = CommonsDataHolder.getInstance().getRegistryService();
UserRegistry registry = registryService.getGovernanceSystemRegistry();
// Set queue properties
Collection queue = null;
String queueID = CommonsUtil.getQueueID(queueName);
if (!registry.resourceExists(queueID)) { // Create queue
queue = registry.newCollection();
queue.setProperty(OWNER, owner);
queue.setProperty(NAME, queueName);
queue.setProperty(CREATED_TIME, ConverterUtil.convertToString(
Calendar.getInstance()));
queue.setProperty(UPDATED_TIME, ConverterUtil.convertToString(
Calendar.getInstance()));
queue.setProperty(CREATED_FROM, CREATED_FROM_AMQP);
queue.setProperty(USER_COUNT, "1");
} else { // Share queue
queue = (Collection)registry.get(queueID);
queue.setProperty(UPDATED_TIME, ConverterUtil.convertToString(
Calendar.getInstance()));
String userCount = queue.getProperty(USER_COUNT);
if (null != userCount) {
int count = Integer.parseInt(userCount);
queue.setProperty(USER_COUNT, Integer.toString(++count));
}
}
registry.put(queueID, queue);
} catch (RegistryException e) {
throw new RegistryClientException(e);
}
}