1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.netty.channel;
17
18 import java.util.Map;
19 import java.util.Map.Entry;
20
21 import org.jboss.netty.buffer.ChannelBufferFactory;
22 import org.jboss.netty.buffer.HeapChannelBufferFactory;
23 import org.jboss.netty.channel.socket.ServerSocketChannelConfig;
24
25
26
27
28 public class DefaultServerChannelConfig implements ChannelConfig {
29
30 private volatile ChannelPipelineFactory pipelineFactory;
31 private volatile ChannelBufferFactory bufferFactory = HeapChannelBufferFactory.getInstance();
32
33 public void setOptions(Map<String, Object> options) {
34 for (Entry<String, Object> e: options.entrySet()) {
35 setOption(e.getKey(), e.getValue());
36 }
37 }
38
39
40
41
42
43 public boolean setOption(String key, Object value) {
44 if (key.equals("pipelineFactory")) {
45 setPipelineFactory((ChannelPipelineFactory) value);
46 } else if (key.equals("bufferFactory")) {
47 setBufferFactory((ChannelBufferFactory) value);
48 } else {
49 return false;
50 }
51 return true;
52 }
53
54 public ChannelPipelineFactory getPipelineFactory() {
55 return pipelineFactory;
56 }
57
58 public void setPipelineFactory(ChannelPipelineFactory pipelineFactory) {
59 if (pipelineFactory == null) {
60 throw new NullPointerException("pipelineFactory");
61 }
62 this.pipelineFactory = pipelineFactory;
63 }
64
65 public ChannelBufferFactory getBufferFactory() {
66 return bufferFactory;
67 }
68
69 public void setBufferFactory(ChannelBufferFactory bufferFactory) {
70 if (bufferFactory == null) {
71 throw new NullPointerException("bufferFactory");
72 }
73
74 this.bufferFactory = bufferFactory;
75 }
76
77 public int getConnectTimeoutMillis() {
78 return 0;
79 }
80
81 public void setConnectTimeoutMillis(int connectTimeoutMillis) {
82
83 }
84 }