View Javadoc

1   //
2   //  ========================================================================
3   //  Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
4   //  ------------------------------------------------------------------------
5   //  All rights reserved. This program and the accompanying materials
6   //  are made available under the terms of the Eclipse Public License v1.0
7   //  and Apache License v2.0 which accompanies this distribution.
8   //
9   //      The Eclipse Public License is available at
10  //      http://www.eclipse.org/legal/epl-v10.html
11  //
12  //      The Apache License v2.0 is available at
13  //      http://www.opensource.org/licenses/apache2.0.php
14  //
15  //  You may elect to redistribute this code under either of these licenses.
16  //  ========================================================================
17  //
18  
19  package org.eclipse.jetty.cdi.websocket;
20  
21  import org.eclipse.jetty.util.component.Container;
22  import org.eclipse.jetty.util.component.LifeCycle;
23  
24  /**
25   * Abstract implementation of listener that needs both Container events and LifeCycle events
26   */
27  public abstract class AbstractContainerListener implements LifeCycle.Listener, Container.InheritedListener
28  {
29      @Override
30      public void beanAdded(Container parent, Object child)
31      {
32          if (child instanceof LifeCycle)
33          {
34              ((LifeCycle)child).addLifeCycleListener(this);
35          }
36      }
37  
38      @Override
39      public void beanRemoved(Container parent, Object child)
40      {
41          if (child instanceof LifeCycle)
42          {
43              ((LifeCycle)child).removeLifeCycleListener(this);
44          }
45      }
46  
47      @Override
48      public void lifeCycleFailure(LifeCycle event, Throwable cause)
49      {
50      }
51  
52      @Override
53      public void lifeCycleStarted(LifeCycle event)
54      {
55      }
56  
57      @Override
58      public void lifeCycleStarting(LifeCycle event)
59      {
60      }
61  
62      @Override
63      public void lifeCycleStopped(LifeCycle event)
64      {
65  
66      }
67  
68      @Override
69      public void lifeCycleStopping(LifeCycle event)
70      {
71      }
72  
73  }