1 20 package org.apache.mina.integration.spring; 21 22 import java.net.SocketAddress ; 23 24 import org.apache.mina.common.IoAcceptor; 25 import org.apache.mina.common.IoHandler; 26 import org.apache.mina.common.IoServiceConfig; 27 import org.springframework.beans.factory.InitializingBean; 28 import org.springframework.util.Assert; 29 30 57 public class Binding implements InitializingBean { 58 private SocketAddress address = null; 59 60 private IoHandler handler = null; 61 62 private IoServiceConfig serviceConfig = null; 63 64 67 public Binding() { 68 } 69 70 78 public Binding(SocketAddress address, IoHandler handler) { 79 setAddress(address); 80 setHandler(handler); 81 } 82 83 92 public Binding(SocketAddress address, IoHandler handler, 93 IoServiceConfig serviceConfig) { 94 setAddress(address); 95 setHandler(handler); 96 setServiceConfig(serviceConfig); 97 } 98 99 104 public SocketAddress getAddress() { 105 return address; 106 } 107 108 115 public void setAddress(SocketAddress address) { 116 Assert.notNull(address, "Property 'address' may not be null"); 117 this.address = address; 118 } 119 120 125 public IoHandler getHandler() { 126 return handler; 127 } 128 129 136 public void setHandler(IoHandler handler) { 137 Assert.notNull(handler, "Property 'handler' may not be null"); 138 this.handler = handler; 139 } 140 141 public IoServiceConfig getServiceConfig() { 142 return serviceConfig; 143 } 144 145 public void setServiceConfig(IoServiceConfig serviceConfig) { 146 this.serviceConfig = serviceConfig; 147 } 148 149 public void afterPropertiesSet() throws Exception { 150 Assert.notNull(address, "Property 'address' may not be null"); 151 Assert.notNull(handler, "Property 'handler' may not be null"); 152 } 153 154 } 155 | Popular Tags |