Examples of SocketBinding


Examples of org.jboss.as.console.client.shared.general.model.SocketBinding

        ToolStrip detailToolStrip = new ToolStrip();
        editBtn = new ToolButton(Console.CONSTANTS.common_label_edit());
        ClickHandler editHandler = new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                SocketBinding editedEntity = form.getEditedEntity();
                if(editBtn.getText().equals(Console.CONSTANTS.common_label_edit())) {
                    presenter.editSocketBinding(editedEntity);
                }
                else {
                    presenter.saveSocketBinding(editedEntity.getName(), editedEntity.getGroup(), form.getChangedValues());
                }
            }
        };
        editBtn.addClickHandler(editHandler);
        detailToolStrip.addToolButton(editBtn);


        ClickHandler clickHandler = new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

                SocketBinding socket = form.getEditedEntity();

                Feedback.confirm(
                        "Delete Socket Binding",
                        "Really delete this socket binding '" + socket.getName() + "' ?",
                        new Feedback.ConfirmationHandler() {
                            @Override
                            public void onConfirmation(boolean isConfirmed) {
                                if (isConfirmed) {
                                    presenter.onDelete(form.getEditedEntity());
View Full Code Here

Examples of org.jboss.as.console.client.shared.general.model.SocketBinding

                    public void onClick(ClickEvent event) {

                        FormValidation validation = form.validate();
                        if(!validation.hasErrors())
                        {
                            SocketBinding newGroup = form.getUpdatedEntity();
                            presenter.createNewSocketBinding(newGroup);
                        }
                    }
                },
View Full Code Here

Examples of org.jboss.as.console.client.shared.general.model.SocketBinding

        toolstrip.addToolButtonRight(addBtn);

        ToolButton removeBtn = new ToolButton(Console.CONSTANTS.common_label_delete(), new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                final SocketBinding editedEntity = form.getEditedEntity();
                Feedback.confirm(
                        Console.MESSAGES.deleteTitle("Socket Binding"),
                        Console.MESSAGES.deleteConfirm("Socket Binding " + editedEntity.getName()),
                        new Feedback.ConfirmationHandler() {
                            @Override
                            public void onConfirmation(boolean isConfirmed) {
                                if(isConfirmed)
                                    presenter.onDelete(editedEntity);
                            }
                        });
            }
        });
        removeBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_remove_socketBindingView());
        toolstrip.addToolButtonRight(removeBtn);

        // -----------

        socketTable = new SocketTable();

        // -----------

        form = new Form<SocketBinding>(SocketBinding.class);
        form.setNumColumns(2);

        FormToolStrip<SocketBinding> detailToolStrip = new FormToolStrip<SocketBinding>(
                form,
                new FormToolStrip.FormCallback<SocketBinding>()
                {
                    @Override
                    public void onSave(Map<String, Object> changeset) {
                        SocketBinding updatedEntity = form.getUpdatedEntity();
                        presenter.saveSocketBinding(
                                updatedEntity.getName(),
                                form.getEditedEntity().getGroup()// TODO: why does it not get pushed through?
                                form.getChangedValues()
                        );
                    }
View Full Code Here

Examples of org.jboss.as.network.SocketBinding

        return channel;
    }

    private void init(TP transport) {
        TransportConfiguration transportConfig = this.configuration.getTransport();
        SocketBinding binding = transportConfig.getSocketBinding();
        if (binding != null) {
            SocketFactory factory = transport.getSocketFactory();
            if (!(factory instanceof ManagedSocketFactory)) {
                transport.setSocketFactory(new ManagedSocketFactory(factory, binding.getSocketBindings()));
            }
        }
        ThreadFactory threadFactory = transportConfig.getThreadFactory();
        if (threadFactory != null) {
            if (!(transport.getThreadFactory() instanceof ThreadFactoryAdapter)) {
View Full Code Here

Examples of org.jboss.as.network.SocketBinding

        if (transport.isShared()) {
            properties.put(Global.SINGLETON_NAME, this.configuration.getName());
        }

        SocketBinding binding = transport.getSocketBinding();
        if (binding != null) {
            this.configureBindAddress(transport, config, binding);
            this.configureServerSocket(transport, config, "bind_port", binding);
            this.configureMulticastSocket(transport, config, "mcast_addr", "mcast_port", binding);
        }

        SocketBinding diagnosticsSocketBinding = transport.getDiagnosticsSocketBinding();
        boolean diagnostics = (diagnosticsSocketBinding != null);
        properties.put("enable_diagnostics", String.valueOf(diagnostics));
        if (diagnostics) {
            this.configureMulticastSocket(transport, config, "diagnostics_addr", "diagnostics_port", diagnosticsSocketBinding);
        }
View Full Code Here

Examples of org.jboss.as.network.SocketBinding

        Assert.assertEquals(345, group.require(SOCKET_BINDING).require("test3").require(PORT).asInt());

        ServiceController<?> controller = services.getContainer().getService(SocketBindingUserService.NAME);
        Assert.assertNotNull(controller);
        SocketBindingUserService service = (SocketBindingUserService)controller.getValue();
        SocketBinding socketBinding = service.socketBindingValue.getValue();
        Assert.assertEquals(234, socketBinding.getPort());
        Assert.assertEquals("127.0.0.1", socketBinding.getAddress().getHostAddress());
    }
View Full Code Here

Examples of org.jboss.as.network.SocketBinding

        config.setExcludedContexts("ROOT,invoker,jbossws,juddi,console");

        // Read node to set configuration.
        if (modelconf.hasDefined(CommonAttributes.ADVERTISE_SOCKET)) {
            // There should be a socket-binding....
            final SocketBinding binding = this.binding.getValue();
            if (binding != null) {
                config.setAdvertisePort(binding.getMulticastPort());
                config.setAdvertiseGroupAddress(binding.getMulticastSocketAddress().getHostName());
                config.setAdvertiseInterface(binding.getSocketAddress().getAddress().getHostAddress());
                if (!this.isMulticastEnabled(binding.getNetworkInterfaceBinding().getNetworkInterfaces())) {
                    ROOT_LOGGER.multicastInterfaceNotAvailable();
                }
                config.setAdvertise(true);
            }
        }
View Full Code Here

Examples of org.jboss.as.network.SocketBinding

    @Override
    public synchronized void start(StartContext context) throws StartException {
        ROOT_LOGGER.debug("Starting remote JMX connector");
        setRmiServerProperty(serverPortBinding.getValue().getAddress().getHostAddress());
        try {
            SocketBinding registryBinding = registryPortBinding.getValue();
            RMIServerSocketFactory registrySocketFactory = new JMXServerSocketFactory(registryBinding);
            SocketBinding rmiServerBinding = serverPortBinding.getValue();
            RMIServerSocketFactory serverSocketFactory = new JMXServerSocketFactory(rmiServerBinding);

            registry = LocateRegistry.createRegistry(getRmiRegistryPort(), null, registrySocketFactory);
            HashMap<String, Object> env = new HashMap<String, Object>();
View Full Code Here

Examples of org.jboss.as.network.SocketBinding

     *
     * @param context the start context
     * @throws StartException if the connector cannot be started
     */
    public synchronized void start(StartContext context) throws StartException {
        final SocketBinding binding = this.binding.getValue();
        final InetSocketAddress address = binding.getSocketAddress();
        final Executor executor = this.executor.getOptionalValue();
        try {
            // Create connector
            final Connector connector = new Connector(protocol);
            connector.setPort(address.getPort());
            connector.setScheme(scheme);
            if(enableLookups != null) connector.setEnableLookups(enableLookups);
            if(maxPostSize != null) connector.setMaxPostSize(maxPostSize);
            if(maxSavePostSize != null) connector.setMaxSavePostSize(maxSavePostSize);
            if(proxyName != null) connector.setProxyName(proxyName);
            if(proxyPort != null) connector.setProxyPort(proxyPort);
            if(redirectPort != null) connector.setRedirectPort(redirectPort);
            if(secure != null) connector.setSecure(secure);
            boolean nativeProtocolHandler = false;
            if (connector.getProtocolHandler() instanceof Http11AprProtocol
                    || connector.getProtocolHandler() instanceof AjpAprProtocol) {
                nativeProtocolHandler = true;
            }
            if (executor != null) {
                Method m = connector.getProtocolHandler().getClass().getMethod("setExecutor", Executor.class);
                m.invoke(connector.getProtocolHandler(), executor);
            }
            if (address != null && address.getAddress() != null)  {
                Method m = connector.getProtocolHandler().getClass().getMethod("setAddress", InetAddress.class);
                m.invoke(connector.getProtocolHandler(), address.getAddress());
            }
            if (maxConnections != null) {
                try {
                    Method m = connector.getProtocolHandler().getClass().getMethod("setPollerSize", Integer.TYPE);
                    m.invoke(connector.getProtocolHandler(), maxConnections);
                } catch (NoSuchMethodException e) {
                 // Not all connectors will have this
                }
                if (nativeProtocolHandler) {
                    try {
                        Method m = connector.getProtocolHandler().getClass().getMethod("setSendfileSize", Integer.TYPE);
                        m.invoke(connector.getProtocolHandler(), maxConnections);
                    } catch (NoSuchMethodException e) {
                     // Not all connectors will have this
                    }
                } else {
                    Method m = connector.getProtocolHandler().getClass().getMethod("setMaxThreads", Integer.TYPE);
                    m.invoke(connector.getProtocolHandler(), maxConnections);
                }
            }
            if (virtualServers != null) {
                HashSet<String> virtualServersList = new HashSet<String>();
                for (final ModelNode virtualServer : virtualServers.asList()) {
                    virtualServersList.add(virtualServer.asString());
                }
                connector.setAllowedHosts(virtualServersList);
            }
            if (ssl != null) {
                boolean nativeSSL = false;
                if (connector.getProtocolHandler() instanceof Http11AprProtocol) {
                    nativeSSL = true;
                } else if ((connector.getProtocolHandler() instanceof AjpProtocol) || (connector.getProtocolHandler() instanceof AjpAprProtocol)) {
                    throw new StartException(MESSAGES.noSSLWithNonHTTPConnectors());
                }
                // Enable SSL
                try {
                    Method m = connector.getProtocolHandler().getClass().getMethod("setSSLEnabled", Boolean.TYPE);
                    m.invoke(connector.getProtocolHandler(), true);
                } catch (NoSuchMethodException e) {
                    // No SSL support
                    throw new StartException(MESSAGES.failedSSLConfiguration(), e);
                }
                if (nativeSSL) {
                    // OpenSSL configuration
                    try {
                        if (ssl.hasDefined(Constants.PASSWORD)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setSSLPassword", String.class);
                            m.invoke(connector.getProtocolHandler(), ssl.get(Constants.PASSWORD).asString());
                        }
                        if (ssl.hasDefined(Constants.CERTIFICATE_KEY_FILE)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setSSLCertificateKeyFile", String.class);
                            m.invoke(connector.getProtocolHandler(), ssl.get(Constants.CERTIFICATE_KEY_FILE).asString());
                        }
                        if (ssl.hasDefined(Constants.CIPHER_SUITE)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setSSLCipherSuite", String.class);
                            m.invoke(connector.getProtocolHandler(), ssl.get(Constants.CIPHER_SUITE).asString());
                        }
                        if (ssl.hasDefined(Constants.PROTOCOL)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setSSLProtocol", String.class);
                            m.invoke(connector.getProtocolHandler(), ssl.get(Constants.PROTOCOL).asString());
                        }
                        if (ssl.hasDefined(Constants.VERIFY_CLIENT)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setSSLVerifyClient", String.class);
                            m.invoke(connector.getProtocolHandler(), ssl.get(Constants.VERIFY_CLIENT).asString());
                        }
                        if (ssl.hasDefined(Constants.VERIFY_DEPTH)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setSSLVerifyDepth", Integer.TYPE);
                            m.invoke(connector.getProtocolHandler(), ssl.get(Constants.VERIFY_DEPTH).asInt());
                        }
                        if (ssl.hasDefined(Constants.CERTIFICATE_FILE)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setSSLCertificateFile", String.class);
                            m.invoke(connector.getProtocolHandler(), ssl.get(Constants.CERTIFICATE_FILE).asString());
                        }
                        if (ssl.hasDefined(Constants.CA_CERTIFICATE_FILE)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setSSLCACertificateFile", String.class);
                            m.invoke(connector.getProtocolHandler(), ssl.get(Constants.CA_CERTIFICATE_FILE).asString());
                        }
                        if (ssl.hasDefined(Constants.CA_REVOCATION_URL)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setSSLCARevocationFile", String.class);
                            m.invoke(connector.getProtocolHandler(), ssl.get(Constants.CA_REVOCATION_URL).asString());
                        }
                   } catch (NoSuchMethodException e) {
                       throw new StartException(MESSAGES.failedSSLConfiguration(), e);
                    }
                } else {
                    // JSSE configuration
                    try {
                        if (ssl.hasDefined(Constants.KEY_ALIAS)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setKeyAlias", String.class);
                            m.invoke(connector.getProtocolHandler(), ssl.get(Constants.KEY_ALIAS).asString());
                        }
                        if (ssl.hasDefined(Constants.PASSWORD)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setKeypass", String.class);
                            m.invoke(connector.getProtocolHandler(), ssl.get(Constants.PASSWORD).asString());
                        }
                        if (ssl.hasDefined(Constants.CERTIFICATE_KEY_FILE)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setKeystore", String.class);
                            m.invoke(connector.getProtocolHandler(), ssl.get(Constants.CERTIFICATE_KEY_FILE).asString());
                        }
                        if (ssl.hasDefined(Constants.CIPHER_SUITE)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setCiphers", String.class);
                            m.invoke(connector.getProtocolHandler(), ssl.get(Constants.CIPHER_SUITE).asString());
                        }
                        if (ssl.hasDefined(Constants.PROTOCOL)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setProtocols", String.class);
                            m.invoke(connector.getProtocolHandler(), ssl.get(Constants.PROTOCOL).asString());
                        }
                        if (ssl.hasDefined(Constants.VERIFY_CLIENT)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setClientauth", String.class);
                            m.invoke(connector.getProtocolHandler(), ssl.get(Constants.VERIFY_CLIENT).asString());
                        }
                        if (ssl.hasDefined(Constants.SESSION_CACHE_SIZE)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setAttribute", String.class, Object.class);
                            m.invoke(connector.getProtocolHandler(), "sessionCacheSize", ssl.get(Constants.SESSION_CACHE_SIZE).asString());
                        }
                        if (ssl.hasDefined(Constants.SESSION_TIMEOUT)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setAttribute", String.class, Object.class);
                            m.invoke(connector.getProtocolHandler(), "sessionCacheTimeout", ssl.get(Constants.SESSION_TIMEOUT).asString());
                        }
                        /* possible attributes that apply to ssl socket factory
                            keystoreType -> PKCS12
                            keystore -> path/to/keystore.p12
                            keypass -> key password
                            truststorePass -> trustPassword
                            truststoreFile -> path/to/truststore.jks
                            truststoreType -> JKS
                         */
                        if (ssl.hasDefined(Constants.CA_CERTIFICATE_FILE)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setAttribute", String.class, Object.class);
                            m.invoke(connector.getProtocolHandler(), "truststoreFile", ssl.get(Constants.CA_CERTIFICATE_FILE).asString());

                        }
                        if (ssl.hasDefined(Constants.CA_CERTIFICATE_PASSWORD)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setAttribute", String.class, Object.class);
                            m.invoke(connector.getProtocolHandler(), "truststorePass",ssl.get(Constants.CA_CERTIFICATE_PASSWORD).asString());
                        }
                        if (ssl.hasDefined(Constants.TRUSTSTORE_TYPE)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setAttribute", String.class, Object.class);
                            m.invoke(connector.getProtocolHandler(), "truststoreType",ssl.get(Constants.TRUSTSTORE_TYPE).asString());
                        }
                        if (ssl.hasDefined(Constants.KEYSTORE_TYPE)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setKeytype", String.class);
                            m.invoke(connector.getProtocolHandler(), ssl.get(Constants.KEYSTORE_TYPE).asString());
                        }
                        if (ssl.hasDefined(Constants.CA_REVOCATION_URL)) {
                            Method m = connector.getProtocolHandler().getClass().getMethod("setAttribute", String.class, Object.class);
                            m.invoke(connector.getProtocolHandler(), "crlFile", ssl.get(Constants.CA_REVOCATION_URL).asString());
                        }

                    } catch (NoSuchMethodException e) {
                        throw new StartException(MESSAGES.failedSSLConfiguration(), e);
                    }
                }
            }
            getWebServer().addConnector(connector);
            connector.init();
            connector.start();
            this.connector = connector;
        } catch (Exception e) {
            throw new StartException(MESSAGES.connectorStartError(), e);
        }
        // Register the binding after the connector is started
        binding.getSocketBindings().getNamedRegistry().registerBinding(new ConnectorBinding(binding));
    }
View Full Code Here

Examples of org.jboss.as.network.SocketBinding



    /** {@inheritDoc} */
    public synchronized void stop(StopContext context) {
        final SocketBinding binding = this.binding.getValue();
        binding.getSocketBindings().getNamedRegistry().unregisterBinding(binding.getName());
        final Connector connector = this.connector;
        try {
            connector.pause();
        } catch (Exception e) {
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.