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.websocket.common.scopes;
20  
21  import java.util.concurrent.Executor;
22  
23  import org.eclipse.jetty.io.ByteBufferPool;
24  import org.eclipse.jetty.util.DecoratedObjectFactory;
25  import org.eclipse.jetty.util.ssl.SslContextFactory;
26  import org.eclipse.jetty.websocket.api.WebSocketPolicy;
27  import org.eclipse.jetty.websocket.common.WebSocketSession;
28  
29  /**
30   * Defined Scope for a WebSocketContainer.
31   */
32  public interface WebSocketContainerScope
33  {
34      /**
35       * The configured Container Buffer Pool.
36       * 
37       * @return the buffer pool (never null)
38       */
39      public ByteBufferPool getBufferPool();
40  
41      /**
42       * Executor in use by the container.
43       * 
44       * @return the Executor in use by the container.
45       */
46      public Executor getExecutor();
47  
48      /**
49       * Object Factory used to create objects.
50       * 
51       * @return Object Factory used to create instances of objects.
52       */
53      public DecoratedObjectFactory getObjectFactory();
54  
55      /**
56       * The policy the container is running on.
57       * 
58       * @return the websocket policy
59       */
60      public WebSocketPolicy getPolicy();
61  
62      /**
63       * The SslContextFactory in use by the container.
64       * 
65       * @return the SslContextFactory in use by the container (can be null if no SSL context is defined)
66       */
67      public SslContextFactory getSslContextFactory();
68  
69      /**
70       * A Session has been opened
71       * 
72       * @param session the session that was opened
73       */
74      public void onSessionOpened(WebSocketSession session);
75      
76      /**
77       * A Session has been closed
78       * 
79       * @param session the session that was closed
80       */
81      public void onSessionClosed(WebSocketSession session);
82  
83  }