use of org.glassfish.internal.api.ORBLocator in project Payara by payara.
the class ActiveJmsResourceAdapter method setAppClientRABeanProperties.
/**
* Sets the SE/EE specific MQ-RA bean properties
* @throws ConnectorRuntimeException
*/
private void setAppClientRABeanProperties() throws ConnectorRuntimeException {
if (_logger.isLoggable(Level.FINE))
logFine("In Appclient container!!!");
ConnectorDescriptor cd = super.getDescriptor();
// if the CONNECTION_URL is localhost, in JMSRA,
// use the ORB hostname so multi-homed connections work properly
ORBLocator orbHelper = habitat.getService(ORBLocator.class);
if (orbHelper != null && orbHelper.getORB() != null) {
String jmsHost = null;
String orbHost = orbHelper.getORBHost(orbHelper.getORB());
String jmsPort = "7676";
Set<?> props = cd.getConfigProperties();
for (Object prop_ : props) {
if (prop_ instanceof ConnectorConfigProperty) {
final ConnectorConfigProperty prop = (ConnectorConfigProperty) prop_;
if (prop.getName().equals(CONNECTION_URL)) {
try {
URI url = new URI(prop.getValue());
jmsPort = Integer.toString(url.getPort());
if ("localhost".equalsIgnoreCase(url.getHost())) {
jmsHost = orbHost;
}
} catch (URISyntaxException ex) {
_logger.fine(String.format("Invalid Connection URL: %s", prop.getValue()));
}
}
}
}
if (jmsHost != null) {
setProperty(cd, new ConnectorConfigProperty(CONNECTION_URL, String.format("mq://%s:%s", orbHost, jmsPort), "ORB Address List", "java.lang.String"));
}
}
ConnectorConfigProperty envProp1 = new ConnectorConfigProperty(BROKERTYPE, REMOTE, "Broker Type", "java.lang.String");
setProperty(cd, envProp1);
ConnectorConfigProperty envProp2 = new ConnectorConfigProperty(GROUPNAME, "", "Group Name", "java.lang.String");
cd.removeConfigProperty(envProp2);
ConnectorConfigProperty envProp3 = new ConnectorConfigProperty(CLUSTERCONTAINER, "false", "Cluster flag", "java.lang.Boolean");
setProperty(cd, envProp3);
}
Aggregations