| %line | %branch | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| org.apache.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes |
|
|
| 1 | package org.apache.jcs.auxiliary.lateral.socket.tcp; |
|
| 2 | ||
| 3 | /* |
|
| 4 | * Licensed to the Apache Software Foundation (ASF) under one |
|
| 5 | * or more contributor license agreements. See the NOTICE file |
|
| 6 | * distributed with this work for additional information |
|
| 7 | * regarding copyright ownership. The ASF licenses this file |
|
| 8 | * to you under the Apache License, Version 2.0 (the |
|
| 9 | * "License"); you may not use this file except in compliance |
|
| 10 | * with the License. You may obtain a copy of the License at |
|
| 11 | * |
|
| 12 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 13 | * |
|
| 14 | * Unless required by applicable law or agreed to in writing, |
|
| 15 | * software distributed under the License is distributed on an |
|
| 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
| 17 | * KIND, either express or implied. See the License for the |
|
| 18 | * specific language governing permissions and limitations |
|
| 19 | * under the License. |
|
| 20 | */ |
|
| 21 | ||
| 22 | import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes; |
|
| 23 | import org.apache.jcs.auxiliary.lateral.LateralCacheAttributes; |
|
| 24 | import org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * This interface defines functions that are particular to the TCP Lateral Cache |
|
| 28 | * plugin. It extends the generic LateralCacheAttributes interface which in turn |
|
| 29 | * extends the AuxiliaryCache interface. |
|
| 30 | * |
|
| 31 | * @author Aaron Smuts |
|
| 32 | * |
|
| 33 | */ |
|
| 34 | 34 | public class TCPLateralCacheAttributes |
| 35 | extends LateralCacheAttributes |
|
| 36 | implements ITCPLateralCacheAttributes |
|
| 37 | { |
|
| 38 | ||
| 39 | private static final long serialVersionUID = 1077889204513905220L; |
|
| 40 | ||
| 41 | private static final String DEFAULT_UDP_DISCOVERY_ADDRESS = "228.5.6.7"; |
|
| 42 | ||
| 43 | private static final int DEFAULT_UDP_DISCOVERY_PORT = 6789; |
|
| 44 | ||
| 45 | private static final boolean DEFAULT_UDP_DISCOVERY_ENABLED = true; |
|
| 46 | ||
| 47 | private static final boolean DEFAULT_ALLOW_GET = true; |
|
| 48 | ||
| 49 | private static final boolean DEFAULT_ALLOW_PUT = true; |
|
| 50 | ||
| 51 | private static final boolean DEFAULT_ISSUE_REMOVE_FOR_PUT = false; |
|
| 52 | ||
| 53 | private static final boolean DEFAULT_FILTER_REMOVE_BY_HASH_CODE = true; |
|
| 54 | ||
| 55 | // TCP -------------------------------------------- |
|
| 56 | 34 | private String tcpServers = ""; |
| 57 | ||
| 58 | // used to identify the service that this manager will be |
|
| 59 | // operating on |
|
| 60 | 34 | private String tcpServer = ""; |
| 61 | ||
| 62 | 34 | private int tcpListenerPort = 0; |
| 63 | ||
| 64 | // udp discovery for tcp server |
|
| 65 | 34 | private String udpDiscoveryAddr = DEFAULT_UDP_DISCOVERY_ADDRESS; |
| 66 | ||
| 67 | 34 | private int udpDiscoveryPort = DEFAULT_UDP_DISCOVERY_PORT; |
| 68 | ||
| 69 | 34 | private boolean udpDiscoveryEnabled = DEFAULT_UDP_DISCOVERY_ENABLED; |
| 70 | ||
| 71 | 34 | private boolean allowPut = DEFAULT_ALLOW_GET; |
| 72 | ||
| 73 | 34 | private boolean allowGet = DEFAULT_ALLOW_PUT; |
| 74 | ||
| 75 | 34 | private boolean issueRemoveOnPut = DEFAULT_ISSUE_REMOVE_FOR_PUT; |
| 76 | ||
| 77 | 34 | private boolean filterRemoveByHashCode = DEFAULT_FILTER_REMOVE_BY_HASH_CODE; |
| 78 | ||
| 79 | /* |
|
| 80 | * (non-Javadoc) |
|
| 81 | * |
|
| 82 | * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#setTcpServer(java.lang.String) |
|
| 83 | */ |
|
| 84 | public void setTcpServer( String val ) |
|
| 85 | { |
|
| 86 | 47 | this.tcpServer = val; |
| 87 | 47 | } |
| 88 | ||
| 89 | /* |
|
| 90 | * (non-Javadoc) |
|
| 91 | * |
|
| 92 | * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#getTcpServer() |
|
| 93 | */ |
|
| 94 | public String getTcpServer() |
|
| 95 | { |
|
| 96 | 263 | return this.tcpServer; |
| 97 | } |
|
| 98 | ||
| 99 | /* |
|
| 100 | * (non-Javadoc) |
|
| 101 | * |
|
| 102 | * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#setTcpServers(java.lang.String) |
|
| 103 | */ |
|
| 104 | public void setTcpServers( String val ) |
|
| 105 | { |
|
| 106 | 27 | this.tcpServers = val; |
| 107 | 27 | } |
| 108 | ||
| 109 | /* |
|
| 110 | * (non-Javadoc) |
|
| 111 | * |
|
| 112 | * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#getTcpServers() |
|
| 113 | */ |
|
| 114 | public String getTcpServers() |
|
| 115 | { |
|
| 116 | 54 | return this.tcpServers; |
| 117 | } |
|
| 118 | ||
| 119 | /* |
|
| 120 | * (non-Javadoc) |
|
| 121 | * |
|
| 122 | * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#setTcpListenerPort(int) |
|
| 123 | */ |
|
| 124 | public void setTcpListenerPort( int val ) |
|
| 125 | { |
|
| 126 | 47 | this.tcpListenerPort = val; |
| 127 | 47 | } |
| 128 | ||
| 129 | /* |
|
| 130 | * (non-Javadoc) |
|
| 131 | * |
|
| 132 | * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#getTcpListenerPort() |
|
| 133 | */ |
|
| 134 | public int getTcpListenerPort() |
|
| 135 | { |
|
| 136 | 299 | return this.tcpListenerPort; |
| 137 | } |
|
| 138 | ||
| 139 | /* |
|
| 140 | * (non-Javadoc) |
|
| 141 | * |
|
| 142 | * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#setUdpDiscoveryEnabled(boolean) |
|
| 143 | */ |
|
| 144 | public void setUdpDiscoveryEnabled( boolean udpDiscoveryEnabled ) |
|
| 145 | { |
|
| 146 | 0 | this.udpDiscoveryEnabled = udpDiscoveryEnabled; |
| 147 | 0 | } |
| 148 | ||
| 149 | /* |
|
| 150 | * (non-Javadoc) |
|
| 151 | * |
|
| 152 | * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#isUdpDiscoveryEnabled() |
|
| 153 | */ |
|
| 154 | public boolean isUdpDiscoveryEnabled() |
|
| 155 | { |
|
| 156 | 26 | return this.udpDiscoveryEnabled; |
| 157 | } |
|
| 158 | ||
| 159 | /* |
|
| 160 | * (non-Javadoc) |
|
| 161 | * |
|
| 162 | * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#getUdpDiscoveryPort() |
|
| 163 | */ |
|
| 164 | public int getUdpDiscoveryPort() |
|
| 165 | { |
|
| 166 | 26 | return this.udpDiscoveryPort; |
| 167 | } |
|
| 168 | ||
| 169 | /* |
|
| 170 | * (non-Javadoc) |
|
| 171 | * |
|
| 172 | * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#setUdpDiscoveryPort(int) |
|
| 173 | */ |
|
| 174 | public void setUdpDiscoveryPort( int udpDiscoveryPort ) |
|
| 175 | { |
|
| 176 | 0 | this.udpDiscoveryPort = udpDiscoveryPort; |
| 177 | 0 | } |
| 178 | ||
| 179 | /* |
|
| 180 | * (non-Javadoc) |
|
| 181 | * |
|
| 182 | * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#getUdpDiscoveryAddr() |
|
| 183 | */ |
|
| 184 | public String getUdpDiscoveryAddr() |
|
| 185 | { |
|
| 186 | 26 | return this.udpDiscoveryAddr; |
| 187 | } |
|
| 188 | ||
| 189 | /* |
|
| 190 | * (non-Javadoc) |
|
| 191 | * |
|
| 192 | * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes#setUdpDiscoveryAddr(java.lang.String) |
|
| 193 | */ |
|
| 194 | public void setUdpDiscoveryAddr( String udpDiscoveryAddr ) |
|
| 195 | { |
|
| 196 | 0 | this.udpDiscoveryAddr = udpDiscoveryAddr; |
| 197 | 0 | } |
| 198 | ||
| 199 | /* |
|
| 200 | * (non-Javadoc) |
|
| 201 | * |
|
| 202 | * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#setAllowGet(boolean) |
|
| 203 | */ |
|
| 204 | public void setAllowGet( boolean allowGet ) |
|
| 205 | { |
|
| 206 | 27 | this.allowGet = allowGet; |
| 207 | 27 | } |
| 208 | ||
| 209 | /* |
|
| 210 | * (non-Javadoc) |
|
| 211 | * |
|
| 212 | * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#isAllowGet() |
|
| 213 | */ |
|
| 214 | public boolean isAllowGet() |
|
| 215 | { |
|
| 216 | 0 | return this.allowGet; |
| 217 | } |
|
| 218 | ||
| 219 | /* |
|
| 220 | * (non-Javadoc) |
|
| 221 | * |
|
| 222 | * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#setAllowPut(boolean) |
|
| 223 | */ |
|
| 224 | public void setAllowPut( boolean allowPut ) |
|
| 225 | { |
|
| 226 | 13 | this.allowPut = allowPut; |
| 227 | 13 | } |
| 228 | ||
| 229 | /* |
|
| 230 | * (non-Javadoc) |
|
| 231 | * |
|
| 232 | * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#isAllowPut() |
|
| 233 | */ |
|
| 234 | public boolean isAllowPut() |
|
| 235 | { |
|
| 236 | 1419 | return this.allowPut; |
| 237 | } |
|
| 238 | ||
| 239 | /* |
|
| 240 | * (non-Javadoc) |
|
| 241 | * |
|
| 242 | * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#setIssueRemoveOnPut(boolean) |
|
| 243 | */ |
|
| 244 | public void setIssueRemoveOnPut( boolean issueRemoveOnPut ) |
|
| 245 | { |
|
| 246 | 47 | this.issueRemoveOnPut = issueRemoveOnPut; |
| 247 | 47 | } |
| 248 | ||
| 249 | /* |
|
| 250 | * (non-Javadoc) |
|
| 251 | * |
|
| 252 | * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#isIssueRemoveOnPut() |
|
| 253 | */ |
|
| 254 | public boolean isIssueRemoveOnPut() |
|
| 255 | { |
|
| 256 | 2831 | return this.issueRemoveOnPut; |
| 257 | } |
|
| 258 | ||
| 259 | /* |
|
| 260 | * (non-Javadoc) |
|
| 261 | * |
|
| 262 | * @see org.apache.jcs.auxiliary.AuxiliaryCacheAttributes#copy() |
|
| 263 | */ |
|
| 264 | public AuxiliaryCacheAttributes copy() |
|
| 265 | { |
|
| 266 | try |
|
| 267 | { |
|
| 268 | 80 | return (AuxiliaryCacheAttributes) this.clone(); |
| 269 | } |
|
| 270 | 0 | catch ( Exception e ) |
| 271 | { |
|
| 272 | //noop |
|
| 273 | } |
|
| 274 | 0 | return this; |
| 275 | } |
|
| 276 | ||
| 277 | /* |
|
| 278 | * (non-Javadoc) |
|
| 279 | * |
|
| 280 | * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#isFilterRemoveByHashCode() |
|
| 281 | */ |
|
| 282 | public boolean isFilterRemoveByHashCode() |
|
| 283 | { |
|
| 284 | 1412 | return this.filterRemoveByHashCode; |
| 285 | } |
|
| 286 | ||
| 287 | /* |
|
| 288 | * (non-Javadoc) |
|
| 289 | * |
|
| 290 | * @see org.apache.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes#setFilterRemoveByHashCode(boolean) |
|
| 291 | */ |
|
| 292 | public void setFilterRemoveByHashCode( boolean filter ) |
|
| 293 | { |
|
| 294 | 13 | this.filterRemoveByHashCode = filter; |
| 295 | 13 | } |
| 296 | ||
| 297 | /** |
|
| 298 | * Used to key the instance TODO create another method for this and use |
|
| 299 | * toString for debugging only. |
|
| 300 | * |
|
| 301 | * @return String |
|
| 302 | */ |
|
| 303 | public String toString() |
|
| 304 | { |
|
| 305 | 195 | return this.getTcpServer() + ":" + this.getTcpListenerPort(); |
| 306 | } |
|
| 307 | ||
| 308 | } |
| This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |