001package org.apache.commons.jcs.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.jcs.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 * <p>
029 * @author Aaron Smuts
030 */
031public interface ITCPLateralCacheAttributes
032    extends ILateralCacheAttributes
033{
034    /**
035     * Sets the tcpServer attribute of the ILateralCacheAttributes object
036     * <p>
037     * @param val
038     *            The new tcpServer value
039     */
040    void setTcpServer( String val );
041
042    /**
043     * Gets the tcpServer attribute of the ILateralCacheAttributes object
044     * <p>
045     * @return The tcpServer value
046     */
047    String getTcpServer();
048
049    /**
050     * Sets the tcpServers attribute of the ILateralCacheAttributes object
051     * <p>
052     * @param val
053     *            The new tcpServers value
054     */
055    void setTcpServers( String val );
056
057    /**
058     * Gets the tcpServers attribute of the ILateralCacheAttributes object
059     * <p>
060     * @return The tcpServers value
061     */
062    String getTcpServers();
063
064    /**
065     * Sets the tcpListenerPort attribute of the ILateralCacheAttributes object
066     * <p>
067     * @param val
068     *            The new tcpListenerPort value
069     */
070    void setTcpListenerPort( int val );
071
072    /**
073     * Gets the tcpListenerPort attribute of the ILateralCacheAttributes object
074     * <p>
075     * @return The tcpListenerPort value
076     */
077    int getTcpListenerPort();
078
079    /**
080     * Can setup UDP Discovery. This only works for TCp laterals right now. It
081     * allows TCP laterals to find each other by broadcasting to a multicast
082     * port.
083     * <p>
084     * @param udpDiscoveryEnabled
085     *            The udpDiscoveryEnabled to set.
086     */
087    void setUdpDiscoveryEnabled( boolean udpDiscoveryEnabled );
088
089    /**
090     * Whether or not TCP laterals can try to find each other by multicast
091     * communication.
092     * <p>
093     * @return Returns the udpDiscoveryEnabled.
094     */
095    boolean isUdpDiscoveryEnabled();
096
097    /**
098     * The port to use if UDPDiscovery is enabled.
099     * <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}