Package org.jvnet.hk2.config

Examples of org.jvnet.hk2.config.ObservableBean


    public void postConstruct() {
        events.register(this);
       
        final NetworkConfig networkConfig = config.getNetworkConfig();
        configListener = new DynamicConfigListener(config, LOGGER);
        ObservableBean bean = (ObservableBean) ConfigSupport.getImpl(networkConfig.getNetworkListeners());
        bean.addListener(configListener);
        bean = (ObservableBean) ConfigSupport.getImpl(config.getHttpService());
        bean.addListener(configListener);
        transactions.addListenerForType(SystemProperty.class, configListener);
        configListener.setGrizzlyService(this);

        try {
            boolean isAtLeastOneProxyStarted = false;
View Full Code Here


        initInstanceSessionProperties();

        configListener = addAndGetWebConfigListener();

        ObservableBean bean = (ObservableBean) ConfigSupport.getImpl(
                serverConfig.getHttpService());
        bean.addListener(configListener);

        bean = (ObservableBean) ConfigSupport.getImpl(
                serverConfig.getNetworkConfig().getNetworkListeners());
        bean.addListener(configListener);

        if (serverConfig.getAvailabilityService() != null) {
            bean = (ObservableBean) ConfigSupport.getImpl(
                    serverConfig.getAvailabilityService());
            bean.addListener(configListener);
        }

        transactions.addListenerForType(SystemProperty.class, configListener);

        configListener.setNetworkConfig(serverConfig.getNetworkConfig());

        // embedded mode does not have manager-propertie in domain.xml
        if (configListener.managerProperties != null) {
            ObservableBean managerBean = (ObservableBean) ConfigSupport.getImpl(
                    configListener.managerProperties);
            managerBean.addListener(configListener);
        }

        if (serverConfig.getJavaConfig() != null) {
            ((ObservableBean)ConfigSupport.getImpl(
                    serverConfig.getJavaConfig())).addListener(configListener);
View Full Code Here

            connector.setRedirectPort(Integer.parseInt(redirectPort));
        } else if (defaultRedirectPort != -1) {
            connector.setRedirectPort(defaultRedirectPort);
        }

        ObservableBean httpListenerBean = (ObservableBean) ConfigSupport.getImpl(
                listener);
        httpListenerBean.addListener(configListener);

        return connector;
    }
View Full Code Here

        vs.setClassLoaderHierarchy(clh);

        // Add Host to Engine
        engine.addChild(vs);

        ObservableBean virtualServerBean = (ObservableBean) ConfigSupport.getImpl(vsBean);
        virtualServerBean.addListener(configListener);

        return vs;
    }
View Full Code Here

        initInstanceSessionProperties();

        configListener = addAndGetWebConfigListener();

        ObservableBean bean = (ObservableBean) ConfigSupport.getImpl(
                serverConfig.getHttpService());
        bean.addListener(configListener);

        bean = (ObservableBean) ConfigSupport.getImpl(
                serverConfig.getNetworkConfig().getNetworkListeners());
        bean.addListener(configListener);

        if (serverConfig.getAvailabilityService() != null) {
            bean = (ObservableBean) ConfigSupport.getImpl(
                    serverConfig.getAvailabilityService());
            bean.addListener(configListener);
        }

        transactions.addListenerForType(SystemProperty.class, configListener);

        configListener.setNetworkConfig(serverConfig.getNetworkConfig());

        // embedded mode does not have manager-propertie in domain.xml
        if (configListener.managerProperties != null) {
            ObservableBean managerBean = (ObservableBean) ConfigSupport.getImpl(
                    configListener.managerProperties);
            managerBean.addListener(configListener);
        }

        if (serverConfig.getJavaConfig() != null) {
            ((ObservableBean)ConfigSupport.getImpl(
                    serverConfig.getJavaConfig())).addListener(configListener);
View Full Code Here

            connector.setRedirectPort(Integer.parseInt(redirectPort));
        } else if (defaultRedirectPort != -1) {
            connector.setRedirectPort(defaultRedirectPort);
        }

        ObservableBean httpListenerBean = (ObservableBean) ConfigSupport.getImpl(
                listener);
        httpListenerBean.addListener(configListener);

        return connector;
    }
View Full Code Here

        vs.setClassLoaderHierarchy(clh);

        // Add Host to Engine
        engine.addChild(vs);

        ObservableBean virtualServerBean = (ObservableBean) ConfigSupport.getImpl(vsBean);
        virtualServerBean.addListener(configListener);

        return vs;
    }
View Full Code Here

                try {
                    boolean wasAdded = ports.add(Integer.parseInt(val));

                    if (!wasAdded) //TODO unit test
                        throw new TransactionFailure(Strings.get("PortUtils.duplicate_port", val, server.getName()));
                }
                catch(TransactionFailure tf) {
                    // don't re-wrap the same Exception type!
                    throw tf;
                }
                catch (Exception e) {  //TODO unit test
                    throw new TransactionFailure(Strings.get("PortUtils.non_int_port", val, server.getName()));
                }
            }
        }
        checkForLegalPorts(ports, server.getName());
    }
View Full Code Here

     * @return a message if error, nu8ll means A-OK
     */
    private static void checkForLegalPorts(Set<Integer> ports, String serverName) throws TransactionFailure {
        for (int port : ports)
            if (!NetUtils.isPortValid(port))
                throw new TransactionFailure(Strings.get("PortUtils.illegal_port_number", port, serverName, MAX_PORT));
    }
View Full Code Here

    private int convertPortStr(final String port)
            throws TransactionFailure {
        try {
            return Integer.parseInt(port);
        } catch (Exception e) {
            throw new TransactionFailure(
                    strings.get("InvalidPortNumber", port));
        }
    }
View Full Code Here

TOP

Related Classes of org.jvnet.hk2.config.ObservableBean

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.