Package org.apache.qpid.server.configuration

Examples of org.apache.qpid.server.configuration.ServerConfiguration


        // Call save Configuration to be sure we have saved the test specific
        // file. As the optional status
        saveTestConfiguration();
        saveTestVirtualhosts();

        ServerConfiguration configuration = new ServerConfiguration(_configFile);
        // Don't need to configuration.configure() here as we are just pulling
        // values directly by String.
        return configuration.getConfig().getString(property);
    }
View Full Code Here


        }
    }

    static int getConfiguredFrameSize()
    {
        final ServerConfiguration config = ApplicationRegistry.getInstance().getConfiguration();
        final int framesize = config.getFrameSize();
        _logger.info("Framesize set to " + framesize);
        return framesize;
    }
View Full Code Here

        _monitor = new LogMonitor(_outputFile);
    }

    protected ServerConfiguration getServerConfig() throws ConfigurationException
    {
        ServerConfiguration _serverConfiguration;
        if (isExternalBroker())
        {
            _serverConfiguration = new ServerConfiguration(_configFile)
            {
                @Override
                public void initialise() throws ConfigurationException
                {
                    //Overriding initialise to only setup the vhosts and not
                    //perform the ConfigurationPlugin setup, removing need for
                    //an ApplicationRegistry to be loaded.
                    setupVirtualHosts(getConfig());
                }
            };
            _serverConfiguration.initialise();
        }
        else
        {
            _serverConfiguration = ApplicationRegistry.getInstance().getConfiguration();
        }
View Full Code Here

        List<String> results = findMatches(VHT_PREFIX + "1002");
       
        try
        {
            // Load VirtualHost list from file.
            ServerConfiguration configuration = new ServerConfiguration(_configFile);
            configuration.initialise();
            List<String> vhosts = Arrays.asList(configuration.getVirtualHosts());

            assertEquals("Each vhost did not close their store.", vhosts.size(), results.size());
        }
        catch (AssertionFailedError afe)
        {
View Full Code Here

        File logConfigFile = getConfigFile(options.getLogConfigFile(),
                                    BrokerOptions.DEFAULT_LOG_CONFIG_FILE, qpidHome, false);

        configureLogging(logConfigFile, options.getLogWatchFrequency());

        ServerConfiguration serverConfig = new ServerConfiguration(configFile);
        ApplicationRegistry config = new ApplicationRegistry(serverConfig);
        if (options.getQpidWork() != null)
        {
            serverConfig.setQpidWork(options.getQpidWork());
        }
        if (options.getQpidHome() != null)
        {
            serverConfig.setQpidHome(options.getQpidHome());
        }
        updateManagementPorts(serverConfig, options.getJmxPortRegistryServer(), options.getJmxPortConnectorServer());

        ApplicationRegistry.initialise(config);

        // We have already loaded the BrokerMessages class by this point so we
        // need to refresh the locale setting incase we had a different value in
        // the configuration.
        BrokerMessages.reload();

        // AR.initialise() sets and removes its own actor so we now need to set the actor
        // for the remainder of the startup, and the default actor if the stack is empty
        CurrentActor.set(new BrokerActor(config.getCompositeStartupMessageLogger()));
        CurrentActor.setDefault(new BrokerActor(config.getRootMessageLogger()));
        GenericActor.setDefaultMessageLogger(config.getRootMessageLogger());

        try
        {
            Set<Integer> ports = new HashSet<Integer>(options.getPorts());
            if(ports.isEmpty())
            {
                parsePortList(ports, serverConfig.getPorts());
            }

            Set<Integer> sslPorts = new HashSet<Integer>(options.getSSLPorts());
            if(sslPorts.isEmpty())
            {
                parsePortList(sslPorts, serverConfig.getSSLPorts());
            }

            //1-0 excludes and includes
            Set<Integer> exclude_1_0 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v1_0));
            if(exclude_1_0.isEmpty())
            {
                parsePortList(exclude_1_0, serverConfig.getPortExclude10());
            }

            Set<Integer> include_1_0 = new HashSet<Integer>(options.getIncludedPorts(ProtocolInclusion.v1_0));
            if(include_1_0.isEmpty())
            {
                parsePortList(include_1_0, serverConfig.getPortInclude10());
            }

            //0-10 excludes and includes
            Set<Integer> exclude_0_10 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v0_10));
            if(exclude_0_10.isEmpty())
            {
                parsePortList(exclude_0_10, serverConfig.getPortExclude010());
            }

            Set<Integer> include_0_10 = new HashSet<Integer>(options.getIncludedPorts(ProtocolInclusion.v0_10));
            if(include_0_10.isEmpty())
            {
                parsePortList(include_0_10, serverConfig.getPortInclude010());
            }

            //0-9-1 excludes and includes
            Set<Integer> exclude_0_9_1 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v0_9_1));
            if(exclude_0_9_1.isEmpty())
            {
                parsePortList(exclude_0_9_1, serverConfig.getPortExclude091());
            }

            Set<Integer> include_0_9_1 = new HashSet<Integer>(options.getIncludedPorts(ProtocolInclusion.v0_9_1));
            if(include_0_9_1.isEmpty())
            {
                parsePortList(include_0_9_1, serverConfig.getPortInclude091());
            }

            //0-9 excludes and includes
            Set<Integer> exclude_0_9 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v0_9));
            if(exclude_0_9.isEmpty())
            {
                parsePortList(exclude_0_9, serverConfig.getPortExclude09());
            }

            Set<Integer> include_0_9 = new HashSet<Integer>(options.getIncludedPorts(ProtocolInclusion.v0_9));
            if(include_0_9.isEmpty())
            {
                parsePortList(include_0_9, serverConfig.getPortInclude09());
            }

            //0-8 excludes and includes
            Set<Integer> exclude_0_8 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v0_8));
            if(exclude_0_8.isEmpty())
            {
                parsePortList(exclude_0_8, serverConfig.getPortExclude08());
            }

            Set<Integer> include_0_8 = new HashSet<Integer>(options.getIncludedPorts(ProtocolInclusion.v0_8));
            if(include_0_8.isEmpty())
            {
                parsePortList(include_0_8, serverConfig.getPortInclude08());
            }

            String bindAddr = options.getBind();
            if (bindAddr == null)
            {
                bindAddr = serverConfig.getBind();
            }

            InetAddress bindAddress;
            if (bindAddr.equals(WILDCARD_ADDRESS))
            {
                bindAddress = null;
            }
            else
            {
                bindAddress = InetAddress.getByName(bindAddr);
            }

            final AmqpProtocolVersion defaultSupportedProtocolReply = serverConfig.getDefaultSupportedProtocolReply();

            if (!serverConfig.getSSLOnly())
            {
                for(int port : ports)
                {
                    final InetSocketAddress inetSocketAddress = new InetSocketAddress(bindAddress, port);

                    final Set<AmqpProtocolVersion> supported =
                                    getSupportedVersions(port, exclude_1_0, exclude_0_10, exclude_0_9_1, exclude_0_9, exclude_0_8,
                                                         include_1_0, include_0_10, include_0_9_1, include_0_9, include_0_8,serverConfig);

                    final NetworkTransportConfiguration settings =
                                    new ServerNetworkTransportConfiguration(serverConfig, inetSocketAddress, Transport.TCP);

                    final IncomingNetworkTransport transport = Transport.getIncomingTransportInstance();
                    final MultiVersionProtocolEngineFactory protocolEngineFactory =
                                    new MultiVersionProtocolEngineFactory(supported, defaultSupportedProtocolReply);

                    transport.accept(settings, protocolEngineFactory, null);

                    ApplicationRegistry.getInstance().addAcceptor(inetSocketAddress,
                                    new QpidAcceptor(transport,QpidAcceptor.Transport.TCP, supported));
                    CurrentActor.get().message(BrokerMessages.LISTENING("TCP", port));
                }
            }

            if (serverConfig.getEnableSSL())
            {
                final String keystorePath = serverConfig.getConnectorKeyStorePath();
                final String keystorePassword = serverConfig.getConnectorKeyStorePassword();
                final String keystoreType = serverConfig.getConnectorKeyStoreType();
                final String keyManagerFactoryAlgorithm = serverConfig.getConnectorKeyManagerFactoryAlgorithm();
                final SSLContext sslContext;
                if(serverConfig.getConnectorTrustStorePath()!=null)
                {
                    sslContext = SSLContextFactory.buildClientContext(serverConfig.getConnectorTrustStorePath(),
                                                                      serverConfig.getConnectorTrustStorePassword(),
                                                                      serverConfig.getConnectorTrustStoreType(),
                                                                      serverConfig.getConnectorTrustManagerFactoryAlgorithm(),
                                                                      keystorePath,
                                                                      keystorePassword, keystoreType, keyManagerFactoryAlgorithm,
                                                                      serverConfig.getCertAlias());
                }
                else
                {
                    sslContext = SSLContextFactory.buildServerContext(keystorePath, keystorePassword, keystoreType, keyManagerFactoryAlgorithm);
                }
View Full Code Here

     *            queue name
     * @return DLQ name
     */
    protected static String getDeadLetterQueueName(String name)
    {
        ServerConfiguration serverConfig = ApplicationRegistry.getInstance().getConfiguration();
        String dlQueueName = name + serverConfig.getDeadLetterQueueSuffix();
        return dlQueueName;
    }
View Full Code Here

     *            queue name
     * @return DL exchange name
     */
    protected static String getDeadLetterExchangeName(String name)
    {
        ServerConfiguration serverConfig = ApplicationRegistry.getInstance().getConfiguration();
        String dlExchangeName = name + serverConfig.getDeadLetterExchangeSuffix();
        return dlExchangeName;
    }
View Full Code Here

            // Write the test config file to test output
            message.append("Server configuration overrides in use:\n");
            message.append(FileUtils.readFileAsString(getTestConfigFile()));

            message.append("\nVirtualhost maxMessageCount:\n");
            ServerConfiguration config = new ServerConfiguration(_configFile);
            config.initialise();
            message.append(config.getVirtualHostConfig(VIRTUALHOST).getMaximumMessageCount());

            fail(message.toString());
        }
    }
View Full Code Here

                                    BrokerOptions.DEFAULT_LOG_CONFIG_FILE, qpidHome, false);

        configureLogging(logConfigFile, options.getLogWatchFrequency());

        ConfigurationFileApplicationRegistry config = new ConfigurationFileApplicationRegistry(configFile, options.getBundleContext());
        ServerConfiguration serverConfig = config.getConfiguration();
        if (options.getQpidWork() != null)
        {
            serverConfig.setQpidWork(options.getQpidWork());
        }
        if (options.getQpidHome() != null)
        {
            serverConfig.setQpidHome(options.getQpidHome());
        }
        updateManagementPorts(serverConfig, options.getJmxPortRegistryServer(), options.getJmxPortConnectorServer());

        ApplicationRegistry.initialise(config);

        // We have already loaded the BrokerMessages class by this point so we
        // need to refresh the locale setting incase we had a different value in
        // the configuration.
        BrokerMessages.reload();

        // AR.initialise() sets and removes its own actor so we now need to set the actor
        // for the remainder of the startup, and the default actor if the stack is empty
        CurrentActor.set(new BrokerActor(config.getCompositeStartupMessageLogger()));
        CurrentActor.setDefault(new BrokerActor(config.getRootMessageLogger()));
        GenericActor.setDefaultMessageLogger(config.getRootMessageLogger());

        try
        {
            Set<Integer> ports = new HashSet<Integer>(options.getPorts());
            if(ports.isEmpty())
            {
                parsePortList(ports, serverConfig.getPorts());
            }

            Set<Integer> sslPorts = new HashSet<Integer>(options.getSSLPorts());
            if(sslPorts.isEmpty())
            {
                parsePortList(sslPorts, serverConfig.getSSLPorts());
            }

            //1-0 excludes and includes
            Set<Integer> exclude_1_0 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v1_0));
            if(exclude_1_0.isEmpty())
            {
                parsePortList(exclude_1_0, serverConfig.getPortExclude10());
            }

            Set<Integer> include_1_0 = new HashSet<Integer>(options.getIncludedPorts(ProtocolInclusion.v1_0));
            if(include_1_0.isEmpty())
            {
                parsePortList(include_1_0, serverConfig.getPortInclude10());
            }

            //0-10 excludes and includes
            Set<Integer> exclude_0_10 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v0_10));
            if(exclude_0_10.isEmpty())
            {
                parsePortList(exclude_0_10, serverConfig.getPortExclude010());
            }

            Set<Integer> include_0_10 = new HashSet<Integer>(options.getIncludedPorts(ProtocolInclusion.v0_10));
            if(include_0_10.isEmpty())
            {
                parsePortList(include_0_10, serverConfig.getPortInclude010());
            }

            //0-9-1 excludes and includes
            Set<Integer> exclude_0_9_1 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v0_9_1));
            if(exclude_0_9_1.isEmpty())
            {
                parsePortList(exclude_0_9_1, serverConfig.getPortExclude091());
            }

            Set<Integer> include_0_9_1 = new HashSet<Integer>(options.getIncludedPorts(ProtocolInclusion.v0_9_1));
            if(include_0_9_1.isEmpty())
            {
                parsePortList(include_0_9_1, serverConfig.getPortInclude091());
            }

            //0-9 excludes and includes
            Set<Integer> exclude_0_9 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v0_9));
            if(exclude_0_9.isEmpty())
            {
                parsePortList(exclude_0_9, serverConfig.getPortExclude09());
            }

            Set<Integer> include_0_9 = new HashSet<Integer>(options.getIncludedPorts(ProtocolInclusion.v0_9));
            if(include_0_9.isEmpty())
            {
                parsePortList(include_0_9, serverConfig.getPortInclude09());
            }

            //0-8 excludes and includes
            Set<Integer> exclude_0_8 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v0_8));
            if(exclude_0_8.isEmpty())
            {
                parsePortList(exclude_0_8, serverConfig.getPortExclude08());
            }

            Set<Integer> include_0_8 = new HashSet<Integer>(options.getIncludedPorts(ProtocolInclusion.v0_8));
            if(include_0_8.isEmpty())
            {
                parsePortList(include_0_8, serverConfig.getPortInclude08());
            }

            String bindAddr = options.getBind();
            if (bindAddr == null)
            {
                bindAddr = serverConfig.getBind();
            }

            InetAddress bindAddress;
            if (bindAddr.equals(WILDCARD_ADDRESS))
            {
                bindAddress = null;
            }
            else
            {
                bindAddress = InetAddress.getByName(bindAddr);
            }

            final AmqpProtocolVersion defaultSupportedProtocolReply = serverConfig.getDefaultSupportedProtocolReply();

            if (!serverConfig.getSSLOnly())
            {
                for(int port : ports)
                {
                    final InetSocketAddress inetSocketAddress = new InetSocketAddress(bindAddress, port);

                    final Set<AmqpProtocolVersion> supported =
                                    getSupportedVersions(port, exclude_1_0, exclude_0_10, exclude_0_9_1, exclude_0_9, exclude_0_8,
                                                         include_1_0, include_0_10, include_0_9_1, include_0_9, include_0_8,serverConfig);

                    final NetworkTransportConfiguration settings =
                                    new ServerNetworkTransportConfiguration(serverConfig, inetSocketAddress, Transport.TCP);

                    final IncomingNetworkTransport transport = Transport.getIncomingTransportInstance();
                    final MultiVersionProtocolEngineFactory protocolEngineFactory =
                                    new MultiVersionProtocolEngineFactory(supported, defaultSupportedProtocolReply);

                    transport.accept(settings, protocolEngineFactory, null);

                    ApplicationRegistry.getInstance().addAcceptor(inetSocketAddress,
                                    new QpidAcceptor(transport,QpidAcceptor.Transport.TCP, supported));
                    CurrentActor.get().message(BrokerMessages.LISTENING("TCP", port));
                }
            }

            if (serverConfig.getEnableSSL())
            {
                final String keystorePath = serverConfig.getConnectorKeyStorePath();
                final String keystorePassword = serverConfig.getConnectorKeyStorePassword();
                final String keystoreType = serverConfig.getConnectorKeyStoreType();
                final String keyManagerFactoryAlgorithm = serverConfig.getConnectorKeyManagerFactoryAlgorithm();
                final SSLContext sslContext;
                if(serverConfig.getConnectorTrustStorePath()!=null)
                {
                    sslContext = SSLContextFactory.buildClientContext(serverConfig.getConnectorTrustStorePath(),
                                                                      serverConfig.getConnectorTrustStorePassword(),
                                                                      serverConfig.getConnectorTrustStoreType(),
                                                                      serverConfig.getConnectorTrustManagerFactoryAlgorithm(),
                                                                      keystorePath,
                                                                      keystorePassword, keystoreType, keyManagerFactoryAlgorithm,
                                                                      serverConfig.getCertAlias());
                }
                else
                {
                    sslContext = SSLContextFactory.buildServerContext(keystorePath, keystorePassword, keystoreType, keyManagerFactoryAlgorithm);
                }
View Full Code Here

        }
    }

    static int getConfiguredFrameSize()
    {
        final ServerConfiguration config = ApplicationRegistry.getInstance().getConfiguration();
        final int framesize = config.getFrameSize();
        _logger.info("Framesize set to " + framesize);
        return framesize;
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.configuration.ServerConfiguration

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.