Package org.jboss.soa.esb

Examples of org.jboss.soa.esb.ConfigurationException


            AssertArgument.isNotNullAndNotEmpty(className, "className");

            try {
                return (ScheduledEventMessageComposer) ClassUtil.forName(className, Factory.class).newInstance();
            } catch (ClassNotFoundException e) {
                throw new ConfigurationException("Composer class [" + className + "] not found in classpath.", e);
            } catch (InstantiationException e) {
                throw new ConfigurationException("Failed to instantiate composer class [" + className + "].", e);
            } catch (IllegalAccessException e) {
                throw new ConfigurationException("Failed to instantiate composer class [" + className + "].", e);
            }
        }
View Full Code Here


        oneWay = false ;
        defaultProcessing = false ;
    }
    else
    {
        throw new ConfigurationException("Unrecognised action MEP: " + mep) ;
    }

    final boolean validate = config.getBooleanAttribute(ListenerTagNames.VALIDATE_ATTRIBUTE_TAG, false) ;
    if (validate)
    {
      final String inXsd = config.getAttribute(ListenerTagNames.IN_XSD_ATTRIBUTE_TAG) ;
      try
      {
        requestSchema = (inXsd == null ? null : XMLHelper.getSchema(inXsd)) ;
      }
      catch (final SAXException saxe)
      {
        throw new ConfigurationException("Failed to parse the request schema: " + inXsd, saxe) ;
      }
      final String outXsd = config.getAttribute(ListenerTagNames.OUT_XSD_ATTRIBUTE_TAG) ;
      try
      {
        responseSchema = (outXsd == null ? null : XMLHelper.getSchema(outXsd));
      }
      catch (final SAXException saxe)
      {
        throw new ConfigurationException("Failed to parse the response schema: " + outXsd, saxe) ;
      }
      requestPayloadProxy = new MessagePayloadProxy(config.getAttribute(ListenerTagNames.REQUEST_LOCATION_TAG), null) ;
      responsePayloadProxy = new MessagePayloadProxy(config.getAttribute(ListenerTagNames.RESPONSE_LOCATION_TAG), null) ;
    }
    else
    {
      requestSchema = null ;
      responseSchema = null ;
    }
    if (LOGGER.isDebugEnabled())
    {
        LOGGER.debug("Using mep: " + mep + ", oneWay: " + oneWay + ", defaultProcessing: " + defaultProcessing) ;
    }
                this.oneWay = oneWay ;
                this.defaultProcessing = defaultProcessing ;

    final ConfigTree[] actionList = config
        .getChildren(ListenerTagNames.ACTION_ELEMENT_TAG);

    if ((actionList == null) || (actionList.length == 0))
    {
      throw new ConfigurationException("No actions in list");
    }

    final ArrayList<ActionPipelineProcessor> processorList = new ArrayList<ActionPipelineProcessor>();

    try
    {
      serviceMessageCounter = ServiceMessageCounterLifecycleResource.getServiceMessageCounter(config);
    }
    catch (final LifecycleResourceException lre)
    {
      throw new ConfigurationException("Failed to obtain the service message counter", lre);
    }

    for (final ConfigTree actionConfig : actionList)
    {
      final String actionClassTag = actionConfig
           .getAttribute(ListenerTagNames.ACTION_CLASS_TAG);
      if (LOGGER.isDebugEnabled())
      {
        LOGGER.debug("Registering action class " + actionClassTag);
      }
      final Class<?> actionClass;
      try
      {
        actionClass = ClassUtil.forName(actionClassTag, getClass());
      }
      catch (final ClassNotFoundException cnfe)
      {
        throw new ConfigurationException("Could not load action class "
            + actionClassTag);
      }

      final ActionPipelineProcessor processor;
      if (BeanConfiguredAction.class.isAssignableFrom(actionClass))
      {
        if (LOGGER.isDebugEnabled())
        {
          LOGGER.debug("Using bean configured action processor for "
              + actionClassTag);
        }
        processor = new BeanConfigActionProcessor(actionConfig,
            actionClass);
      }
      else if (ActionPipelineProcessor.class
          .isAssignableFrom(actionClass))
      {
        final ActionPipelineProcessor currentProcessor = (ActionPipelineProcessor) ActionProcessorMethodInfo
            .getActionClassInstance(actionConfig, actionClass);
        if (ActionProcessorMethodInfo.checkOverridden(actionConfig))
        {
          if (LOGGER.isDebugEnabled())
          {
            LOGGER
                .debug("Using overridden action pipeline processor for "
                    + actionClassTag);
          }
          processor = new OverriddenActionPipelineProcessor(
              actionConfig, currentProcessor);
        }
        else
        {
          if (LOGGER.isDebugEnabled())
          {
            LOGGER.debug("Using normal action pipeline processor for " + actionClassTag);
          }
          processor = currentProcessor;
        }
      }
      else if (ActionLifecycle.class.isAssignableFrom(actionClass))
      {
        if (LOGGER.isDebugEnabled())
        {
          LOGGER.debug("Using overridden action lifecycle processor for " + actionClassTag);
        }
        final ActionLifecycle currentLifecycle = (ActionLifecycle) ActionProcessorMethodInfo
            .getActionClassInstance(actionConfig, actionClass);
        processor = new OverriddenActionLifecycleProcessor(
            actionConfig, currentLifecycle);
      }
      else if (BeanContainerAction.isAnnotatedActionClass(actionClass))
      {
        if (LOGGER.isDebugEnabled())
        {
          LOGGER.debug("Using BeanContainerAction for Annotated Action processor for " + actionClassTag);
        }
        try {
          processor = new BeanContainerAction(actionClass.newInstance(), actionConfig);         
        } catch (InstantiationException e) {
          throw new ConfigurationException("Failed to create an instance of Annotated ESB Action class '" + actionClass.getName() + "'.  Class must contain a default public constructor.", e);
        } catch (IllegalAccessException e) {
          throw new ConfigurationException("Failed to create an instance of Annotated ESB Action class '" + actionClass.getName() + "'.  Class must contain a default public constructor.", e);
        }
      }
      else
      {
        LOGGER.warn("Action class " + actionClassTag + " does not: a) implement the ActionLifecycle interface, or b) have any public method annotated with the @ProcessMethod annotation.");
        if (LOGGER.isDebugEnabled())
        {
          LOGGER.debug("Using overridden actions processor for " + actionClassTag);
        }
        processor = new OverriddenActionProcessor(actionConfig, actionClass);
      }
      processorList.add(processor);
    }
    processors = processorList.toArray(new ActionPipelineProcessor[processorList.size()]);

    ConfigTree[] securityConfigs = config.getChildren( ListenerTagNames.SECURITY_TAG );
    String securityPropagatorClass = null;
    if (securityConfigs.length > 0)
    {
      securityConf = SecurityConfigUtil.createSecurityConfig(securityConfigs[0]);
      //   Check if a security context propagator was specified in the security element.
      securityPropagatorClass = securityConf.getProperties().get(Environment.SECURITY_SERVICE_CONTEXT_PROPAGATOR_CLASS);
    }
        serviceName = config.getAttribute(ListenerTagNames.SERVICE_NAME_TAG);

    try
        {
            securityContextPropagator = securityPropagatorClass != null ?
                    SecurityContextPropagatorFactory.create(securityPropagatorClass):
                    SecurityContextPropagatorFactory.createFromConfig();
        }
    catch (final SecurityServiceException e)
        {
        final String errorMsg;
        if (securityPropagatorClass != null )
        {
           errorMsg = "Could not create an instance of class '" + securityPropagatorClass + "' which was configured for service '" +
                       serviceName + "'. Please check the value of '" + Environment.SECURITY_SERVICE_CONTEXT_PROPAGATOR_CLASS + "'" +
                       " which is a property element of the security element declared in jboss-esb.xml.";
        }
        else
        {
           errorMsg = "Could not create an instance of class the security context propagator configured in jbossesb-properties.xml" +
                       ".Please check the value of '" + Environment.SECURITY_SERVICE_CONTEXT_PROPAGATOR_CLASS + "' in jbossesb-properties.xml";
        }
        throw new ConfigurationException(errorMsg, e);
        }

    if (LOGGER.isDebugEnabled())
        {
            if (securityContextPropagator != null)
View Full Code Here

        lifecycle.initialise();
      }
      catch (final Exception ex)
      {
        handleDestroy(count - 1);
        throw new ConfigurationException(
            "Unexpected exception during lifecycle initialisation",
            ex);
      }
    }
    active.set(true);
View Full Code Here

        super(config, InflowMessageProcessorAdapter.class);
       
        targetServiceCategory = ListenerUtil.getValue(config, ListenerTagNames.TARGET_SERVICE_CATEGORY_TAG) ;
        if (Util.isNullString(targetServiceCategory))
        {
            throw new ConfigurationException("No service category defined!") ;
        }
        targetServiceName = ListenerUtil.getValue(config, ListenerTagNames.TARGET_SERVICE_NAME_TAG) ;
        if (Util.isNullString(targetServiceName))
        {
            throw new ConfigurationException("No service name defined!") ;
        }
       
        serviceCategory = ListenerUtil.getValue(config, ListenerTagNames.SERVICE_CATEGORY_NAME_TAG) ;
        serviceName = ListenerUtil.getValue(config, ListenerTagNames.SERVICE_NAME_TAG) ;
       
        if (serviceName != null)
        {
            serviceEPR = ListenerUtil.assembleEpr(config) ;
        }
        else
        {
            serviceEPR = null ;
        }
       
        final String composerName = config.getAttribute(ListenerTagNames.GATEWAY_COMPOSER_CLASS_TAG) ;
        if (Util.isNullString(composerName))
        {
            throw new ConfigurationException("No composer class defined") ;
        }
        final Class<?> composerClass ;
        try
        {
            composerClass = ClassUtil.forName(composerName, getClass()) ;
        }
        catch (final ClassNotFoundException cnfe)
        {
            throw new ConfigurationException("Could not load composer class: " + composerName, cnfe) ;
        }
       
        try
        {
            Object composer ;
            try
            {
                final Constructor<?> configConstructor = composerClass.getConstructor(ConfigTree.class) ;
                composer = configConstructor.newInstance(config) ;
            }
            catch (final NoSuchMethodException nsme)
            {
                composer = composerClass.newInstance() ;
            }
            this.composer = composer ;
        }
        catch (final Throwable th)
        {
            throw new ConfigurationException("Unexpected error instantiating composer: " + composerName, th) ;
        }
       
        final String processMethodName = config.getAttribute(ListenerTagNames.GATEWAY_COMPOSER_METHOD_TAG) ;
        try
        {
            processMethod = composerClass.getMethod(processMethodName, Object.class) ;
        }
        catch (final NoSuchMethodException nsme)
        {
            throw new ConfigurationException("Could not locate process method: " + processMethodName, nsme) ;
        }
    }
View Full Code Here

        if(fileConfig != null) {
            try {
                properties.load(StreamUtils.getResource(fileConfig));
            } catch (IOException e) {
                throw new ConfigurationException("Failed to load HttpClient config '" + fileConfig + "'.");
            }
        }

        // Apply the mandatory Configurators...
        new Connection().configure(httpClient, properties);
View Full Code Here

    private static Configurator createConfigurator(String configuratorClass) throws ConfigurationException {
        try {
             return (Configurator) ClassUtil.forName(configuratorClass, HttpClientFactory.class).newInstance();
        } catch (ClassCastException e) {
            throw new ConfigurationException("Class [" + configuratorClass + "] must extend [" + Configurator.class.getName() + "].", e);
        } catch (ClassNotFoundException e) {
            if(!configuratorClass.startsWith(HttpProtocol.class.getPackage().getName())) {
                return createConfigurator(HttpProtocol.class.getPackage().getName() + "." + configuratorClass);
            }
            throw new ConfigurationException("Configurator implementation class [" + configuratorClass + "] not found in classpath.", e);
        } catch (InstantiationException e) {
            throw new ConfigurationException("Failed to instantiate Configurator implementation class [" + configuratorClass + "].", e);
        } catch (IllegalAccessException e) {
            throw new ConfigurationException("Failed to instantiate Configurator implementation class [" + configuratorClass + "].", e);
        }
    }
View Full Code Here

      }
 
      m_processMethod = m_composerClass.getMethod(sProcessMethod, new Class[] { Object.class });
    } catch (InvocationTargetException ex) {
      m_logger.debug(ex);
      throw new ConfigurationException(ex);
    } catch (IllegalAccessException ex) {
      m_logger.debug(ex);
      throw new ConfigurationException(ex);
    } catch (InstantiationException ex) {
      m_logger.debug(ex)
      throw new ConfigurationException(ex);
    } catch (ClassNotFoundException ex) {
      m_logger.debug(ex);     
      throw new ConfigurationException(ex);
    } catch (NoSuchMethodException ex) {
      m_logger.debug(ex);
      throw new ConfigurationException(ex);
    }
  }
View Full Code Here

                        _logger.warn("Invalid " + ListenerTagNames.MAX_THREADS_TAG + " attribute, defaulting to <" + _maxThreads + ">") ;
                    }
                }

    if (Util.isNullString(_eprCategoryName))
      throw new ConfigurationException(
          "Missing or invalid " + ListenerTagNames.SERVICE_CATEGORY_NAME_TAG);
    if (Util.isNullString(_eprName))
      throw new ConfigurationException(
          "Missing or invalid " + ListenerTagNames.SERVICE_NAME_TAG);

    ConfigTree eprElement = _config.getFirstChild(ListenerTagNames.EPR_TAG);
    if (null == eprElement)
      throw new ConfigurationException(
          "Missing or invalid " + ListenerTagNames.EPR_TAG + " element");
    _epr = ListenerUtil.assembleEpr(eprElement);

                String latency = _config.getAttribute(ListenerTagNames.POLL_LATENCY_SECS_TAG);
                long lSeconds = 10;
View Full Code Here

            ListenerTagNames.TARGET_SERVICE_CATEGORY_TAG, null);
      serviceName = ListenerUtil.getValue(config,
            ListenerTagNames.TARGET_SERVICE_NAME_TAG, null);

      if (serviceCategory == null)
        throw new ConfigurationException("No service category defined!");
     
      if (serviceName == null)
        throw new ConfigurationException("No service name defined!");
   }
View Full Code Here

        {
            if (totalConnections != null) {
                try {
                    maxTotalConnections = Integer.valueOf(totalConnections.trim()) ;
                } catch (final NumberFormatException nfe) {
                    throw new ConfigurationException("Invalid " + MAX_TOTAL_CONNECTIONS + " property: " + totalConnections) ;
                }
            } else {
                maxTotalConnections = null ;
            }
           
            if (connectionsPerHost != null) {
                try {
                    maxConnectionsPerHost = Integer.valueOf(connectionsPerHost.trim()) ;
                } catch (final NumberFormatException nfe) {
                    throw new ConfigurationException("Invalid " + MAX_CONNECTIONS_PER_HOST + " property: " + connectionsPerHost) ;
                }
            } else {
                maxConnectionsPerHost = null ;
            }
        }
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.