use of org.apache.oozie.util.MappingRule in project oozie by apache.
the class HCatAccessorService method getJMSConnectionInfo.
/**
* Given a publisher host:port return the connection details of JMS server that the publisher
* publishes to
*
* @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;
}
}
if (connInfo == null && defaultJMSConnInfo != null) {
connInfo = defaultJMSConnInfo;
publisherJMSConnInfoMap.put(publisherAuthority, defaultJMSConnInfo);
LOG.info("Adding hcat server [{0}] to the list of JMS publishers", schemeWithAuthority);
} else {
nonJMSPublishers.add(publisherAuthority);
LOG.info("Adding hcat server [{0}] to the list of non JMS publishers", schemeWithAuthority);
}
}
return connInfo;
}
use of org.apache.oozie.util.MappingRule in project oozie by apache.
the class HCatAccessorService method initializeMappingRules.
private void initializeMappingRules() {
String[] connections = ConfigurationService.getStrings(conf, JMS_CONNECTIONS_PROPERTIES);
if (connections != null) {
mappingRules = new ArrayList<MappingRule>(connections.length);
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));
}
}
} else {
LOG.warn("No JMS connection defined");
}
}
Aggregations