001package org.apache.commons.jcs3.auxiliary.lateral.socket.tcp.behavior;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import org.apache.commons.jcs3.auxiliary.lateral.behavior.ILateralCacheAttributes;
023
024/**
025 * This interface defines functions that are particular to the TCP Lateral Cache
026 * plugin. It extends the generic LateralCacheAttributes interface which in turn
027 * extends the AuxiliaryCache interface.
028 */
029public interface ITCPLateralCacheAttributes
030    extends ILateralCacheAttributes
031{
032    /**
033     * Sets the tcpServer attribute of the ILateralCacheAttributes object
034     * <p>
035     * @param val
036     *            The new tcpServer value
037     */
038    void setTcpServer( String val );
039
040    /**
041     * Gets the tcpServer attribute of the ILateralCacheAttributes object
042     * <p>
043     * @return The tcpServer value
044     */
045    String getTcpServer();
046
047    /**
048     * Sets the tcpServers attribute of the ILateralCacheAttributes object
049     * <p>
050     * @param val
051     *            The new tcpServers value
052     */
053    void setTcpServers( String val );
054
055    /**
056     * Gets the tcpServers attribute of the ILateralCacheAttributes object
057     * <p>
058     * @return The tcpServers value
059     */
060    String getTcpServers();
061
062    /**
063     * Sets the tcpListenerPort attribute of the ILateralCacheAttributes object
064     * <p>
065     * @param val
066     *            The new tcpListenerPort value
067     */
068    void setTcpListenerPort( int val );
069
070    /**
071     * Gets the tcpListenerPort attribute of the ILateralCacheAttributes object
072     * <p>
073     * @return The tcpListenerPort value
074     */
075    int getTcpListenerPort();
076
077    /**
078     * Sets the tcpListenerHost attribute of the ILateralCacheAttributes object
079     * <p>
080     * @param val
081     *            The new tcpListenerHost value
082     */
083    void setTcpListenerHost( String val );
084
085    /**
086     * Gets the tcpListenerHost attribute of the ILateralCacheAttributes object
087     * <p>
088     * @return The tcpListenerHost value
089     */
090    String getTcpListenerHost();
091
092    /**
093     * Can setup UDP Discovery. This only works for TCp laterals right now. It
094     * allows TCP laterals to find each other by broadcasting to a multicast
095     * port.
096     * <p>
097     * @param udpDiscoveryEnabled
098     *            The udpDiscoveryEnabled to set.
099     */
100    void setUdpDiscoveryEnabled( boolean udpDiscoveryEnabled );
101
102    /**
103     * Whether or not TCP laterals can try to find each other by multicast
104     * communication.
105     * <p>
106     * @return Returns the udpDiscoveryEnabled.
107     */
108    boolean isUdpDiscoveryEnabled();
109
110    /**
111     * The port to use if UDPDiscovery is enabled.
112     * <p>
113     * @return Returns the udpDiscoveryPort.
114     */
115    int getUdpDiscoveryPort();
116
117    /**
118     * Sets the port to use if UDPDiscovery is enabled.
119     * <p>
120     * @param udpDiscoveryPort
121     *            The udpDiscoveryPort to set.
122     */
123    void setUdpDiscoveryPort( int udpDiscoveryPort );
124
125    /**
126     * The address to broadcast to if UDPDiscovery is enabled.
127     * <p>
128     * @return Returns the udpDiscoveryAddr.
129     */
130    String getUdpDiscoveryAddr();
131
132    /**
133     * Sets the address to broadcast to if UDPDiscovery is enabled.
134     * <p>
135     * @param udpDiscoveryAddr
136     *            The udpDiscoveryAddr to set.
137     */
138    void setUdpDiscoveryAddr( String udpDiscoveryAddr );
139
140    /**
141     * The time-to-live for the UDP multicast packets
142     * <p>
143     * @return Returns the udpTTL.
144     * @since 3.1
145     */
146    int getUdpTTL();
147
148    /**
149     * Sets the time-to-live for the UDP multicast packet
150     * <p>
151     * @param udpTTL The udpTTL to set.
152     * @since 3.1
153     */
154    void setUdpTTL( final int udpTTL );
155
156    /**
157     * Is the lateral allowed to try and get from other laterals.
158     * <p>
159     * This replaces the old putOnlyMode
160     * <p>
161     * @param allowGet
162     */
163    void setAllowGet( boolean allowGet );
164
165    /**
166     * Is the lateral allowed to try and get from other laterals.
167     * <p>
168     * @return true if the lateral will try to get
169     */
170    boolean isAllowGet();
171
172    /**
173     * Is the lateral allowed to put objects to other laterals.
174     * <p>
175     * @param allowPut
176     */
177    void setAllowPut( boolean allowPut );
178
179    /**
180     * Is the lateral allowed to put objects to other laterals.
181     * <p>
182     * @return true if puts are allowed
183     */
184    boolean isAllowPut();
185
186    /**
187     * Should the client send a remove command rather than a put when update is
188     * called. This is a client option, not a receiver option. This allows you
189     * to prevent the lateral from serializing objects.
190     * <p>
191     * @param issueRemoveOnPut
192     */
193    void setIssueRemoveOnPut( boolean issueRemoveOnPut );
194
195    /**
196     * Should the client send a remove command rather than a put when update is
197     * called. This is a client option, not a receiver option. This allows you
198     * to prevent the lateral from serializing objects.
199     * <p>
200     * @return true if updates will result in a remove command being sent.
201     */
202    boolean isIssueRemoveOnPut();
203
204    /**
205     * Should the receiver try to match hash codes. If true, the receiver will
206     * see if the client supplied a hash code. If it did, then it will try to get
207     * the item locally. If the item exists, then it will compare the hash code.
208     * if they are the same, it will not remove. This isn't perfect since
209     * different objects can have the same hash code, but it is unlikely of
210     * objects of the same type.
211     * <p>
212     * @return boolean
213     */
214    boolean isFilterRemoveByHashCode();
215
216    /**
217     * Should the receiver try to match hash codes. If true, the receiver will
218     * see if the client supplied a hash code. If it did, then it will try to get
219     * the item locally. If the item exists, then it will compare the hash code.
220     * if they are the same, it will not remove. This isn't perfect since
221     * different objects can have the same hash code, but it is unlikely of
222     * objects of the same type.
223     * <p>
224     * @param filter
225     */
226    void setFilterRemoveByHashCode( boolean filter );
227
228    /**
229     * @param socketTimeOut the socketTimeOut to set
230     */
231    void setSocketTimeOut( int socketTimeOut );
232
233    /**
234     * @return the socketTimeOut
235     */
236    int getSocketTimeOut();
237
238    /**
239     * @param openTimeOut the openTimeOut to set
240     */
241    void setOpenTimeOut( int openTimeOut );
242
243    /**
244     * @return the openTimeOut
245     */
246    int getOpenTimeOut();
247}