-
Notifications
You must be signed in to change notification settings - Fork 143
/
DummyNetworkListener.java
268 lines (222 loc) · 6.39 KB
/
DummyNetworkListener.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
/*
* Copyright (c) 2007, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package com.sun.enterprise.v3.services.impl;
import java.util.ArrayList;
import java.util.List;
import org.glassfish.grizzly.config.dom.NetworkListener;
import org.glassfish.grizzly.config.dom.NetworkListeners;
import org.glassfish.grizzly.config.dom.Protocol;
import org.glassfish.grizzly.config.dom.ThreadPool;
import org.glassfish.grizzly.config.dom.Transport;
import org.jvnet.hk2.config.ConfigBeanProxy;
import org.jvnet.hk2.config.TransactionFailure;
import org.jvnet.hk2.config.types.Property;
/**
* This is a dummy implementation of the NetworkListener interface. This is used to create a fake network-listener
* elements. This is used only to support lazyInit attribute of iiop and jms services through the light weight listener.
* Ultimately, these services will move to their own network-listener element in domain.xml (at which point we have to
* get rid of this fake object). But till the time IIOP and JMS service elements in domain.xml can move to use
* network-listener element, we will create this "fake network-listener" which in turn will help start light weight
* listener for these services.
*/
public class DummyNetworkListener implements NetworkListener {
private String address = "0.0.0.0";
private String enabled = "true";
private String type = "standard";
private String name;
private String port;
private String protocol;
private String pool;
private String transport;
private String jkEnabled;
private String jkConfigurationFile;
private final List<Property> properties = new ArrayList<>();
public DummyNetworkListener() {
}
@Override
public String getType() {
return type;
}
@Override
public void setType(String type) {
this.type = type;
}
@Override
public String getAddress() {
return address;
}
@Override
public void setAddress(String value) {
address = value;
}
@Override
public String getEnabled() {
return enabled;
}
@Override
public void setEnabled(String enabled) {
this.enabled = enabled;
}
@Override
public String getName() {
return name;
}
@Override
public void setName(String value) {
name = value;
}
@Override
public String getPort() {
return port;
}
@Override
public void setPort(String value) {
port = value;
}
@Override
public String getProtocol() {
return protocol;
}
@Override
public void setProtocol(String value) {
protocol = value;
}
@Override
public String getThreadPool() {
return pool;
}
@Override
public void setThreadPool(String value) {
pool = value;
}
@Override
public String getTransport() {
return transport;
}
@Override
public void setTransport(String value) {
transport = value;
}
@Override
public String getJkEnabled() {
return jkEnabled;
}
@Override
public void setJkEnabled(String value) {
jkEnabled = value;
}
@Override
public String getJkConfigurationFile() {
return jkConfigurationFile;
}
@Override
public void setJkConfigurationFile(String jkConfigurationFile) {
this.jkConfigurationFile = jkConfigurationFile;
}
public void injectedInto(Object target) {
}
@Override
public <T extends ConfigBeanProxy> T createChild(Class<T> type) throws TransactionFailure {
throw new UnsupportedOperationException();
}
@Override
public Protocol findProtocol() {
return null;
}
@Override
public String findHttpProtocolName() {
return null;
}
@Override
public Protocol findHttpProtocol() {
return null;
}
@Override
public ThreadPool findThreadPool() {
return null;
}
@Override
public Transport findTransport() {
return null;
}
@Override
public NetworkListeners getParent() {
throw new UnsupportedOperationException();
}
@Override
public <T extends ConfigBeanProxy> T getParent(Class<T> c) {
throw new UnsupportedOperationException();
}
@Override
public ConfigBeanProxy deepCopy(ConfigBeanProxy parent) {
throw new UnsupportedOperationException();
}
@Override
public List<Property> getProperty() {
return properties;
}
@Override
public Property getProperty(String name) {
if (name == null) {
return null;
}
for (Property property : properties) {
if (name.equals(property.getName())) {
return property;
}
}
return null;
}
@Override
public String getPropertyValue(String name) {
return getPropertyValue(name, null);
}
@Override
public String getPropertyValue(String name, String defaultValue) {
final Property property = getProperty(name);
if (property != null) {
return property.getValue();
}
return defaultValue;
}
@Override
public Property addProperty(Property prprt) {
if (properties.add(prprt)) {
return prprt;
} else {
return null;
}
}
@Override
public Property lookupProperty(String string) {
return getProperty(name);
}
@Override
public Property removeProperty(String string) {
final Property prop = getProperty(name);
if (prop == null) {
return null;
}
return removeProperty(prop);
}
@Override
public Property removeProperty(Property prprt) {
if (properties.remove(prprt)) {
return prprt;
}
return null;
}
}