Search in sources :

Example 1 with JMSConnectionInfoBean

use of org.apache.oozie.client.rest.JMSConnectionInfoBean in project oozie by apache.

the class MockDagEngineService method createDummyJMSConnectionInfo.

private static JMSConnectionInfoBean createDummyJMSConnectionInfo() {
    JMSConnectionInfoBean jmsBean = new JMSConnectionInfoBean();
    Properties jmsProps = new Properties();
    jmsProps.setProperty("k1", "v1");
    jmsProps.setProperty("k2", "v2");
    jmsBean.setJNDIProperties(jmsProps);
    jmsBean.setTopicPrefix("topicPrefix");
    return jmsBean;
}
Also used : Properties(java.util.Properties) JMSConnectionInfoBean(org.apache.oozie.client.rest.JMSConnectionInfoBean)

Example 2 with JMSConnectionInfoBean

use of org.apache.oozie.client.rest.JMSConnectionInfoBean in project oozie by apache.

the class V2AdminServlet method getJMSConnectionInfo.

@Override
protected JsonBean getJMSConnectionInfo(HttpServletRequest request, HttpServletResponse response) throws XServletException, IOException {
    Configuration conf = Services.get().getConf();
    JMSTopicService jmsTopicService = Services.get().get(JMSTopicService.class);
    String connectionProperties = conf.get(JMSJobEventListener.JMS_CONNECTION_PROPERTIES);
    if (connectionProperties == null) {
        throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.E1601, "JMS connection property is not defined");
    }
    JMSConnectionInfoBean jmsBean = new JMSConnectionInfoBean();
    JMSConnectionInfo jmsInfo = new JMSConnectionInfo(connectionProperties);
    Properties jmsInfoProps = jmsInfo.getJNDIProperties();
    jmsInfoProps.remove("java.naming.security.principal");
    jmsBean.setJNDIProperties(jmsInfoProps);
    if (jmsTopicService != null) {
        jmsBean.setTopicPrefix(jmsTopicService.getTopicPrefix());
        jmsBean.setTopicPatternProperties(jmsTopicService.getTopicPatternProperties());
    } else {
        throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.E1601, "JMSTopicService is not initialized. JMS notification" + "may not be enabled");
    }
    return jmsBean;
}
Also used : JMSTopicService(org.apache.oozie.service.JMSTopicService) Configuration(org.apache.hadoop.conf.Configuration) JMSConnectionInfo(org.apache.oozie.jms.JMSConnectionInfo) Properties(java.util.Properties) JMSConnectionInfoBean(org.apache.oozie.client.rest.JMSConnectionInfoBean)

Aggregations

Properties (java.util.Properties)2 JMSConnectionInfoBean (org.apache.oozie.client.rest.JMSConnectionInfoBean)2 Configuration (org.apache.hadoop.conf.Configuration)1 JMSConnectionInfo (org.apache.oozie.jms.JMSConnectionInfo)1 JMSTopicService (org.apache.oozie.service.JMSTopicService)1