Package flex.messaging.config

Examples of flex.messaging.config.ConfigurationException


            }
            MessageBroker broker = getService().getMessageBroker();
            FlexFactory f = broker.getFactory(factoryId);
            if (f == null)
            {
                ConfigurationException ex = new ConfigurationException();
                ex.setMessage(INVALID_FACTORY, new Object[] {getId(), factoryId});
                throw ex;
            }
            factory = f;
        }
       
View Full Code Here


                factoryId = DEFAULT_FACTORY;
            }
            if (getService() == null)
            {
                // Factory cannot be returned without ''{0}'' set.
                ConfigurationException ex = new ConfigurationException();
                ex.setMessage(FACTORY_CANNOT_BE_RETURNED, new Object[] {"Service"});
                throw ex;
            }
            if (getService().getMessageBroker() == null)
            {
                // Factory cannot be returned without ''{0}'' set.
                ConfigurationException ex = new ConfigurationException();
                ex.setMessage(FACTORY_CANNOT_BE_RETURNED, new Object[] {"MessageBroker"});
                throw ex;
            }
            MessageBroker broker = getService().getMessageBroker();
            FlexFactory f = broker.getFactory(factoryId);
            if (f == null)
            {
                ConfigurationException ex = new ConfigurationException();
                ex.setMessage(INVALID_FACTORY, new Object[] {getId(), factoryId});
                throw ex;
            }
            factory = f;
        }
        return factory;
View Full Code Here

        {
            MessageBroker broker = getService().getMessageBroker();
            FlexFactory factory = broker.getFactory(id);
            if (factory == null)
            {
                ConfigurationException ex = new ConfigurationException();
                ex.setMessage(INVALID_FACTORY, new Object[] {getId(), factory});
                throw ex;
            }
            setFactory(factory);
        }
        factoryId = id;
View Full Code Here

    protected void validateEndpointProtocol()
    {
        if (isSecure() && !url.startsWith("https:"))
        {
            ConfigurationException ce = new ConfigurationException();
            ce.setMessage(11100, new Object[] {url, "https"});
            throw ce;
        }
    }
View Full Code Here

                && !FlexFactory.SCOPE_APPLICATION.equals(scope)
                && !FlexFactory.SCOPE_REQUEST.equals(scope))
        {
            // Invalid scope setting for RemotingService destination '{id}'.
            // Valid options are 'request', 'session', or 'application'.
            ConfigurationException ex = new ConfigurationException();
            ex.setMessage(INVALID_SCOPE, new Object[] {id, "\'request\', \'session\', or \'application\'"});
            throw ex;
        }

    }
View Full Code Here

    public void addServer(Server server)
    {
        if (server == null)
        {
            // Cannot add null ''{0}'' to the ''{1}''
            ConfigurationException ex = new ConfigurationException();
            ex.setMessage(ConfigurationConstants.NULL_COMPONENT, new Object[]{"Server", "MessageBroker"});
            throw ex;           
        }
       
        String id = server.getId();
       
        if (id == null)
        {
            // Cannot add ''{0}'' with null id to the ''{1}''
            ConfigurationException ex = new ConfigurationException();
            ex.setMessage(ConfigurationConstants.NULL_COMPONENT_ID, new Object[]{"Server", "MessageBroker"});
            throw ex;                    
        }
       
        // No need to add if server is already added
        Server currentServer = getServer(id);
        if (currentServer == server)
            return;
       
        // Do not allow servers with the same id
        if (currentServer != null)
        {
            // Cannot add a ''{0}'' with the id ''{1}'' that is already registered with the ''{2}''
            ConfigurationException ex = new ConfigurationException();
            ex.setMessage(ConfigurationConstants.DUPLICATE_COMPONENT_ID, new Object[]{"Server", id, "MessageBroker"});
            throw ex;         
        }
       
        servers.put(id, server);
    }
View Full Code Here

    public void addEndpoint(Endpoint endpoint)
    {
        if (endpoint == null)
        {
            // Cannot add null ''{0}'' to the ''{1}''
            ConfigurationException ex = new ConfigurationException();
            ex.setMessage(ConfigurationConstants.NULL_COMPONENT, new Object[]{"Endpoint", "MessageBroker"});
            throw ex;           
        }
       
        String id = endpoint.getId();
       
        if (id == null)
        {
            // Cannot add ''{0}'' with null id to the ''{1}''
            ConfigurationException ex = new ConfigurationException();
            ex.setMessage(ConfigurationConstants.NULL_COMPONENT_ID, new Object[]{"Endpoint", "MessageBroker"});
            throw ex;                    
       
       
        // No need to add if endpoint is already added
        if (getEndpoint(id) == endpoint)
            return;
       
        // Do not allow endpoints with the same id
        if (getEndpoint(id) != null)
        {
            // Cannot add a ''{0}'' with the id ''{1}'' that is already registered with the ''{2}''
            ConfigurationException ex = new ConfigurationException();
            ex.setMessage(ConfigurationConstants.DUPLICATE_COMPONENT_ID, new Object[]{"Endpoint", id, "MessageBroker"});
            throw ex;         
        }
                  
        // Add the endpoint only if its url is not null and it is not registered
        // by another channel       
View Full Code Here

    {
        // Do not allow endpoints with null url property.
        if (endpointUrl == null)
        {
            // Cannot add ''{0}'' with null url to the ''{1}''
            ConfigurationException ex = new ConfigurationException();
            ex.setMessage(NULL_ENDPOINT_URL, new Object[]{"Endpoint", "MessageBroker"});
            throw ex;              
        }

        String parsedEndpointURI = ChannelSettings.removeTokens(endpointUrl);
       
        // first check the original URI
        if (registeredEndpoints.containsKey(parsedEndpointURI))
        {
          ConfigurationException ce = new ConfigurationException();                           
          ce.setMessage(URI_ALREADY_REGISTERED, new Object[] {id, parsedEndpointURI,
                        registeredEndpoints.get(parsedEndpointURI)});
          throw ce;
        }

        // add the original URI to the registered endpoints map
        registeredEndpoints.put(parsedEndpointURI, id);  
         
        // also need to check the URI without the context root
        int nextSlash = parsedEndpointURI.indexOf('/', 1);
        if (nextSlash > 0)
        {
            String parsedEndpointURI2 = parsedEndpointURI.substring(nextSlash);
            if (registeredEndpoints.containsKey(parsedEndpointURI2))
            {
                ConfigurationException ce = new ConfigurationException();        
                ce.setMessage(URI_ALREADY_REGISTERED, new Object[] {
                        parsedEndpointURI2, id,
                        registeredEndpoints.get(parsedEndpointURI2) });
                throw ce;
            }
            registeredEndpoints.put(parsedEndpointURI2, id);
View Full Code Here

    public void addFactory(String id, FlexFactory factory)
    {
        if (id == null)
        {
            // Cannot add ''{0}'' with null id to the ''{1}''
            ConfigurationException ex = new ConfigurationException();
            ex.setMessage(ConfigurationConstants.NULL_COMPONENT_ID, new Object[]{"FlexFactory", "MessageBroker"});
            throw ex;                    
       
        // No need to add if factory is already added
        if (getFactory(id) == factory)
        {
            return;
        }
        // Do not allow multiple factories with the same id
        if (getFactory(id) != null)
        {
            // Cannot add a ''{0}'' with the id ''{1}'' that is already registered with the ''{2}''
            ConfigurationException ex = new ConfigurationException();
            ex.setMessage(ConfigurationConstants.DUPLICATE_COMPONENT_ID, new Object[]{"FlexFactory", id, "MessageBroker"});
            throw ex;         
        }       
        factories.put(id, factory);
    }
View Full Code Here

    public void addService(Service service)
    {       
        if (service == null)
        {
            // Cannot add null ''{0}'' to the ''{1}''
            ConfigurationException ex = new ConfigurationException();
            ex.setMessage(ConfigurationConstants.NULL_COMPONENT, new Object[]{"Service", "MessageBroker"});
            throw ex;           
        }
       
        String id = service.getId();
       
        if (id == null)
        {
            // Cannot add ''{0}'' with null id to the ''{1}''
            ConfigurationException ex = new ConfigurationException();
            ex.setMessage(ConfigurationConstants.NULL_COMPONENT_ID, new Object[]{"Service", "MessageBroker"});
            throw ex;                    
       
        // No need to add if service is already added
        if (getService(id) == service)
        {
            return;
        }
        // Do not allow multiple services with the same id
        if (getService(id) != null)
        {
            // Cannot add a ''{0}'' with the id ''{1}'' that is already registered with the ''{2}''
            ConfigurationException ex = new ConfigurationException();
            ex.setMessage(ConfigurationConstants.DUPLICATE_COMPONENT_ID, new Object[]{"Service", id, "MessageBroker"});
            throw ex;         
        }       
        // Do not allow multiple services of the same type
        String type = service.getClass().getName();
        if (getServiceByType(type) != null)
        {
            ConfigurationException ce = new ConfigurationException();
            ce.setMessage(SERVICE_TYPE_EXISTS, new Object[] {type});
            throw ce;
        }      
       
        services.put(id, service);
       
View Full Code Here

TOP

Related Classes of flex.messaging.config.ConfigurationException

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.