Search in sources :

Example 1 with IiopListener

use of org.glassfish.orb.admin.config.IiopListener in project Payara by payara.

the class AbstractRemoteCertificateManagementCommand method resolveKeyStore.

/**
 * Resolves the keystore location and the password required to access it.
 */
protected void resolveKeyStore() {
    Config config = servers.getServer(target).getConfig();
    if (listener != null) {
        // Check if listener is an HTTP listener
        List<Protocol> protocols = config.getNetworkConfig().getProtocols().getProtocol();
        for (Protocol protocol : protocols) {
            if (protocol.getName().equals(listener)) {
                Ssl sslConfig = protocol.getSsl();
                if (sslConfig != null) {
                    if (StringUtils.ok(sslConfig.getKeyStore())) {
                        keystore = new File(TranslatedConfigView.expandConfigValue(sslConfig.getKeyStore()));
                        keystorePassword = TranslatedConfigView.expandConfigValue(sslConfig.getKeyStorePassword()).toCharArray();
                    }
                }
            }
        }
        if (keystore == null) {
            // Check if listener is an IIOP listener
            List<IiopListener> listeners = iiopService.getIiopListener();
            for (IiopListener listener : listeners) {
                if (listener.getId().equals(listener)) {
                    Ssl sslConfig = listener.getSsl();
                    if (StringUtils.ok(sslConfig.getKeyStore())) {
                        keystore = new File(TranslatedConfigView.expandConfigValue(sslConfig.getKeyStore()));
                        keystorePassword = TranslatedConfigView.expandConfigValue(sslConfig.getKeyStorePassword()).toCharArray();
                    }
                }
            }
        }
    }
    // Default to getting it from the JVM options if no non-default value found
    if (keystore == null) {
        List<String> jvmOptions = config.getJavaConfig().getJvmOptions();
        for (String jvmOption : jvmOptions) {
            if (jvmOption.startsWith("-Djavax.net.ssl.keyStore")) {
                keystore = new File(TranslatedConfigView.expandConfigValue(jvmOption.substring(jvmOption.indexOf("=") + 1)));
            }
        }
    }
    // If it's STILL null, just go with default
    if (keystore == null) {
        keystore = serverEnvironment.getJKS();
    }
    // If the password hasn't been set, go with master
    if (keystorePassword == null) {
        MasterPasswordImpl masterPasswordService = serviceLocator.getService(MasterPasswordImpl.class);
        keystorePassword = masterPasswordService.getMasterPassword();
    }
}
Also used : IiopListener(org.glassfish.orb.admin.config.IiopListener) MasterPasswordImpl(com.sun.enterprise.security.ssl.impl.MasterPasswordImpl) Config(com.sun.enterprise.config.serverbeans.Config) Protocol(org.glassfish.grizzly.config.dom.Protocol) Ssl(org.glassfish.grizzly.config.dom.Ssl) File(java.io.File)

Example 2 with IiopListener

use of org.glassfish.orb.admin.config.IiopListener in project Payara by payara.

the class AbstractRemoteCertificateManagementCommand method resolveTrustStore.

/**
 * Resolves the truststore location and the password required to access it.
 */
protected void resolveTrustStore() {
    Config config = servers.getServer(target).getConfig();
    if (listener != null) {
        // Check if listener is an HTTP listener
        List<Protocol> protocols = config.getNetworkConfig().getProtocols().getProtocol();
        for (Protocol protocol : protocols) {
            if (protocol.getName().equals(listener)) {
                Ssl sslConfig = protocol.getSsl();
                if (sslConfig != null) {
                    if (StringUtils.ok(sslConfig.getTrustStore())) {
                        truststore = new File(TranslatedConfigView.expandConfigValue(sslConfig.getTrustStore()));
                        truststorePassword = TranslatedConfigView.expandConfigValue(sslConfig.getTrustStorePassword()).toCharArray();
                    }
                }
            }
        }
        if (truststore == null) {
            // Check if listener is an IIOP listener
            List<IiopListener> listeners = iiopService.getIiopListener();
            for (IiopListener listener : listeners) {
                if (listener.getId().equals(listener)) {
                    Ssl sslConfig = listener.getSsl();
                    if (StringUtils.ok(sslConfig.getTrustStore())) {
                        truststore = new File(TranslatedConfigView.expandConfigValue(sslConfig.getTrustStore()));
                        truststorePassword = TranslatedConfigView.expandConfigValue(sslConfig.getTrustStorePassword()).toCharArray();
                    }
                }
            }
        }
    }
    // Default to getting it from the JVM options if no non-default value found
    if (truststore == null) {
        List<String> jvmOptions = config.getJavaConfig().getJvmOptions();
        for (String jvmOption : jvmOptions) {
            if (jvmOption.startsWith("-Djavax.net.ssl.trustStore")) {
                truststore = new File(TranslatedConfigView.expandConfigValue(jvmOption.substring(jvmOption.indexOf("=") + 1)));
            }
        }
    }
    // If it's STILL null, just go with default
    if (truststore == null) {
        truststore = serverEnvironment.getTrustStore();
    }
    // If the password hasn't been set, go with master
    if (truststorePassword == null) {
        MasterPasswordImpl masterPassword = serviceLocator.getService(MasterPasswordImpl.class);
        truststorePassword = masterPassword.getMasterPassword();
    }
}
Also used : IiopListener(org.glassfish.orb.admin.config.IiopListener) MasterPasswordImpl(com.sun.enterprise.security.ssl.impl.MasterPasswordImpl) Config(com.sun.enterprise.config.serverbeans.Config) Protocol(org.glassfish.grizzly.config.dom.Protocol) Ssl(org.glassfish.grizzly.config.dom.Ssl) File(java.io.File)

Example 3 with IiopListener

use of org.glassfish.orb.admin.config.IiopListener in project Payara by payara.

the class CertificateManagementRestApiHandlers method getAllListenerNamesAndUrls.

/**
 * Gets the names of all HTTP and IIOP listeners for the target instance and the links to them.
 * @param contextPath The root context path
 * @param config The config of the target instance
 * @param serviceLocator The ServiceLocator to get additional HK2 services from
 * @param listeners The list of listeners to populate
 * @param usedByLinks The map of usedBy links to populate
 */
private static void getAllListenerNamesAndUrls(String contextPath, Config config, ServiceLocator serviceLocator, List<String> listeners, Map<String, String> usedByLinks) {
    List<Protocol> protocols = config.getNetworkConfig().getProtocols().getProtocol();
    String httpConfigUrl = contextPath + "/web/grizzly/networkListenerEdit.jsf?configName=" + config.getName() + "&cancelTo=web/grizzly/networkListeners.jsf";
    for (Protocol protocol : protocols) {
        listeners.add(protocol.getName());
        usedByLinks.put(protocol.getName(), httpConfigUrl + "&name=" + protocol.getName());
    }
    IiopService iiopService = serviceLocator.getService(IiopService.class);
    String iiopConfigUrl = contextPath + "/corba/sslEdit.jsf?configName=" + config.getName();
    List<IiopListener> iiopListeners = iiopService.getIiopListener();
    for (IiopListener listener : iiopListeners) {
        listeners.add(listener.getId());
        usedByLinks.put(listener.getId(), iiopConfigUrl + "&name=" + listener.getId());
    }
}
Also used : IiopListener(org.glassfish.orb.admin.config.IiopListener) IiopService(org.glassfish.orb.admin.config.IiopService) Protocol(org.glassfish.grizzly.config.dom.Protocol)

Example 4 with IiopListener

use of org.glassfish.orb.admin.config.IiopListener in project Payara by payara.

the class PEORBConfigurator method configure.

public void configure(DataCollector dc, ORB orb) {
    try {
        // end temp fix for bug 6320008
        if (threadpoolMgr != null) {
            // This will be the case for the Server Side ORB created
            // For client side threadpoolMgr will be null, so we will
            // never come here
            orb.setThreadPoolManager(threadpoolMgr);
        }
        // Do the stats for the threadpool
        ThreadPoolManager tpool = orb.getThreadPoolManager();
        // ORB creates its own threadpool if threadpoolMgr was null above
        ThreadPool thpool = tpool.getDefaultThreadPool();
        String ThreadPoolName = thpool.getName();
        ThreadPoolStats tpStats = new ThreadPoolStatsImpl(thpool.getWorkQueue(0).getThreadPool());
        StatsProviderManager.register("orb", PluginPoint.SERVER, "thread-pool/orb/threadpool/" + ThreadPoolName, tpStats);
        configureCopiers(orb);
        configureCallflowInvocationInterceptor(orb);
        // In the server-case, iiop acceptors need to be set up after the
        // initial part of the orb creation but before any
        // portable interceptor initialization
        IIOPUtils iiopUtils = IIOPUtils.getInstance();
        if (iiopUtils.getProcessType().isServer()) {
            List<IiopListener> iiop_listener_list = IIOPUtils.getInstance().getIiopService().getIiopListener();
            IiopListener[] iiopListenerBeans = iiop_listener_list.toArray(new IiopListener[iiop_listener_list.size()]);
            this.createORBListeners(iiopUtils, iiopListenerBeans, orb);
        }
        if (orb.getORBData().environmentIsGFServer()) {
            // Start the transient name service, which publishes NameService
            // in the ORB's local resolver.
            new TransientNameService(orb);
        }
        // Publish the ORB reference back to GlassFishORBHelper, so that
        // subsequent calls from interceptor ORBInitializers can call
        // GlassFishORBHelper.getORB() without problems.  This is
        // especially important for code running in the service initializer
        // thread.
        getHelper().setORB(orb);
    } catch (NoSuchWorkQueueException ex) {
        Logger.getLogger(PEORBConfigurator.class.getName()).log(Level.SEVERE, null, ex);
    }
}
Also used : IiopListener(org.glassfish.orb.admin.config.IiopListener) NoSuchWorkQueueException(com.sun.corba.ee.spi.threadpool.NoSuchWorkQueueException) ThreadPoolStats(org.glassfish.enterprise.iiop.util.ThreadPoolStats) ThreadPoolStatsImpl(org.glassfish.enterprise.iiop.util.ThreadPoolStatsImpl) ThreadPool(com.sun.corba.ee.spi.threadpool.ThreadPool) TransientNameService(com.sun.corba.ee.impl.naming.cosnaming.TransientNameService) ThreadPoolManager(com.sun.corba.ee.spi.threadpool.ThreadPoolManager) S1ASThreadPoolManager(org.glassfish.enterprise.iiop.util.S1ASThreadPoolManager) IIOPUtils(org.glassfish.enterprise.iiop.util.IIOPUtils)

Example 5 with IiopListener

use of org.glassfish.orb.admin.config.IiopListener in project Payara by payara.

the class CreateIiopListenerTest method tearDown.

@After
public void tearDown() throws TransactionFailure {
    ConfigSupport.apply(new SingleConfigCode<IiopService>() {

        public Object run(IiopService param) throws PropertyVetoException, TransactionFailure {
            List<IiopListener> listenerList = param.getIiopListener();
            for (IiopListener listener : listenerList) {
                String currListenerId = listener.getId();
                if (currListenerId != null && currListenerId.equals("iiop_1")) {
                    listenerList.remove(listener);
                    break;
                }
            }
            return listenerList;
        }
    }, iiopService);
    parameters = new ParameterMap();
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) TransactionFailure(org.jvnet.hk2.config.TransactionFailure) IiopListener(org.glassfish.orb.admin.config.IiopListener) IiopService(org.glassfish.orb.admin.config.IiopService) List(java.util.List) ParameterMap(org.glassfish.api.admin.ParameterMap) After(org.junit.After)

Aggregations

IiopListener (org.glassfish.orb.admin.config.IiopListener)28 IiopService (org.glassfish.orb.admin.config.IiopService)11 Test (org.junit.Test)7 Config (com.sun.enterprise.config.serverbeans.Config)5 PropertyVetoException (java.beans.PropertyVetoException)5 Ssl (org.glassfish.grizzly.config.dom.Ssl)5 TransactionFailure (org.jvnet.hk2.config.TransactionFailure)5 ParameterMap (org.glassfish.api.admin.ParameterMap)4 ActionReport (org.glassfish.api.ActionReport)3 CommandTarget (org.glassfish.config.support.CommandTarget)3 Protocol (org.glassfish.grizzly.config.dom.Protocol)3 Target (org.glassfish.internal.api.Target)3 MasterPasswordImpl (com.sun.enterprise.security.ssl.impl.MasterPasswordImpl)2 File (java.io.File)2 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