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