1 package org.apache.commons.jcs.auxiliary.lateral.socket.tcp.behavior; 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.commons.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes; 23 24 /** 25 * This interface defines functions that are particular to the TCP Lateral Cache 26 * plugin. It extends the generic LateralCacheAttributes interface which in turn 27 * extends the AuxiliaryCache interface. 28 * <p> 29 * @author Aaron Smuts 30 */ 31 public interface ITCPLateralCacheAttributes 32 extends ILateralCacheAttributes 33 { 34 /** 35 * Sets the tcpServer attribute of the ILateralCacheAttributes object 36 * <p> 37 * @param val 38 * The new tcpServer value 39 */ 40 void setTcpServer( String val ); 41 42 /** 43 * Gets the tcpServer attribute of the ILateralCacheAttributes object 44 * <p> 45 * @return The tcpServer value 46 */ 47 String getTcpServer(); 48 49 /** 50 * Sets the tcpServers attribute of the ILateralCacheAttributes object 51 * <p> 52 * @param val 53 * The new tcpServers value 54 */ 55 void setTcpServers( String val ); 56 57 /** 58 * Gets the tcpServers attribute of the ILateralCacheAttributes object 59 * <p> 60 * @return The tcpServers value 61 */ 62 String getTcpServers(); 63 64 /** 65 * Sets the tcpListenerPort attribute of the ILateralCacheAttributes object 66 * <p> 67 * @param val 68 * The new tcpListenerPort value 69 */ 70 void setTcpListenerPort( int val ); 71 72 /** 73 * Gets the tcpListenerPort attribute of the ILateralCacheAttributes object 74 * <p> 75 * @return The tcpListenerPort value 76 */ 77 int getTcpListenerPort(); 78 79 /** 80 * Can setup UDP Discovery. This only works for TCp laterals right now. It 81 * allows TCP laterals to find each other by broadcasting to a multicast 82 * port. 83 * <p> 84 * @param udpDiscoveryEnabled 85 * The udpDiscoveryEnabled to set. 86 */ 87 void setUdpDiscoveryEnabled( boolean udpDiscoveryEnabled ); 88 89 /** 90 * Whether or not TCP laterals can try to find each other by multicast 91 * communication. 92 * <p> 93 * @return Returns the udpDiscoveryEnabled. 94 */ 95 boolean isUdpDiscoveryEnabled(); 96 97 /** 98 * The port to use if UDPDiscovery is enabled. 99 * <p> 100 * @return Returns the udpDiscoveryPort. 101 */ 102 int getUdpDiscoveryPort(); 103 104 /** 105 * Sets the port to use if UDPDiscovery is enabled. 106 * <p> 107 * @param udpDiscoveryPort 108 * The udpDiscoveryPort to set. 109 */ 110 void setUdpDiscoveryPort( int udpDiscoveryPort ); 111 112 /** 113 * The address to broadcast to if UDPDiscovery is enabled. 114 * <p> 115 * @return Returns the udpDiscoveryAddr. 116 */ 117 String getUdpDiscoveryAddr(); 118 119 /** 120 * Sets the address to broadcast to if UDPDiscovery is enabled. 121 * <p> 122 * @param udpDiscoveryAddr 123 * The udpDiscoveryAddr to set. 124 */ 125 void setUdpDiscoveryAddr( String udpDiscoveryAddr ); 126 127 /** 128 * Is the lateral allowed to try and get from other laterals. 129 * <p> 130 * This replaces the old putOnlyMode 131 * <p> 132 * @param allowGet 133 */ 134 void setAllowGet( boolean allowGet ); 135 136 /** 137 * Is the lateral allowed to try and get from other laterals. 138 * <p> 139 * @return true if the lateral will try to get 140 */ 141 boolean isAllowGet(); 142 143 /** 144 * Is the lateral allowed to put objects to other laterals. 145 * <p> 146 * @param allowPut 147 */ 148 void setAllowPut( boolean allowPut ); 149 150 /** 151 * Is the lateral allowed to put objects to other laterals. 152 * <p> 153 * @return true if puts are allowed 154 */ 155 boolean isAllowPut(); 156 157 /** 158 * Should the client send a remove command rather than a put when update is 159 * called. This is a client option, not a receiver option. This allows you 160 * to prevent the lateral from serializing objects. 161 * <p> 162 * @param issueRemoveOnPut 163 */ 164 void setIssueRemoveOnPut( boolean issueRemoveOnPut ); 165 166 /** 167 * Should the client send a remove command rather than a put when update is 168 * called. This is a client option, not a receiver option. This allows you 169 * to prevent the lateral from serializing objects. 170 * <p> 171 * @return true if updates will result in a remove command being sent. 172 */ 173 boolean isIssueRemoveOnPut(); 174 175 /** 176 * Should the receiver try to match hashcodes. If true, the receiver will 177 * see if the client supplied a hashcode. If it did, then it will try to get 178 * the item locally. If the item exists, then it will compare the hashcode. 179 * if they are the same, it will not remove. This isn't perfect since 180 * different objects can have the same hashcode, but it is unlikely of 181 * objects of the same type. 182 * <p> 183 * @return boolean 184 */ 185 boolean isFilterRemoveByHashCode(); 186 187 /** 188 * Should the receiver try to match hashcodes. If true, the receiver will 189 * see if the client supplied a hashcode. If it did, then it will try to get 190 * the item locally. If the item exists, then it will compare the hashcode. 191 * if they are the same, it will not remove. This isn't perfect since 192 * different objects can have the same hashcode, but it is unlikely of 193 * objects of the same type. 194 * <p> 195 * @param filter 196 */ 197 void setFilterRemoveByHashCode( boolean filter ); 198 199 /** 200 * @param socketTimeOut the socketTimeOut to set 201 */ 202 void setSocketTimeOut( int socketTimeOut ); 203 204 /** 205 * @return the socketTimeOut 206 */ 207 int getSocketTimeOut(); 208 209 /** 210 * @param openTimeOut the openTimeOut to set 211 */ 212 void setOpenTimeOut( int openTimeOut ); 213 214 /** 215 * @return the openTimeOut 216 */ 217 int getOpenTimeOut(); 218 }