1 package org.apache.jcs.auxiliary;
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.jcs.engine.behavior.ICacheEventQueue;
23
24 /***
25 * This has common attributes used by all auxiliaries.
26 * <p>
27 * @author aaronsm
28 *
29 */
30 public abstract class AbstractAuxiliaryCacheAttributes
31 implements AuxiliaryCacheAttributes
32 {
33 /***
34 * cacheName
35 */
36 protected String cacheName;
37
38 /***
39 * name
40 */
41 protected String name;
42
43 /***
44 * eventQueueType -- pooled or single threaded
45 */
46 protected int eventQueueType;
47
48 /***
49 * Named when pooled
50 */
51 protected String eventQueuePoolName;
52
53 /*
54 * (non-Javadoc)
55 *
56 * @see org.apache.jcs.auxiliary.AuxiliaryCacheAttributes#setCacheName(java.lang.String)
57 */
58 public void setCacheName( String s )
59 {
60 this.cacheName = s;
61 }
62
63 /*
64 * (non-Javadoc)
65 *
66 * @see org.apache.jcs.auxiliary.AuxiliaryCacheAttributes#getCacheName()
67 */
68 public String getCacheName()
69 {
70 return this.cacheName;
71 }
72
73 /***
74 * This is the name of the auxiliary in configuration file.
75 * <p>
76 * @see org.apache.jcs.auxiliary.AuxiliaryCacheAttributes#setName(java.lang.String)
77 */
78 public void setName( String s )
79 {
80 this.name = s;
81 }
82
83 /*
84 * (non-Javadoc)
85 *
86 * @see org.apache.jcs.auxiliary.AuxiliaryCacheAttributes#getName()
87 */
88 public String getName()
89 {
90 return this.name;
91 }
92
93 /*
94 * (non-Javadoc)
95 *
96 * @see org.apache.jcs.auxiliary.AuxiliaryCacheAttributes#setEventQueueType(java.lang.String)
97 */
98 public void setEventQueueType( String s )
99 {
100 if ( s != null )
101 {
102 if ( s.equalsIgnoreCase( POOLED_QUEUE_TYPE ) )
103 {
104 this.eventQueueType = ICacheEventQueue.POOLED_QUEUE_TYPE;
105 }
106 else
107 {
108 // single by default
109 this.eventQueueType = ICacheEventQueue.SINGLE_QUEUE_TYPE;
110 }
111 }
112 else
113 {
114 // null, single by default
115 this.eventQueueType = ICacheEventQueue.SINGLE_QUEUE_TYPE;
116 }
117 }
118
119 /*
120 * (non-Javadoc)
121 *
122 * @see org.apache.jcs.auxiliary.AuxiliaryCacheAttributes#getEventQueueType()
123 */
124 public String getEventQueueType()
125 {
126 if ( this.eventQueueType == ICacheEventQueue.POOLED_QUEUE_TYPE )
127 {
128 return POOLED_QUEUE_TYPE;
129 }
130 else
131 {
132 return SINGLE_QUEUE_TYPE;
133 }
134 }
135
136 /*
137 * (non-Javadoc)
138 *
139 * @see org.apache.jcs.auxiliary.AuxiliaryCacheAttributes#getEventQueueTypeFactoryCode()
140 */
141 public int getEventQueueTypeFactoryCode()
142 {
143 return this.eventQueueType;
144 }
145
146 /*
147 * (non-Javadoc)
148 *
149 * @see org.apache.jcs.auxiliary.AuxiliaryCacheAttributes#setEventQueuePoolName(java.lang.String)
150 */
151 public void setEventQueuePoolName( String s )
152 {
153 eventQueuePoolName = s;
154 }
155
156 /*
157 * (non-Javadoc)
158 *
159 * @see org.apache.jcs.auxiliary.AuxiliaryCacheAttributes#getEventQueuePoolName()
160 */
161 public String getEventQueuePoolName()
162 {
163 return eventQueuePoolName;
164 }
165
166 }