private Key newKey(final InjectionPoint ip) { final Annotated annotated = ip.getAnnotated(); final JMSConnectionFactory jmsConnectionFactory = annotated.getAnnotation(JMSConnectionFactory.class); final JMSSessionMode sessionMode = annotated.getAnnotation(JMSSessionMode.class); final JMSPasswordCredential credential = annotated.getAnnotation(JMSPasswordCredential.class); final String jndi = "openejb:Resource/" + (jmsConnectionFactory == null ? findAnyConnectionFactory() : findMatchingConnectionFactory(jmsConnectionFactory.value())); return new Key( jndi, credential != null ? credential.userName() : null, credential != null ? credential.password() : null, sessionMode != null ? sessionMode.value() : null); }