List of usage examples for org.springframework.context.support ClassPathXmlApplicationContext registerShutdownHook
@Override public void registerShutdownHook()
From source file:org.copperengine.examples.orchestration.Main.java
/** * @param args//from ww w. j a v a 2 s . c om */ public static void main(String[] args) { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("OrchestrationEngineContext.xml"); ctx.registerShutdownHook(); }
From source file:com.edmunds.etm.agent.apache.ApacheAgentMain.java
public static void main(String[] args) { // Create the Spring application context ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("apache-etm-agent-context.xml"); ctx.registerShutdownHook(); // Run the Apache agent Agent agent;/*from w w w. j a v a2s . com*/ agent = (Agent) ctx.getBean("agent", Agent.class); agent.run(); }
From source file:com.edmunds.etm.agent.haproxy.HaProxyAgentMain.java
public static void main(String[] args) { // Create the Spring application context ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("ha-proxy-etm-agent-context.xml"); ctx.registerShutdownHook(); // Run the agent Agent agent;//from w ww . j ava 2 s . c o m agent = (Agent) ctx.getBean("agent", Agent.class); agent.run(); }
From source file:org.ogcs.okra.example.game.Bootstrap.java
public static void main(String[] args) { LOG.info("PreBootstrap server."); ClassPathXmlApplicationContext context = null; try {/*from ww w . ja va 2s . c o m*/ context = new ClassPathXmlApplicationContext("classpath:spring/beans.xml"); context.registerShutdownHook(); LOG.info("Server bootstrap successful."); } catch (Exception e) { if (context != null) context.close(); LOG.error("Server bootstrap failure.", e); } }
From source file:biz.c24.io.spring.integration.samples.fpml.EngineMain.java
/** * @param args//from w w w . jav a2 s . co m */ public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "classpath:/biz/c24/io/spring/integration/samples/fpml/si-context.xml"); context.registerShutdownHook(); }
From source file:biz.c24.io.spring.integration.samples.fpml.DataGeneratorMain.java
/** * @param args/* w ww. j a v a 2s. c o m*/ */ public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "classpath:/biz/c24/io/spring/integration/samples/fpml/generator/si-context.xml"); context.registerShutdownHook(); }
From source file:biz.c24.io.spring.integration.samples.fpml.PreRenderingDataGeneratorMain.java
/** * @param args/*from w w w . ja v a 2s . co m*/ */ public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "classpath:/biz/c24/io/spring/integration/samples/fpml/generator/prerender-si-context.xml"); context.registerShutdownHook(); }
From source file:com.dangdang.config.service.easyzk.demo.spring.MainEntrance.java
public static void main(String[] args) { ClassPathXmlApplicationContext context = null; try {// ww w .j a v a 2 s .co m context = new ClassPathXmlApplicationContext("classpath:config-toolkit-simple.xml"); context.registerShutdownHook(); context.start(); ExampleBeanWithConfigNode bean = context.getBean(ExampleBeanWithConfigNode.class); while (true) { bean.someMethod(); try { Thread.sleep(1000); } catch (InterruptedException e) { // } } } finally { if (context != null) { context.close(); } } }
From source file:org.kuali.student.git.cleaner.RepositoryCleanerMain.java
/** * @param args//from w ww. ja v a 2 s. co m */ public static void main(String[] args) { if (args.length < 1) { log.error("USAGE: <module name> [module specific arguments]"); System.exit(-1); } try { ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext( "RepositoryCleanerMain-applicationContext.xml"); applicationContext.registerShutdownHook(); String beanName = args[0]; RepositoryCleaner repoCleaner = (RepositoryCleaner) applicationContext.getBean(beanName); /* * Exclude the module name from the args sent to the module. */ repoCleaner.validateArgs(Arrays.asList(args).subList(1, args.length)); repoCleaner.execute(); } catch (Exception e) { log.error("unexpected exception", e); } }
From source file:org.kuali.student.git.tools.Main.java
/** * @param args//from w w w . ja va 2s . co m */ public static void main(String[] args) { if (args.length != 2) { log.error("USAGE: <path to git repository> <data file>"); System.exit(-1); } String pathToGitRepo = args[0]; String comparisonTagDataFile = args[1]; try { ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext( "git/applicationContext.xml"); applicationContext.registerShutdownHook(); GitExtractor extractor = applicationContext.getBean(GitExtractor.class); extractor.buildRepository(new File(pathToGitRepo)); List<String> pathsToCompare = FileUtils.readLines(new File(comparisonTagDataFile), "UTF-8"); for (String comparisonPath : pathsToCompare) { if (comparisonPath.trim().length() == 0 || comparisonPath.trim().startsWith("#")) continue; // skip empty lines and comments String parts[] = comparisonPath.split(":"); String targetTag = parts[0]; String copyFromTag = parts[1]; extractor.extractDifference(targetTag, copyFromTag); } } catch (Exception e) { log.error("Unexpected Exception", e); } }