1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.extension.handler.internal

File ExtensionApplicationStartedListener.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
3
3
1
78
36
3
1
1
3
1

Classes

Class Line # Actions
ExtensionApplicationStartedListener 46 3 0% 3 0
1.0100%
 

Contributing tests

This file is covered by 109 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20   
21    package org.xwiki.extension.handler.internal;
22   
23    import java.util.Collections;
24    import java.util.List;
25   
26    import javax.inject.Inject;
27    import javax.inject.Named;
28    import javax.inject.Provider;
29    import javax.inject.Singleton;
30   
31    import org.xwiki.component.annotation.Component;
32    import org.xwiki.extension.handler.ExtensionInitializer;
33    import org.xwiki.observation.EventListener;
34    import org.xwiki.observation.event.ApplicationStartedEvent;
35    import org.xwiki.observation.event.Event;
36   
37    /**
38    * An application started listener to initialize extensions.
39    *
40    * @version $Id: 7616d78be918e57b4be0cec4bde2185efa7a466c $
41    * @since 4.0M1
42    */
43    @Component
44    @Singleton
45    @Named("ExtensionApplicationStartedListener")
 
46    public class ExtensionApplicationStartedListener implements EventListener
47    {
48    /**
49    * The list of events observed.
50    */
51    private static final List<Event> EVENTS = Collections.<Event>singletonList(new ApplicationStartedEvent());
52   
53    /**
54    * The extension initializer.
55    * <p>
56    * Use it only when receiving an {@link ApplicationStartedEvent} event.
57    */
58    @Inject
59    private Provider<ExtensionInitializer> extensionInitializer;
60   
 
61  259 toggle @Override
62    public List<Event> getEvents()
63    {
64  259 return EVENTS;
65    }
66   
 
67  962 toggle @Override
68    public String getName()
69    {
70  962 return "ExtensionApplicationStartedListener";
71    }
72   
 
73  32 toggle @Override
74    public void onEvent(Event arg0, Object arg1, Object arg2)
75    {
76  32 this.extensionInitializer.get().initialize();
77    }
78    }