001package org.apache.commons.jcs.auxiliary.lateral.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.AuxiliaryCacheAttributes;
023
024/**
025 * This interface defines configuration options common to lateral cache plugins.
026 * <p>
027 * TODO it needs to be trimmed down. The old version had features for every lateral. Now, the
028 * individual laterals have their own specific attributes interfaces.
029 */
030public interface ILateralCacheAttributes
031    extends AuxiliaryCacheAttributes
032{
033    enum Type
034    {
035        /** HTTP type */
036        HTTP, // 1
037
038        /** UDP type */
039        UDP, // 2
040
041        /** TCP type */
042        TCP, // 3
043
044        /** XMLRPC type */
045        XMLRPC // 4
046    }
047
048    /**
049     * The number of elements the zombie queue will hold. This queue is used to store events if we
050     * loose our connection with the server.
051     */
052    int DEFAULT_ZOMBIE_QUEUE_MAX_SIZE = 1000;
053
054    /**
055     * Sets the httpServer attribute of the ILateralCacheAttributes object
056     * <p>
057     * @param val The new httpServer value
058     */
059    void setHttpServer( String val );
060
061    /**
062     * Gets the httpServer attribute of the ILateralCacheAttributes object
063     * <p>
064     * @return The httpServer value
065     */
066    String getHttpServer();
067
068    /**
069     * Sets the httpListenerPort attribute of the ILateralCacheAttributes object
070     * <p>
071     * @param val The new tcpListenerPort value
072     */
073    void setHttpListenerPort( int val );
074
075    /**
076     * Gets the httpListenerPort attribute of the ILateralCacheAttributes object
077     * <p>
078     * @return The httpListenerPort value
079     */
080    int getHttpListenerPort();
081
082    /**
083     * Sets the httpServers attribute of the LateralCacheAttributes object
084     * <p>
085     * @param val The new httpServers value
086     */
087    void setHttpServers( String val );
088
089    /**
090     * Gets the httpSrvers attribute of the LateralCacheAttributes object
091     * <p>
092     * @return The httpServers value
093     */
094    String getHttpServers();
095
096    /**
097     * Sets the udpMulticastAddr attribute of the ILateralCacheAttributes object
098     * <p>
099     * @param val The new udpMulticastAddr value
100     */
101    void setUdpMulticastAddr( String val );
102
103    /**
104     * Gets the udpMulticastAddr attribute of the ILateralCacheAttributes object
105     * <p>
106     * @return The udpMulticastAddr value
107     */
108    String getUdpMulticastAddr();
109
110    /**
111     * Sets the udpMulticastPort attribute of the ILateralCacheAttributes object
112     * <p>
113     * @param val The new udpMulticastPort value
114     */
115    void setUdpMulticastPort( int val );
116
117    /**
118     * Gets the udpMulticastPort attribute of the ILateralCacheAttributes object
119     * <p>
120     * @return The udpMulticastPort value
121     */
122    int getUdpMulticastPort();
123
124    /**
125     * Sets the transmissionType attribute of the ILateralCacheAttributes object
126     * <p>
127     * @param val The new transmissionType value
128     */
129    void setTransmissionType( Type val );
130
131    /**
132     * Gets the transmissionType attribute of the ILateralCacheAttributes object
133     * <p>
134     * @return The transmissionType value
135     */
136    Type getTransmissionType();
137
138    /**
139     * Sets the transmissionTypeName attribute of the ILateralCacheAttributes object
140     * <p>
141     * @param val The new transmissionTypeName value
142     */
143    void setTransmissionTypeName( String val );
144
145    /**
146     * Gets the transmissionTypeName attribute of the ILateralCacheAttributes object
147     * <p>
148     * @return The transmissionTypeName value
149     */
150    String getTransmissionTypeName();
151
152    /**
153     * Sets the putOnlyMode attribute of the ILateralCacheAttributes. When this is true the lateral
154     * cache will only issue put and remove order and will not try to retrieve elements from other
155     * lateral caches.
156     * <p>
157     * @param val The new transmissionTypeName value
158     */
159    void setPutOnlyMode( boolean val );
160
161    /**
162     * @return The outgoingOnlyMode value. Stops gets from going remote.
163     */
164    boolean getPutOnlyMode();
165
166    /**
167     * @param receive The receive to set.
168     */
169    void setReceive( boolean receive );
170
171    /**
172     * Should a listener be created. By default this is true.
173     * <p>
174     * If this is false the lateral will connect to others but it will not create a listener to
175     * receive.
176     * <p>
177     * It is possible if two laterals are misconfigured that lateral A may have a region R1 that is
178     * not configured for the lateral but another is. And if cache B has region R1 configured for
179     * lateral distribution, A will get messages for R1 but not send them.
180     * <p>
181     * @return true if we should have a listener connection
182     */
183    boolean isReceive();
184
185    /**
186     * The number of elements the zombie queue will hold. This queue is used to store events if we
187     * loose our connection with the server.
188     * <p>
189     * @param zombieQueueMaxSize The zombieQueueMaxSize to set.
190     */
191    void setZombieQueueMaxSize( int zombieQueueMaxSize );
192
193    /**
194     * The number of elements the zombie queue will hold. This queue is used to store events if we
195     * loose our connection with the server.
196     * <p>
197     * @return Returns the zombieQueueMaxSize.
198     */
199    int getZombieQueueMaxSize();
200}