| 1 |
/* |
| 2 |
* |
| 3 |
* Licensed to the Apache Software Foundation (ASF) under one |
| 4 |
* or more contributor license agreements. See the NOTICE file |
| 5 |
* distributed with this work for additional information |
| 6 |
* regarding copyright ownership. The ASF licenses this file |
| 7 |
* to you under the Apache License, Version 2.0 (the |
| 8 |
* "License"); you may not use this file except in compliance |
| 9 |
* with the License. You may obtain a copy of the License at |
| 10 |
* |
| 11 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 12 |
* |
| 13 |
* Unless required by applicable law or agreed to in writing, |
| 14 |
* software distributed under the License is distributed on an |
| 15 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 |
* KIND, either express or implied. See the License for the |
| 17 |
* specific language governing permissions and limitations |
| 18 |
* under the License. |
| 19 |
* |
| 20 |
*/ |
| 21 |
package org.apache.qpid.proton.engine; |
| 22 |
|
| 23 |
import java.util.EnumSet; |
| 24 |
import java.util.Map; |
| 25 |
|
| 26 |
import org.apache.qpid.proton.amqp.Symbol; |
| 27 |
|
| 28 |
|
| 29 |
/** |
| 30 |
* Session |
| 31 |
* |
| 32 |
* Note that session level flow control is handled internally by Proton. |
| 33 |
*/ |
| 34 |
public interface Session extends Endpoint |
| 35 |
{ |
| 36 |
/** |
| 37 |
* Returns a newly created sender endpoint |
| 38 |
*/ |
| 39 |
public Sender sender(String name); |
| 40 |
|
| 41 |
/** |
| 42 |
* Returns a newly created receiver endpoint |
| 43 |
*/ |
| 44 |
public Receiver receiver(String name); |
| 45 |
|
| 46 |
public Session next(EnumSet<EndpointState> local, EnumSet<EndpointState> remote); |
| 47 |
|
| 48 |
public Connection getConnection(); |
| 49 |
|
| 50 |
public int getIncomingCapacity(); |
| 51 |
|
| 52 |
public void setIncomingCapacity(int bytes); |
| 53 |
|
| 54 |
public int getIncomingBytes(); |
| 55 |
|
| 56 |
public int getOutgoingBytes(); |
| 57 |
|
| 58 |
public long getOutgoingWindow(); |
| 59 |
|
| 60 |
/** |
| 61 |
* Sets the outgoing window size. |
| 62 |
* |
| 63 |
* @param outgoingWindowSize the outgoing window size |
| 64 |
*/ |
| 65 |
public void setOutgoingWindow(long outgoingWindowSize); |
| 66 |
|
| 67 |
/** |
| 68 |
* Sets the local session properties, to be conveyed to the peer via the Begin frame when |
| 69 |
* attaching the session to the session. |
| 70 |
* |
| 71 |
* Must be called during session setup, i.e. before calling the {@link #open()} method. |
| 72 |
* |
| 73 |
* @param properties |
| 74 |
* the properties map to send, or null for none. |
| 75 |
*/ |
| 76 |
void setProperties(Map<Symbol, Object> properties); |
| 77 |
|
| 78 |
/** |
| 79 |
* Gets the local session properties. |
| 80 |
* |
| 81 |
* @return the properties map, or null if none was set. |
| 82 |
* |
| 83 |
* @see #setProperties(Map) |
| 84 |
*/ |
| 85 |
Map<Symbol, Object> getProperties(); |
| 86 |
|
| 87 |
/** |
| 88 |
* Gets the remote session properties, as conveyed from the peer via the Begin frame |
| 89 |
* when opening the session. |
| 90 |
* |
| 91 |
* @return the properties Map conveyed by the peer, or null if there was none. |
| 92 |
*/ |
| 93 |
Map<Symbol, Object> getRemoteProperties(); |
| 94 |
|
| 95 |
/** |
| 96 |
* Sets the local session offered capabilities, to be conveyed to the peer via the Begin frame |
| 97 |
* when opening the session. |
| 98 |
* |
| 99 |
* Must be called during session setup, i.e. before calling the {@link #open()} method. |
| 100 |
* |
| 101 |
* @param offeredCapabilities |
| 102 |
* the offered capabilities array to send, or null for none. |
| 103 |
*/ |
| 104 |
public void setOfferedCapabilities(Symbol[] offeredCapabilities); |
| 105 |
|
| 106 |
/** |
| 107 |
* Gets the local session offered capabilities. |
| 108 |
* |
| 109 |
* @return the offered capabilities array, or null if none was set. |
| 110 |
* |
| 111 |
* @see #setOfferedCapabilities(Symbol[]) |
| 112 |
*/ |
| 113 |
Symbol[] getOfferedCapabilities(); |
| 114 |
|
| 115 |
/** |
| 116 |
* Gets the remote session offered capabilities, as conveyed from the peer via the Begin frame |
| 117 |
* when opening the session. |
| 118 |
* |
| 119 |
* @return the offered capabilities array conveyed by the peer, or null if there was none. |
| 120 |
*/ |
| 121 |
Symbol[] getRemoteOfferedCapabilities(); |
| 122 |
|
| 123 |
/** |
| 124 |
* Sets the local session desired capabilities, to be conveyed to the peer via the Begin frame |
| 125 |
* when opening the session. |
| 126 |
* |
| 127 |
* Must be called during session setup, i.e. before calling the {@link #open()} method. |
| 128 |
* |
| 129 |
* @param desiredCapabilities |
| 130 |
* the desired capabilities array to send, or null for none. |
| 131 |
*/ |
| 132 |
public void setDesiredCapabilities(Symbol[] desiredCapabilities); |
| 133 |
|
| 134 |
/** |
| 135 |
* Gets the local session desired capabilities. |
| 136 |
* |
| 137 |
* @return the desired capabilities array, or null if none was set. |
| 138 |
* |
| 139 |
* @see #setDesiredCapabilities(Symbol[]) |
| 140 |
*/ |
| 141 |
Symbol[] getDesiredCapabilities(); |
| 142 |
|
| 143 |
/** |
| 144 |
* Gets the remote session desired capabilities, as conveyed from the peer via the Begin frame |
| 145 |
* when opening the session. |
| 146 |
* |
| 147 |
* @return the desired capabilities array conveyed by the peer, or null if there was none. |
| 148 |
*/ |
| 149 |
Symbol[] getRemoteDesiredCapabilities(); |
| 150 |
} |