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:ru.histone.spring.mvc.HistoneView.java

@Override
public boolean checkResource(Locale locale) throws Exception {
    try {//ww w .  java 2  s.c  om
        Reader content = new InputStreamReader(getServletContext().getResourceAsStream(getUrl()));
        if (content == null) {
            throw new FileNotFoundException("Can't find view file");
        }
        getHistone().setGlobalProperty(GlobalProperty.BASE_URI, "webapp:" + getUrl());
        getHistone().evaluate(content);
        return true;
    } catch (FileNotFoundException ex) {
        if (logger.isDebugEnabled()) {
            logger.debug("No Histone view found for URL: " + getUrl());
        }
        return false;
    } catch (HistoneException ex) {
        throw new ApplicationContextException("Failed to parse Histone template for URL [" + getUrl() + "]",
                ex);
    } catch (IOException ex) {
        throw new ApplicationContextException("Could not load Histone template for URL [" + getUrl() + "]", ex);
    }
}

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

public void stopServer(String serverId, String pathToServersXML) throws CompositeException {

    String prefix = "stopServer";
    // Extract variables for the serverId
    serverId = CommonUtils.extractVariable(prefix, serverId, propertyFile, true);

    if (logger.isDebugEnabled()) {
        logger.debug(" Entering ServerManagerImpl.start() with following params - serverId: " + serverId
                + ", pathToServersXML: " + pathToServersXML);
    }/*from   w  ww. j a va2s.  c o m*/
    try {
        serverManagerAction(ServerDAO.action.STOP.name(), serverId, pathToServersXML);
    } catch (CompositeException e) {
        logger.error("Error while stopping server: ", e);
        throw new ApplicationContextException(e.getMessage(), e);
    }
}

From source file:com.gzj.tulip.load.context.RoseWebAppContext.java

@Override
protected void prepareBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    try {//from  ww  w . j a va2s . com
        prepareBeanFactoryByRose(beanFactory);
    } catch (IOException e) {
        throw new ApplicationContextException("", e);
    }
    super.prepareBeanFactory(beanFactory);
}

From source file:com.sinosoft.one.mvc.scanning.context.MvcWebAppContext.java

@Override
protected void prepareBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    try {//from   w  w  w. ja v  a2s.  co  m
        prepareBeanFactoryByMvc(beanFactory);
    } catch (IOException e) {
        throw new ApplicationContextException("", e);
    }
    super.prepareBeanFactory(beanFactory);
}

From source file:com.laxser.blitz.scanning.context.BlitzWebAppContext.java

@Override
protected void prepareBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    try {//from ww w .  j a  v  a 2 s. com
        prepareBeanFactoryByBlitz(beanFactory);
    } catch (IOException e) {
        throw new ApplicationContextException("", e);
    }
    super.prepareBeanFactory(beanFactory);
}

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

public void restartServer(String serverId, String pathToServersXML) throws CompositeException {

    String prefix = "restartServer";
    // Extract variables for the serverId
    serverId = CommonUtils.extractVariable(prefix, serverId, propertyFile, true);

    if (logger.isDebugEnabled()) {
        logger.debug(" Entering ServerManagerImpl.start() with following params - serverId: " + serverId
                + ", pathToServersXML: " + pathToServersXML);
    }/*from   w  w  w . j  av a2 s . com*/
    try {
        serverManagerAction(ServerDAO.action.RESTART.name(), serverId, pathToServersXML);
    } catch (CompositeException e) {
        logger.error("Error while restarting server: ", e);
        throw new ApplicationContextException(e.getMessage(), e);
    }
}

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

public void createOrUpdateUsers(String serverId, String userIds, String pathToUsersXML, String pathToServersXML)
        throws CompositeException {
    if (logger.isDebugEnabled()) {
        logger.debug("Entering UserManagerImpl.createOrUpdateUsers() with following params " + " serverName: "
                + serverId + ", userIds: " + userIds + ", pathToUsersXML: " + pathToUsersXML
                + ", pathToServersXML: " + pathToServersXML);
    }// w  w  w  .  j a  v  a2 s  .  c  o m
    try {
        userAction(UserDAO.action.CREATEORUPDATE.name(), serverId, userIds, pathToUsersXML, pathToServersXML);
    } catch (CompositeException e) {
        logger.error("Error while deleting user: ", e);
        throw new ApplicationContextException(e.getMessage(), e);
    }
}

From source file:com.predic8.membrane.core.config.spring.TrackingFileSystemXmlApplicationContext.java

@Override
public void checkForInvalidBeanDefinitions() throws InvalidConfigurationException {
    try {//from   w  w  w  .  java  2 s .co  m
        DefaultListableBeanFactory beanFactory = createBeanFactory();
        beanFactory.setSerializationId(null);
        customizeBeanFactory(beanFactory);
        loadBeanDefinitions(beanFactory);
    } catch (XmlBeanDefinitionStoreException e) {
        handleXmlBeanDefinitionStoreException(e);
    } catch (IOException ex) {
        throw new ApplicationContextException(
                "I/O error parsing bean definition source for " + getDisplayName(), ex);
    }
}

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

public void deleteUsers(String serverId, String userIds, String pathToUsersXML, String pathToServersXML)
        throws CompositeException {
    if (logger.isDebugEnabled()) {
        logger.debug("Entering UserManagerImpl.createOrUpdateUsers() with following params " + " serverName: "
                + serverId + ", userIds: " + userIds + ", pathToUsersXML: " + pathToUsersXML
                + ", pathToServersXML: " + pathToServersXML);
    }//from w ww . j  a va 2  s. c o m
    try {
        userAction(UserDAO.action.DELETE.name(), serverId, userIds, pathToUsersXML, pathToServersXML);
    } catch (CompositeException e) {
        logger.error("Error while deleting user: ", e);
        throw new ApplicationContextException(e.getMessage(), e);
    }
}

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

private void serverManagerAction(String actionName, String serverId, String pathToServersXML)
        throws CompositeException {

    String prefix = "serverManagerAction";
    String processedIds = null;//w  ww. j a va 2s.c om

    // Extract variables for the serverId
    serverId = CommonUtils.extractVariable(prefix, serverId, propertyFile, true);

    // Set the Module Action Objective
    String s1 = (serverId == null) ? "no_serverId" : "Ids=" + serverId;
    System.setProperty("MODULE_ACTION_OBJECTIVE", actionName + " : " + s1);

    // Validate whether the files exist or not
    if (!CommonUtils.fileExists(pathToServersXML)) {
        throw new CompositeException("File [" + pathToServersXML + "] does not exist.");
    }

    try {
        if (logger.isInfoEnabled()) {
            logger.info("processing action " + actionName + " on server " + serverId);
        }
        getServerDAO().takeServerManagerAction(actionName, serverId, pathToServersXML);
    } catch (CompositeException e) {
        logger.error("Error on server action (" + actionName + "): ", e);
        throw new ApplicationContextException(e.getMessage(), e);
    }
}