1 package org.apache.jcs.auxiliary.remote.http.server;
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.auxiliary.AbstractAuxiliaryCacheAttributes;
23 import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
24
25 /**
26 * Configuration for the RemoteHttpCacheServer. Most of these properties are used only by the
27 * service.
28 */
29 public class RemoteHttpCacheServerAttributes
30 extends AbstractAuxiliaryCacheAttributes
31 {
32 /** Don't change. */
33 private static final long serialVersionUID = -3987239306108780496L;
34
35 /** Can a cluster remote put to other remotes */
36 private boolean localClusterConsistency = true;
37
38 /** Can a cluster remote get from other remotes */
39 private boolean allowClusterGet = true;
40
41 /**
42 * clones
43 * <p>
44 * @return AuxiliaryCacheAttributes clone
45 */
46 public AuxiliaryCacheAttributes copy()
47 {
48 try
49 {
50 return (AuxiliaryCacheAttributes) this.clone();
51 }
52 catch ( Exception e )
53 {
54 // swallow
55 }
56 return this;
57 }
58
59 /**
60 * Should cluster updates be propagated to the locals
61 * <p>
62 * @return The localClusterConsistency value
63 */
64 public boolean isLocalClusterConsistency()
65 {
66 return localClusterConsistency;
67 }
68
69 /**
70 * Should cluster updates be propagated to the locals
71 * <p>
72 * @param r The new localClusterConsistency value
73 */
74 public void setLocalClusterConsistency( boolean r )
75 {
76 this.localClusterConsistency = r;
77 }
78
79 /**
80 * Should gets from non-cluster clients be allowed to get from other remote auxiliaries.
81 * <p>
82 * @return The localClusterConsistency value
83 */
84 public boolean isAllowClusterGet()
85 {
86 return allowClusterGet;
87 }
88
89 /**
90 * Should we try to get from other cluster servers if we don't find the items locally.
91 * <p>
92 * @param r The new localClusterConsistency value
93 */
94 public void setAllowClusterGet( boolean r )
95 {
96 allowClusterGet = r;
97 }
98
99 /**
100 * @return String details
101 */
102 @Override
103 public String toString()
104 {
105 StringBuffer buf = new StringBuffer();
106 buf.append( "\nRemoteHttpCacheServiceAttributes" );
107 buf.append( "\n cacheName = [" + this.getCacheName() + "]" );
108 buf.append( "\n allowClusterGet = [" + this.isAllowClusterGet() + "]" );
109 buf.append( "\n localClusterConsistency = [" + this.isLocalClusterConsistency() + "]" );
110 buf.append( "\n eventQueueType = [" + this.getEventQueueType() + "]" );
111 buf.append( "\n eventQueuePoolName = [" + this.getEventQueuePoolName() + "]" );
112 return buf.toString();
113 }
114 }