1 | package org.apache.continuum.web.startup; |
2 | |
3 | /* |
4 | * Licensed to the Apache Software Foundation (ASF) under one |
5 | * or more contributor license agreements. See the NOTICE file |
6 | * distributed with this work for additional information |
7 | * regarding copyright ownership. The ASF licenses this file |
8 | * to you under the Apache License, Version 2.0 (the |
9 | * "License"); you may not use this file except in compliance |
10 | * with the License. You may obtain a copy of the License at |
11 | * |
12 | * http://www.apache.org/licenses/LICENSE-2.0 |
13 | * |
14 | * Unless required by applicable law or agreed to in writing, |
15 | * software distributed under the License is distributed on an |
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
17 | * KIND, either express or implied. See the License for the |
18 | * specific language governing permissions and limitations |
19 | * under the License. |
20 | */ |
21 | |
22 | import javax.servlet.ServletContextEvent; |
23 | import javax.servlet.ServletContextListener; |
24 | |
25 | import org.apache.continuum.buildmanager.BuildsManager; |
26 | import org.apache.continuum.builder.distributed.manager.DistributedBuildManager; |
27 | import org.apache.maven.continuum.Continuum; |
28 | import org.codehaus.plexus.spring.PlexusToSpringUtils; |
29 | import org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor; |
30 | import org.slf4j.Logger; |
31 | import org.slf4j.LoggerFactory; |
32 | import org.springframework.web.context.WebApplicationContext; |
33 | import org.springframework.web.context.support.WebApplicationContextUtils; |
34 | |
35 | /** |
36 | * @author <a href="mailto:olamy@apache.org">olamy</a> |
37 | * @since 15 mars 2008 |
38 | * @version $Id: ContinuumStartup.java 775693 2009-05-17 16:14:22Z ctan $ |
39 | */ |
40 | public class ContinuumStartup |
41 | implements ServletContextListener |
42 | { |
43 | |
44 | private Logger log = LoggerFactory.getLogger( getClass() ); |
45 | |
46 | /** |
47 | * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent) |
48 | */ |
49 | public void contextDestroyed( ServletContextEvent sce ) |
50 | { |
51 | // nothing to do here |
52 | |
53 | } |
54 | |
55 | /** |
56 | * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent) |
57 | */ |
58 | public void contextInitialized( ServletContextEvent sce ) |
59 | { |
60 | WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext( sce |
61 | .getServletContext() ); |
62 | |
63 | // to simulate Plexus load on start with Spring |
64 | Continuum continuum = (Continuum) wac.getBean( PlexusToSpringUtils.buildSpringId( Continuum.class ) ); |
65 | |
66 | BuildsManager buildsManager = (BuildsManager) wac.getBean( PlexusToSpringUtils.buildSpringId( BuildsManager.class, "parallel" ) ); |
67 | |
68 | TaskQueueExecutor prepareRelease = (TaskQueueExecutor) wac.getBean( PlexusToSpringUtils |
69 | .buildSpringId( TaskQueueExecutor.class, "prepare-release" ) ); |
70 | |
71 | TaskQueueExecutor performRelease = (TaskQueueExecutor) wac.getBean( PlexusToSpringUtils |
72 | .buildSpringId( TaskQueueExecutor.class, "perform-release" ) ); |
73 | |
74 | TaskQueueExecutor rollbackRelease = (TaskQueueExecutor) wac.getBean( PlexusToSpringUtils |
75 | .buildSpringId( TaskQueueExecutor.class, "rollback-release" ) ); |
76 | |
77 | TaskQueueExecutor purge = (TaskQueueExecutor) wac.getBean( PlexusToSpringUtils |
78 | .buildSpringId( TaskQueueExecutor.class, "purge" ) ); |
79 | |
80 | TaskQueueExecutor prepareBuildProject = (TaskQueueExecutor) wac.getBean( PlexusToSpringUtils |
81 | .buildSpringId( TaskQueueExecutor.class, "prepare-build-project" ) ); |
82 | |
83 | DistributedBuildManager distributedBuildManager = (DistributedBuildManager) wac.getBean( PlexusToSpringUtils |
84 | .buildSpringId( DistributedBuildManager.class ) ); |
85 | } |
86 | } |