use of org.glassfish.orb.admin.config.IiopListener in project Payara by payara.
the class SecIORInterceptor method getServerPort.
private int getServerPort(String mech) {
List<IiopListener> listenersList = IIOPUtils.getInstance().getIiopService().getIiopListener();
IiopListener[] iiopListenerBeans = listenersList.toArray(new IiopListener[listenersList.size()]);
for (IiopListener ilisten : iiopListenerBeans) {
if (mech.equalsIgnoreCase("SSL")) {
if (ilisten.getSecurityEnabled().equalsIgnoreCase("true") && ilisten.getSsl() != null && !ilisten.getSsl().getClientAuthEnabled().equalsIgnoreCase("true")) {
return Integer.parseInt(ilisten.getPort());
}
} else if (mech.equalsIgnoreCase("SSL_MUTUALAUTH")) {
if (ilisten.getSecurityEnabled().equalsIgnoreCase("true") && ilisten.getSsl() != null && ilisten.getSsl().getClientAuthEnabled().equalsIgnoreCase("true")) {
return Integer.parseInt(ilisten.getPort());
}
} else if (!ilisten.getSecurityEnabled().equalsIgnoreCase("true")) {
return Integer.parseInt(ilisten.getPort());
}
}
return -1;
}
use of org.glassfish.orb.admin.config.IiopListener in project Payara by payara.
the class GlassFishORBManager method checkORBInitialPort.
private String checkORBInitialPort(Properties props) {
// Port setting in system properties always takes precedence.
String initialPort = System.getProperty(ORBConstants.INITIAL_PORT_PROPERTY);
if (initialPort == null) {
initialPort = props.getProperty(ORBConstants.INITIAL_PORT_PROPERTY);
}
if (initialPort == null) {
IiopListener il = getClearTextIiopListener();
if (il != null) {
initialPort = il.getPort();
}
}
if (initialPort == null) {
initialPort = DEFAULT_ORB_INIT_PORT;
}
// Make sure we set initial port in System properties so that
// any instantiations of com.sun.jndi.cosnaming.CNCtxFactory
// use same port.
props.setProperty(ORBConstants.INITIAL_PORT_PROPERTY, initialPort);
// Do it only in the appserver, not on appclient.
if (processType.isServer()) {
props.setProperty(ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY, initialPort);
}
fineLog("Setting orb initial port to {0}", initialPort);
orbInitialPort = Integer.parseInt(initialPort);
return initialPort;
}
use of org.glassfish.orb.admin.config.IiopListener in project Payara by payara.
the class IiopFolbGmsClient method resolvePort.
private int resolvePort(Server server, IiopListener listener) {
fineLog("resolvePort: server {0} listener {1}", server, listener);
IiopListener ilRaw = GlassFishConfigBean.getRawView(listener);
fineLog("resolvePort: ilRaw {0}", ilRaw);
PropertyResolver pr = new PropertyResolver(domain, server.getName());
fineLog("resolvePort: pr {0}", pr);
String port = pr.getPropertyValue(ilRaw.getPort());
fineLog("resolvePort: port {0}", port);
return Integer.parseInt(port);
}
use of org.glassfish.orb.admin.config.IiopListener in project Payara by payara.
the class IiopFolbGmsClient method getClusterInstanceInfo.
private ClusterInstanceInfo getClusterInstanceInfo(Server server, Config config, boolean assumeInstanceIsRunning) {
if (server == null) {
return null;
}
if (!assumeInstanceIsRunning) {
if (!server.isRunning()) {
return null;
}
}
fineLog("getClusterInstanceInfo: server {0}, config {1}", server, config);
final String name = server.getName();
fineLog("getClusterInstanceInfo: name {0}", name);
final int weight = Integer.parseInt(server.getLbWeight());
fineLog("getClusterInstanceInfo: weight {0}", weight);
final IiopService iservice = config.getExtensionByType(IiopService.class);
fineLog("getClusterInstanceInfo: iservice {0}", iservice);
final String nodeName = server.getNodeRef();
String hostName = nodeName;
if (nodes != null) {
Node node = nodes.getNode(nodeName);
if (node != null) {
// System level, use the local host name
if ((node.isLocal() && !Boolean.getBoolean(USE_NODE_HOST_FOR_LOCAL_NODE_SYSTEM_PROPERTY)) && (node.isLocal() && !Boolean.parseBoolean(iservice.getOrb().getPropertyValue(USE_NODE_HOST_FOR_LOCAL_NODE_PROPERTY, "false")))) {
try {
hostName = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException exc) {
fineLog("getClusterInstanceInfo: caught exception for localhost lookup {0}", exc);
}
} else {
hostName = node.getNodeHost();
}
}
}
fineLog("getClusterInstanceInfo: host {0}", hostName);
final List<IiopListener> listeners = iservice.getIiopListener();
fineLog("getClusterInstanceInfo: listeners {0}", listeners);
final List<SocketInfo> sinfos = new ArrayList<SocketInfo>();
for (IiopListener il : listeners) {
SocketInfo sinfo = new SocketInfo(il.getId(), hostName, resolvePort(server, il));
sinfos.add(sinfo);
}
fineLog("getClusterInstanceInfo: sinfos {0}", sinfos);
final ClusterInstanceInfo result = new ClusterInstanceInfo(name, weight, sinfos);
fineLog("getClusterInstanceInfo: result {0}", result);
return result;
}
use of org.glassfish.orb.admin.config.IiopListener in project Payara by payara.
the class PEORBConfigurator method createORBListeners.
private void createORBListeners(IIOPUtils iiopUtils, IiopListener[] iiopListenerBeans, org.omg.CORBA.ORB orb) {
if (iiopListenerBeans != null) {
int lazyCount = 0;
for (IiopListener ilb : iiopListenerBeans) {
boolean securityEnabled = Boolean.valueOf(ilb.getSecurityEnabled());
boolean isLazy = Boolean.valueOf(ilb.getLazyInit());
if (isLazy) {
lazyCount++;
}
if (lazyCount > 1) {
throw new IllegalStateException("Invalid iiop-listener " + ilb.getId() + ". Only one iiop-listener can be configured " + "with lazy-init=true");
}
int port = Integer.parseInt(ilb.getPort());
String host = handleAddrAny(ilb.getAddress());
if (!securityEnabled || ilb.getSsl() == null) {
Acceptor acceptor = addAcceptor(orb, isLazy, host, IIOP_CLEAR_TEXT_CONNECTION, port);
if (isLazy) {
lazyAcceptor = acceptor;
}
} else {
if (isLazy) {
throw new IllegalStateException("Invalid iiop-listener " + ilb.getId() + ". Lazy-init not supported for SSL iiop-listeners");
}
Ssl sslBean = ilb.getSsl();
assert sslBean != null;
boolean clientAuth = Boolean.valueOf(sslBean.getClientAuthEnabled());
String type = clientAuth ? SSL_MUTUALAUTH : SSL;
addAcceptor(orb, isLazy, host, type, port);
}
}
if (lazyCount == 1) {
getHelper().setSelectableChannelDelegate(new AcceptorDelegateImpl(lazyAcceptor));
}
}
}
Aggregations