Example usage for org.springframework.context ApplicationContext getApplicationName

List of usage examples for org.springframework.context ApplicationContext getApplicationName

Introduction

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

Prototype

String getApplicationName();

Source Link

Document

Return a name for the deployed application that this context belongs to.

Usage

From source file:starterspringmvc4.Application.java

public static void main(String[] args) {
    ApplicationContext ctx = new AnnotationConfigApplicationContext(Application.class);
    String appName = ctx.getApplicationName();
    System.out.println(appName);/*from w w  w  . ja  v a 2s  .c  o m*/
}

From source file:com.vmware.licensecheck.runner.LicenseCheckValidatorRunner.java

public static void main(String[] args) {
    ApplicationContext ctx = SpringApplication.run(LicenseCheckValidatorRunner.class, args);
    logger.info("Complete loading context for {}.", ctx.getApplicationName());
}

From source file:cn.edu.zjnu.acm.judge.Application.java

public static void main(String[] args) {
    ApplicationContext context = SpringApplication.run(Application.class, args);
    if (log.isInfoEnabled() && context instanceof EmbeddedWebApplicationContext) {
        int port = ((EmbeddedWebApplicationContext) context).getEmbeddedServletContainer().getPort();
        String contextPath = context.getApplicationName();
        final String dashes = "------------------------------------------------------------------------";
        log.info("Access URLs:\n" + dashes + "\n\tLocal:\t\thttp://localhost:{}{}\n" + dashes, port,
                contextPath);// w w w.  j  a v  a2  s  . c om
    }
}

From source file:com.github.zhanhb.customdatasource.Application.java

public static void main(String[] args) throws IOException {
    ApplicationContext context = SpringApplication.run(Application.class, args);
    if (log.isInfoEnabled() && context instanceof EmbeddedWebApplicationContext) {
        int port = ((EmbeddedWebApplicationContext) context).getEmbeddedServletContainer().getPort();
        String contextPath = context.getApplicationName();
        String url = String.format(Locale.US, "http://localhost:%d%s", port, contextPath);
        String dashes = "------------------------------------------------------------------------";
        log.info("Access URLs:\n{}\n\tLocal: \t\t{}\n{}", dashes, url, dashes);
    }/*w ww  . j  a  v  a  2  s  . com*/

}

From source file:com.ebay.logstorm.server.LogStormServer.java

public static void start(String[] args) {
    ApplicationContext context = SpringApplication.run(LogStormServer.class, args);
    LOG.info("Started application named '{}'", context.getApplicationName());
}

From source file:org.openbaton.nfvo.vim_interfaces.vim.Vim.java

public Vim(String type, ApplicationContext context) throws PluginException {
    try {/*from w  ww . ja  va2  s .c  o  m*/
        if (context == null) {
            client = new VimDriverCaller("", type, "15672");
        } else {
            log.trace("Using context: " + context.getApplicationName());
            try {
                client = (VimDriverCaller) ((RabbitPluginBroker) context.getBean("rabbitPluginBroker"))
                        .getVimDriverCaller("", type, "15672");
            } catch (BeansException ignored) {
                client = new VimDriverCaller("", type, "15672");
            }
        }
    } catch (TimeoutException | NotFoundException | IOException e) {
        throw new PluginException("Error instantiating plugin: " + e.getMessage(), e);
    }
}

From source file:org.openbaton.nfvo.vim_interfaces.vim.Vim.java

public Vim(String type, String name, String managementPort, ApplicationContext context) throws PluginException {
    try {//from   w w  w  .  java2  s  . c  o m
        if (managementPort == null) {
            managementPort = "15672";
        }
        if (context == null) {
            client = new VimDriverCaller(name, type, managementPort);
        } else {
            log.trace("Using context: " + context.getApplicationName());
            try {
                client = (VimDriverCaller) ((RabbitPluginBroker) context.getBean("rabbitPluginBroker"))
                        .getVimDriverCaller(name, type, managementPort);
            } catch (BeansException ignored) {
                client = new VimDriverCaller(name, type, managementPort);
            }
        }
    } catch (TimeoutException | NotFoundException | IOException e) {
        throw new PluginException("Error instantiating plugin: " + e.getMessage(), e);
    }
}

From source file:org.openbaton.nfvo.vim_interfaces.vim.Vim.java

public Vim(String type, String managementPort, ApplicationContext context) throws PluginException {
    try {/*from   www .ja v  a  2  s . c  om*/
        if (managementPort == null || managementPort.isEmpty()) {
            managementPort = "15672";
        }
        if (context == null) {
            client = new VimDriverCaller("", type, managementPort);
        } else {
            log.trace("Using context: " + context.getApplicationName());
            try {
                client = (VimDriverCaller) ((RabbitPluginBroker) context.getBean("rabbitPluginBroker"))
                        .getVimDriverCaller("", type, managementPort);
            } catch (BeansException ignored) {
                client = new VimDriverCaller("", type, managementPort);
            }
        }
    } catch (TimeoutException | NotFoundException | IOException e) {
        throw new PluginException("Error instantiating plugin: " + e.getMessage(), e);
    }
}

From source file:org.openbaton.nfvo.vim_interfaces.vim.Vim.java

public Vim(String type, String brokerIp, int port, String managementPort, ApplicationContext context)
        throws PluginException {
    try {/*from w w w. j av a  2  s .c o m*/
        if (managementPort == null) {
            managementPort = "15672";
        }

        if (context == null) {
            client = new VimDriverCaller(brokerIp, "admin", "openbaton", port, type, managementPort);
        } else {
            log.trace("Using context: " + context.getApplicationName());
            try {
                client = (VimDriverCaller) ((RabbitPluginBroker) context.getBean("rabbitPluginBroker"))
                        .getVimDriverCaller(brokerIp, "admin", "openbaton", port, type, managementPort);
            } catch (BeansException ignored) {
                client = new VimDriverCaller(brokerIp, "admin", "openbaton", port, type, managementPort);
            }
        }

    } catch (TimeoutException | NotFoundException | IOException e) {
        throw new PluginException("Error instantiating plugin: " + e.getMessage(), e);
    }
}

From source file:org.openbaton.nfvo.vim_interfaces.vim.Vim.java

public Vim(String type, String username, String password, String brokerIp, String managementPort,
        ApplicationContext context) throws PluginException {
    try {/*from w  w  w . j a v  a  2s  .co  m*/
        //            client = (VimDriverCaller) RabbitPluginBroker.getVimDriverCaller(brokerIp,username,password,type);
        if (managementPort == null) {
            managementPort = "15672";
        }
        if (context == null) {
            client = new VimDriverCaller(brokerIp, username, password, type, managementPort);
        } else {
            log.trace("Using context: " + context.getApplicationName());
            try {
                client = (VimDriverCaller) ((RabbitPluginBroker) context.getBean("rabbitPluginBroker"))
                        .getVimDriverCaller(brokerIp, username, password, type, managementPort);
            } catch (BeansException ignored) {
                client = new VimDriverCaller(brokerIp, username, password, type, managementPort);
            }
        }
    } catch (TimeoutException | NotFoundException | IOException e) {
        throw new PluginException("Error instantiating plugin: " + e.getMessage(), e);
    }
}