Package com.sun.grizzly.config.dom

Examples of com.sun.grizzly.config.dom.Protocol


        throws TransactionFailure {
        ConfigSupport.apply(new SingleConfigCode<Protocols>() {
            @Override
            public Object run(Protocols param) throws TransactionFailure {
                for (final HttpListener httpListener : httpService.getHttpListener()) {
                    final Protocol protocol = param.createChild(Protocol.class);
                    param.getProtocol().add(protocol);
                    protocol.setName(httpListener.getId());
                    final Http http = protocol.createChild(Http.class);
                    http.setFileCache(http.createChild(FileCache.class));
                    http.setDefaultVirtualServer(
                        httpListener.getId().equals(ASADMIN_LISTENER) ? ASADMIN_VIRTUAL_SERVER : "server");
                    protocol.setHttp(http);
                }
                return null;
            }
        }, protocols);
    }
View Full Code Here


    private void createPortUnification(final NetworkListener listener) throws TransactionFailure {
        ConfigSupport.apply(new SingleConfigCode<Protocols>() {
            @Override
            public Object run(final Protocols protocols) throws TransactionFailure {
                final Protocol puProtocol = createProtocol(protocols, "pu-" + listener.getName());
                final PortUnification pu = puProtocol.createChild(PortUnification.class);
                puProtocol.setPortUnification(pu);
                createProtocolFinder(pu, listener.getProtocol(), listener.getProtocol(),
                    "com.sun.grizzly.http.portunif.HttpProtocolFinder");
                createProtocolFinder(pu, "soap-tcp", "soap-tcp-finder",
                    "org.glassfish.webservices.transport.tcp.WSTCPProtocolFinder");
                final Protocol soap = createProtocol(protocols, "soap-tcp");
                final ProtocolChainInstanceHandler handler = soap.createChild(ProtocolChainInstanceHandler.class);
                soap.setProtocolChainInstanceHandler(handler);
                final ProtocolChain chain = handler.createChild(ProtocolChain.class);
                handler.setProtocolChain(chain);
                createProtocolFilter(chain, "soap-tcp-filter",
                    "org.glassfish.webservices.transport.tcp.WSTCPProtocolFilter");
                return null;
View Full Code Here

            }
        }, getNetworkConfig().getProtocols());
    }

    private Protocol createProtocol(final Protocols protocols, final String name) throws TransactionFailure {
        final Protocol puProtocol = protocols.createChild(Protocol.class);
        protocols.getProtocol().add(puProtocol);
        puProtocol.setName(name);
        return puProtocol;
    }
View Full Code Here

        }, httpService);
    }

    private void migrateHttpListeners(NetworkConfig config) throws TransactionFailure {
        for (final HttpListener listener : currentConfig.getHttpService().getHttpListener()) {
            final Protocol protocol = migrateToProtocols(config, listener);
            final NetworkListener networkListener = createNetworkListener(currentConfig, listener, protocol);
            if ("ws/tcp".equals(listener.getPropertyValue("proxiedProtocols"))) {
                createPortUnification(networkListener);
                ConfigSupport.apply(new SingleConfigCode<NetworkListener>() {
                    @Override
View Full Code Here

    private Protocol migrateToProtocols(NetworkConfig config, final HttpListener listener) throws TransactionFailure {
        final Protocols protocols = getProtocols(config);
        return (Protocol) ConfigSupport.apply(new SingleConfigCode<Protocols>() {
            public Object run(Protocols param) throws TransactionFailure {
                final Protocol protocol = param.createChild(Protocol.class);
                final Ssl ssl = listener.getSsl();
                if (ssl != null && ssl.getClassname() == null) {
                    ConfigSupport.apply(new SingleConfigCode<Ssl>() {
                        @Override
                        public Object run(final Ssl param) {
                            param.setClassname("com.sun.enterprise.security.ssl.GlassfishSSLImpl");
                            return null;
                        }
                    }, ssl);
                }
                param.getProtocol().add(protocol);
                protocol.setName(listener.getId());
                protocol.setSsl(ssl);
                protocol.setSecurityEnabled(listener.getSecurityEnabled());
                createHttp(protocol, listener);
                return protocol;
            }
        }, protocols);
    }
View Full Code Here

        try {

            ConfigSupport.apply(new SingleConfigCode<Protocols>() {
                public Object run(Protocols param) throws TransactionFailure {
                    final Protocol protocol = param.createChild(Protocol.class);
                    protocol.setName(listenerName);
                    protocol.setSecurityEnabled(securityEnabled);
                    param.getProtocol().add(protocol);
                    final Http http = protocol.createChild(Http.class);
                    http.setDefaultVirtualServer(defaultVS);
                    http.setFileCache(http.createChild(FileCache.class));
                    protocol.setHttp(http);
                    return protocol;
                }
            }, networkConfig.getProtocols());

            ConfigSupport.apply(new ConfigCode() {
                public Object run(ConfigBeanProxy... params) throws TransactionFailure {
                    NetworkListeners nls = (NetworkListeners) params[0];
                    Transports transports = (Transports) params[1];
                    final NetworkListener listener = nls.createChild(NetworkListener.class);
                    listener.setName(listenerName);
                    listener.setPort(Integer.toString(portNumber));
                    listener.setProtocol(listenerName);
                    listener.setThreadPool("http-thread-pool");
                    if (listener.findThreadPool() == null) {
                        final ThreadPool pool = nls.createChild(ThreadPool.class);
                        pool.setName(listenerName);
                        listener.setThreadPool(listenerName);
                    }
                    listener.setTransport("tcp");
                    if (listener.findTransport() == null) {
                        final Transport transport = transports.createChild(Transport.class);
                        transport.setName(listenerName);
                        listener.setTransport(listenerName);
                    }
                    nls.getNetworkListener().add(listener);
                    return listener;
                }
            }, networkConfig.getNetworkListeners(), networkConfig.getTransports());
           
            if (webListener.getProtocol().equals("https")) {
                NetworkListener networkListener = networkConfig.getNetworkListener(listenerName);
                Protocol httpProtocol = networkListener.findHttpProtocol();
                ConfigSupport.apply(new SingleConfigCode<Protocol>() {
                    public Object run(Protocol param) throws TransactionFailure {
                        Ssl newSsl = param.createChild(Ssl.class);
                        populateSslElement(newSsl, listener);
                        param.setSsl(newSsl);
View Full Code Here

            NetworkListeners networkListeners = networkConfig.getNetworkListeners();
            final NetworkListener listenerToBeRemoved =
                    networkConfig.getNetworkListener(name);

            final Protocols protocols = networkConfig.getProtocols();
            final Protocol protocol = networkConfig.findProtocol(name);

            if (listenerToBeRemoved == null) {
                log.severe("Network Listener " + name + " doesn't exist");
            } else {
                final com.sun.enterprise.config.serverbeans.VirtualServer virtualServer =
                        httpService.getVirtualServerByName(
                        listenerToBeRemoved.findHttpProtocol().getHttp().getDefaultVirtualServer());
                ConfigSupport.apply(new ConfigCode() {
                    public Object run(ConfigBeanProxy... params) throws PropertyVetoException {
                        final NetworkListeners listeners = (NetworkListeners) params[0];
                        final com.sun.enterprise.config.serverbeans.VirtualServer server =
                                (com.sun.enterprise.config.serverbeans.VirtualServer) params[1];
                        listeners.getNetworkListener().remove(listenerToBeRemoved);
                        server.removeNetworkListener(listenerToBeRemoved.getName());
                        return listenerToBeRemoved;
                    }
                }, networkListeners, virtualServer);

                ConfigSupport.apply(new ConfigCode() {
                    public Object run(ConfigBeanProxy... params) throws PropertyVetoException {
                        final Protocols protocols = (Protocols) params[0];
                        final Protocol protocol = (Protocol) params[1];
                        protocols.getProtocol().remove(protocol);
                        return protocol;
                    }
                }, protocols, protocol);
View Full Code Here

            return protocols_w;
        }

        private Protocol writableProtocol(final String protocolName,
                final boolean isSecure) throws TransactionFailure {
            Protocol p_w = namedProtocols_w.get(protocolName);
            if (p_w == null) {
                /*
                 * Try to find an existing entry for this protocol.
                 */
                final Protocol p_r = findProtocol(protocolName);
                if (p_r == null) {
                    final Protocols ps_w = writableProtocols();
                    if (ps_w == null) {
                        return null;
                    }
View Full Code Here

                    final String protocolName) throws TransactionFailure {
                final Protocols ps_w = writableProtocols();
                if (ps_w == null) {
                    return;
                }
                final Protocol doomedProtocol = ps_w.findProtocol(protocolName);
                if (doomedProtocol != null) {
                    ps_w.getProtocol().remove(doomedProtocol);
                }
            }
View Full Code Here

         *         <ssl ...>
         *
         */
         final Config serverConfig;
         final NetworkConfig nc;
         final Protocol p;
         final Ssl ssl ;
         if ((serverConfig = configs.getConfigByName(SecureAdminUpgradeHelper.DAS_CONFIG_NAME)) == null) {
             return false;
         }

         if ((nc = serverConfig.getNetworkConfig()) == null) {
             return false;
         }

         if ((p = nc.findProtocol(ADMIN_LISTENER_NAME)) == null) {
             return false;
         }

        
         if ((ssl = p.getSsl()) == null) {
             return false;
         }
         return true;
    }
View Full Code Here

TOP

Related Classes of com.sun.grizzly.config.dom.Protocol

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.