View Javadoc
1   package org.apache.commons.jcs3.auxiliary.lateral.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.jcs3.auxiliary.AuxiliaryCacheAttributes;
23  
24  /**
25   * This interface defines configuration options common to lateral cache plugins.
26   * <p>
27   * TODO it needs to be trimmed down. The old version had features for every lateral. Now, the
28   * individual laterals have their own specific attributes interfaces.
29   */
30  public interface ILateralCacheAttributes
31      extends AuxiliaryCacheAttributes
32  {
33      enum Type
34      {
35          /** HTTP type */
36          HTTP("HTTP"), // 1
37  
38          /** UDP type */
39          UDP("UDP"), // 2
40  
41          /** TCP type */
42          TCP("TCP"), // 3
43  
44          /** XMLRPC type */
45          XMLRPC("XMLRPC"); // 4
46  
47          private final String typeName;
48  
49          Type(String typeName)
50          {
51              this.typeName = typeName;
52          }
53  
54          /**
55           * @since 3.1
56           */
57          @Override
58          public String toString()
59          {
60              return typeName;
61          }
62      }
63  
64      /**
65       * The number of elements the zombie queue will hold. This queue is used to store events if we
66       * loose our connection with the server.
67       */
68      int DEFAULT_ZOMBIE_QUEUE_MAX_SIZE = 1000;
69  
70      /**
71       * Sets the httpServer attribute of the ILateralCacheAttributes object
72       * <p>
73       * @param val The new httpServer value
74       */
75      void setHttpServer( String val );
76  
77      /**
78       * Gets the httpServer attribute of the ILateralCacheAttributes object
79       * <p>
80       * @return The httpServer value
81       */
82      String getHttpServer();
83  
84      /**
85       * Sets the httpListenerPort attribute of the ILateralCacheAttributes object
86       * <p>
87       * @param val The new tcpListenerPort value
88       */
89      void setHttpListenerPort( int val );
90  
91      /**
92       * Gets the httpListenerPort attribute of the ILateralCacheAttributes object
93       * <p>
94       * @return The httpListenerPort value
95       */
96      int getHttpListenerPort();
97  
98      /**
99       * 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 }