Package org.jboss.soa.esb

Examples of org.jboss.soa.esb.ConfigurationException


            ruleService = RuleServiceFactory.getRuleService( ruleServiceImpl );
            ruleService.setConfigTree( config );
        }
        catch (RuleServiceException e)
        {
            throw new ConfigurationException("Could not create RuleService", e);
        }
       
        ruleSet = config.getAttribute(ListenerTagNames.RULE_SET_TAG);
        ruleLanguage = config.getAttribute(ListenerTagNames.RULE_LANGUAGE_TAG);
       
View Full Code Here


          }
          channel_list.add(channel);
        }
        catch (ClassNotFoundException cnfe)
        {
          throw new ConfigurationException("could not find channel-class: " + channel_class_name, cnfe);
        }
        catch (Exception nsme)
        {
          throw new ConfigurationException("problem instantiating channel-class: " + channel_class_name, nsme);
        }
      }
      Map<String,Channel> channel_map = new HashMap<String,Channel>();
      for (Entry<String,List<Channel>> entry : channel_list_map.entrySet())
      {
View Full Code Here

        listenerNode.setAttribute("name", listener.getName());

        try {
            bus = (JbrBus) model.getBus(listener.getBusidref());
        } catch (ClassCastException e) {
            throw new ConfigurationException("Invalid busid reference [" + listener.getBusidref() + "] on listener [" + listener.getName() + "].  A <jbr-listener> must reference a <jbr-bus>.");
        }
        try {
            provider = (JbrProvider) model.getProvider(bus);
        } catch (ClassCastException e) {
            throw new ConfigurationException("Invalid bus config [" + listener.getBusidref() + "].  Should be contained within a <jbr-provider> instance.  Unexpected exception - this should have caused a validation error!");
        }

        // Map the standard listener attributes - common across all listener types...
        MapperUtil.mapDefaultAttributes(listener, listenerNode, model);
        // Map the <property> elements targeted at the listener - from the listener itself.
        MapperUtil.mapProperties(provider.getPropertyList(), listenerNode);
        MapperUtil.mapProperties(bus.getPropertyList(), listenerNode);
        MapperUtil.mapProperties(listener.getPropertyList(), listenerNode);

        if(listener.getIsGateway()) {
            String host = provider.getHost();

            listenerNode.setAttribute("gatewayClass", JBossRemotingGatewayListener.class.getName());
      listenerNode.setAttribute(ListenerTagNames.IS_GATEWAY_TAG, Boolean.toString(listener.getIsGateway()));

            if(host != null) {
                listenerNode.setAttribute(JBossRemotingGatewayListener.JBR_SERVER_HOST, host);
            }
            listenerNode.setAttribute(JBossRemotingGatewayListener.JBR_SERVER_PROTOCOL, provider.getProtocol().toString());
            listenerNode.setAttribute(JBossRemotingGatewayListener.JBR_SERVER_PORT, Integer.toString(bus.getPort()));
        } else {
            throw new ConfigurationException("Invalid <jbr-listener> config [" + listener.getName() + "].  <jbr-listener> is currently only supported as a gateway listener.");
        }

        return listenerNode;
    }
View Full Code Here

        for (Service service : services) {
          if (hm.containsKey(service.getCategory())) {
            HashMap<String, String> hc = hm.get(service.getCategory());

            if (hc.containsKey(service.getName())) {
              throw new ConfigurationException("Service names must be unique within a category.  "
                  + "The service name " + service.getName()
                  + " is already defined within the " + service.getCategory() + " category.");
            } else {
              hc.put(service.getName(), service.getName());
            }
View Full Code Here

        } else if (gateway instanceof UdpListener) {
            listenerConfig = UdpListenerMapper.map(root, (UdpListener) gateway, model);
        } else if (gateway instanceof DualListener){
            listenerConfig = UntypedListenerMapper.map(root, (DualListener)gateway, model);
        } else {
            throw new ConfigurationException("Unexpected gateway type encountered: " + gateway) ;
        }

        if (gateway instanceof AbstractScheduledListener) {
            ScheduleMapper.map(listenerConfig, (AbstractScheduledListener) gateway, model);
        }
View Full Code Here

        } else if (listener instanceof GroovyListener) {
            listenerConfigTree = GroovyListenerMapper.map(root, (GroovyListener)listener, model);
    } else if (listener instanceof DualListener){
      listenerConfigTree = UntypedListenerMapper.map(root, (DualListener)listener, model);
    } else {
      throw new ConfigurationException("Unexpected listener type encountered: " + listener) ;
    }

        if (listener instanceof AbstractScheduledListener) {
            ScheduleMapper.map(listenerConfigTree, (AbstractScheduledListener) listener, model);
        }
View Full Code Here

      HashMap<String,String> hm = new HashMap<String,String>();
      for(Action action : actionList) {
        mapAction(listenerConfigTree, action);
        if (hm.containsKey(action.getName())) {
          throw new ConfigurationException("Tried to register a duplicate action name.  Service "
              + listenerService.getName() + " already contains an action named "
              + action.getName() + ".    Action names must be unique per service.");
        } else {
          hm.put(action.getName(), action.getName());
        }
View Full Code Here

        listenerNode.setAttribute("name", listener.getName());

        try {
            bus = (HttpBus) model.getOptionalBus(listener.getBusidref());
        } catch (ClassCastException e) {
            throw new ConfigurationException("Invalid busid reference [" + listener.getBusidref() + "] on listener [" + listener.getName() + "].  A <http-listener> must reference a <http-bus>.");
        }

        // Map the standard listener attributes - common across all listener types...
        MapperUtil.mapDefaultAttributes(listener, listenerNode, model);

        String urlPattern = listener.getUrlPattern();
        PayloadAs.Enum payloadAs = listener.getPayloadAs();

        if(listener.getAsyncResponseList() != null && !listener.getAsyncResponseList().isEmpty()) {
            AsyncHttpResponse asyncResponse = listener.getAsyncResponseList().get(0);
            listenerNode.setAttribute(HttpGatewayServlet.ASYNC_SERVICE_INVOKE, "true");
            listenerNode.setAttribute(HttpGatewayServlet.ASYNC_STATUS_CODE, Integer.toString(asyncResponse.getStatusCode()));
            AsyncHttpResponse.Payload payload = asyncResponse.getPayload();
            if(payload != null) {
                listenerNode.setAttribute(HttpGatewayServlet.ASYNC_PAYLOAD, payload.getClasspathResource());
                listenerNode.setAttribute(HttpGatewayServlet.ASYNC_PAYLOAD_CONTENT_TYPE, payload.getContentType());
                if(payload.getCharacterEncoding() != null) {
                    listenerNode.setAttribute(HttpGatewayServlet.ASYNC_PAYLOAD_CHARACTER_ENCODING, payload.getCharacterEncoding());
                }
            }
        } else {
            listenerNode.setAttribute(HttpGatewayServlet.ASYNC_SERVICE_INVOKE, "false");
        }

        if(bus != null) {
            try {
                provider = (HttpProvider) model.getProvider(bus);
            } catch (ClassCastException e) {
                throw new ConfigurationException("Invalid bus config [" + listener.getBusidref() + "].  Should be contained within a <http-provider> instance.  Unexpected exception - this should have caused a validation error!");
            }

            // Map the <property> elements targeted at the listener - from the listener itself.
            //MapperUtil.mapProperties(provider.getPropertyList(), listenerNode);
            for(Property property : provider.getPropertyList()) {
View Full Code Here

                loadExceptionMappings(mappingTokens[0], mappings);
            } else if(mappingTokens.length == 2) {
                try {
                    mappings.put(mappingTokens[0], Integer.valueOf(mappingTokens[1]));
                } catch(NumberFormatException e) {
                    throw new ConfigurationException("Invalid Exception Status Mapping mapping declaration '" + mappingDecl + "'.  Status code value '" + mappingTokens[1] + "' not a valid integer.");
                }
            } else {
                throw new ConfigurationException("Invalid Exception Status Mapping mapping declaration '" + mappingDecl + "'.  Expected either an exception mapping file name, or a '<exception>=<status>' Key Value Pair.");
            }
        }

        return mappings;
    }
View Full Code Here

    private static void loadExceptionMappings(String mappingsFile, Map<String, Integer> mappings) throws ConfigurationException {
        Properties mappingProperties = new Properties();
        InputStream stream = ClassUtil.getResourceAsStream(mappingsFile, HttpGatewayMapper.class);

        if(stream == null) {
            throw new ConfigurationException("Failed to find Exception to HTTP Status code mappings file '" + mappingsFile + "' on classpath.");
        }

        try {
            mappingProperties.load(stream);
        } catch (IOException e) {
            throw new ConfigurationException("Error reading Exception to HTTP Status code mappings file '" + mappingsFile + "'.", e);
        } finally {
            try {
                stream.close();
            } catch (IOException e) {
                logger.debug("Error closing Exception to HTTP Status code mappings file '" + mappingsFile + "'.", e);
            }
        }

        Set<Map.Entry<Object, Object>> entries = mappingProperties.entrySet();
        for(Map.Entry<Object, Object> entry : entries) {
            try {
                mappings.put((String) entry.getKey(), Integer.valueOf((String) entry.getValue()));
            } catch(NumberFormatException e) {
                throw new ConfigurationException("Invalid Exception Status Mapping mapping '" + entry.getKey() + "=" + entry.getValue() + "'.  Status code value '" + entry.getValue() + "' not a valid integer.");
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.soa.esb.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.