Examples of JMSConnectionInfo


Examples of org.apache.oozie.jms.JMSConnectionInfo

        String jmsConnectionURL = server1 + "," + server2 + "," + server3;
        conf.set(HCatAccessorService.JMS_CONNECTIONS_PROPERTIES, jmsConnectionURL);
        services.init();

        HCatAccessorService hcatService = services.get(HCatAccessorService.class);
        JMSConnectionInfo connInfo = hcatService.getJMSConnectionInfo(new URI("hcat://hcatserver.blue.server.com:8020"));
        // rules will be applied
        assertEquals("java.naming.factory.initial#Dummy.Factory;java.naming.provider.url#tcp://broker.blue:61616",
                connInfo.getJNDIPropertiesString());

        connInfo = hcatService.getJMSConnectionInfo(new URI("http://unknown:9999/fs"));
        // will map to default
        assertEquals(
                "java.naming.factory.initial#org.apache.activemq.jndi.ActiveMQInitialContextFactory;" +
                "java.naming.provider.url#vm://localhost?broker.persistent=false",
                connInfo.getJNDIPropertiesString());

        connInfo = hcatService.getJMSConnectionInfo(new URI("hcat://xyz.corp.dummy.com"));
        assertEquals("java.naming.factory.initial#Dummy.Factory;java.naming.provider.url#tcp:localhost:61616",
                connInfo.getJNDIPropertiesString());
    }
View Full Code Here

Examples of org.apache.oozie.jms.JMSConnectionInfo

        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());
View Full Code Here

Examples of org.apache.oozie.jms.JMSConnectionInfo

            for (String connection : connections) {
                String[] values = connection.split("=", 2);
                String key = values[0].trim();
                String value = values[1].trim();
                if (key.equals("default")) {
                    defaultJMSConnInfo = new JMSConnectionInfo(value);
                }
                else {
                    mappingRules.add(new MappingRule(key, value));
                }
            }
View Full Code Here

Examples of org.apache.oozie.jms.JMSConnectionInfo

    public boolean isKnownPublisher(URI sourceURI) {
        if (nonJMSPublishers.contains(sourceURI.getAuthority())) {
            return true;
        }
        else {
            JMSConnectionInfo connInfo = publisherJMSConnInfoMap.get(sourceURI.getAuthority());
            return connInfo == null ? (getJMSConnectionInfo(sourceURI) != null) : true;
        }
    }
View Full Code Here

Examples of org.apache.oozie.jms.JMSConnectionInfo

     * @param publisherURI URI of the publisher
     * @return JMSConnectionInfo to connect to the JMS server that the publisher publishes to
     */
    public JMSConnectionInfo getJMSConnectionInfo(URI publisherURI) {
        String publisherAuthority = publisherURI.getAuthority();
        JMSConnectionInfo connInfo = null;
        if (publisherJMSConnInfoMap.containsKey(publisherAuthority)) {
            connInfo = publisherJMSConnInfoMap.get(publisherAuthority);
        }
        else {
            String schemeWithAuthority = publisherURI.getScheme() + "://" + publisherAuthority;
            for (MappingRule mr : mappingRules) {
                String jndiPropertiesString = mr.applyRule(schemeWithAuthority);
                if (jndiPropertiesString != null) {
                    connInfo = new JMSConnectionInfo(jndiPropertiesString);
                    publisherJMSConnInfoMap.put(publisherAuthority, connInfo);
                    LOG.info("Adding hcat server [{0}] to the list of JMS publishers", schemeWithAuthority);
                    break;
                }
            }
View Full Code Here

Examples of org.apache.oozie.jms.JMSConnectionInfo

     * @param hcatURI hcatalog partition URI
     * @param topic JMS topic to register to
     * @param msgHandler Handler which will process the messages received on the topic
     */
    public void registerForNotification(HCatURI hcatURI, String topic, HCatMessageHandler msgHandler) {
        JMSConnectionInfo connInfo = getJMSConnectionInfo(hcatURI.getURI());
        jmsService.registerForNotification(connInfo, topic, msgHandler);
        registeredTopicsMap.put(
                getKeyForRegisteredTopicsMap(hcatURI), topic);
    }
View Full Code Here

Examples of org.apache.oozie.jms.JMSConnectionInfo

    }

    public void unregisterFromNotification(HCatURI hcatURI) {
        String topic = registeredTopicsMap.remove(getKeyForRegisteredTopicsMap(hcatURI));
        if (topic != null) {
            JMSConnectionInfo connInfo = getJMSConnectionInfo(hcatURI.getURI());
            jmsService.unregisterFromNotification(connInfo, topic);
        }
    }
View Full Code Here

Examples of org.apache.oozie.jms.JMSConnectionInfo

    public void unregisterFromNotification(String server, String database, String table) {
        String key = server + DELIMITER + database + DELIMITER + table;
        String topic = registeredTopicsMap.remove(key);
        if (topic != null) {
            try {
                JMSConnectionInfo connInfo = getJMSConnectionInfo(new URI("hcat://" + server));
                jmsService.unregisterFromNotification(connInfo, topic);
            }
            catch (URISyntaxException e) {
                LOG.warn("Error unregistering from notification for topic [{0}]. Hcat table=[{1}]", topic, key, e);
            }
View Full Code Here

Examples of org.apache.oozie.jms.JMSConnectionInfo

        addMissingDependencyAndRegister(dep4, actionId4);
        addMissingDependencyAndRegister(dep4, actionId4);

        HCatAccessorService hcatService = Services.get().get(HCatAccessorService.class);
        JMSAccessorService jmsService = Services.get().get(JMSAccessorService.class);
        JMSConnectionInfo connInfo = hcatService.getJMSConnectionInfo(dep1.getURI());
        assertTrue(hcatService.isRegisteredForNotification(dep1)); //server1,db,table1
        assertTrue(hcatService.isRegisteredForNotification(dep3)); //server2,db,table2
        assertTrue(jmsService.isListeningToTopic(connInfo, dep1.getDb() + "." + dep1.getTable()));
        assertTrue(jmsService.isListeningToTopic(connInfo, dep3.getDb() + "." + dep3.getTable()));
View Full Code Here

Examples of org.apache.oozie.jms.JMSConnectionInfo

    @Test
    public void testConnection() throws Exception {
        HCatAccessorService hcatService = services.get(HCatAccessorService.class);
        JMSAccessorService jmsService = services.get(JMSAccessorService.class);
        // both servers should connect to default JMS server
        JMSConnectionInfo connInfo = hcatService.getJMSConnectionInfo(new URI("hcat://hcatserver.blue.server.com:8020"));
        ConnectionContext ctxt1 = jmsService.createConnectionContext(connInfo);
        assertTrue(ctxt1.isConnectionInitialized());
        JMSConnectionInfo connInfo1 = hcatService.getJMSConnectionInfo(new URI("http://unknown:80"));
        ConnectionContext ctxt2 = jmsService.createConnectionContext(connInfo1);
        assertTrue(ctxt2.isConnectionInitialized());
        assertEquals(ctxt1, ctxt2);
        ctxt1.close();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.