Debian Codegraph @

proton-j/src/main/java/org/apache/qpid/proton/engine/Connection.java

raw
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 import org.apache.qpid.proton.engine.impl.ConnectionImpl;
28 import org.apache.qpid.proton.reactor.Reactor;
29 import org.apache.qpid.proton.reactor.ReactorChild;
30
31
32 /**
33 * Maintains lists of sessions, links and deliveries in a state
34 * that is interesting to the application.
35 *
36 * These are exposed by returning the head of those lists via
37 * {@link #sessionHead(EnumSet, EnumSet)}, {@link #linkHead(EnumSet, EnumSet)}
38 * {@link #getWorkHead()} respectively.
39 */
40 public interface Connection extends Endpoint, ReactorChild
41 {
42
43 public static final class Factory
44 {
45 public static Connection create() {
46 return new ConnectionImpl();
47 }
48 }
49
50 /**
51 * Returns a newly created session
52 *
53 * TODO does the Connection's channel-max property limit how many sessions can be created,
54 * or opened, or neither?
55 */
56 public Session session();
57
58 /**
59 * Returns the head of the list of sessions in the specified states.
60 *
61 * Typically used to discover sessions whose remote state has acquired
62 * particular values, e.g. sessions that have been remotely opened or closed.
63 *
64 * TODO what ordering guarantees on the returned "linked list" are provided?
65 *
66 * @see Session#next(EnumSet, EnumSet)
67 */
68 public Session sessionHead(EnumSet<EndpointState> local, EnumSet<EndpointState> remote);
69
70 /**
71 * Returns the head of the list of links in the specified states.
72 *
73 * Typically used to discover links whose remote state has acquired
74 * particular values, e.g. links that have been remotely opened or closed.
75 *
76 * @see Link#next(EnumSet, EnumSet)
77 */
78 public Link linkHead(EnumSet<EndpointState> local, EnumSet<EndpointState> remote);
79
80 /**
81 * Returns the head of the delivery work list. The delivery work list consists of
82 * unsettled deliveries whose state has been changed by the other container
83 * and not yet locally processed.
84 *
85 * @see Receiver#recv(byte[], int, int)
86 * @see Delivery#settle()
87 * @see Delivery#getWorkNext()
88 */
89 public Delivery getWorkHead();
90
91 public void setContainer(String container);
92
93 public String getContainer();
94
95 /**
96 * Set the name of the host (either fully qualified or relative) to which
97 * this connection is connecting to. This information may be used by the
98 * remote peer to determine the correct back-end service to connect the
99 * client to. This value will be sent in the Open performative.
100 *
101 * <b>Note that it is illegal to set the hostname to a numeric IP
102 * address or include a port number.</b>
103 *
104 * @param hostname the RFC1035 compliant host name.
105 */
106 public void setHostname(String hostname);
107
108 public String getHostname();
109
110 public String getRemoteContainer();
111
112 public String getRemoteHostname();
113
114 void setOfferedCapabilities(Symbol[] capabilities);
115
116 void setDesiredCapabilities(Symbol[] capabilities);
117
118 Symbol[] getRemoteOfferedCapabilities();
119
120 Symbol[] getRemoteDesiredCapabilities();
121
122 Map<Symbol,Object> getRemoteProperties();
123
124 void setProperties(Map<Symbol,Object> properties);
125
126 @Override
127 Object getContext();
128
129 @Override
130 void setContext(Object context);
131
132 void collect(Collector collector);
133
134 Transport getTransport();
135
136 Reactor getReactor();
137 }