public static String fullName(String name, JMSDestination.Type type) { if (isJndiName(name)) { return name; } else { return jmsName(name, type); } }
@Override protected Topic createTopic(final String name) throws Exception { return this.destinationManager.installTopicService(name, DestinationUtil.jndiName(name, JMSDestination.Type.TOPIC)); }
protected javax.jms.Queue createRemoteQueue(final JMSSpecificContext context, final String name) { return (javax.jms.Queue) DestinationUtil.mightThrow(new Callable() { @Override public Object call() throws Exception { return context.jmsSession().createQueue(name); } }); }
protected javax.jms.Queue lookupQueue(String name) { List<String> jndiNames = new ArrayList<>(); if (this.server != null) { jndiNames.addAll(Arrays.asList(this.server.serverManager().getJNDIOnQueue(name))); } jndiNames.add(name); jndiNames.add(DestinationUtil.jmsName(name, JMSDestination.Type.QUEUE)); jndiNames.add(DestinationUtil.jndiName(name, JMSDestination.Type.QUEUE)); final Object value = lookupJNDI(jndiNames); if (value != null && value instanceof javax.jms.Queue) { return (javax.jms.Queue) value; } else { return null; } }
if (DestinationUtil.isJndiName(name)) { throw new IllegalArgumentException("topic " + name + " does not exist, and jndi names are lookup only."); } else { topic = createTopic(name); addCreatedDestination(DestinationUtil.fullName(name, JMSDestination.Type.TOPIC));
public String jmsName() { return DestinationUtil.jmsName(name(), type()); }
public String fullName() { return DestinationUtil.fullName(name(), type()); }
protected javax.jms.Topic lookupTopic(String name) { List<String> jndiNames = new ArrayList<>(); if (this.server != null) { jndiNames.addAll(Arrays.asList(this.server.serverManager().getJNDIOnTopic(name))); } jndiNames.add(name); jndiNames.add(DestinationUtil.jmsName(name, JMSDestination.Type.TOPIC)); jndiNames.add(DestinationUtil.jndiName(name, JMSDestination.Type.TOPIC)); final Object value = lookupJNDI(jndiNames); if (value != null && value instanceof javax.jms.Topic) { return (javax.jms.Topic) value; } else { return null; } }
if (DestinationUtil.isJndiName(name)) { throw new IllegalArgumentException("queue " + name + " does not exist, and jndi names are lookup only."); } else { opts.getString(CreateQueueOption.SELECTOR, ""), opts.getBoolean(CreateQueueOption.DURABLE)); addCreatedDestination(DestinationUtil.fullName(name, JMSDestination.Type.QUEUE));
@Override protected Queue createQueue(final String name, final String selector, final boolean durable) throws Exception { return this.destinationManager.installQueueService(name, DestinationUtil.jndiName(name, JMSDestination.Type.QUEUE), selector, durable); }
protected javax.jms.Topic createRemoteTopic(final JMSSpecificContext context, final String name) { return (javax.jms.Topic) DestinationUtil.mightThrow(new Callable() { @Override public Object call() throws Exception { return context.jmsSession().createTopic(name); } }); }
protected javax.jms.Queue createQueue(String name, String selector, boolean durable) throws Exception { this.server .serverManager() .createQueue(false, name, selector, durable, DestinationUtil.jndiName(name, JMSDestination.Type.QUEUE)); return lookupQueue(name); }
@Override public void acknowledge() { if (this.latestMessage != null) { DestinationUtil.mightThrow(new Callable() { @Override public Object call() throws Exception { JMSContext.this.latestMessage.jmsMessage().acknowledge(); return null; } }); } }
protected javax.jms.Topic createTopic(String name) throws Exception { this.server .serverManager() .createTopic(false, name, DestinationUtil.jndiName(name, JMSDestination.Type.TOPIC)); return lookupTopic(name); }
@Override public void commit() { if (isTransacted()) { DestinationUtil.mightThrow(new Callable() { @Override public Object call() throws Exception { jmsSession().commit(); return null; } }); } }
@Override protected void destroyTopic(final String name) { ServiceController controller = this.mscService.serviceRegistry().getService(ASUtils.topicServiceName(name)); controller.setMode(ServiceController.Mode.REMOVE); this.destinationManager.removeDestination(controller, name, DestinationUtil.jndiName(name, JMSDestination.Type.TOPIC), JMSDestination.Type.TOPIC); }
@Override public void rollback() { if (isTransacted()) { DestinationUtil.mightThrow(new Callable() { @Override public Object call() throws Exception { jmsSession().rollback(); return null; } }); } }
@Override protected void destroyQueue(final String name) { ServiceController controller = this.mscService.serviceRegistry().getService(ASUtils.queueServiceName(name)); controller.setMode(ServiceController.Mode.REMOVE); this.destinationManager.removeDestination(controller, name, DestinationUtil.jndiName(name, JMSDestination.Type.QUEUE), JMSDestination.Type.QUEUE); }
@Override public Session jmsSession() { if (this.jmsSession == null) { this.jmsSession = (Session) DestinationUtil.mightThrow(new Callable() { @Override public Object call() throws Exception { jmsConnection.start(); return createJMSSession(); } }); addCloseable(this.jmsSession); } return this.jmsSession; }
protected JMSSpecificContext createXAContext(final XAConnectionFactory cf, final Options<CreateContextOption> options) { if (TransactionUtil.tm == null) { throw new NullPointerException("TransactionManager not found; is transactions module on the classpath?"); } XAConnection connection = (XAConnection) DestinationUtil.mightThrow(new Callable() { @Override public Object call() throws Exception { if (options.has(CreateContextOption.USERNAME)) { return cf.createXAConnection(options.getString(CreateContextOption.USERNAME), options.getString(CreateContextOption.PASSWORD)); } else { return cf.createXAConnection(); } } }); return new JMSXAContext(connection, this, (Context.Mode)options.get(CreateContextOption.MODE), options.has(CreateContextOption.HOST)); }