Search in sources :

Example 6 with IiopListener

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;
}
Also used : IiopListener(org.glassfish.orb.admin.config.IiopListener)

Example 7 with IiopListener

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;
}
Also used : IiopListener(org.glassfish.orb.admin.config.IiopListener)

Example 8 with IiopListener

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);
}
Also used : IiopListener(org.glassfish.orb.admin.config.IiopListener) PropertyResolver(org.glassfish.config.support.PropertyResolver)

Example 9 with IiopListener

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;
}
Also used : IiopListener(org.glassfish.orb.admin.config.IiopListener) UnknownHostException(java.net.UnknownHostException) IiopService(org.glassfish.orb.admin.config.IiopService) Node(com.sun.enterprise.config.serverbeans.Node) SocketInfo(com.sun.corba.ee.spi.folb.SocketInfo) ArrayList(java.util.ArrayList) ClusterInstanceInfo(com.sun.corba.ee.spi.folb.ClusterInstanceInfo)

Example 10 with IiopListener

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));
        }
    }
}
Also used : IiopListener(org.glassfish.orb.admin.config.IiopListener) Acceptor(com.sun.corba.ee.spi.transport.Acceptor) Ssl(org.glassfish.grizzly.config.dom.Ssl) PluginPoint(org.glassfish.external.probe.provider.PluginPoint)

Aggregations

IiopListener (org.glassfish.orb.admin.config.IiopListener)24 IiopService (org.glassfish.orb.admin.config.IiopService)9 Test (org.junit.Test)7 PropertyVetoException (java.beans.PropertyVetoException)5 TransactionFailure (org.jvnet.hk2.config.TransactionFailure)5 ParameterMap (org.glassfish.api.admin.ParameterMap)4 Config (com.sun.enterprise.config.serverbeans.Config)3 ActionReport (org.glassfish.api.ActionReport)3 CommandTarget (org.glassfish.config.support.CommandTarget)3 Ssl (org.glassfish.grizzly.config.dom.Ssl)3 Target (org.glassfish.internal.api.Target)3 List (java.util.List)2 TransientNameService (com.sun.corba.ee.impl.naming.cosnaming.TransientNameService)1 ClusterInstanceInfo (com.sun.corba.ee.spi.folb.ClusterInstanceInfo)1 SocketInfo (com.sun.corba.ee.spi.folb.SocketInfo)1 NoSuchWorkQueueException (com.sun.corba.ee.spi.threadpool.NoSuchWorkQueueException)1 ThreadPool (com.sun.corba.ee.spi.threadpool.ThreadPool)1 ThreadPoolManager (com.sun.corba.ee.spi.threadpool.ThreadPoolManager)1 Acceptor (com.sun.corba.ee.spi.transport.Acceptor)1 CreateSsl (com.sun.enterprise.admin.commands.CreateSsl)1