Example usage for org.springframework.context ApplicationContextException ApplicationContextException

List of usage examples for org.springframework.context ApplicationContextException ApplicationContextException

Introduction

In this page you can find the example usage for org.springframework.context ApplicationContextException ApplicationContextException.

Prototype

public ApplicationContextException(String msg, Throwable cause) 

Source Link

Document

Create a new ApplicationContextException with the specified detail message and the given root cause.

Usage

From source file:com.cisco.dvbu.ps.deploytool.services.ServerAttributeManagerImpl.java

public void updateServerAttributes(String serverId, String serverAttributeIds, String pathToServerAttributeXML,
        String pathToServersXML) throws CompositeException {
    if (logger.isDebugEnabled()) {
        logger.debug(" Entering ServerAttributeManagerImpl.updateServerAttributes() with following params "
                + " serverId: " + serverId + ", serverAttributeIds: " + serverAttributeIds
                + ", pathToServerAttributeXML: " + pathToServerAttributeXML + ", pathToServersXML: "
                + pathToServersXML);/* w  ww .  java2s . c o  m*/
    }
    try {
        serverAttributeAction(ServerAttributeDAO.action.UPDATE.name(), serverId, serverAttributeIds,
                pathToServerAttributeXML, pathToServersXML);
    } catch (CompositeException e) {
        logger.error("Error while updating server attribute: ", e);
        throw new ApplicationContextException(e.getMessage(), e);
    }
}

From source file:com.cisco.dvbu.ps.deploytool.services.ResourceCacheManagerImpl.java

public void updateResourceCache(String serverId, String resourceIds, String pathToResourceCacheXML,
        String pathToServersXML) throws CompositeException {
    if (logger.isDebugEnabled()) {
        logger.debug(" Entering ResourceCacheManagerImpl.updateResourceCache() with following params "
                + " serverId: " + serverId + ", resourceIds: " + resourceIds + ", pathToResourceCacheXML: "
                + pathToResourceCacheXML + ", pathToServersXML: " + pathToServersXML);
    }/*  ww w  . j av  a2 s .c  o m*/
    try {
        resourceCacheAction(ResourceCacheDAO.action.UPDATE.name(), serverId, resourceIds,
                pathToResourceCacheXML, pathToServersXML);
    } catch (CompositeException e) {
        logger.error("Error while updating resource cache: ", e);
        throw new ApplicationContextException(e.getMessage(), e);
    }
}

From source file:com.cisco.dvbu.ps.deploytool.services.ResourceCacheManagerImpl.java

public void clearResourceCache(String serverId, String resourceIds, String pathToResourceCacheXML,
        String pathToServersXML) throws CompositeException {
    if (logger.isDebugEnabled()) {
        logger.debug(" Entering ResourceCacheManagerImpl.clearResourceCache() with following params "
                + " serverId: " + serverId + ", resourceIds: " + resourceIds + ", pathToResourceCacheXML: "
                + pathToResourceCacheXML + ", pathToServersXML: " + pathToServersXML);
    }// w w  w  .ja v  a2 s.  c o  m
    try {
        resourceCacheAction(ResourceCacheDAO.action.CLEAR.name(), serverId, resourceIds, pathToResourceCacheXML,
                pathToServersXML);
    } catch (CompositeException e) {
        logger.error("Error while clearing resource cache: ", e);
        throw new ApplicationContextException(e.getMessage(), e);
    }
}

From source file:com.cisco.dvbu.ps.deploytool.services.ResourceCacheManagerImpl.java

public void refreshResourceCache(String serverId, String resourceIds, String pathToResourceCacheXML,
        String pathToServersXML) throws CompositeException {
    if (logger.isDebugEnabled()) {
        logger.debug(" Entering ResourceCacheManagerImpl.refreshResourceCache() with following params "
                + " serverId: " + serverId + ", resourceIds: " + resourceIds + ", pathToResourceCacheXML: "
                + pathToResourceCacheXML + ", pathToServersXML: " + pathToServersXML);
    }/*from   w  w w. j a va 2s  . c o  m*/
    try {
        resourceCacheAction(ResourceCacheDAO.action.REFRESH.name(), serverId, resourceIds,
                pathToResourceCacheXML, pathToServersXML);
    } catch (CompositeException e) {
        logger.error("Error while refreshing resource cache: ", e);
        throw new ApplicationContextException(e.getMessage(), e);
    }
}

From source file:com.cisco.dvbu.ps.deploytool.services.ResourceCacheManagerImpl.java

public void updateResourceCacheEnabled(String serverId, String resourceIds, String pathToResourceCacheXML,
        String pathToServersXML) throws CompositeException {
    if (logger.isDebugEnabled()) {
        logger.debug(" Entering ResourceCacheManagerImpl.updateResourceCacheEnabled() with following params "
                + " serverId: " + serverId + ", resourceIds: " + resourceIds + ", pathToResourceCacheXML: "
                + pathToResourceCacheXML + ", pathToServersXML: " + pathToServersXML);
    }//from   w  ww  .  j  a v a2 s.  c  o m
    try {
        resourceCacheAction(ResourceCacheDAO.action.ENABLE_DISABLE.name(), serverId, resourceIds,
                pathToResourceCacheXML, pathToServersXML);
    } catch (CompositeException e) {
        logger.error("Error while enabling/disabling resource cache: ", e);
        throw new ApplicationContextException(e.getMessage(), e);
    }
}

From source file:org.sakaiproject.hierarchy.tool.vm.spring.VelocityView.java

/**
 * Autodetect a VelocityEngine via the ApplicationContext.
 * Called if no explicit VelocityEngine has been specified.
 * @return the VelocityEngine to use for VelocityViews
 * @throws BeansException if no VelocityEngine could be found
 * @see #getApplicationContext//from   ww w.  ja  v  a  2 s.com
 * @see #setVelocityEngine
 */
protected VelocityEngine autodetectVelocityEngine() throws BeansException {
    try {
        VelocityConfig velocityConfig = (VelocityConfig) BeanFactoryUtils
                .beanOfTypeIncludingAncestors(getApplicationContext(), VelocityConfig.class, true, false);
        return velocityConfig.getVelocityEngine();
    } catch (NoSuchBeanDefinitionException ex) {
        throw new ApplicationContextException(
                "Must define a single VelocityConfig bean in this web application context "
                        + "(may be inherited): VelocityConfigurer is the usual implementation. "
                        + "This bean may be given any name.",
                ex);
    }
}

From source file:net.alpha.velocity.spring.web.VelocityView.java

/**
 * Autodetect a VelocityEngine via the ApplicationContext.
 * Called if no explicit VelocityEngine has been specified.
 *
 * @return the VelocityEngine to use for VelocityViews
 * @throws BeansException if no VelocityEngine could be found
 * @see #getApplicationContext/*w w w.  j  a  v a2s.  c  om*/
 * @see #setVelocityEngine
 */
protected VelocityEngine autodetectVelocityEngine() throws BeansException {
    try {
        VelocityConfig velocityConfig = BeanFactoryUtils.beanOfTypeIncludingAncestors(getApplicationContext(),
                VelocityConfig.class, true, false);
        return velocityConfig.getVelocityEngine();
    } catch (NoSuchBeanDefinitionException ex) {
        throw new ApplicationContextException(
                "Must define a single VelocityConfig bean in this web application context "
                        + "(may be inherited): VelocityConfigurer is the usual implementation. "
                        + "This bean may be given any name.",
                ex);
    }
}

From source file:org.sakaiproject.hierarchy.tool.vm.spring.VelocityView.java

/**
 * Check that the Velocity template used for this view exists and is valid.
 * <p>Can be overridden to customize the behavior, for example in case of
 * multiple templates to be rendered into a single view.
 * @throws ApplicationContextException if the template cannot be found or is invalid
 *//*  w  ww  .j a va  2s .  co  m*/
protected void checkTemplate() throws ApplicationContextException {
    try {
        // Check that we can get the template, even if we might subsequently get it again.
        this.template = getTemplate();
    } catch (ResourceNotFoundException ex) {
        throw new ApplicationContextException("Cannot find Velocity template for URL [" + getUrl()
                + "]: Did you specify the correct resource loader path?", ex);
    } catch (Exception ex) {
        throw new ApplicationContextException("Could not load Velocity template for URL [" + getUrl() + "]",
                ex);
    }
}

From source file:ro.codecamp.ebp.core.util.ServerOsgiBundleXmlWebApplicationContext.java

/**
 * Register request/session scopes, a {@link ServletContextAwareProcessor}, etc.
 * /* w w w  .j  a v a  2 s .  c o  m*/
 * @see WebApplicationContextUtils#registerWebApplicationScopes(ConfigurableListableBeanFactory)
 */
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    super.postProcessBeanFactory(beanFactory);

    // Drive the kernel's bean factory post processors.
    BundleContext bundleContext = getBundleContext();
    if (bundleContext != null) {
        ServiceReference sr = bundleContext.getServiceReference(OsgiBeanFactoryPostProcessor.class);
        if (sr != null) {
            OsgiBeanFactoryPostProcessor kernelPostProcessor = (OsgiBeanFactoryPostProcessor) bundleContext
                    .getService(sr);
            try {
                kernelPostProcessor.postProcessBeanFactory(bundleContext, beanFactory);
            } catch (Exception e) {
                throw new ApplicationContextException("Kernel bean factory post processor failed", e);
            } finally {
                bundleContext.ungetService(sr);
            }
        }
    }

    beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(getServletContext(), getServletConfig()));
    beanFactory.ignoreDependencyInterface(ServletContextAware.class);
    beanFactory.ignoreDependencyInterface(ServletConfigAware.class);
    beanFactory.registerResolvableDependency(ServletContext.class, getServletContext());
    beanFactory.registerResolvableDependency(ServletConfig.class, getServletConfig());

    WebApplicationContextUtils.registerWebApplicationScopes(beanFactory);
}

From source file:com.productone.spring.ServerOsgiBundleXmlWebApplicationContext.java

/**
 * Register request/session scopes, a {@link ServletContextAwareProcessor},
 * etc./*from  www.  jav a2s.  c om*/
 *
 * @see
 * WebApplicationContextUtils#registerWebApplicationScopes(ConfigurableListableBeanFactory)
 */
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    super.postProcessBeanFactory(beanFactory);

    // Drive the kernel's bean factory post processors.
    BundleContext bundleContext = getBundleContext();
    if (bundleContext != null) {
        ServiceReference sr = bundleContext.getServiceReference(OsgiBeanFactoryPostProcessor.class.getName());
        if (sr != null) {
            OsgiBeanFactoryPostProcessor kernelPostProcessor = (OsgiBeanFactoryPostProcessor) bundleContext
                    .getService(sr);
            try {
                kernelPostProcessor.postProcessBeanFactory(bundleContext, beanFactory);
            } catch (Exception e) {
                throw new ApplicationContextException("Kernel bean factory post processor failed", e);
            } finally {
                bundleContext.ungetService(sr);
            }
        }
    }

    beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(getServletContext(), getServletConfig()));
    beanFactory.ignoreDependencyInterface(ServletContextAware.class);
    beanFactory.ignoreDependencyInterface(ServletConfigAware.class);
    beanFactory.registerResolvableDependency(ServletContext.class, getServletContext());
    beanFactory.registerResolvableDependency(ServletConfig.class, getServletConfig());

    WebApplicationContextUtils.registerWebApplicationScopes(beanFactory);
}